dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22803
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11080: (DV) Interpretations.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11080 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-05-29 15:35:59 +0200
message:
(DV) Interpretations.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties 2013-05-28 16:16:39 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties 2013-05-29 11:33:06 +0000
@@ -81,7 +81,7 @@
last_12_months=12 derniers mois
for_standard_reports_only=pour les rapports standards seuls
financial_years=Ann\u00E9es financi\u00E8res
-user_organisation_unit_children=Unit\u00E9s filles de l'unit\u00E9 d'organisation de l'utilisateur
+user_organisation_unit_children=Filles de l'unit\u00E9 de l'utilisateur
overwrite=Ecraser
row=Ligne
categories=Cat\u00E9gories
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties 2013-05-28 16:16:39 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties 2013-05-29 11:33:06 +0000
@@ -92,7 +92,7 @@
no_periods_selected=No periods selected
last_year=Ann\u00E9e derni\u00E8re
last_quarter=Dernier trimestre
-user_orgunit_children=Unit\u00E9s filles de l'Orgunit utilisateur
+user_orgunit_children=Filles de l'unit\u00E9 de l'utilisateur
example_chart=Exemple de graphique
base_line_label=Libell\u00E9 de la ligne de r\u00E9ference
manage_favorites=G\u00E9rer les favoris
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2013-05-28 14:37:50 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2013-05-29 13:34:16 +0000
@@ -85,6 +85,16 @@
border-right: 2px solid white;
}
+ /* User select */
+.user-select {
+ -webkit-touch-callout: text;
+ -webkit-user-select: text;
+ -khtml-user-select: text;
+ -moz-user-select: text;
+ -ms-user-select: text;
+ user-select: text;
+}
+
/* Scrollbar */
.x-scroller-vertical {
border: 0 none;
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-05-28 14:37:50 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2013-05-29 13:34:16 +0000
@@ -1191,14 +1191,13 @@
alert(r.responseText);
},
success: function(r) {
- var id = r.getAllResponseHeaders().location.split('/').pop();
-
+ favorite.id = r.getAllResponseHeaders().location.split('/').pop();
dv.favorite = favorite;
+ dv.viewport.interpretationButton.enable();
+
dv.store.charts.loadStore();
- //dv.viewport.interpretationButton.enable();
-
window.destroy();
}
});
@@ -1422,7 +1421,7 @@
params: Ext.encode(favorite),
success: function() {
dv.favorite = favorite;
- //dv.viewport.interpretationButton.enable();
+ dv.viewport.interpretationButton.enable();
dv.store.charts.loadStore();
}
});
@@ -1881,6 +1880,99 @@
return window;
};
+ DV.app.InterpretationWindow = function() {
+ var textArea,
+ linkPanel,
+ shareButton,
+ window;
+
+ if (Ext.isObject(dv.favorite) && Ext.isString(dv.favorite.id)) {
+ textArea = Ext.create('Ext.form.field.TextArea', {
+ cls: 'dv-textarea',
+ height: 130,
+ fieldStyle: 'padding-left: 4px; padding-top: 3px',
+ emptyText: DV.i18n.write_your_interpretation,
+ enableKeyEvents: true,
+ listeners: {
+ keyup: function() {
+ shareButton.xable();
+ }
+ }
+ });
+
+ linkPanel = Ext.create('Ext.panel.Panel', {
+ html: '<b>Link: </b><span class="user-select">' + dv.baseUrl + '/dhis-web-visualizer/app/index.html?id=' + dv.favorite.id + '</span>',
+ style: 'padding-top: 9px; padding-bottom: 6px',
+ bodyStyle: 'border: 0 none'
+ });
+
+ shareButton = Ext.create('Ext.button.Button', {
+ text: DV.i18n.share,
+ disabled: true,
+ xable: function() {
+ this.setDisabled(!textArea.getValue());
+ },
+ handler: function() {
+ if (textArea.getValue()) {
+ Ext.Ajax.request({
+ url: dv.conf.finals.ajax.path_api + 'interpretations/chart/' + dv.favorite.id,
+ method: 'POST',
+ params: textArea.getValue(),
+ headers: {'Content-Type': 'text/html'},
+ success: function() {
+ textArea.reset();
+ dv.viewport.interpretationButton.disable();
+ window.hide();
+ //DV.util.notification.interpretation(DV.i18n.interpretation_was_shared + '.');
+ }
+ });
+ }
+ }
+ });
+
+ window = Ext.create('Ext.window.Window', {
+ title: DV.i18n.share + ' ' + DV.i18n.interpretation + '<span style="font-weight:normal; font-size:11px"> (' + dv.favorite.name + ') </span>',
+ layout: 'fit',
+ //iconCls: 'dv-window-title-interpretation',
+ width: 500,
+ bodyStyle: 'padding:5px 5px 3px; background-color:#fff',
+ resizable: true,
+ modal: true,
+ items: [
+ textArea,
+ linkPanel
+ ],
+ bbar: {
+ cls: 'dv-toolbar-bbar',
+ defaults: {
+ height: 24
+ },
+ items: [
+ '->',
+ shareButton
+ ]
+ },
+ listeners: {
+ show: function(w) {
+ dv.util.window.setAnchorPosition(w, dv.viewport.interpretationButton);
+
+ document.body.oncontextmenu = true;
+ },
+ hide: function() {
+ document.body.oncontextmenu = function(){return false;};
+ },
+ destroy: function() {
+ dv.viewport.interpretationWindow = null;
+ }
+ }
+ });
+
+ return window;
+ }
+
+ return;
+ };
+
DV.app.init.onInitialize = function(r) {
var createViewport;
@@ -3847,6 +3939,11 @@
return;
}
+ // State
+ dv.viewport.interpretationButton.disable();
+ dv.favorite = undefined;
+
+ // Create chart
dv.util.chart.createChart(layout, dv);
};
@@ -4012,6 +4109,43 @@
}
});
+ interpretationButton = Ext.create('Ext.button.Button', {
+ text: DV.i18n.share,
+ menu: {},
+ disabled: true,
+ xable: function() {
+ if (dv.favorite) {
+ this.enable();
+ this.disabledTooltip.destroy();
+ }
+ else {
+ if (dv.xLayout) {
+ this.disable();
+ this.createTooltip();
+ }
+ }
+ },
+ disabledTooltip: null,
+ createTooltip: function() {
+ this.disabledTooltip = Ext.create('Ext.tip.ToolTip', {
+ target: this.getEl(),
+ html: DV.i18n.save_load_favorite_before_sharing,
+ 'anchor': 'bottom'
+ });
+ },
+ handler: function() {
+ if (dv.viewport.interpretationWindow) {
+ dv.viewport.interpretationWindow.destroy();
+ }
+
+ dv.viewport.interpretationWindow = DV.app.InterpretationWindow();
+
+ if (dv.viewport.interpretationWindow) {
+ dv.viewport.interpretationWindow.show();
+ }
+ }
+ });
+
centerRegion = Ext.create('Ext.panel.Panel', {
region: 'center',
bodyStyle: 'padding:0; text-align:center',
@@ -4051,6 +4185,7 @@
getSeparator(),
favoriteButton,
downloadButton,
+ interpretationButton,
'->',
{
text: DV.i18n.table,
@@ -4105,8 +4240,13 @@
isOu = false,
isOuc = false;
+ // State
+ dv.viewport.interpretationButton.enable();
+
+ // Create chart
dv.util.chart.createChart(layout, dv);
+ // Set gui
xLayout = dv.util.chart.getExtendedLayout(layout);
dimMap = xLayout.objectNameDimensionsMap;
recMap = xLayout.objectNameItemsMap;
@@ -4236,6 +4376,7 @@
optionsButton: optionsButton,
favoriteButton: favoriteButton,
downloadButton: downloadButton,
+ interpretationButton: interpretationButton,
userOrganisationUnit: userOrganisationUnit,
userOrganisationUnitChildren: userOrganisationUnitChildren,
dataElementDetailLevel: dataElementDetailLevel,
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2013-05-28 14:37:50 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/core.js 2013-05-29 13:34:16 +0000
@@ -1589,42 +1589,48 @@
generator.pie = function(xResponse, xLayout) {
var store = getDefaultStore(xResponse, xLayout),
- series = [{
- type: 'pie',
- field: store.rangeFields[0],
- lengthField: store.rangeFields[0],
- donut: 7,
- showInLegend: true,
- highlight: {
- segment: {
- margin: 5
- }
- },
- label: {
- field: dv.conf.finals.data.domain,
- display: 'middle',
- contrast: true,
- font: '14px ' + dv.conf.chart.style.fontFamily,
- renderer: function(value) {
- var record = store.getAt(store.findExact(dv.conf.finals.data.domain, value));
-
- return record.data[store.rangeFields[0]];
- }
- },
- style: {
- opacity: 0.8,
- stroke: '#555'
- },
- tips: {
- trackMouse: true,
- cls: 'dv-chart-tips',
- renderer: function(item) {
- this.update('<div style="text-align:center"><div style="font-size:17px; font-weight:bold">' + item.data[store.rangeFields[0]] + '</div><div style="font-size:10px">' + item.data[dv.conf.finals.data.domain] + '</div></div>');
- }
- }
- }],
+ series,
colors,
- chart;
+ chart,
+ label = {
+ field: dv.conf.finals.data.domain
+ };
+
+ // Label
+ if (xLayout.showValues) {
+ label.display = 'middle';
+ label.contrast = true;
+ label.font = '14px ' + dv.conf.chart.style.fontFamily;
+ label.renderer = function(value) {
+ var record = store.getAt(store.findExact(dv.conf.finals.data.domain, value));
+ return record.data[store.rangeFields[0]];
+ };
+ }
+
+ // Series
+ series = [{
+ type: 'pie',
+ field: store.rangeFields[0],
+ donut: 7,
+ showInLegend: true,
+ highlight: {
+ segment: {
+ margin: 5
+ }
+ },
+ label: label,
+ style: {
+ opacity: 0.8,
+ stroke: '#555'
+ },
+ tips: {
+ trackMouse: true,
+ cls: 'dv-chart-tips',
+ renderer: function(item) {
+ this.update('<div style="text-align:center"><div style="font-size:17px; font-weight:bold">' + item.data[store.rangeFields[0]] + '</div><div style="font-size:10px">' + item.data[dv.conf.finals.data.domain] + '</div></div>');
+ }
+ }
+ }];
// Theme
colors = dv.conf.chart.theme.dv1.slice(0, xResponse.nameHeaderMap[xLayout.rowDimensionNames[0]].items.length);
@@ -1640,10 +1646,9 @@
// Chart
chart = getDefaultChart(store, null, series, xResponse, xLayout);
-
chart.legend.position = 'right';
chart.legend.isVertical = true;
- chart.insetPadding = 40;
+ chart.insetPadding = 20;
chart.shadow = true;
return chart;
@@ -1738,9 +1743,14 @@
alert(r.responseText);
},
success: function(r) {
- var layout = dv.api.layout.Layout(Ext.decode(r.responseText));
+ var layoutConfig = Ext.decode(r.responseText),
+ layout = dv.api.layout.Layout(layoutConfig);
if (layout) {
+ layout.id = layoutConfig.id;
+ layout.name = layoutConfig.name;
+ dv.favorite = Ext.clone(layout);
+
dv.viewport.setFavorite(layout);
}
}