Bug #1491: Mark strings in GlobalChart to be translated
FEA: ItEr76S04BugFixing
This commit is contained in:
parent
af2fb68516
commit
4bdc94a625
2 changed files with 24 additions and 13 deletions
|
|
@ -93,13 +93,14 @@ public class GlobalProgressChart {
|
|||
private String jsonify(Collection<?> list) {
|
||||
Collection<String> result = new ArrayList<String>();
|
||||
for (Object each : list) {
|
||||
if (each.getClass() == String.class) {
|
||||
result.add(String.format("\"%s\"", each.toString()));
|
||||
} else {
|
||||
result.add(String.format("%s", each.toString()));
|
||||
}
|
||||
result.add(jsonify(each));
|
||||
}
|
||||
return String.format("'[%s]'", StringUtils.join(result, ','));
|
||||
return String.format("[%s]", StringUtils.join(result, ','));
|
||||
}
|
||||
|
||||
private String jsonify(Object value) {
|
||||
return (value.getClass().equals(String.class)) ? String.format("\"%s\"",
|
||||
value.toString()) : String.format("%s", value.toString());
|
||||
}
|
||||
|
||||
public String getSeries() {
|
||||
|
|
@ -116,9 +117,13 @@ public class GlobalProgressChart {
|
|||
}
|
||||
|
||||
public void render() {
|
||||
String command = String.format(
|
||||
"global_progress.render(%s, %s, %s);", getPercentages(),
|
||||
String params = String.format(
|
||||
"'{\"title\": %s, \"label\": %s, \"ticks\": %s, \"series\": %s}'",
|
||||
jsonify(_("Project progress percentage")),
|
||||
jsonify(_("Progress percentage per progress type")),
|
||||
getTicks(), getSeries());
|
||||
String command = String.format("global_progress.render(%s, %s);",
|
||||
getPercentages(), params);
|
||||
Clients.evalJavaScript(command);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -56,12 +56,18 @@
|
|||
location: 'e',
|
||||
placement: 'outside',
|
||||
},
|
||||
render: function(data, ticks, series) {
|
||||
if (ticks !== undefined) {
|
||||
this.axes.yaxis.ticks = jQuery.parseJSON(ticks);
|
||||
render: function(data, params) {
|
||||
if (params['title'] !== undefined) {
|
||||
this.title = params['title'];
|
||||
}
|
||||
if (series !== undefined) {
|
||||
this.series = jQuery.parseJSON(series);
|
||||
if (params['label'] !== undefined) {
|
||||
this.axes.xaxis.label = params['label'];
|
||||
}
|
||||
if (params['ticks'] !== undefined) {
|
||||
this.axes.yaxis.ticks = params['ticks'];
|
||||
}
|
||||
if (params['series'] !== undefined) {
|
||||
this.series = params['series'];
|
||||
}
|
||||
data = jQuery.parseJSON(data);
|
||||
this.plot = $.jqplot(this.id, data, this);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue