dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15717
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5769: (DV) Improved validation when loading favorites.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5769 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-01-20 14:50:18 +0100
message:
(DV) Improved validation when loading favorites.
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-20 12:02:17 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2012-01-20 13:40:57 +0000
@@ -87,3 +87,4 @@
organisation_unit=Organisation unit
invalid_uid=Invalid uid
system_favorite_overwrite_not_allowed=* You are not allowed to overwrite a system favorite
+favorite_no_orgunits=Favorite has no organisation units
=== 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-20 12:43:03 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-01-20 13:40:57 +0000
@@ -806,6 +806,14 @@
});
}
}
+ },
+ favorite: {
+ validate: function(f) {
+ if (!f.organisationUnits || !f.organisationUnits.length) {
+ alert('Favorite has no organisation units');
+ return;
+ }
+ }
}
};
@@ -1070,6 +1078,10 @@
var f = Ext.JSON.decode(r.responseText),
indiment = [];
+ if (!DV.util.favorite.validate(f)) {
+ return;
+ }
+
f.type = f.type.toLowerCase();
f.series = f.series.toLowerCase();
f.category = f.category.toLowerCase();
=== 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-19 13:56:59 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/i18n.vm 2012-01-20 13:40:57 +0000
@@ -85,6 +85,7 @@
period:'$encoder.jsEscape($i18n.getString( 'period' ) , "'")',
organisation_unit:'$encoder.jsEscape($i18n.getString( 'organisation_unit' ) , "'")',
invalid_uid:'$encoder.jsEscape($i18n.getString( 'invalid_uid' ) , "'")',
-system_favorite_overwrite_not_allowed:'$encoder.jsEscape($i18n.getString( 'system_favorite_overwrite_not_allowed' ) , "'")'
+system_favorite_overwrite_not_allowed:'$encoder.jsEscape($i18n.getString( 'system_favorite_overwrite_not_allowed' ) , "'")',
+favorite_no_orgunits:'$encoder.jsEscape($i18n.getString( 'favorite_no_orgunits' ) , "'")'
};
\ No newline at end of file