← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4774: Select the first program stage of single-event program automatically.

 

------------------------------------------------------------
revno: 4774
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-09-30 15:45:40 +0700
message:
  Select the first program stage of single-event program automatically.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.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-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2011-09-30 08:37:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm	2011-09-30 08:45:40 +0000
@@ -25,7 +25,7 @@
             <select id="programId" name="programId" style="min-width:350px" onchange="loadProgramStages();" #if( $programs.size() == 0 ) disabled="disabled" #end>
                 <option value="0">[$i18n.getString( "select" )]</option>
                 #foreach( $program in $programs )
-                    <option value="$program.id" #if( $programId && $program.id == $programId ) selected="selected" #end>$encoder.htmlEncode( $program.name )</option>
+                    <option value="$program.id" singleevent="$program.singleEvent" #if( $programId && $program.id == $programId ) selected="selected" #end>$encoder.htmlEncode( $program.name )</option>
                 #end
             </select>
         </td>

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-09-30 08:37:26 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/dataEntry.js	2011-09-30 08:45:40 +0000
@@ -108,7 +108,19 @@
                 history += '</tr>';
 			}
 			history += '</table>';
-			setInnerHTML( 'currentSelection', history ); 
+			setInnerHTML( 'currentSelection', history );
+			
+			var singleEvent = jQuery('#programId option:selected').attr('singleevent');
+			if(singleEvent=='true')
+			{
+				byId('programStageId').selectedIndex = 1;
+				disable('programStageId');
+				loadDataEntry();
+			}
+			else
+			{
+				enable('programStageId');
+			}
 	});
 }