← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11645: Data entry, added indications in form for entry cells with comments

 

------------------------------------------------------------
revno: 11645
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-08-13 00:04:17 +0200
message:
  Data entry, added indications in form for entry cells with comments
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment_active.png
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm
  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/responseDataValues.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-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2012-09-10 16:11:09 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/datavalue/DataValue.java	2013-08-12 22:04:17 +0000
@@ -183,6 +183,11 @@
         return followup != null && followup;
     }
 
+    public boolean hasComment()
+    {
+        return comment != null && !comment.isEmpty();
+    }
+    
     // -------------------------------------------------------------------------
     // hashCode and equals
     // -------------------------------------------------------------------------

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm	2013-07-20 12:47:46 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/cacheManifest.vm	2013-08-12 22:04:17 +0000
@@ -1,5 +1,5 @@
 CACHE MANIFEST
-# 2.13-SNAPSHOT V3
+# 2.13-SNAPSHOT V4
 NETWORK:
 *
 CACHE:
@@ -46,9 +46,11 @@
 ../images/search.png
 ../images/colapse.png
 ../images/expand.png
-../images/transparent.gif
 ../images/help.png
 ../images/hide.png
+../images/comment.png
+../images/comment_active.png
+../images/transparent.gif
 ../images/ajax-loader-circle.gif
 ../images/ajax-loader-bar.gif
 ../dhis-web-dataentry/javascript/form.js

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment_active.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment_active.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment_active.png	2013-08-12 22:04:17 +0000 differ
=== 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	2013-08-12 20:59:22 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-08-12 22:04:17 +0000
@@ -60,8 +60,11 @@
 var COLOR_YELLOW = '#fffe8c';
 var COLOR_RED = '#ff8a8a';
 var COLOR_ORANGE = '#ff6600';
-var COLOR_WHITE = '#ffffff';
-var COLOR_GREY = '#cccccc';
+var COLOR_WHITE = '#fff';
+var COLOR_GREY = '#ccc';
+
+var COLOR_BORDER_ACTIVE = '#73ad72';
+var COLOR_BORDER = '#aaa';
 
 var DEFAULT_TYPE = 'int';
 var DEFAULT_NAME = '[unknown]';
@@ -1035,11 +1038,11 @@
 
     $( '.entryfield' ).val( '' );
     $( '.entryselect' ).val( '' );
-    $( '.entrytrueonly' ).removeAttr('checked');
+    $( '.entrytrueonly' ).removeAttr( 'checked' );
     $( '.entryoptionset' ).val( '' );
 
-    $( '.entryfield' ).css( 'background-color', COLOR_WHITE );
-    $( '.entryselect' ).css( 'background-color', COLOR_WHITE );
+    $( '.entryfield' ).css( 'background-color', COLOR_WHITE ).css( 'border-color', COLOR_BORDER );
+    $( '.entryselect' ).css( 'background-color', COLOR_WHITE ).css( 'border-color', COLOR_BORDER );
     $( '.entrytrueonly' ).css( 'background-color', COLOR_WHITE );
     $( '.entryoptionset' ).css( 'background-color', COLOR_WHITE );
 
@@ -1087,12 +1090,13 @@
 	        $.safeEach( json.dataValues, function( i, value )
 	        {
 	            var fieldId = '#' + value.id + '-val';
+	            var commentId = '#' + value.id + '-comment';
 
-	            if ( $( fieldId ).length > 0 )
+	            if ( $( fieldId ).length > 0 ) // Set values
 	            {
                     if ( $( fieldId ).attr( 'name' ) == 'entrytrueonly' && 'true' == value.val ) 
                     {
-                        $( fieldId ).attr( 'checked', true);
+                        $( fieldId ).attr( 'checked', true );
                     } 
                     else 
                     {
@@ -1100,6 +1104,18 @@
                     }
                 }
 	            
+	            if ( 'true' == value.com ) // Set active comments
+	            {
+	                if ( $( commentId ).length > 0 )
+	                {
+	                    $( commentId ).attr( 'src', '../images/comment_active.png' );
+	                }
+	                else if ( $( fieldId ).length > 0 )
+	                {
+	                    $( fieldId ).css( 'border-color', COLOR_BORDER_ACTIVE )
+	                }	            		
+	            }
+	            
 	            dataValueMap[value.id] = value.val;
 	        } );
 

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataValues.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataValues.vm	2013-01-04 18:10:25 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseDataValues.vm	2013-08-12 22:04:17 +0000
@@ -8,7 +8,8 @@
     #else
     "id":"${value.dataElement.uid}-${value.optionCombo.uid}",
     #end
-    "val":"$!{value.value}"
+    "val":"$!{value.value}",
+    "com":"${value.hasComment()}"
   }#if( $velocityCount < $size1 ),#end
   #end ],
   "minMaxDataElements": [