← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14807: Show unique attributes first in Attribute list of Advanced-search TEI.

 

------------------------------------------------------------
revno: 14807
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2014-04-12 17:21:12 +0800
message:
  Show unique attributes first in Attribute list of Advanced-search TEI.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/updateAttributeForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.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/javascript/commons.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-04-12 02:37:13 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/commons.js	2014-04-12 09:21:12 +0000
@@ -372,18 +372,19 @@
 		});
 
 		clearListById('searchObjectId');
-		if (getFieldValue('program') != '') {
-			jQuery('#searchObjectId').append(
-				'<option value="programDate" >' + i18n_enrollment_date
-					+ '</option>');
-		}
-
+		
 		for ( var i in json.attributes) {
 			jQuery('#searchObjectId').append(
 				'<option value="' + json.attributes[i].id 
 					+ '" displayed="' + json.attributes[i].displayed  + '">'
 					+ json.attributes[i].name + '</option>');
 		}
+		
+		if (getFieldValue('program') != '') {
+			jQuery('#searchObjectId').append(
+				'<option value="programDate" >' + i18n_enrollment_date
+					+ '</option>');
+		}
 
 		addAttributeOption();
 	});

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm	2014-04-11 00:54:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/jsonProgramAttributes.vm	2014-04-12 09:21:12 +0000
@@ -8,24 +8,56 @@
 	#set( $size = $size + $program.attributes.size() ) 
 #end
 
+#if( $!size > 0 )
+	#set( $size = $size - 1 )
+#end
+
 { "attributes": [
-#foreach( $attribute in $attributes )
- {
-	"id":  "${attribute.uid}",
-	"name": "$!encoder.jsonEncode( ${attribute.displayName} )",
-	"displayed": "true"
-  }#if( $velocityCount < $size ),#end
-#end
-
-#set( $idx = $attributes.size() + 1 )
-#foreach( $programAttribute in $program.attributes )
- {
-	"id":  "${programAttribute.attribute.uid}",
-	"name": "$!encoder.jsonEncode( ${programAttribute.attribute.displayName} )",
-	"displayed": "$programAttribute.displayInList"
-  }#if( $idx < $size ),#end
-  
-  #set( $idx = $idx + 1 ) 
+
+#set( $idx = 0 )
+#foreach( $attribute in $attributes )
+ #if($attribute.unique=='true')
+  {
+	"id":  "${attribute.uid}",
+	"name": "$!encoder.jsonEncode( ${attribute.displayName} )",
+	"displayed": "true"
+  }#if( $idx < $size ),#end
+  #set( $idx = $idx + 1 ) 
+  #end
+#end
+
+#foreach( $attribute in $attributes )
+ #if($attribute.unique!='true')
+  {
+	"id":  "${attribute.uid}",
+	"name": "$!encoder.jsonEncode( ${attribute.displayName} )",
+	"displayed": "true"
+  }#if( $idx < $size ),#end
+  #set( $idx = $idx + 1 ) 
+  #end
+#end
+
+#foreach( $programAttribute in $program.attributes )
+ #if($programAttribute.attribute.unique=='true')
+  {
+	"id":  "${programAttribute.attribute.uid}",
+	"name": "$!encoder.jsonEncode( ${programAttribute.attribute.displayName} )",
+	"displayed": "$programAttribute.displayInList"
+  }#if( $idx < $size ),#end
+  #set( $idx = $idx + 1 ) 
+ #end
+#end
+
+
+#foreach( $programAttribute in $program.attributes )
+ #if($programAttribute.attribute.unique!='true')
+  {
+	"id":  "${programAttribute.attribute.uid}",
+	"name": "$!encoder.jsonEncode( ${programAttribute.attribute.displayName} )",
+	"displayed": "$programAttribute.displayInList"
+  }#if( $idx < $size ),#end 
+  #set( $idx = $idx + 1 ) 
+ #end
 #end
 ]
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm	2014-04-09 04:03:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm	2014-04-12 09:21:12 +0000
@@ -67,6 +67,7 @@
                 <option value="age">$i18n.getString( "age" )</option>
                 <option value="users">$i18n.getString( "users" )</option>
                 <option value="combo">$i18n.getString( "attribute_combo_type" )</option>
+				<option value="localId">$i18n.getString( "local_identifier" )</option>
             </select>
         </td>
         <td></td>
@@ -100,6 +101,19 @@
 			</td>
 			<td></td>
 		</tr>
+		
+		<tr name='localIdField' style='display:none;'>
+			<td><label for="type">$i18n.getString( "period_type" )</label></td>
+			<td>
+				<select type='checkbox' id="periodTypeName" name="periodTypeName" >
+					<option value="">[$i18n.getString( "please_select" )]</option>
+					#foreach ( $periodType in $periodTypes )
+					<option value="$periodType.name">$i18n.getString( $periodType.name )</option>
+					#end
+				</select>
+			</td>
+			<td></td>
+		</tr>
 
     </tbody>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeForm.js	2014-04-09 04:03:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeForm.js	2014-04-12 09:21:12 +0000
@@ -1,13 +1,9 @@
-jQuery(document).ready(function() {
-  validation('addAttributeForm', function( form ) {
-    form.submit();
-  })
-
-  checkValueIsExist("name", "validateAttribute.action");
-  checkValueIsExist("shortName", "validateAttribute.action");
-  checkValueIsExist("code", "validateAttribute.action");
-
-  $('#unique').on('click', function() {
-    $("[name='localIdField']").toggle();
-  });
-});
\ No newline at end of file
+jQuery(document).ready(	function(){
+	validation( 'addAttributeForm', function(form){
+		form.submit();
+	})
+
+	checkValueIsExist( "name", "validateAttribute.action");
+	checkValueIsExist( "shortName", "validateAttribute.action");
+	checkValueIsExist( "code", "validateAttribute.action");
+});	
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/updateAttributeForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/updateAttributeForm.js	2014-04-09 04:03:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/updateAttributeForm.js	2014-04-12 09:21:12 +0000
@@ -1,17 +1,9 @@
-jQuery(document).ready(function() {
-  validation('updateAttributeForm', function( form ) {
-    form.submit();
-  });
-
-  checkValueIsExist("name", "validateAttribute.action", {id: getFieldValue('id')});
-  checkValueIsExist("shortName", "validateAttribute.action", {id: getFieldValue('id')});
-  checkValueIsExist("code", "validateAttribute.action", {id: getFieldValue('id')});
-
-  if( $('#unique').is(':checked') ) {
-    $("[name='localIdField']").show();
-  }
-
-  $('#unique').on('click', function() {
-    $("[name='localIdField']").toggle();
-  });
-});
\ No newline at end of file
+jQuery(document).ready(	function(){
+	validation( 'updateAttributeForm', function(form){
+		form.submit();
+	});
+	
+	checkValueIsExist( "name", "validateAttribute.action", {id:getFieldValue('id')});
+	checkValueIsExist( "shortName", "validateAttribute.action", {id:getFieldValue('id')});
+	checkValueIsExist( "code", "validateAttribute.action", {id:getFieldValue('id')});
+});		
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm	2014-04-09 04:03:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm	2014-04-12 09:21:12 +0000
@@ -63,6 +63,7 @@
 				<option value="age" #if( $attribute.valueType == 'age' ) selected="selected" #end>$i18n.getString( "age" )</option>
 				<option value="users" #if( $attribute.valueType == 'users' ) selected="selected" #end>$i18n.getString( "users" )</option>
 				<option value="combo" #if( $attribute.valueType == 'combo' ) selected="selected" #end>$i18n.getString( "attribute_combo_type" )</option>
+				<option value="localId" #if( $attribute.valueType == 'localId' ) selected="selected" #end>$i18n.getString( "local_identifier" )</option>
             </select>
         </td>
     </tr>
@@ -96,7 +97,20 @@
 		</td>
 		<td></td>
 	</tr>
-
+	
+	<tr name='localIdField' #if($attribute.valueType!='localId' ) style='display:none;' #end>
+		<td><label for="type">$i18n.getString( "period_type" )</label></td>
+		<td>
+			<select type='checkbox' id="periodTypeName" name="periodTypeName" >
+				<option value="">[$i18n.getString( "please_select" )]</option>
+				#foreach ( $periodType in $periodTypes )
+				<option value="$periodType.name" #if( $attribute.periodType.name==$periodType.name ) selected #end>$i18n.getString( $periodType.name )</option>
+				#end
+			</select>
+		</td>
+		<td></td>
+	</tr>
+		
     </tbody>
 	
 	<tr>