← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9731: Data entry, made it possiblet to add comments for boolean values

 

------------------------------------------------------------
revno: 9731
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-02-05 14:34:09 +0200
message:
  Data entry, made it possiblet to add comments for boolean values
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment.png
modified:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.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/sectionForm.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.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
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/comment.png	2013-02-05 12:34:09 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2012-02-16 19:58:55 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2013-02-05 12:34:09 +0000
@@ -113,16 +113,16 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private Integer dataElementId;
+    private String dataElementId;
 
-    public void setDataElementId( Integer dataElementId )
+    public void setDataElementId( String dataElementId )
     {
         this.dataElementId = dataElementId;
     }
 
-    private Integer optionComboId;
+    private String optionComboId;
 
-    public void setOptionComboId( Integer optionComboId )
+    public void setOptionComboId( String optionComboId )
     {
         this.optionComboId = optionComboId;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2013-01-24 14:06:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2013-02-05 12:34:09 +0000
@@ -108,4 +108,5 @@
 left_side=Left side
 right_side=Right side
 no_periods_click_prev_year_button=No periods, click "Prev year" button
-print=Print
\ No newline at end of file
+print=Print
+view_comment=View comment
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm	2013-01-04 18:10:25 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/defaultForm.vm	2013-02-05 12:34:09 +0000
@@ -38,16 +38,17 @@
   <tr>
   <td id="${dataElement.uid}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end><span id="${dataElement.uid}-dataelement">${encoder.htmlEncode( $dataElement.getFormNameFallback() )}</span></td>
   #foreach( $optionCombo in $optionCombos )
-  #set( $dataEntryId = "${dataElement.uid}-${optionCombo.uid}-val" )	    
-  <td>
+  #set( $dataEntryId = "${dataElement.uid}-${optionCombo.uid}-val" )
+  #set( $commentId = "${dataElement.uid}-${optionCombo.uid}-comment" )
   #if( $dataElement.type == "bool" )
-  <select name="entryselect" id="$dataEntryId"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex">
+  <td><select name="entryselect" id="$dataEntryId"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex">
     <option value="">[$i18n.getString( "no_value" )]</option>
     <option value="true">$i18n.getString( "yes" )</option>
     <option value="false">$i18n.getString( "no" )</option>
   </select>
+  <img name="commentlink" id="${commentId}"></td>
   #else
-  <input name="entryfield" id="$dataEntryId" maxlength="255" type="text"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex">
+  <td><input name="entryfield" id="${dataEntryId}" maxlength="255" type="text"#if( !$hasAccess ) disabled="disabled"#end tabindex="$tabIndex"></td>
   #end
   </td>
   #set( $tabIndex = $tabIndex + 1 )

=== 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-02-04 22:40:03 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js	2013-02-05 12:34:09 +0000
@@ -399,6 +399,26 @@
         $( this ).css( 'width', '100%' );
     } );
     
+    $( '[name="commentlink"]' ).each( function( i )
+    {
+        var id = $( this ).attr( 'id' );
+        var split = splitFieldId( id );
+
+        var dataElementId = split.dataElementId;
+        var optionComboId = split.optionComboId;
+
+        $( this ).unbind( 'click' );
+        
+        $( this ).attr( "src", "../images/comment.png" );
+        $( this ).attr( "title", i18n_view_comment );
+        
+        $( this ).css( "cursor", "pointer" );
+        
+        $( this ).click ( function() {
+        	viewHist( dataElementId, optionComboId );
+        } );
+    } );
+    
     $( '[name="dynselect"]' ).each( function( i )
     {
     	var id = $( this ).attr( 'id' );
@@ -1536,27 +1556,30 @@
 {
     var periodId = $( '#selectedPeriodId' ).val();
 
-    var dataElementName = getDataElementName( dataElementId );
-    var optionComboName = getOptionComboName( optionComboId );
-    var operandName = dataElementName + ' ' + optionComboName;
-
-    $( '#historyDiv' ).load( 'viewHistory.action', {
-        dataElementId : dataElementId,
-        optionComboId : optionComboId,
-        periodId : periodId,
-        organisationUnitId : currentOrganisationUnitId
-    }, 
-    function( response, status, xhr )
-    {
-        if ( status == 'error' )
-        {
-            window.alert( i18n_operation_not_available_offline );
-        }
-        else
-        {
-            displayHistoryDialog( operandName );
-        }
-    } );
+	if ( dataElementId && optionComboId && periodId && periodId != -1 )
+	{
+	    var dataElementName = getDataElementName( dataElementId );
+	    var optionComboName = getOptionComboName( optionComboId );
+	    var operandName = dataElementName + ' ' + optionComboName;
+	
+	    $( '#historyDiv' ).load( 'viewHistory.action', {
+	        dataElementId : dataElementId,
+	        optionComboId : optionComboId,
+	        periodId : periodId,
+	        organisationUnitId : currentOrganisationUnitId
+	    }, 
+	    function( response, status, xhr )
+	    {
+	        if ( status == 'error' )
+	        {
+	            window.alert( i18n_operation_not_available_offline );
+	        }
+	        else
+	        {
+	            displayHistoryDialog( operandName );
+	        }
+	    } );
+	}
 }
 
 function closeCurrentSelection()

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2013-02-03 10:13:17 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/sectionForm.vm	2013-02-05 12:34:09 +0000
@@ -57,16 +57,17 @@
     <td id="${dataElement.uid}-cell" #if( $mark == 1 )class="alt"#else class="reg"#end><span id="${dataElement.uid}-dataelement">${encoder.htmlEncode( $dataElement.getFormNameFallback() )}</span></td>
     #foreach( $optionCombo in $optionCombos )
     #set( $dataEntryId = "${dataElement.uid}-${optionCombo.uid}-val" )
+    #set( $commentId = "${dataElement.uid}-${optionCombo.uid}-comment" )
     #set( $greyedField = false )
-    #set( $greyedField = $greyedFields.get( "$dataElement.uid:$optionCombo.uid" ) )        
+    #set( $greyedField = $greyedFields.get( "$dataElement.uid:$optionCombo.uid" ) )  
     #if( $dataElement.type == "bool" )
     <td><select name="entryselect" id="$dataEntryId" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end>
       <option value="">[$i18n.getString( "no_value" )]</option>
       <option value="true">$i18n.getString( "yes" )</option>
       <option value="false">$i18n.getString( "no" )</option>
-    </select></td>
+    </select><img name="commentlink" id="${commentId}"></td>
     #else
-    <td><input name="entryfield" id="$dataEntryId" type="text" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
+    <td><input name="entryfield" id="${dataEntryId}" type="text" tabindex="$tabIndex"#if( $greyedField || !$hasAccess ) disabled="disabled"#end></td>
     #end
     </td>
     #set( $tabIndex = $tabIndex + 1 )

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2013-01-24 14:06:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/select.vm	2013-02-05 12:34:09 +0000
@@ -43,6 +43,7 @@
 var i18n_no_organisationunit_selected = '$encoder.jsEscape( $i18n.getString( "no_organisationunit_selected" ) , "'")';
 var i18n_childrens_forms = '$encoder.jsEscape( $i18n.getString( "childrens_forms" ) , "'")';
 var i18n_no_periods_click_prev_year_button = '$encoder.jsEscape( $i18n.getString( "no_periods_click_prev_year_button" ) , "'")';
+var i18n_view_comment = '$encoder.jsEscape( $i18n.getString( "view_comment" ) , "'")';
 </script>
 
 <style type="text/css" media="print">