← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8350: Don't allow to add identifiers/attributes for anonymous program.

 

------------------------------------------------------------
revno: 8350
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-10-03 11:54:22 +0700
message:
  Don't allow to add identifiers/attributes for anonymous program.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm
  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/javascript/addProgramForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js	2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/addProgramForm.js	2012-10-03 04:54:22 +0000
@@ -10,14 +10,16 @@
 		var personDisplayNames = jQuery( "#personDisplayNames" );
 		personDisplayNames.empty();
 		
-		jQuery("#selectedList").find("tr").each( function( i, item ){ 
-			
-			selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-			
-			var displayed = jQuery( item ).find( "input[name='displayed']:first");
-			var checked = displayed.attr('checked') ? true : false;
-			personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
-		});
+		if(getFieldValue('type')!=3){
+			jQuery("#selectedList").find("tr").each( function( i, item ){ 
+				
+				selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+				
+				var displayed = jQuery( item ).find( "input[name='displayed']:first");
+				var checked = displayed.attr('checked') ? true : false;
+				personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+			});
+		}
 	});
 	
 	

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2012-10-03 04:27:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js	2012-10-03 04:54:22 +0000
@@ -55,11 +55,17 @@
 		disable('dateOfEnrollmentDescription');
 		disable("displayIncidentDate");
 		disable("dateOfIncidentDescription");
+		disable("generatedByEnrollmentDate");
+		disable("availablePropertyIds");
+		hideById("selectedList");
 		jQuery("[name=displayed]").attr("disabled", true);
 		jQuery("[name=displayed]").removeAttr("checked");
 	}
 	else{
 		jQuery("[name=displayed]").prop("disabled", false);
+		enable("availablePropertyIds");
+		showById("selectedList");
+		enable("generatedByEnrollmentDate");
 		enable('dateOfEnrollmentDescription');
 		enable("displayIncidentDate");
 		if(byId('displayIncidentDate').checked){
@@ -80,7 +86,7 @@
 	var selectedList = jQuery("#selectedList");
 	jQuery("#availablePropertyIds").children().each(function(i, item){
 		if( item.selected ){
-			html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectDataElement( this )'><td onmousedown='select(event,this)'>" + item.text + "</td>";
+			html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectProperties( this )'><td onmousedown='select(event,this)'>" + item.text + "</td>";
 			html += "<td align='center'><input type='checkbox' name='displayed' value='" + item.value + "'";
 			if( item.value.match("^attr_")=="attr_" )
 			{

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js	2012-09-05 14:30:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/updateProgramForm.js	2012-10-03 04:54:22 +0000
@@ -9,15 +9,16 @@
 		selectedPropertyIds.empty();
 		var personDisplayNames = jQuery( "#personDisplayNames" );
 		personDisplayNames.empty();
-		
-		jQuery("#selectedList").find("tr").each( function( i, item ){ 
-			
-			selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
-			
-			var displayed = jQuery( item ).find( "input[name='displayed']:first");
-			var checked = displayed.attr('checked') ? true : false;
-			personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
-		});
+		if(getFieldValue('type')!=3){
+			jQuery("#selectedList").find("tr").each( function( i, item ){ 
+				
+				selectedPropertyIds.append( "<option value='" + item.id + "' selected='true'>" + item.id + "</option>" );
+				
+				var displayed = jQuery( item ).find( "input[name='displayed']:first");
+				var checked = displayed.attr('checked') ? true : false;
+				personDisplayNames.append( "<option value='" + checked + "' selected='true'>" + checked + "</option>" );
+			});
+		}
 	});
 	
 	checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')});

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2012-10-03 04:27:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm	2012-10-03 04:54:22 +0000
@@ -38,7 +38,7 @@
 		
 		<tr>
 			<td><label>$i18n.getString( "events_generated_by_enrollment_date" )</label></td>
-			<td><input style="margin: 0;"type="checkbox" id="generatedByEnrollmentDate" name="generatedByEnrollmentDate" value='true' #if($program.generatedByEnrollmentDate=='true') checked #end></td>
+			<td><input style="margin: 0;"type="checkbox" id="generatedByEnrollmentDate" name="generatedByEnrollmentDate" value='true' #if($program.generatedByEnrollmentDate=='true') checked #end #if( $program.type=='3' ) disabled #end ></td>
 			<td></td>
 		</tr>
 		
@@ -98,7 +98,7 @@
 	
 		<tr>
 			<td>
-				<select size="15" style="width: 330px;" multiple id="availablePropertyIds" name="availablePropertyIds" ondblclick="selectProperties();">
+				<select size="15" style="width: 330px;" multiple id="availablePropertyIds" name="availablePropertyIds" ondblclick="selectProperties();" #if( $program.type=='3' ) disabled #end>
 					#foreach( $identifier in $availableIdentifierTypes )
 						<option value="iden_$identifier.id">$identifier.name</option>
 					#end
@@ -121,7 +121,7 @@
 								<th>$i18n.getString( "identifiers_and_attributes" )</th>
 								<th width="20px">$i18n.getString( "displayed_in_list" )</th>
 						</thead>
-						<tbody id="selectedList">
+						<tbody id="selectedList" #if($program.type==3) style="display:none;" #end>
 							#foreach( $identifier in $program.patientIdentifierTypes )
 								<tr ondblclick="unSelectProperties( this )" id="iden_$identifier.id">
 									<td onmousedown="select(event, this)">$encoder.htmlEncode( $identifier.name )</td>

=== 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	2012-10-03 04:27:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramStageForm.vm	2012-10-03 04:54:22 +0000
@@ -114,9 +114,13 @@
 			
 		</tr>
 		</tbody>
-		<tr><th colspan='3'>$i18n.getString("template_reminder_message")</th></tr>
+		
+		#if($programStage.program.type!=3)
+			<tr><th colspan='3'>$i18n.getString("template_reminder_message")</th></tr>
+		#end
 	</table>
 	
+	#if($programStage.program.type!=3)
 	<table>
 		<tbody id='programStageMessage'>
 			#set($index = 0)
@@ -159,7 +163,8 @@
 			</td>
 		</tr>
 	</table>
-	
+	#end
+		
 	<p>
 		<input type="submit" value="$i18n.getString( 'update' )" />
 		<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='programStage.action?id=$programStage.program.id'" />