← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17991: Allow to add Report-date field in custom entry form of single event anonymous program.

 

------------------------------------------------------------
revno: 17991
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2015-01-14 21:41:31 +0700
message:
  Allow to add Report-date field in custom entry form of single event anonymous program.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewDataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.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-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewDataEntryForm.js	2014-06-26 21:14:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/viewDataEntryForm.js	2015-01-14 14:41:31 +0000
@@ -169,7 +169,11 @@
 	var dataElementType = dataElement.type;
 	
 	var htmlCode = "";
-	var id = programStageUid + "-" + dataElementUid + "-val" ;	
+	var id = programStageUid + "-" + dataElementUid + "-val" ;
+	if( dataElementUid == "executionDate" )
+	{
+		id = dataElementUid;
+	}	
 	var titleValue = dataElementUid + " - " + dataElementName + " - " + dataElementType;
 	
 	if ( dataElementType == "bool" )
@@ -195,12 +199,12 @@
 	
 	if( checkExisted( id ) )
 	{		
-		jQuery( source + " #message_").html( "<span class='bold'>" + i18n_dataelement_is_inserted + "</span>" );
+		jQuery( " #message_").html( "<span class='bold'>" + i18n_dataelement_is_inserted + "</span>" );
 		return;
 	}else{
 		var oEditor = jQuery("#designTextarea").ckeditor().editor;
 		oEditor.insertHtml( htmlCode );
-		jQuery( source + " #message_").html("");
+		jQuery(" #message_").html("");
 	}
 
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.vm	2014-11-03 13:35:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/viewDataEntryForm.vm	2015-01-14 14:41:31 +0000
@@ -17,9 +17,9 @@
 		checkValueIsExist( "name", "validateDataEntryForm.action", { dataEntryFormId: '$!programStage.dataEntryForm.id' } );
 	});
 
-  var i18n_dataelement_is_inserted = '$encoder.jsEscape( $i18n.getString( "dataelement_is_inserted" ) , "'" )';
+    var i18n_dataelement_is_inserted = '$encoder.jsEscape( $i18n.getString( "dataelement_is_inserted" ) , "'" )';
 	var i18n_specify_dataelememt = '$encoder.jsEscape( $i18n.getString( "specify_dataelememt" ) , "'" )';
-  var i18n_choose_existing_dataentry ='$encoder.jsEscape( $i18n.getString( "choose_existing_dataentry" ) , "'" )';
+    var i18n_choose_existing_dataentry ='$encoder.jsEscape( $i18n.getString( "choose_existing_dataentry" ) , "'" )';
 	var i18n_dataelement = '$encoder.jsEscape( $i18n.getString( "dataelement" ) , "'" )';
 	var i18n_dataelement_of_orther_program_stage = "$i18n.getString( 'dataelement_of_orther_program_stage' )";
 	var i18n_save_success = '$encoder.jsEscape( $i18n.getString( "save_success" ) , "'" )';
@@ -140,14 +140,27 @@
 			</td>
 		</tr>
 		<tr>
-			<td colspan='2'>	
+			<td colspan='2'>
+			
 				<select id="dataElementIds" name="dataElementIds" style="height:200px; width:100%;"  multiple="multiple" size="10" ondblclick="insertDataElement( '#dataElementSelection', '$programStage.uid')">
+				
+					#if( $programStage.program.type=='3' )
+						#set($name = "$encoder.htmlEncode($programStage.reportDateDescription)")
+						#set($deJSON = '{"uid":"executionDate","name":"executionDate","executionDate":"executionDate","type":"date"}' )
+						<option value='$deJSON' decode="executionDate" dename="executionDate" title="$name">$encoder.htmlEncode($programStage.reportDateDescription)</option>
+					#end
+					
 					#foreach( $de in $dataElements)
 					#set($deJSON = '{' + '"uid"' + ':"' + "$de.uid" + '",' + '"name"' + ':"' + "$de.name" + '",' + '"shortName"' + ':"' + "$de.shortName" + '",' + '"type"' + ':"' + "$de.getDetailedTextType()"  + '"}' )
 					<option value='$deJSON' decode="$!de.code" dename="$encoder.htmlEncode($de.name)" title="$encoder.htmlEncode($de.name)">$encoder.htmlEncode( $de.name )</option>
 					#end
 				</select>
 				<select id="dataElementIdsStore" multiple="multiple" style="display:none">
+					#if( $programStage.program.type=='3' )
+						#set($name = "$encoder.htmlEncode($programStage.reportDateDescription)")#set($deJSON = '{"uid":"executionDate","name":"executionDate","executionDate":"executionDate","type":"date"}' )
+						<option value='$deJSON' decode="executionDate" dename="executionDate" title="$name">$encoder.htmlEncode($programStage.reportDateDescription)</option>
+					#end
+					
 					#foreach( $de in $dataElements)
 					#set($deJSON = '{' + '"uid"' + ':"' + "$de.uid" + '",' + '"name"' + ':"' + "$de.name" + '",' + '"shortName"' + ':"' + "$de.shortName" + '",' + '"type"' + ':"' + "$de.getDetailedTextType()"  + '"}' )
 					<option value='$deJSON' decode="$!de.code" dename="$encoder.htmlEncode($de.name)">$encoder.htmlEncode( $de.name )</option>