← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11980: made offline optionset loading work again in anonymous entry, also fixed other minor issues

 

------------------------------------------------------------
revno: 11980
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-09-09 12:33:55 +0200
message:
  made offline optionset loading work again in anonymous entry, also fixed other minor issues
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.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-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-09-08 09:12:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2013-09-09 10:33:55 +0000
@@ -64,9 +64,9 @@
 		
 	</table>
 	</table>
-	
+
 	<br>
-	
+
 	#if( $customDataEntryFormCode )
 		#parse( "/dhis-web-caseentry/customDataEntryForm.vm" )
 	#elseif( $sections && $sections.size() > 0 )

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm	2013-09-06 15:53:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/defaultDataEntryForm.vm	2013-09-09 10:33:55 +0000
@@ -71,7 +71,7 @@
 				</script> 
 			#elseif($hasOptionSet=='true')
 				#if(($displayOptionSetAsRadioButton=='dropdown') || ( $displayOptionSetAsRadioButton=='' && $programStageDataElement.displayAsRadioButton =='false' ) )
-					<input id='$id' name="entryfield" options='$hasOptionSet' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="auto-field optionset" />
+					<input id='$id' name="entryfield" data-optionset="$!programStageDataElement.dataElement.optionSet.uid" options='$hasOptionSet' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="auto-field optionset" />
 				#elseif(($displayOptionSetAsRadioButton=='radio' && $programStageDataElement.displayAsRadioButton =='true' ) || ( $displayOptionSetAsRadioButton=='' && $programStageDataElement.displayAsRadioButton =='true' ) )
 					<table style='width:100%'>
 						<tr>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-09-08 09:12:12 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2013-09-09 10:33:55 +0000
@@ -769,8 +769,11 @@
                     $( '#latitude' ).val( obj.coordinate.latitude );
                 }
 
-                if ( obj.executionDate.completed !== undefined ) {
-                    $( "#entryFormContainer input[id='completed']" ).val( obj.executionDate.completed );
+                if(obj.executionDate) {
+                    $( "input[id='executionDate']" ).val( obj.executionDate.executionDate );
+                    $("#entryFormContainer input[id='completed']").val(obj.executionDate.completed);
+                    $( '#entryForm' ).removeClass( 'hidden' ).addClass( 'visible' );
+                    $( '#inputCriteriaDiv' ).removeClass( 'hidden' );
                 }
             }
 
@@ -832,6 +835,7 @@
                 $( '#longitude' ).val( data.longitude );
                 $( '#latitude' ).val( data.latitude );
             }
+
             _.each( data.dataValues, function ( value, key ) {
                 var fieldId = getProgramStageUid() + '-' + key + '-val';
                 var field = $('#' + fieldId);
@@ -936,8 +940,12 @@
 }
 
 function searchOptionSet( uid, query, success ) {
+    console.log(uid);
+
     if(window.DAO !== undefined && window.DAO.store !== undefined ) {
+        console.log('searching in store');
         DAO.store.get( 'optionSets', uid ).done( function ( obj ) {
+            console.log(obj);
             if(obj) {
                 var options = [];
 
@@ -1005,7 +1013,7 @@
 		delay: 0,
 		minLength: 0,
 		source: function( request, response ){
-            searchOptionSet( dataElementUid, input.val(), response );
+            searchOptionSet( input.data('optionset'), input.val(), response );
 		},
 		minLength: 0,
 		select: function( event, ui ) {

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm	2013-09-06 15:53:07 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/sectionDataEntryForm.vm	2013-09-09 10:33:55 +0000
@@ -82,7 +82,7 @@
 									</script> 
 								#elseif($hasOptionSet=='true')
 									#if(($displayOptionSetAsRadioButton=='dropdown') || ( $displayOptionSetAsRadioButton=='' && $programStageDataElement.displayAsRadioButton =='false' ) )
-										<input id='$id' name="entryfield" options='$hasOptionSet' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="auto-field optionset" />
+										<input id='$id' name="entryfield" data-optionset="$!programStageDataElement.dataElement.optionSet.uid" options='$hasOptionSet' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" class="auto-field optionset" />
 									#elseif(($displayOptionSetAsRadioButton=='radio' && $programStageDataElement.displayAsRadioButton =='true' ) || ( $displayOptionSetAsRadioButton=='' && $programStageDataElement.displayAsRadioButton =='true' ) )
 										<table style='width:100%'>
 											<tr>