← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4027: Replaced standard comments with free-text comments in data entry

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 4027 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-06-27 12:39:01 +0200
message:
  Replaced standard comments with free-text comments in data entry
removed:
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/DefaultStandardCommentsManager.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/StandardCommentsManager.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/standard_comments.xml
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/java/org/hisp/dhis/de/action/SelectAction.java
  dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
  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/history.vm
  dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.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/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	2010-04-21 14:32:54 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/HistoryAction.java	2011-06-27 10:39:01 +0000
@@ -38,7 +38,6 @@
 import org.hisp.dhis.datavalue.DataValueAudit;
 import org.hisp.dhis.datavalue.DataValueAuditService;
 import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.de.comments.StandardCommentsManager;
 import org.hisp.dhis.de.history.DataElementHistory;
 import org.hisp.dhis.de.history.HistoryRetriever;
 import org.hisp.dhis.de.state.SelectedStateManager;
@@ -95,13 +94,6 @@
         this.selectedStateManager = selectedStateManager;
     }
     
-    private StandardCommentsManager standardCommentsManager;
-
-    public void setStandardCommentsManager( StandardCommentsManager standardCommentsManager )
-    {
-        this.standardCommentsManager = standardCommentsManager;
-    }
-
     private DataValueAuditService dataValueAuditService;
 
     public void setDataValueAuditService( DataValueAuditService dataValueAuditService )
@@ -207,12 +199,6 @@
 
         dataElementHistory = historyRetriever.getHistory( dataElement, optionCombo, organisationUnit, period, HISTORY_LENGTH );
         
-        // ---------------------------------------------------------------------
-        // Make the standard comments available
-        // ---------------------------------------------------------------------
-
-        standardComments = standardCommentsManager.getStandardComments();
-        
         if ( dataElementHistory == null )
         {
             isHistoryValid = false;

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java	2011-05-31 07:54:15 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/SelectAction.java	2011-06-27 10:39:01 +0000
@@ -58,7 +58,6 @@
 import org.hisp.dhis.dataset.comparator.SectionOrderComparator;
 import org.hisp.dhis.datavalue.DataValue;
 import org.hisp.dhis.datavalue.DataValueService;
-import org.hisp.dhis.de.comments.StandardCommentsManager;
 import org.hisp.dhis.de.state.SelectedStateManager;
 import org.hisp.dhis.i18n.I18n;
 import org.hisp.dhis.minmax.MinMaxDataElement;
@@ -126,13 +125,6 @@
         this.dataValueService = dataValueService;
     }
 
-    private StandardCommentsManager standardCommentsManager;
-
-    public void setStandardCommentsManager( StandardCommentsManager standardCommentsManager )
-    {
-        this.standardCommentsManager = standardCommentsManager;
-    }
-
     private MinMaxDataElementService minMaxDataElementService;
 
     public void setMinMaxDataElementService( MinMaxDataElementService minMaxDataElementService )
@@ -594,12 +586,6 @@
         }
 
         // ---------------------------------------------------------------------
-        // Make the standard comments available
-        // ---------------------------------------------------------------------
-
-        standardComments = standardCommentsManager.getStandardComments();
-
-        // ---------------------------------------------------------------------
         // Make the DataElement types available
         // ---------------------------------------------------------------------
 

=== removed directory 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments'
=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/DefaultStandardCommentsManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/DefaultStandardCommentsManager.java	2010-06-03 10:32:02 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/DefaultStandardCommentsManager.java	1970-01-01 00:00:00 +0000
@@ -1,96 +0,0 @@
-package org.hisp.dhis.de.comments;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-import com.thoughtworks.xstream.XStream;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: DefaultStandardCommentsManager.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public class DefaultStandardCommentsManager
-    implements StandardCommentsManager
-{
-    private static final Log log = LogFactory.getLog( DefaultStandardCommentsManager.class );
-    
-    // -------------------------------------------------------------------------
-    // Dependencies
-    // -------------------------------------------------------------------------
-
-    private String standardCommentsFile;
-
-    public void setStandardCommentsFile( String standardCommentsFile )
-    {
-        this.standardCommentsFile = standardCommentsFile;
-    }
-
-    private List<String> standardComments;
-
-    @SuppressWarnings("unchecked")
-    public void init()
-    {
-        Reader reader = null;
-        try 
-        {
-            reader = new BufferedReader( new InputStreamReader( getClass().getClassLoader().getResourceAsStream( standardCommentsFile ), "UTF-8" ) );
-        }
-        catch ( UnsupportedEncodingException e )
-        {
-            log.warn( "Unsupported encoding", e );
-        }
-        
-        if ( reader != null )
-        {
-            XStream xStream = new XStream();
-            standardComments = (List<String>) xStream.fromXML( reader );
-        }
-        else
-        {
-            standardComments = new ArrayList<String>();
-        }
-    }
-    
-    // -------------------------------------------------------------------------
-    // StandardCommentsManager implementation
-    // -------------------------------------------------------------------------
-
-    public List<String> getStandardComments()
-    {
-        return standardComments;
-    }
-}

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/StandardCommentsManager.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/StandardCommentsManager.java	2010-06-03 10:32:02 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/comments/StandardCommentsManager.java	1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-package org.hisp.dhis.de.comments;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.List;
-
-/**
- * @author Torgeir Lorange Ostby
- * @version $Id: StandardCommentsManager.java 2869 2007-02-20 14:26:09Z andegje $
- */
-public interface StandardCommentsManager
-{
-    String ID = StandardCommentsManager.class.getName();
-
-    List<String> getStandardComments();
-}

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2011-06-23 08:20:44 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml	2011-06-27 10:39:01 +0000
@@ -5,11 +5,6 @@
 
   <bean id="org.hisp.dhis.de.action.EmptyAction" class="org.hisp.dhis.de.action.EmptyAction" />
 
-  <bean id="org.hisp.dhis.de.comments.StandardCommentsManager" class="org.hisp.dhis.de.comments.DefaultStandardCommentsManager"
-    init-method="init">
-    <property name="standardCommentsFile" value="standard_comments.xml" />
-  </bean>
-
   <bean id="org.hisp.dhis.de.history.HistoryRetriever" class="org.hisp.dhis.de.history.DefaultHistoryRetriever">
     <property name="minMaxDataElementService" ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
@@ -58,7 +53,6 @@
     <property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
     <property name="registrationService" ref="org.hisp.dhis.dataset.CompleteDataSetRegistrationService" />
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-    <property name="standardCommentsManager" ref="org.hisp.dhis.de.comments.StandardCommentsManager" />
     <property name="minMaxDataElementService" ref="org.hisp.dhis.minmax.MinMaxDataElementService" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
   </bean>
@@ -103,7 +97,6 @@
     <property name="selectedStateManager" ref="org.hisp.dhis.de.state.SelectedStateManager" />
     <property name="categoryService" ref="org.hisp.dhis.dataelement.DataElementCategoryService" />
     <property name="dataValueService" ref="org.hisp.dhis.datavalue.DataValueService" />
-    <property name="standardCommentsManager" ref="org.hisp.dhis.de.comments.StandardCommentsManager" />
     <property name="dataValueAuditService" ref="org.hisp.dhis.datavalue.DataValueAuditService" />
   </bean>
 

=== 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	2011-06-23 06:46:26 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2011-06-26 19:19:35 +0000
@@ -125,4 +125,5 @@
 to									= to
 on									= On
 value								= Value
-no_response_from_server				= No response from server. Please check connectivity and try again.
\ No newline at end of file
+no_response_from_server				= No response from server. Please check connectivity and try again.
+save_comment						= Save comment
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/standard_comments.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/standard_comments.xml	2010-11-16 17:14:13 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/standard_comments.xml	1970-01-01 00:00:00 +0000
@@ -1,12 +0,0 @@
-<list>
-  <string>Holiday visitors</string>
-  <string>Interpolated dataset</string>
-  <string>Missing</string>
-  <string>Never in stock</string>
-  <string>No activity for this month</string>
-  <string>No transport</string>
-  <string>Normal seasonal variation</string>
-  <string>Seasonal workers</string>
-  <string>Staff on leave</string>
-  <string>Staff on sick leave</string>
-</list>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2011-06-26 13:40:38 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/history.vm	2011-06-27 10:39:01 +0000
@@ -17,32 +17,25 @@
     $encoder.htmlEncode( $dataElementHistory.dataElement.name )
     $encoder.htmlEncode( $dataElementHistory.optionCombo.name )
     #if ( $dataValue && $dataValue.isFollowup() )
-        <img id="followup" src="../images/marked_large.png" alt="$i18n.getString( 'mark_value_for_followup' )" onclick="markValueForFollowup( '$dataValue.dataElement.id', '$dataValue.period.id', '$dataValue.source.id', '$dataValue.optionCombo.id' )" style="cursor:pointer"/>
+        <img id="followup" src="../images/marked.png" alt="$i18n.getString( 'mark_value_for_followup' )" onclick="markValueForFollowup( '$dataValue.dataElement.id', '$dataValue.period.id', '$dataValue.source.id', '$dataValue.optionCombo.id' )" style="cursor:pointer"/>
 	#elseif ( $dataValue )
-        <img id="followup" src="../images/unmarked_large.png" alt="$i18n.getString( 'unmark_value_for_followup' )" onclick="markValueForFollowup( '$dataValue.dataElement.id', '$dataValue.period.id', '$dataValue.source.id', '$dataValue.optionCombo.id' )" style="cursor:pointer"/>
+        <img id="followup" src="../images/unmarked.png" alt="$i18n.getString( 'unmark_value_for_followup' )" onclick="markValueForFollowup( '$dataValue.dataElement.id', '$dataValue.period.id', '$dataValue.source.id', '$dataValue.optionCombo.id' )" style="cursor:pointer"/>
 	#else
-	    <img id="followup" src="../images/unmarked_large.png"/>
+	    <img id="followup" src="../images/unmarked.png"/>
 	#end
 </h3>
 
 <table>
 	<tr>		
-		<!-- Column 1 - Comment and Followup -->
+		<!-- Column 1 - Comment -->
 		<td valign="top">			
 			<h4>$i18n.getString( "dataelement_comment" )</h4>
 			#if( $showComment == 'true' )
-			##comment
-			    <select id="value[$dataElementHistory.dataElement.id:$dataElementHistory.optionCombo.id].comments" #if( $auth.hasAccess( "dhis-web-dataentry", "saveComment" ) ) onchange="commentSelected()" #else disabled="disabled" #end #if( $dataValue.comment && !$standardComments.contains( $dataValue.comment ) ) style="display:none; width:100%" #end#if( $locked ) disabled="disabled"#end>
-			        <option value="">[$i18n.getString( "no_comment" )]</option>
-			        <option value="custom">[$i18n.getString( "custom_comment" )]</option>
-			        #foreach( $comment in $standardComments )
-			            <option value="$encoder.htmlEncode( $comment )" #if( $encoder.htmlEncode( $comment ) == $encoder.htmlEncode( $dataValue.comment ) ) selected="selected" #end>$encoder.htmlEncode( $comment )</option>
-			        #end
-			    </select>
-			    <input id="value[$dataElementHistory.dataElement.id:$dataElementHistory.optionCombo.id].comment" type="text" value="$!encoder.htmlEncode( $dataValue.comment )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveComment" ))
-			        onblur="commentLeft()" #else disabled="disabled" #end style="width:100% #if( !$dataValue.comment || $standardComments.contains( $dataValue.comment )) ;display:none #end"/>
+			<textarea id="commentTextArea" style="height:130px;width:240px">$!encoder.htmlEncode( $dataValue.comment )</textarea><br>
+			<input type="button" value="$i18n.getString( 'save_comment' )" style="width:130px" onclick="saveComment()">
 			#end
 		</td>
+		
 		<!-- Column 2 - Min-max -->
         <td valign="top">       
             <h4>$encoder.htmlEncode( $i18n.getString( "min_max_limits" ) )</h4>
@@ -110,4 +103,4 @@
 
 </table>
 
-<p><input type="button" value="$encoder.htmlEncode( $i18n.getString( 'close' ) )" onclick="javascript:self.close()"/></p>
+<p><input type="button" style="width:130px" value="$encoder.htmlEncode( $i18n.getString( 'close' ) )" onclick="javascript:self.close()"></p>

=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2011-06-26 13:40:38 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/history.js	2011-06-27 10:39:01 +0000
@@ -1,66 +1,23 @@
 
+var COLOR_GREEN = '#b9ffb9';
+var COLOR_YELLOW = '#fffe8c';
+var COLOR_RED = '#ff8a8a';
+
 // -----------------------------------------------------------------------------
 // Comments
 // -----------------------------------------------------------------------------
 
-function commentSelected()
-{  
-    var commentSelector = document.getElementById( 'value[' + currentDataElementId + ':' + currentOptionComboId + '].comments' );
-    var commentField = document.getElementById( 'value[' + currentDataElementId + ':' + currentOptionComboId + '].comment' );
-
-    var value = commentSelector.options[commentSelector.selectedIndex].value;
-    
-    if ( value == 'custom' )
-    {
-        commentSelector.style.display = 'none';
-        commentField.style.display = 'inline';
-        
-        commentField.select();
-        commentField.focus();
-    }
-    else
-    {
-        commentField.value = value;
-        
-        saveComment( value );
-    }
-}
-
-function commentLeft()
-{
-    var commentField = document.getElementById( 'value[' + currentDataElementId + ':' + currentOptionComboId + '].comment' );
-    var commentSelector = document.getElementById( 'value[' + currentDataElementId + ':' + currentOptionComboId + '].comments' );
-
-    saveComment( dataElementId, optionComboId, commentField.value );
-
-    var value = commentField.value;
-    
-    if ( value == '' )
-    {
-        commentField.style.display = 'none';
-        commentSelector.style.display = 'inline';
-
-        commentSelector.selectedIndex = 0;
-    }
-}
-
-function saveComment( commentValue )
-{
-    var field = document.getElementById( 'value[' + currentDataElementId + ':' + currentOptionComboId + '].comment' );                
-    var select = document.getElementById( 'value[' + currentDataElementId + ':' + currentOptionComboId + '].comments' );
-
-    field.style.backgroundColor = '#ffffcc';
-    select.style.backgroundColor = '#ffffcc';
-    
-    var commentSaver = new CommentSaver( currentDataElementId, currentOptionComboId, currentOrganisationUnitId, commentValue );
-    commentSaver.save();
+function saveComment()
+{
+	var commentValue = $( '#commentTextArea' ).val();
+	
+	var commentSaver = new CommentSaver( currentDataElementId, currentOptionComboId, currentOrganisationUnitId, commentValue );
+	
+	commentSaver.save();
 }
 
 function CommentSaver( dataElementId_, optionComboId_, organisationUnitId_, value_ )
-{
-    var SUCCESS = '#ccffcc';
-    var ERROR = '#ccccff';
-
+{	
     var dataElementId = dataElementId_;
     var optionComboId = optionComboId_;
     var organisationUnitId = organisationUnitId_;
@@ -68,6 +25,8 @@
     
     this.save = function()
     {
+    	markComment( COLOR_YELLOW );
+    	
         var url = 'saveComment.action?organisationUnitId=' + organisationUnitId + '&dataElementId=' +
                 dataElementId + '&optionComboId=' + optionComboId + '&comment=' + value;
         
@@ -80,28 +39,24 @@
     	
         if ( code == 0 )
         {
-            markComment( SUCCESS );           
+            markComment( COLOR_GREEN );           
         }
         else
         {
-            markComment( ERROR );
+            markComment( COLOR_RED );
             window.alert( i18n_saving_comment_failed_status_code + '\n\n' + code );
         }
     }
     
     function handleError( jqXHR, textStatus, errorThrown )
     {
-        markComment( ERROR );
+        markComment( COLOR_RED );
         window.alert( i18n_saving_comment_failed_error_code + '\n\n' + textStatus );
     }
     
     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;
+    	$( '#commentTextArea' ).css( 'background-color', color );
     }
 }
 
@@ -176,11 +131,11 @@
     $.getJSON( url, function( json ) {
     	
     	if ( json.message == 'marked' ) {
-    		$( '#followup' ).attr( 'src', '../images/marked_large.png' );
+    		$( '#followup' ).attr( 'src', '../images/marked.png' );
     		$( '#followup' ).attr( 'alt', i18n_unmark_value_for_followup );
     	}
     	else if ( json.message == 'unmarked' ) {
-    		$( '#followup' ).attr( 'src', '../images/unmarked_large.png' );
+    		$( '#followup' ).attr( 'src', '../images/unmarked.png' );
     		$( '#followup' ).attr( 'alt', i18n_mark_value_for_followup );
     	}
     } );