← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2067: Centralized javascript in dataentry

 

------------------------------------------------------------
revno: 2067
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-15 20:13:42 +0100
message:
  Centralized javascript in dataentry
removed:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/general.js
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/multidimensional.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-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2010-11-12 07:55:55 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml	2010-11-15 19:13:42 +0000
@@ -24,7 +24,7 @@
 			<param name="menuTreeHeight">420</param>
 			<param name="javascripts">
 				../dhis-web-commons/ouwt/ouwt.js,
-				javascript/general.js,
+				javascript/multidimensional.js,
 				javascript/form.js
 			</param>
 			<param name="stylesheets">style/dhis-web-dataentry.css</param>
@@ -48,8 +48,9 @@
 			<param name="menuTreeHeight">420</param>
 			<param name="javascripts">
 				../dhis-web-commons/ouwt/ouwt.js,				
-				javascript/general.js,javascript/form.js,
-				javascript/section.js,javascript/multidimensional.js,
+				javascript/form.js,
+				javascript/section.js,
+				javascript/multidimensional.js,
 				../dhis-web-commons/calendar/calendar.js,
 				../dhis-web-commons/calendar/calendar-lang.js,
 				../dhis-web-commons/calendar/calendar-setup.js
@@ -66,7 +67,8 @@
 			<param name="menuTreeHeight">420</param>
 			<param name="javascripts">
 				../dhis-web-commons/ouwt/ouwt.js,
-				javascript/general.js,javascript/form.js,javascript/multidimensional.js,
+				javascript/form.js,
+				javascript/multidimensional.js,
 				../dhis-web-commons/calendar/calendar.js,
 				../dhis-web-commons/calendar/calendar-lang.js,
 				../dhis-web-commons/calendar/calendar-setup.js

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-10-07 11:14:36 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2010-11-15 19:13:42 +0000
@@ -337,3 +337,12 @@
 	setMessage( i18n_undo_register_complete_dataset_success );
 	changeInputTextStatus( false );
 }
+
+// -----------------------------------------------------------------------------
+// Validation
+// -----------------------------------------------------------------------------
+
+function validate()
+{
+    window.open( 'validate.action', '_blank', 'width=800, height=400, scrollbars=yes, resizable=yes' );
+}

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/general.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/general.js	2010-11-15 18:43:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/general.js	1970-01-01 00:00:00 +0000
@@ -1,360 +0,0 @@
-
-// -----------------------------------------------------------------------------
-// Selection
-// -----------------------------------------------------------------------------
-
-function organisationUnitSelected( orgUnits )
-{
-    window.location.href = 'select.action';
-}
-
-selection.setListenerFunction( organisationUnitSelected );
-
-// -----------------------------------------------------------------------------
-// Save
-// -----------------------------------------------------------------------------
-
-function saveValue( dataElementId, optionComboId, dataElementName, zeroValueSaveMode )
-{
-    var field = document.getElementById( 'value[' + dataElementId + '].value' + ':' +  'value[' + optionComboId + '].value');
-    var type = document.getElementById( 'value[' + dataElementId + '].type' ).innerHTML; 
-	var organisationUnitId = getFieldValue( 'organisationUnitId' );
-    
-    field.style.backgroundColor = '#ffffcc';   
-    
-    if ( field.value != '' )
-    {
-         if ( type == 'int' || type == 'number' || type == 'positiveNumber' || type == 'negativeNumber' )      
-        {
-        	var value = new Number( field.value );       	        	
-        	
-            if (  type == 'int' && !isInt( field.value ))
-            {
-                field.style.backgroundColor = '#ffcc00';
-                window.alert( i18n_value_must_integer + '\n\n' + dataElementName );
-                field.select();
-                field.focus();
-
-                return;
-            }
-			else if (  type == 'number' && !isNumber( field.value ))
-            {
-                field.style.backgroundColor = '#ffcc00';
-                window.alert( i18n_value_must_number + '\n\n' + dataElementName );
-                field.select();
-                field.focus();
-
-                return;
-            } 
-			else if (  type == 'positiveNumber' && !isPositiveNumber( field.value ))
-            {
-                field.style.backgroundColor = '#ffcc00';
-                window.alert( i18n_value_must_positive_number + '\n\n' + dataElementName );
-                field.select();
-                field.focus();
-
-                return;
-            } 
-			else if (  type == 'negativeNumber' && !isNegativeNumber( field.value ))
-            {
-                field.style.backgroundColor = '#ffcc00';
-                window.alert( i18n_value_must_negative_number + '\n\n' + dataElementName );
-                field.select();
-                field.focus();
-
-                return;
-            } 
-            else
-            {
-                var minString = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].min' ).innerHTML;
-                var maxString = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].max' ).innerHTML;
-
-                if ( minString.length != 0 && maxString.length != 0 )
-                {
-                    var value = new Number( field.value );
-                    var min = new Number( minString );
-                    var max = new Number( maxString );
-
-                    if ( value < min )
-                    {
-                        var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, '#ffcccc' );
-                        valueSaver.save();
-                        
-                        window.alert( i18n_value_of_data_element_less + '\n\n' + dataElementName );
-                        
-                        return;
-                    }
-
-                    if ( value > max )
-                    {
-                        var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId,  field.value, '#ffcccc' );
-                        valueSaver.save();
-                        
-                        window.alert( i18n_value_of_data_element_greater + '\n\n' + dataElementName);
-                        
-                        return;
-                    }
-                }
-            }
-        }
-    }
-
-    var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, '#ccffcc', '' );
-    valueSaver.save();    
-    
-    if ( type == 'int')
-    {
-    	calculateCDE(dataElementId);
-    }
-
-}
-
-function saveBoolean( dataElementId, optionComboId, selectedOption )
-{
-    selectedOption.style.backgroundColor = '#ffffcc';
-	var organisationUnitId = getFieldValue( 'organisationUnitId' );
-    
-    var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, selectedOption.options[selectedOption.selectedIndex].value, '#ccffcc', selectedOption );
-    valueSaver.save();
-}
-
-function saveDate( dataElementId, dataElementName )
-{
-	
-	var field = document.getElementById( 'value[' + dataElementId + '].date' );
-    var type = document.getElementById( 'value[' + dataElementId + '].valueType' ).innerHTML;
-	var organisationUnitId = getFieldValue( 'organisationUnitId' );
-    
-    field.style.backgroundColor = '#ffffcc';
-    
-    var valueSaver = new ValueSaver( dataElementId, '', organisationUnitId, field.value, '#ccffcc', '' );
-    valueSaver.save();
-}
-
-function saveComment( dataElementId, optionComboId, commentValue )
-{
-    var field = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comment' );                
-    var select = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comments' );
-    var organisationUnitId = getFieldValue( 'organisationUnitId' );
-	
-    field.style.backgroundColor = '#ffffcc';
-    select.style.backgroundColor = '#ffffcc';
-    
-    var commentSaver = new CommentSaver( dataElementId, optionComboId, organisationUnitId, commentValue );
-    commentSaver.save();
-}
-
-// -----------------------------------------------------------------------------
-// Saver objects
-// -----------------------------------------------------------------------------
-
-function ValueSaver( dataElementId_, optionComboId_, organisationUnitId_, value_, resultColor_, selectedOption_ )
-{
-    var SUCCESS = '#ccffcc';
-    var ERROR = '#ccccff';
-
-    var dataElementId = dataElementId_;
-    var optionComboId = optionComboId_;
-    var value = value_;
-    var resultColor = resultColor_;
-    var selectedOption = selectedOption_; 
-    var organisationUnitId = organisationUnitId_; 
-    
-    this.save = function()
-    {
-        var request = new Request();
-        request.setCallbackSuccess( handleResponse );
-        request.setCallbackError( handleHttpError );
-        request.setResponseTypeXML( 'status' );
-        request.send( 'saveValue.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
-                dataElementId + '&value=' + value );
-    };
-    
-    function handleResponse( rootElement )
-    {
-        var codeElement = rootElement.getElementsByTagName( 'code' )[0];
-        var code = parseInt( codeElement.firstChild.nodeValue );
-        
-        if ( code == 0 )
-        {
-            markValue( resultColor );                   
-        }
-        else
-        {
-            markValue( ERROR );
-            window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
-        }
-    }
-    
-    function handleHttpError( errorCode )
-    {
-        markValue( ERROR );
-        window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode );
-    }   
-    
-    function markValue( color )
-    {
-        var type = document.getElementById( 'value[' + dataElementId + '].type' ).innerHTML;       
-        
-        var element;
-        
-        if ( type == 'bool' )
-        {
-            element = document.getElementById( 'value[' + dataElementId + '].boolean' );
-        }
-        else if( type == 'date' )
-        {
-        	element = document.getElementById( 'value[' + dataElementId + '].date' );
-        }
-        else if( selectedOption )
-        {
-        	element = selectedOption;    
-        }
-        else
-        {           
-            element = document.getElementById( 'value[' + dataElementId + '].value' + ':' +  'value[' + optionComboId + '].value');                      
-        }
-                
-        element.style.backgroundColor = color;
-    }
-}
-
-function CommentSaver( dataElementId_, optionComboId_, organisationUnitId_,  value_ )
-{
-    var SUCCESS = '#ccffcc';
-    var ERROR = '#ccccff';
-
-    var dataElementId = dataElementId_;
-    var optionComboId = optionComboId_
-    var value = value_;
-    var organisationUnitId = organisationUnitId_;
-    
-    this.save = function()
-    {
-        var request = new Request();
-        request.setCallbackSuccess( handleResponse );
-        request.setCallbackError( handleHttpError );
-        request.setResponseTypeXML( 'status' );
-        request.send( 'saveComment.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
-                dataElementId + '&optionComboId=' + optionComboId + '&comment=' + value );
-    };
-    
-    function handleResponse( rootElement )
-    {
-        var codeElement = rootElement.getElementsByTagName( 'code' )[0];
-        var code = parseInt( codeElement.firstChild.nodeValue );
-        
-        if ( code == 0 )
-        {
-            markComment( SUCCESS );           
-        }
-        else
-        {
-            markComment( ERROR );
-            window.alert( i18n_saving_comment_failed_status_code + '\n\n' + code );
-        }
-    }
-    
-    function handleHttpError( errorCode )
-    {
-        markComment( ERROR );
-        window.alert( i18n_saving_comment_failed_error_code + '\n\n' + errorCode );
-    }
-    
-    function markComment( color )
-    {
-        var field = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comment' );                
-        var select = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comments' );        
-
-        field.style.backgroundColor = color;
-        select.style.backgroundColor = color;
-    }
-}
-
-// -----------------------------------------------------------------------------
-// Validation
-// -----------------------------------------------------------------------------
-
-function validate()
-{
-	window.open( 'validate.action', '_blank', 'width=800, height=400, scrollbars=yes, resizable=yes' );
-}
-
-// -----------------------------------------------------------------------------
-// CalculatedDataElements
-// -----------------------------------------------------------------------------
-
-/**
- * Calculate and display the value of any CDE the given data element is a part of.
- * @param dataElementId  id of the data element to calculate a CDE for
- */
-function calculateCDE( dataElementId )
-{
-    var cdeId = getCalculatedDataElement(dataElementId);
-  
-    if ( ! cdeId )
-    {
-  	    return;
-    }
-    
-    var factorMap = calculatedDataElementMap[cdeId];
-    var value = 0;
-    var dataElementValue;
-    
-    for ( dataElementId in factorMap )
-    {
-    	dataElementValue = document.getElementById( 'value[' + dataElementId + '].value' ).value;
-    	value += ( dataElementValue * factorMap[dataElementId] );
-    }
-    
-    document.getElementById( 'value[' + cdeId + '].value' ).value = value;
-}
-
-/**
- * Returns the id of the CalculatedDataElement this DataElement id is a part of.
- * @param dataElementId id of the DataElement
- * @return id of the CalculatedDataElement this DataElement id is a part of,
- *     or null if the DataElement id is not part of any CalculatedDataElement
- */
-function getCalculatedDataElement( dataElementId )
-{
-    for ( cdeId in calculatedDataElementMap )
-    {
-  	    var factorMap = calculatedDataElementMap[cdeId];
-
-  	    if ( deId in factorMap )
-  	    {
-  	    	return cdeId;
-  	    }
-    }
-
-    return null;
-}
-
-function calculateAndSaveCDEs()
-{
-	lockScreen();
-	
-    var request = new Request();
-    request.setCallbackSuccess( dataValuesReceived );
-    request.setResponseTypeXML( 'dataValues' );
-    request.send( 'calculateCDEs.action' );
-}
-
-function dataValuesReceived( node )
-{
-	var values = node.getElementsByTagName('dataValue');
-    var dataElementId;
-    var value;
-
-	for ( var i = 0, value; value = values[i]; i++ )
-	{
-		dataElementId = value.getAttribute('dataElementId');
-		value = value.firstChild.nodeValue;		
-		document.getElementById( 'value[' + dataElementId + '].value' ).value = value;
-	}
-	
-	unLockScreen();
-
-	setMessage(i18n_save_calculated_data_element_success);
-}
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/multidimensional.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/multidimensional.js	2010-11-15 18:43:30 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/multidimensional.js	2010-11-15 19:13:42 +0000
@@ -16,8 +16,8 @@
 
 function saveValue( dataElementId, optionComboId, dataElementName, zeroValueSaveMode )
 {
-    var field = byId( 'value[' + dataElementId + '].value' + ':' +  'value[' + optionComboId + '].value');
-    var type = byId( 'value[' + dataElementId + '].type' ).innerHTML;   
+    var field = document.getElementById( 'value[' + dataElementId + '].value' + ':' +  'value[' + optionComboId + '].value');
+    var type = document.getElementById( 'value[' + dataElementId + '].type' ).innerHTML;   
 	var organisationUnitId = getFieldValue( 'organisationUnitId' );
     
     field.style.backgroundColor = '#ffffcc';
@@ -49,9 +49,7 @@
 			else if (  type == 'positiveNumber' && !isPositiveNumber( field.value ))
             {
                 field.style.backgroundColor = '#ffcc00';
-
                 window.alert( i18n_value_must_positive_number + '\n\n' + dataElementName );
-
                 field.select();
                 field.focus();
 
@@ -60,9 +58,7 @@
 			else if (  type == 'negativeNumber' && !isNegativeNumber( field.value ))
             {
                 field.style.backgroundColor = '#ffcc00';
-
                 window.alert( i18n_value_must_negative_number + '\n\n' + dataElementName );
-
                 field.select();
                 field.focus();
 
@@ -70,8 +66,8 @@
             } 
             else
             {
-                var minString = byId( 'value[' + dataElementId + ':' + optionComboId + '].min' ).innerHTML;
-                var maxString = byId( 'value[' + dataElementId + ':' + optionComboId + '].max' ).innerHTML;
+                var minString = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].min' ).innerHTML;
+                var maxString = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].max' ).innerHTML;
 
                 if ( minString.length != 0 && maxString.length != 0 )
                 {
@@ -114,23 +110,32 @@
 }
 
 function saveBoolean( dataElementId, optionComboId, selectedOption  )
+{	
+	var select = selectedOption.options[selectedOption.selectedIndex].value 
+	var organisationUnitId = getFieldValue( 'organisationUnitId' );
+	
+   	selectedOption.style.backgroundColor = '#ffffcc';     
+    
+    var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, select, '#ccffcc', selectedOption );
+    valueSaver.save();
+}
+
+function saveDate( dataElementId, dataElementName )
 {
-	
-	 var select = selectedOption.options[selectedOption.selectedIndex].value 
-	 var organisationUnitId = getFieldValue( 'organisationUnitId' );
-	
-     selectedOption.style.backgroundColor = '#ffffcc';     
-    
-     var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, select, '#ccffcc', selectedOption );
-     valueSaver.save(); 
-   
-
+	var field = document.getElementById( 'value[' + dataElementId + '].date' );
+    var type = document.getElementById( 'value[' + dataElementId + '].valueType' ).innerHTML;
+	var organisationUnitId = getFieldValue( 'organisationUnitId' );
+    
+    field.style.backgroundColor = '#ffffcc';
+    
+    var valueSaver = new ValueSaver( dataElementId, '', organisationUnitId, field.value, '#ccffcc', '' );
+    valueSaver.save();
 }
 
 function saveComment( dataElementId, optionComboId, commentValue )
 {
-    var field = byId( 'value[' + dataElementId + ':' + optionComboId + '].comment' );                
-    var select = byId( 'value[' + dataElementId + ':' + optionComboId + '].comments' );
+    var field = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comment' );                
+    var select = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comments' );
 	var organisationUnitId = getFieldValue( 'organisationUnitId' );
     
     field.style.backgroundColor = '#ffffcc';
@@ -155,20 +160,15 @@
     var resultColor = resultColor_;
     var selectedOption = selectedOption_;
     var organisationUnitId = organisationUnitId_;
-    var inputId = dataElementId + ':' +  optionComboId;
     
     this.save = function()
     {
         var request = new Request();
         request.setCallbackSuccess( handleResponse );
         request.setCallbackError( handleHttpError );
-        request.setResponseTypeXML( 'status' );
-        
+        request.setResponseTypeXML( 'status' );        
         request.send( 'saveMultiDimensionalValue.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
                 dataElementId + '&optionComboId=' + optionComboId + '&value=' + value );
-        
-        /*request.send( 'saveMultiDimensionalValue.action?inputId=' +
-                inputId + '&value=' + value );*/
     };
     
     function handleResponse( rootElement )
@@ -178,8 +178,7 @@
         
         if ( code == 0 )
         {
-            markValue( resultColor );            
-            
+            markValue( resultColor );
         }
         else
         {
@@ -196,12 +195,16 @@
     
     function markValue( color )
     {
-        var type = byId( 'value[' + dataElementId + '].type' ).innerText;
+        var type = document.getElementById( 'value[' + dataElementId + '].type' ).innerText;
         var element;
         
         if ( type == 'bool' )
         {
-            element = byId( 'value[' + dataElementId + '].boolean' );
+            element = document.getElementById( 'value[' + dataElementId + '].boolean' );
+        }
+        else if( type == 'date' )
+        {
+        	element = document.getElementById( 'value[' + dataElementId + '].date' );
         }
         else if( selectedOption )
         {
@@ -209,7 +212,7 @@
         }
         else
         {            
-            element = byId( 'value[' + dataElementId + '].value' + ':' +  'value[' + optionComboId + '].value');            
+            element = document.getElementById( 'value[' + dataElementId + '].value' + ':' +  'value[' + optionComboId + '].value');            
         }
 
         element.style.backgroundColor = color;
@@ -222,7 +225,7 @@
     var ERROR = '#ccccff';
 
     var dataElementId = dataElementId_;
-    var optionComboId = optionComboId_
+    var optionComboId = optionComboId_;
     var organisationUnitId = organisationUnitId_;
     var value = value_;
     
@@ -260,8 +263,8 @@
     
     function markComment( color )
     {
-        var field = byId( 'value[' + dataElementId + ':' + optionComboId + '].comment' );                
-        var select = byId( 'value[' + dataElementId + ':' + optionComboId + '].comments' );        
+        var field = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comment' );                
+        var select = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comments' );        
 
         field.style.backgroundColor = color;
         select.style.backgroundColor = color;
@@ -269,14 +272,6 @@
 }
 
 // -----------------------------------------------------------------------------
-// Validation
-// -----------------------------------------------------------------------------
-function validate()
-{
-    window.open( 'validate.action', '_blank', 'width=800, height=400, scrollbars=yes, resizable=yes' );
-}
-
-// -----------------------------------------------------------------------------
 // CalculatedDataElements
 // -----------------------------------------------------------------------------
 
@@ -299,11 +294,11 @@
     
     for ( dataElementId in factorMap )
     {
-    	dataElementValue = byId( 'value[' + dataElementId + '].value' ).value;
+    	dataElementValue = document.getElementById( 'value[' + dataElementId + '].value' ).value;
     	value += ( dataElementValue * factorMap[dataElementId] );
     }
     
-    byId( 'value[' + cdeId + '].value' ).value = value;
+    document.getElementById( 'value[' + cdeId + '].value' ).value = value;
 }
 
 /**
@@ -347,74 +342,10 @@
 	{
 		dataElementId = value.getAttribute('dataElementId');
 		value = value.firstChild.nodeValue;		
-		byId( 'value[' + dataElementId + '].value' ).value = value;
+		document.getElementById( 'value[' + dataElementId + '].value' ).value = value;
 	}
 	
 	unLockScreen();
 	
 	setMessage(i18n_save_calculated_data_element_success);
 }
-
-// -----------------------------------------------------------------------------
-// View history
-// -----------------------------------------------------------------------------
-
-/**
- * Set min/max limits for dataelements that has one or more values, and no 
- * manually entred min/max limits.
- */
-function SetGeneratedMinMaxValues()
-{
-    this.save = function()
-    {
-        var request = new Request();
-        request.setCallbackSuccess( handleResponse );
-        request.setCallbackError( handleHttpError );
-        request.setResponseTypeXML( 'minmax' );
-        request.send( 'minMaxGeneration.action' );
-    };
-    
-    function handleResponse( rootElement )
-    {
-        var dataElements = rootElement.getElementsByTagName( 'dataelement' );
-        
-        for( i = 0; i < dataElements.length; i++ )
-        {
-            var deId = getElementValue( dataElements[i], 'dataelementId' );
-            var ocId = getElementValue( dataElements[i], 'optionComboId' );
-            
-            setInnerHTML('value[' + deId + ':' + ocId + '].min', getElementValue( dataElements[i], 'minLimit'));
-            setInnerHTML('value[' + deId + ':' + ocId + '].max', getElementValue( dataElements[i], 'maxLimit'));
-        }
-    }
-    
-    function handleHttpError( errorCode )
-    {
-        window.alert( i18n_saving_minmax_failed_error_code + '\n\n' + errorCode );
-    }   
-   
-    function getElementValue( parentElement, childElementName )
-    {
-        var textNode = parentElement.getElementsByTagName( childElementName )[0].firstChild;
-        
-        if ( textNode )
-        {
-            return textNode.nodeValue;
-        }
-        else
-        {
-            return null;
-        }
-    }    
-}
-
-function generateMinMaxValues()
-{    
-	lockScreen();
-    var setGeneratedMinMaxValues = new SetGeneratedMinMaxValues();
-    setGeneratedMinMaxValues.save();
-	
-	unLockScreen();
-	
-	setMessage(i18n_generate_min_max_success);
-}
\ No newline at end of file