← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4066: Allow filtereing of data elements when assigning data elements to a program stage.

 

------------------------------------------------------------
revno: 4066
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2011-07-05 10:55:54 +0700
message:
  Allow filtereing of data elements when assigning data elements to a program stage.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.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/webapp/dhis-web-maintenance-patient/addPatientForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-05-26 03:19:50 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addPatientForm.vm	2011-07-05 03:55:54 +0000
@@ -151,24 +151,9 @@
 	<tr><th colspan="2" class="heading-column">$i18n.getString( "patient_identifiers" )</th></tr>
 	#foreach ($identifierType in $identifierTypes)
 	<tr>
-		<td><label>$identifierType.name #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>
-
-        #if($identifierType.format == "State Format")
-            <td><input type="hidden" id="iden$identifierType.id" name="iden$identifierType.id"/>
-				<table>
-					<tr valign="top">
-						<td><input type="text" id="orgunitcode" name="orgunitcode" disabled="disabled" value="$!organisationUnit.code" maxlength="9" size="10"/> <br/> <div class='stateformat'>$i18n.getString('registering_unit')<br>$i18n.getString('code')</div></td>
-						<td> - <input type="text" id="progcode" name="progcode" maxlength="1" size="6" class='idfield  {validate:{required:$identifierType.mandatory,minlength:1,lettersdigitsonly:true}}' /> <br/> <div class='stateformat'>$i18n.getString('program')<br>$i18n.getString('code')</div></td>
-						<td> - <input type="text" id="yearcode" name="yearcode" maxlength="2" size="6" value="$year" class="{validate:{required:true,minlength:2}}"/> <br/> <div class='stateformat'>$i18n.getString('year')</div></td>
-						<td> - <input type="text" id="benicode" name="benicode" maxlength="4" size="9" class="{validate:{required:true,number:true,minlength:4}}"/> <br/> <div class='stateformat'>$i18n.getString('patient')<br>$i18n.getString('code')</div></td>
-					</tr>
-				</table>
-            </td>
-        #else
+		<td><label>$identifierType.name #if($identifierType.mandatory == true )<em title="$i18n.getString( 'required' )" class="required">*</em> #end</label></td>       
             <td class="input-column">
 			<input type="text" style="width:28em" id="iden$identifierType.id" name="iden$identifierType.id" data="{related:$identifierType.related}" class="{validate:{required:$identifierType.mandatory, #if($!identifierType.noChars) maxlength:$identifierType.noChars, #end #if($identifierType.type=='number') number:true #elseif($!identifierType.type=='letter') lettersonly:true #end }}" /></td>
-        #end
-
 	</tr>
 	#end
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2011-06-28 04:00:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramStageForm.vm	2011-07-05 03:55:54 +0000
@@ -1,3 +1,21 @@
+<script type="text/javascript" src="javascript/addProgramStageForm.js"></script>
+<script type="text/javascript">
+	jQuery(function() {
+		jQuery("#availableList").dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getDataElements.action",
+			iterator: "dataElements",
+			connectedTo: 'selectedDataElementsValidator',
+			handler: function(item) {
+				var option = jQuery("<option />");
+				option.text( item.name );
+				option.attr( "value", item.id );
+
+				return option;
+			}
+		});
+	});
+</script>
+
 <style>
 tr.selected{
 	background-color:#3399FF;
@@ -8,30 +26,6 @@
 }
 </style>
 
-<script>
-jQuery( function(){
-	validation( 'addProgramStageForm', function( form ){ 
-		form.submit();
-	}, function(){
-		selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
-		selectedDataElementsValidator.empty();
-		
-		compulsories = jQuery( "#compulsories" );
-		compulsories.empty();
-		
-		jQuery("#selectedList").find("tr").each( function( i, item ){ 
-			selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-			var compulsory = jQuery( item ).find( "input[name='compulsory']:first");
-			var checked = compulsory.attr('checked') ? true : false;
-			compulsories.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
-		});
-	});
-	
-	checkValueIsExist( "name", "validateProgramStage.action");	
-});
-
-</script>
-
 <h3>$i18n.getString( "add_new_program_stage" )</h3>
 																		
 <form id="addProgramStageForm" name="addProgramStageForm" action="addProgramStage.action" method="get">
@@ -43,7 +37,7 @@
 <table>
 	<tr>
 		<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
-		<td><input type="text" id="name" name="name" maxlength="160" style="width:30em" class="{validate:{required:true,,rangelength:[4,160]}}"/></td>
+		<td><input type="text" id="name" name="name" maxlength="160" style="width:30em" class="{validate:{required:true,rangelength:[4,160]}}"/></td>
 	</tr>	
 	
 	<tr>
@@ -74,17 +68,9 @@
     </thead>
   
     <tbody>
-	 <tr>
-		<td>
-			<input type='text' style="width:29.5em" onkeyup="filterDE(event, this.value, 'availableList');"/>
-		</td>
-		<td></td>
-		<td></td>
-	 </tr>
-	 
       <tr>
         <td>
-            <select size="15" id="availableList" multiple="multiple" style="width:30em;height:20em" ondblclick="selectDataElements( )">
+            <select size="15" id="availableList" name='availableList' multiple="multiple" style="width:30em;height:20em" ondblclick="selectDataElements()">
                 #foreach ( $dataElement in $dataElements )
                     <option value="$dataElement.id">$encoder.htmlEncode( $dataElement.name )</option>
                 #end                

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramStageForm.js	2011-07-05 03:55:54 +0000
@@ -0,0 +1,22 @@
+jQuery( document ).ready( function()
+{
+	validation( 'addProgramStageForm', function( form ){ 
+		form.submit();
+	}, function(){
+		selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
+		selectedDataElementsValidator.empty();
+		
+		compulsories = jQuery( "#compulsories" );
+		compulsories.empty();
+		
+		jQuery("#selectedList").find("tr").each( function( i, item ){ 
+			selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+			var compulsory = jQuery( item ).find( "input[name='compulsory']:first");
+			var checked = compulsory.attr('checked') ? true : false;
+			compulsories.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+		});
+	});
+	
+	checkValueIsExist( "name", "validateProgramStage.action");	
+});
+

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramStageForm.js	2011-07-05 03:55:54 +0000
@@ -0,0 +1,22 @@
+jQuery( document ).ready( function()
+{
+	validation( 'updateProgramStageForm', function( form ){ 
+		form.submit() ;
+	}, function(){
+		selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
+		selectedDataElementsValidator.empty();
+		
+		compulsories = jQuery( "#compulsories" );
+		compulsories.empty();
+		
+		jQuery("#selectedList").find("tr").each( function( i, item ){ 
+			selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+			var compulsory = jQuery( item ).find( "input[name='compulsory']:first");
+			var checked = compulsory.attr('checked') ? true : false;
+			compulsories.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+		});
+	});
+	
+	checkValueIsExist( "name", "validateProgramStage.action", {id:getFieldValue('id')});	
+});
+

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/style/basic.css	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/style/basic.css	2011-07-05 03:55:54 +0000
@@ -7,11 +7,6 @@
 	position:absolute;
 }
 
-.stateformat {
-	color:red;
-	text-align:center;
-}
-
 .heading-column { width : 30.5em;}
 td.input-column { width : 30.5em;}
 td.input-column input, td.input-column select { width: 28.5em;}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2011-06-28 04:00:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2011-07-05 03:55:54 +0000
@@ -1,3 +1,21 @@
+<script type="text/javascript" src="javascript/updateProgramStageForm.js"></script>
+<script type="text/javascript">
+	jQuery(function() {
+		jQuery("#availableList").dhisAjaxSelect({
+			source: "../dhis-web-commons-ajax-json/getDataElements.action",
+			iterator: "dataElements",
+			connectedTo: 'selectedDataElementsValidator',
+			handler: function(item) {
+				var option = jQuery("<option />");
+				option.text( item.name );
+				option.attr( "value", item.id );
+
+				return option;
+			}
+		});
+	});
+</script>
+
 <style>
 tr.selected{
 	background-color:#3399FF;
@@ -7,29 +25,7 @@
 	cursor:pointer;
 }
 </style>
-<script>
-jQuery( function(){
-	validation( 'updateProgramStageForm', function( form ){ 
-		form.submit() ;
-	}, function(){
-		selectedDataElementsValidator = jQuery( "#selectedDataElementsValidator" );
-		selectedDataElementsValidator.empty();
-		
-		compulsories = jQuery( "#compulsories" );
-		compulsories.empty();
-		
-		jQuery("#selectedList").find("tr").each( function( i, item ){ 
-			selectedDataElementsValidator.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-			var compulsory = jQuery( item ).find( "input[name='compulsory']:first");
-			var checked = compulsory.attr('checked') ? true : false;
-			compulsories.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
-		});
-	});
-	
-	checkValueIsExist( "name", "validateProgramStage.action", {id:$programStage.id});	
-});
 
-</script>
 <h3>$i18n.getString( "update_program_stage" )</h3>
 
 <form id="updateProgramStageForm" name="updateProgramStageForm" action="updateProgramStage.action" method="post">
@@ -78,14 +74,7 @@
     </thead>
 	
 	<tbody>
-	 
-	<tr>
-		<td>
-			<input type='text' style="width:29.5em" onkeyup="filterDE(event, this.value, 'availableList');"/>
-		</td>
-		<td></td><td></td>
-	 </tr>
-	 
+	
 	<tr>
         <td>
             <select size="15" id="availableList" multiple="multiple" style="width:30em;height:20em" ondblclick="selectDataElements( )">