← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5749: (DV) Minor fixes.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5749 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-01-18 17:13:25 +0100
message:
  (DV) Minor fixes.
modified:
  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/webapp/dhis-web-visualizer/app/app.js
  dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm


--
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-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	2012-01-18 12:02:22 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties	2012-01-18 15:07:21 +0000
@@ -54,6 +54,7 @@
 data_table=Data table
 favorites=Favorites..
 manage_favorites=Manage favorites
+save_favorite=Save favorite
 sort_by=Sort by
 system=System
 name=Name
@@ -66,15 +67,16 @@
 delete_favorite=Delete favorite
 are_you_sure=Are you sure?
 save=Save
-example_chart_cannot_be_saved=* The example chart cannot be saved.
+example_chart_cannot_be_saved=* The example chart cannot be saved
 overwrite=Overwrite
 download_as=Download as
-browser_download_alert=Please use Chrome, Firefox, Opera or Safari to export images.
+alert_browser_download=Please use Chrome, Firefox, Opera or Safari to export images.
 no_svg_format=No SVG format
 image_png=Image (PNG)
 hide_data_table=Hide data table
+no_indicators_selected=No indicators selected.
 no_data_elements_selected=No data elements selected.
-data_elemenent_store_does_not_exist=Data element store does not exist.
+data_element_store_does_not_exist=Data element store does not exist.
 saving=Saving
 renaming=Renaming
 deleting=Deleting
@@ -84,3 +86,4 @@
 period=Period
 organisation_unit=Organisation unit
 invalid_uid=Invalid uid
+system_favorite_overwrite_not_allowed=* You are not allowed to overwrite a system favorite

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-01-18 14:12:03 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js	2012-01-18 16:12:08 +0000
@@ -323,7 +323,7 @@
                         a.push(r.data.id);
                     });
                     if (exception && !a.length) {
-                        alert('No indicators selected');
+                        alert(DV.i18n.no_indicators_selected);
                     }
                     return a;
                 }
@@ -2577,6 +2577,7 @@
                                                                                     DV.cmp.favorite.name = this;
                                                                                 },
                                                                                 change: function() {
+                                                                                    DV.cmp.favorite.system.check();
                                                                                     DV.cmp.favorite.save.xable();
                                                                                 }
                                                                             }
@@ -2588,6 +2589,13 @@
                                                                             fieldLabel: DV.i18n.system,
                                                                             labelWidth: DV.conf.layout.form_label_width,
                                                                             disabled: !DV.init.system.user.isAdmin,
+                                                                            check: function() {
+                                                                                if (!DV.init.system.user.isAdmin) {
+                                                                                    if (DV.store.favorite.findExact('name', DV.cmp.favorite.name.getValue()) === -1) {
+                                                                                        this.setValue(false);
+                                                                                    }
+                                                                                }
+                                                                            },
                                                                             listeners: {
                                                                                 added: function() {
                                                                                     DV.cmp.favorite.system = this;
@@ -2876,7 +2884,9 @@
                                                                             DV.cmp.favorite.del.xable();
                                                                         },
                                                                         itemdblclick: function() {
-                                                                            DV.cmp.favorite.save.handler();
+                                                                            if (DV.cmp.favorite.save.xable()) {
+                                                                                DV.cmp.favorite.save.handler();
+                                                                            }
                                                                         }
                                                                     }
                                                                 }
@@ -2884,7 +2894,7 @@
                                                             bbar: [
                                                                 {
                                                                     xtype: 'label',
-                                                                    style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:50%',
+                                                                    style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:70%',
                                                                     listeners: {
                                                                         added: function() {
                                                                             DV.cmp.favorite.label = this;
@@ -2898,9 +2908,22 @@
                                                                     xable: function() {
                                                                         if (DV.state.isRendered) {
                                                                             if (DV.cmp.favorite.name.getValue()) {
-                                                                                this.enable();
-                                                                                DV.cmp.favorite.label.setText('');
-                                                                                return;
+                                                                                var index = DV.store.favorite.findExact('name', DV.cmp.favorite.name.getValue());
+                                                                                if (index != -1) {
+                                                                                    if (DV.store.favorite.getAt(index).data.userId || DV.init.system.user.isAdmin) {
+                                                                                        this.enable();
+                                                                                        DV.cmp.favorite.label.setText('');
+                                                                                        return true;
+                                                                                    }
+                                                                                    else {
+                                                                                        DV.cmp.favorite.label.setText(DV.i18n.system_favorite_overwrite_not_allowed);
+                                                                                    }
+                                                                                }
+                                                                                else {
+                                                                                    this.enable();
+                                                                                    DV.cmp.favorite.label.setText('');
+                                                                                    return true;
+                                                                                }
                                                                             }
                                                                             else {
                                                                                 DV.cmp.favorite.label.setText('');
@@ -2915,20 +2938,21 @@
                                                                             }																				
                                                                         }
                                                                         this.disable();
+                                                                        return false;
                                                                     },
                                                                     handler: function() {
-                                                                        var value = DV.cmp.favorite.name.getValue();
-                                                                        if (DV.state.isRendered && value) {
+                                                                        if (this.xable()) {
+                                                                            var value = DV.cmp.favorite.name.getValue();
                                                                             if (DV.store.favorite.findExact('name', value) != -1) {
                                                                                 var item = value.length > 40 ? (value.substr(0,40) + '...') : value;
                                                                                 var w = Ext.create('Ext.window.Window', {
-                                                                                    title: 'Save favorite',
+                                                                                    title: DV.i18n.save_favorite,
                                                                                     width: DV.conf.layout.window_confirm_width,
                                                                                     bodyStyle: 'padding:10px 5px; background-color:#fff; text-align:center',
                                                                                     modal: true,
                                                                                     items: [
                                                                                         {
-                                                                                            html: DV.i18n.area_you_sure,
+                                                                                            html: DV.i18n.are_you_sure,
                                                                                             bodyStyle: 'border-style:none'
                                                                                         },
                                                                                         {
@@ -3056,7 +3080,7 @@
                                 var svg = document.getElementsByTagName('svg');
                                 
                                 if (svg.length < 1) {
-                                    alert(DV.i18n.browser_download_alert);
+                                    alert(DV.i18n.alert_browser_download);
                                     return;
                                 }
                                 

=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2012-01-18 13:51:31 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm	2012-01-18 15:07:21 +0000
@@ -55,6 +55,7 @@
 data_table:'$encoder.jsEscape($i18n.getString( 'data_table' ) , "'")',
 favorites:'$encoder.jsEscape($i18n.getString( 'favorites' ) , "'")',
 manage_favorites:'$encoder.jsEscape($i18n.getString( 'manage_favorites' ) , "'")',
+save_favorite:'$encoder.jsEscape($i18n.getString( 'save_favorite' ) , "'")',
 sort_by:'$encoder.jsEscape($i18n.getString( 'sort_by' ) , "'")',
 system:'$encoder.jsEscape($i18n.getString( 'system' ) , "'")',
 name:'$encoder.jsEscape($i18n.getString( 'name' ) , "'")',
@@ -83,6 +84,7 @@
 data_element:'$encoder.jsEscape($i18n.getString( 'data_element' ) , "'")',
 period:'$encoder.jsEscape($i18n.getString( 'period' ) , "'")',
 organisation_unit:'$encoder.jsEscape($i18n.getString( 'organisation_unit' ) , "'")',
-invalid_uid:'$encoder.jsEscape($i18n.getString( 'invalid_uid' ) , "'")'
+invalid_uid:'$encoder.jsEscape($i18n.getString( 'invalid_uid' ) , "'")',
+system_favorite_overwrite_not_allowed:'$encoder.jsEscape($i18n.getString( 'system_favorite_overwrite_not_allowed' ) , "'")'
 
 };
\ No newline at end of file