← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3211: Move js methods from vm file to js file into Patient module.

 

------------------------------------------------------------
revno: 3211
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-03-30 11:59:34 +0700
message:
  Move js methods from vm file to js file into Patient module.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/orgunitRegistration.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgram.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-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-03-29 02:51:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-03-30 04:59:34 +0000
@@ -774,7 +774,8 @@
 			class="org.hisp.dhis.patient.action.programstage.GetProgramStageListAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/programStageList.vm</param>
-			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>			
+			<param name="menu">/dhis-web-maintenance-patient/patientAndProgramMenu.vm</param>
+			<param name="javascripts">javascript/programStage.js</param>
 		</action>
 
 		<action name="getProgramStage"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js	2011-03-28 04:11:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js	2011-03-30 04:59:34 +0000
@@ -1,5 +1,65 @@
-// -----------------------------------------------------------------------------
-// ProgramStage
+
+function getStageByProgram( programId )
+{
+	window.location = "programStage.action?id=" + programId;
+}
+
+function addProgramStage()
+{
+	var programId = document.getElementById('id').value;
+
+	if( programId == "null"  || programId == "" )
+	{
+		showWarningMessage( i18n_please_select_program );
+	}
+	else
+	{
+		window.location.href="showAddProgramStageForm.action?id=" + programId;
+	}
+}
+
+
+
+function showSortProgramStage()
+{
+	var programId = document.getElementById('id').value;
+	
+	if( programId == "null"  || programId == "" )
+	{
+		showWarningMessage( i18n_please_select_program );
+	}
+	else
+	{
+		window.location.href="showSortProgramStageForm.action?id=" + programId;
+	}
+}
+
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showProgramStageDetails( programStageId )
+{
+    var request = new Request();
+    request.setResponseTypeXML( 'programStage' );
+    request.setCallbackSuccess( programStageReceived );
+    request.send( 'getProgramStage.action?id=' + programStageId );
+}
+
+function programStageReceived( programStageElement )
+{
+	setInnerHTML( 'idField', getElementValue( programStageElement, 'id' ) );
+	setInnerHTML( 'nameField', getElementValue( programStageElement, 'name' ) );	
+    setInnerHTML( 'descriptionField', getElementValue( programStageElement, 'description' ) );
+    setInnerHTML( 'stageInProgramField', getElementValue( programStageElement, 'stageInProgram' ) );   
+    setInnerHTML( 'minDaysFromStartField', getElementValue( programStageElement, 'minDaysFromStart' ) );    
+    setInnerHTML( 'dataElementCountField', getElementValue( programStageElement, 'dataElementCount' ) );   
+   
+    showDetails();
+}
+
+// -----------------------------------------------------------------------------
+// select data-elements
 // -----------------------------------------------------------------------------
 
 function selectDataElements()

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/orgunitRegistration.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/orgunitRegistration.vm	2011-02-16 02:55:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/orgunitRegistration.vm	2011-03-30 04:59:34 +0000
@@ -1,5 +1,5 @@
 
-<h3>$i18n.getString( "define_program_associations" ) </h3>
+<h3>$i18n.getString( "patient_orgunit_registration" ) </h3>
 
 <form action='defineOrgunitRegistration.action' method='post'>
 <table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2010-10-22 07:50:47 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm	2011-03-30 04:59:34 +0000
@@ -1,51 +1,33 @@
 <h3>$i18n.getString( "program_management" )</h3>
+
 <table class="mainPageTable">
 	<tr>
-		<td style="vertical-align:top">
-			<table class="listTable">
+		<td align="right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddProgramForm.action'" style="width:70px"></td>
+	</tr>
+  <tr>
+    <td style="vertical-align:top">
+		
+		<table class="listTable" id="listTable">
 			  <col>          
-			  <col width="20">
-			  <col width="20">
-			  <col width="20">     
-			  <col width="20">
-			  <col width="20">
-			  <col width="20">			     		  
-			  <tr>
-				<td></td>
-				<td colspan="6" style="text-align:right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddProgramForm.action'" style="width:70px"></td>
-			  </tr>
+			  <col width="180">
+			<thead>			  
 			  <tr>            
 				<th>$i18n.getString( "name" )</th>
-				<th colspan="6">$i18n.getString( "operations" )</th>
+				<th class="{sorter: false}">$i18n.getString( "operations" )</th>
 			  </tr>
-
+			</thead>
 			  <tbody id="list">
 				#foreach( $program in $programs )
 				  <tr id="tr${program.id}">
 				  
 					<td>$encoder.htmlEncode( $program.name )</td>                
 					
-					<td style="text-align:center" #alternate( $mark )>
+					<td style="text-align:center">
 					  <a href="defineProgramAssociationsForm.action?id=$program.id" title="$i18n.getString( "define_associations" )"><img src="../images/assign.png" alt="$i18n.getString( "define_associations" )"></a>
-					</td>
-					
-					<td style="text-align:center" #alternate( $mark )>
 					  <a href="defineValidationDEAssociationsForm.action?id=$program.id" title="$i18n.getString( "validationDE_associations" )"><img src="../images/assign_b.png" alt="$i18n.getString( "validationDE_associations" )"></a>
-					</td>
-					
-					<td style="text-align:center" #alternate( $mark )>
 					  <a href="showUpdateProgramForm.action?id=$program.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
-					</td>
-					
-					<td style="text-align:center" #alternate( $mark )>
 					  <a href="programStage.action?id=$program.id" title="$i18n.getString( "view_stage_management" )"><img src="../images/add_section.png" alt="$i18n.getString( "view_stage_management" )"></a>
-					</td>                
-
-					<td style="text-align:center" #alternate( $mark )>
 					  <a href="javascript:removeProgram( '$program.id', '$encoder.jsEncode( $program.name )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
-					</td>            
-					
-					<td style="text-align:center" #alternate( $mark )>
 					  <a href="javascript:showProgramDetails( $program.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
 					</td>
 					
@@ -53,8 +35,7 @@
 				#end
 
 			  </tbody>
-
-			</table>
+        </table>
 		</td>
 		<td style="width:20em; padding-left:2em; vertical-align:top">
 
@@ -64,19 +45,26 @@
 				</div>				
 				<p><label>$i18n.getString( "id" ):</label><br><span id="idField"></span></p>
 				<p><label>$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
-				<p><label>$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
-				<p><label>$i18n.getString( "number_of_days" ):</label><br><span id="numberOfDaysField"></span></p>
-				<p><label>$i18n.getString( "program_stage_count" ):</label><br><span id="programStageCountField"></span></p>				
+				<p><label>$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>				
+				<p><label>$i18n.getString( "stage_in_program" ):</label><br><span id="stageInProgramField"></span></p>
+				<p><label>$i18n.getString( "min_days_from_start" ):</label><br><span id="minDaysFromStartField"></span></p>
+				<p><label>$i18n.getString( "no_of_dataelements" ):</label><br><span id="dataElementCountField"></span></p>			  		
 			</div>
 
 		</td>
-  </tr>
+	</tr>
 </table>
 
 
+
 <script type="text/javascript">
 	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_prorgam" ) , "'" )';
 	var i18n_adding_program_failed = '$encoder.jsEscape( $i18n.getString( "adding_program_failed" ), "'")';
 	var i18n_updating_program_failed = '$encoder.jsEscape( $i18n.getString( "updating_program_failed" ), "'")';	
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';	
+	
+	jQuery(document).ready(function(){	
+		tableSorter( 'listTable' );
+	});
+	
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm	2011-03-23 02:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStageList.vm	2011-03-30 04:59:34 +0000
@@ -19,19 +19,18 @@
 	</tr>
 	<tr>
 		<td style="vertical-align:top" colspan=2>    
-		<table class="listTable">
+		<table class="listTable" id="listTable">
 		  <col>
 		  <col>     
-		  <col width="20">
-		  <col width="20">
-		  <col width="20">  
-		  <col width="20"> 		  
-		  <tr>            
-			<th>$i18n.getString( "name" )</th>
-			<th>$i18n.getString( "description" )</th>
-			<th colspan="4">$i18n.getString( "operations" )</th>
-		  </tr>
-
+		  <col width="120">	 
+		  <thead>
+			  <tr>            
+				<th>$i18n.getString( "name" )</th>
+				<th>$i18n.getString( "description" )</th>
+				<th>$i18n.getString( "operations" )</th>
+			  </tr>
+		  </thead>
+		  
 		  <tbody id="list">
 			#foreach( $association in $associations )
 			  <tr id="tr${association.id}">			  
@@ -40,17 +39,8 @@
 				
 				<td style="text-align:center"#alternate( $mark )>
 				  <a href="showUpdateProgramStageForm.action?id=$association.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a>
-				</td>                
-
-				<td style="text-align:center"#alternate( $mark )>
 				  <a href="javascript:removeItem( '$association.id', '$encoder.jsEncode( $association.name )', i18n_confirm_delete , 'removeProgramStage.action' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
-				</td>            
-				
-				<td style="text-align:center"#alternate( $mark )>
 				  <a href="javascript:showProgramStageDetails( $association.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a>
-				</td>
-				
-				<td style="text-align:center"#alternate( $mark )>
 				  <a href="viewDataEntryForm.action?programStageId=$association.id" title="$i18n.getString( "design_data_entry_form" )"><img src="../images/edit_layout.png" alt="$i18n.getString( "design_data_entry_form" )"></a>
 				</td>
 				
@@ -86,64 +76,4 @@
 	var i18n_updating_program_stage_failed = '$encoder.jsEscape( $i18n.getString( "updating_program_stage_failed" ), "'")';	
 	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
 	
-function getStageByProgram( programId )
-{
-	window.location = "programStage.action?id=" + programId;
-}
-
-function addProgramStage()
-{
-	var programId = document.getElementById('id').value;
-
-	if( programId == "null"  || programId == "" )
-	{
-		showWarningMessage( i18n_please_select_program );
-	}
-	else
-	{
-		window.location.href="showAddProgramStageForm.action?id=" + programId;
-	}
-}
-
-
-
-function showSortProgramStage()
-{
-	var programId = document.getElementById('id').value;
-	
-	if( programId == "null"  || programId == "" )
-	{
-		showWarningMessage( i18n_please_select_program );
-	}
-	else
-	{
-		window.location.href="showSortProgramStageForm.action?id=" + programId;
-	}
-}
-
-// -----------------------------------------------------------------------------
-// View details
-// -----------------------------------------------------------------------------
-
-function showProgramStageDetails( programStageId )
-{
-    var request = new Request();
-    request.setResponseTypeXML( 'programStage' );
-    request.setCallbackSuccess( programStageReceived );
-    request.send( 'getProgramStage.action?id=' + programStageId );
-}
-
-function programStageReceived( programStageElement )
-{
-	setInnerHTML( 'idField', getElementValue( programStageElement, 'id' ) );
-	setInnerHTML( 'nameField', getElementValue( programStageElement, 'name' ) );	
-    setInnerHTML( 'descriptionField', getElementValue( programStageElement, 'description' ) );
-    setInnerHTML( 'stageInProgramField', getElementValue( programStageElement, 'stageInProgram' ) );   
-    setInnerHTML( 'minDaysFromStartField', getElementValue( programStageElement, 'minDaysFromStart' ) );    
-    setInnerHTML( 'dataElementCountField', getElementValue( programStageElement, 'dataElementCount' ) );   
-   
-    showDetails();
-}
-
-	
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgram.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgram.vm	2010-10-20 09:27:52 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseProgram.vm	2011-03-30 04:59:34 +0000
@@ -2,5 +2,7 @@
 	"id":"$program.id",
 	"name":"$!encoder.jsEncode( ${program.name} )",
 	"description": "$!encoder.jsEncode( ${program.description} )",
-	"programStageCount": "$program.programStages.size()"
+	"programStageCount": "$program.programStages.size()",
+	"minDay": "$program.minDaysAllowedInputData",
+	"maxDay": "$program.maxDaysAllowedInputData"
 }
\ No newline at end of file