← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3816: fixed bug when adding aggregation levels in dataElement

 

------------------------------------------------------------
revno: 3816
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-01 10:15:30 +0200
message:
  fixed bug when adding aggregation levels in dataElement
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js	2011-05-31 12:24:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.select.js	2011-06-01 08:15:30 +0000
@@ -31,7 +31,7 @@
  * Return a hidden select with id $select + '_ghost'. This is usually used for temporary hiding options, since these
  * can't be hidden using 'display: none' or other similar techniques.
  * 
- * @param $select A jQuery wrapped selector
+ * @param $select {jQuery} The select to ghost
  * @returns The ghost for a given select
  */
 dhis2.select.getGhost = function( $select )
@@ -53,7 +53,7 @@
  * 
  * NOTE: Both selects should already be in sorted order.
  * 
- * @param $select A jQuery wrapped select
+ * @param $select {jQuery} The select to search within
  * @param key {String} Key to search for
  * @param caseSensitive {Boolean} Case sensitive search (defaults to false, so this parameter only needed if you want
  *            case sensitive search)
@@ -70,7 +70,7 @@
         var $select_ghost_options = $select_ghost.children();
         var $select_ghost_matched;
         var $select_not_matched;
-        
+
         if(caseSensitive) {
             $select_ghost_matched = $select_ghost_options.filter( ':contains(' + key + ')' );
             $select_not_matched = $select_options.filter( ':not( :contains(' + key + ') )' );
@@ -88,8 +88,8 @@
  * Moves an array of child elements into a select, these will be moved in a sorted fashion. Both the select and array is
  * assumed to be sorted to start with.
  * 
- * @param $select A jQuery wrapped select which acts as the target
- * @param $array A jQuery array of child elements to move
+ * @param $select {jQuery} A select which acts as the target
+ * @param $array {jQuery} An array of child elements to move
  */
 dhis2.select.moveSorted = function ($select, $array)
 {
@@ -127,10 +127,30 @@
 /**
  * Moves an array of child elements into a select.
  * 
- * @param $select A jQuery wrapped select which acts as the target
+ * @param $select {jQuery} Select which acts as the target
  * @param $array An array of child elements to move
  */
 dhis2.select.move = function ($select, $array)
 {
     $select.append($array);
 }
+
+/**
+ * Mark all options in a select as selected.
+ * 
+ * @param $select {jQuery} The select
+ */
+dhis2.select.selectAll = function($select)
+{
+    $select.children().attr('selected', true);
+}
+
+/**
+ * Mark all options as not selected.
+ * 
+ * @param $select {jQuery} The select
+ */
+dhis2.select.selectNone = function($select)
+{
+    $select.children().attr('selected', false);
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js	2011-04-24 15:50:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementForm.js	2011-06-01 08:15:30 +0000
@@ -1,13 +1,19 @@
-jQuery(document).ready(	function() {
-	validation2( 'addDataElementForm', function( form ){ form.submit(); }, {
-		'beforeValidateHandler': function() {
-			setFieldValue( 'submitCategoryComboId', getFieldValue( 'selectedCategoryComboId' ) );
-			setFieldValue( 'submitValueType', getFieldValue( 'valueType' ) );
-		},
-		'rules': getValidationRules("dataElement")
-	});
+jQuery( document ).ready( function()
+{
+    validation2( 'addDataElementForm', function( form )
+    {
+        dhis2.select.selectAll( $( '#aggregationLevels' ) );
+        form.submit();
+    }, {
+        'beforeValidateHandler' : function()
+        {
+            setFieldValue( 'submitCategoryComboId', getFieldValue( 'selectedCategoryComboId' ) );
+            setFieldValue( 'submitValueType', getFieldValue( 'valueType' ) );
+        },
+        'rules' : getValidationRules( "dataElement" )
+    } );
 
-	checkValueIsExist( "name", "validateDataElement.action");
-	checkValueIsExist( "shortName", "validateDataElement.action");
-	checkValueIsExist( "alternativeName", "validateDataElement.action");
-});
+    checkValueIsExist( "name", "validateDataElement.action" );
+    checkValueIsExist( "shortName", "validateDataElement.action" );
+    checkValueIsExist( "alternativeName", "validateDataElement.action" );
+} );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js	2011-04-24 15:50:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementForm.js	2011-06-01 08:15:30 +0000
@@ -1,9 +1,15 @@
-jQuery(document).ready(	function() {
-	validation2( 'updateDataElementForm', function( form ) { form.submit(); }, {
-		'beforeValidateHandler': function() {
-			setFieldValue( 'submitCategoryComboId', getFieldValue( 'selectedCategoryComboId' ) );
-			setFieldValue( 'submitValueType', getFieldValue( 'valueType' ) );
-		},
-		'rules': getValidationRules("dataElement")
-	});
-});
+jQuery( document ).ready( function()
+{
+    validation2( 'updateDataElementForm', function( form )
+    {
+        dhis2.select.selectAll( $( '#aggregationLevels' ) );
+        form.submit();
+    }, {
+        'beforeValidateHandler' : function()
+        {
+            setFieldValue( 'submitCategoryComboId', getFieldValue( 'selectedCategoryComboId' ) );
+            setFieldValue( 'submitValueType', getFieldValue( 'valueType' ) );
+        },
+        'rules' : getValidationRules( "dataElement" )
+    } );
+} );