← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2735: Using slightly more distinct colors in data entry and red for error

 

------------------------------------------------------------
revno: 2735
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-01-25 10:03:44 +0100
message:
  Using slightly more distinct colors in data entry and red for error
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.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/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2011-01-17 17:03:05 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2011-01-25 09:03:44 +0000
@@ -606,6 +606,11 @@
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 		
+		<action name="ping"	class="org.hisp.dhis.commons.action.NoAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+		</action>
+		
 	</package>
 
 	<!-- About -->
@@ -657,14 +662,13 @@
 			<param name="javascripts">/dhis-web-commons/useraccount/userAccount.js</param>
 		</action>
 
-		<action name="updateUserAccount"
-			class="org.hisp.dhis.useraccount.action.UpdateUserAccountAction">
+		<action name="updateUserAccount" class="org.hisp.dhis.useraccount.action.UpdateUserAccountAction">
 			<result name="success" type="velocity">
 				/dhis-web-commons/useraccount/updateUserSuccess.vm</result>
 			<result name="input" type="velocity">
 				/dhis-web-commons/useraccount/updateUserInput.vm</result>
 		</action>
-
+		
 	</package>
 
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-01-06 16:37:59 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/entry.js	2011-01-25 09:03:44 +0000
@@ -3,6 +3,10 @@
 // Save
 // -----------------------------------------------------------------------------
 
+var COLOR_GREEN = '#b9ffb9';
+var COLOR_YELLOW = '#fffe8c';
+var COLOR_RED = '#ff8a8a';
+
 function saveVal( dataElementId, optionComboId )
 {
 	var dataElementName = document.getElementById( 'value[' + dataElementId + '].name' ).innerHTML;
@@ -16,7 +20,7 @@
     var type = document.getElementById( 'value[' + dataElementId + '].type' ).innerHTML;   
 	var organisationUnitId = getFieldValue( 'organisationUnitId' );
     
-    field.style.backgroundColor = '#ffffcc';
+    field.style.backgroundColor = COLOR_YELLOW;
     
     if ( field.value && field.value != '' )
     {
@@ -46,7 +50,7 @@
             {
                 // If value is 0 and zero is not significant for data element, then skip value
                 
-                field.style.backgroundColor = '#ccffcc';
+                field.style.backgroundColor = COLOR_GREEN;
                 return;
             }
             else
@@ -62,7 +66,7 @@
 
                     if ( value < min )
                     {
-                        var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, '#ffcccc' );
+                        var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, COLOR_RED );
                         valueSaver.save();
                         
                         window.alert( i18n_value_of_data_element_less + '\n\n' + dataElementName );
@@ -72,7 +76,7 @@
 
                     if ( value > max )
                     {
-                        var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, '#ffcccc' );
+                        var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, COLOR_RED );
                         valueSaver.save();
                         
                         window.alert( i18n_value_of_data_element_greater + '\n\n' + dataElementName);
@@ -84,7 +88,7 @@
         }
     }
 
-    var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, '#ccffcc', '' );
+    var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, field.value, COLOR_GREEN, '' );
     valueSaver.save();
 
     if ( type == 'int')
@@ -98,9 +102,9 @@
 	var select = selectedOption.options[selectedOption.selectedIndex].value 
 	var organisationUnitId = getFieldValue( 'organisationUnitId' );
 	
-   	selectedOption.style.backgroundColor = '#ffffcc';     
+   	selectedOption.style.backgroundColor = COLOR_YELLOW;
     
-    var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, select, '#ccffcc', selectedOption );
+    var valueSaver = new ValueSaver( dataElementId, optionComboId, organisationUnitId, select, COLOR_GREEN, selectedOption );
     valueSaver.save();
 }
 
@@ -110,9 +114,9 @@
     var type = document.getElementById( 'value[' + dataElementId + '].valueType' ).innerHTML;
 	var organisationUnitId = getFieldValue( 'organisationUnitId' );
     
-    field.style.backgroundColor = '#ffffcc';
+    field.style.backgroundColor = COLOR_YELLOW;
     
-    var valueSaver = new ValueSaver( dataElementId, '', organisationUnitId, field.value, '#ccffcc', '' );
+    var valueSaver = new ValueSaver( dataElementId, '', organisationUnitId, field.value, COLOR_GREEN, '' );
     valueSaver.save();
 }
 
@@ -122,8 +126,8 @@
     var select = document.getElementById( 'value[' + dataElementId + ':' + optionComboId + '].comments' );
 	var organisationUnitId = getFieldValue( 'organisationUnitId' );
     
-    field.style.backgroundColor = '#ffffcc';
-    select.style.backgroundColor = '#ffffcc';
+    field.style.backgroundColor = COLOR_YELLOW;
+    select.style.backgroundColor = COLOR_YELLOW;
     
     var commentSaver = new CommentSaver( dataElementId, optionComboId, organisationUnitId, commentValue );
     commentSaver.save();
@@ -134,7 +138,7 @@
  */
 function alertField( field )
 {
-	field.style.backgroundColor = '#ffcc00';
+	field.style.backgroundColor = COLOR_YELLOW;
     field.select();
     field.focus();
     return false;
@@ -146,9 +150,6 @@
 
 function ValueSaver( dataElementId_, optionComboId_, organisationUnitId_, value_, resultColor_, selectedOption_ )
 {
-    var SUCCESS = '#ccffcc';
-    var ERROR = '#ccccff';
-
     var dataElementId = dataElementId_;
     var optionComboId = optionComboId_;
     var value = value_;
@@ -177,14 +178,14 @@
         }
         else
         {
-            markValue( ERROR );
+            markValue( COLOR_RED );
             window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
         }
     }
     
     function handleHttpError( errorCode )
     {
-        markValue( ERROR );
+        markValue( COLOR_RED );
         window.alert( i18n_saving_value_failed_error_code + '\n\n' + errorCode );
     }