=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-05-28 16:16:39 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-05-29 14:14:12 +0000 @@ -117,4 +117,7 @@ top_limit=Top limit plain_data_sources=Plain data source graphics=Graphics -data_sets_cannot_be_specified_as_filter=Data sets cannot be specified as filter \ No newline at end of file +data_sets_cannot_be_specified_as_filter=Data sets cannot be specified as filter +share=Share +interpretation=interpretation +write_your_interpretation=Write a comment, question or interpretation \ No newline at end of file === 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-29 11:33:06 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module_fr_FR.properties 2013-05-29 14:14:12 +0000 @@ -113,4 +113,6 @@ favorites=Favoris plain_data_sources=Source de donn\u00E9es simples graphics=Graphique -data_sets_cannot_be_specified_as_filter=Ensembles de donn\u00E9es ne peuvent \u00EAtre d\u00E9finies comme filtre \ No newline at end of file +data_sets_cannot_be_specified_as_filter=Ensembles de donn\u00E9es ne peuvent \u00EAtre d\u00E9finies comme filtre +share=Partager +interpretation=interpr\u00E9tation \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-05-28 17:35:48 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-05-29 14:14:12 +0000 @@ -1418,7 +1418,7 @@ params: Ext.encode(favorite), success: function() { pt.favorite = favorite; - //pt.viewport.interpretationButton.enable(); + pt.viewport.interpretationButton.enable(); pt.store.tables.loadStore(); } }); @@ -1877,6 +1877,99 @@ return window; }; + PT.app.InterpretationWindow = function() { + var textArea, + linkPanel, + shareButton, + window; + + if (Ext.isObject(pt.favorite) && Ext.isString(pt.favorite.id)) { + textArea = Ext.create('Ext.form.field.TextArea', { + cls: 'pt-textarea', + height: 130, + fieldStyle: 'padding-left: 4px; padding-top: 3px', + emptyText: PT.i18n.write_your_interpretation, + enableKeyEvents: true, + listeners: { + keyup: function() { + shareButton.xable(); + } + } + }); + + linkPanel = Ext.create('Ext.panel.Panel', { + html: 'Link: ' + pt.baseUrl + '/dhis-web-visualizer/app/index.html?id=' + pt.favorite.id + '', + style: 'padding-top: 9px; padding-bottom: 6px', + bodyStyle: 'border: 0 none' + }); + + shareButton = Ext.create('Ext.button.Button', { + text: PT.i18n.share, + disabled: true, + xable: function() { + this.setDisabled(!textArea.getValue()); + }, + handler: function() { + if (textArea.getValue()) { + Ext.Ajax.request({ + url: pt.conf.finals.ajax.path_api + 'interpretations/reportTable/' + pt.favorite.id, + method: 'POST', + params: textArea.getValue(), + headers: {'Content-Type': 'text/html'}, + success: function() { + textArea.reset(); + pt.viewport.interpretationButton.disable(); + window.hide(); + //PT.util.notification.interpretation(PT.i18n.interpretation_was_shared + '.'); + } + }); + } + } + }); + + window = Ext.create('Ext.window.Window', { + title: PT.i18n.share + ' ' + PT.i18n.interpretation + ' (' + pt.favorite.name + ') ', + 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: 'pt-toolbar-bbar', + defaults: { + height: 24 + }, + items: [ + '->', + shareButton + ] + }, + listeners: { + show: function(w) { + pt.util.window.setAnchorPosition(w, pt.viewport.interpretationButton); + + document.body.oncontextmenu = true; + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + }, + destroy: function() { + pt.viewport.interpretationWindow = null; + } + } + }); + + return window; + } + + return; + }; + PT.app.init.onInitialize = function(r) { var createViewport; @@ -3664,6 +3757,43 @@ } }); + interpretationButton = Ext.create('Ext.button.Button', { + text: PT.i18n.share, + menu: {}, + disabled: true, + xable: function() { + if (pt.favorite) { + this.enable(); + this.disabledTooltip.destroy(); + } + else { + if (pt.xLayout) { + this.disable(); + this.createTooltip(); + } + } + }, + disabledTooltip: null, + createTooltip: function() { + this.disabledTooltip = Ext.create('Ext.tip.ToolTip', { + target: this.getEl(), + html: PT.i18n.save_load_favorite_before_sharing, + 'anchor': 'bottom' + }); + }, + handler: function() { + if (pt.viewport.interpretationWindow) { + pt.viewport.interpretationWindow.destroy(); + } + + pt.viewport.interpretationWindow = PT.app.InterpretationWindow(); + + if (pt.viewport.interpretationWindow) { + pt.viewport.interpretationWindow.show(); + } + } + }); + centerRegion = Ext.create('Ext.panel.Panel', { region: 'center', bodyStyle: 'padding:1px', @@ -3698,6 +3828,7 @@ }, favoriteButton, downloadButton, + interpretationButton, '->', { text: PT.i18n.table, @@ -3765,8 +3896,13 @@ isOu = false, isOuc = false; + // State + pt.viewport.interpretationButton.enable(); + + // Create chart pt.util.pivot.createTable(layout, pt); + // Set gui xLayout = pt.util.pivot.getExtendedLayout(layout); dimMap = xLayout.objectNameDimensionsMap; recMap = xLayout.objectNameItemsMap; @@ -3919,6 +4055,7 @@ optionsButton: optionsButton, favoriteButton: favoriteButton, downloadButton: downloadButton, + interpretationButton: interpretationButton, userOrganisationUnit: userOrganisationUnit, userOrganisationUnitChildren: userOrganisationUnitChildren, setFavorite: setFavorite, === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-05-28 17:22:23 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-05-29 14:14:12 +0000 @@ -1839,9 +1839,14 @@ alert(r.responseText); }, success: function(r) { - var layout = pt.api.layout.Layout(Ext.decode(r.responseText)); + var layoutConfig = Ext.decode(r.responseText), + layout = pt.api.layout.Layout(layoutConfig); if (layout) { + pt.favorite = Ext.clone(layout); + pt.favorite.id = layoutConfig.id; + pt.favorite.name = layoutConfig.name; + pt.viewport.setFavorite(layout); } } === modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css 2013-05-28 14:43:39 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/styles/style.css 2013-05-29 14:14:12 +0000 @@ -96,6 +96,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-pivot/src/main/webapp/dhis-web-pivot/i18n.vm' --- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-05-28 16:16:39 +0000 +++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-05-29 14:14:12 +0000 @@ -118,5 +118,8 @@ top_limit: '$encoder.jsEscape($i18n.getString( 'top_limit' ) , "'")', plain_data_sources: '$encoder.jsEscape($i18n.getString( 'plain_data_sources' ) , "'")', graphics: '$encoder.jsEscape($i18n.getString( 'graphics' ) , "'")', - data_sets_cannot_be_specified_as_filter: '$encoder.jsEscape($i18n.getString( 'data_sets_cannot_be_specified_as_filter' ) , "'")' + data_sets_cannot_be_specified_as_filter: '$encoder.jsEscape($i18n.getString( 'data_sets_cannot_be_specified_as_filter' ) , "'")', + share: '$encoder.jsEscape($i18n.getString( 'share' ) , "'")', + interpretation: '$encoder.jsEscape($i18n.getString( 'interpretation' ) , "'")', + write_your_interpretation: '$encoder.jsEscape($i18n.getString( 'write_your_interpretation' ) , "'")' }; === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2013-05-28 16:16:39 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2013-05-29 14:14:12 +0000 @@ -193,4 +193,5 @@ public_access=Public access detailed_data_elements_cannot_be_specified_as_filter=Detailed data elements cannot be specified as filter plain_data_sources=Plain data source -graphics=Graphics \ No newline at end of file +graphics=Graphics +write_your_interpretation=Ecrire votre interpr\u00E9tation \ No newline at end of file === 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-29 11:33:06 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module_fr_FR.properties 2013-05-29 14:14:12 +0000 @@ -55,7 +55,7 @@ wm_targetline_deactivated=Ligne cible d\u00E9sactiv\u00E9e base=Base wm_first_filter_unit=Premi\u00E8re unit\u00E9 de filtre utilis\u00E9 (plus que celui choisi). -interpretation=Interpr\u00E9tation +interpretation=interpr\u00E9tation groups_replace_orgunits=NB\: les groupes vont remplacer les unit\u00E9s d'organisations choisies all_indicator_groups=Tous les groupes d'indicateurs last_5_years=5 derni\u00E8res ann\u00E9es