← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10749: Add display-name option for Add/Update Aggregate Query Builder form.

 

------------------------------------------------------------
revno: 10749
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-03 09:42:42 +0700
message:
  Add display-name option for Add/Update Aggregate Query Builder form.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.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-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm	2013-05-02 14:59:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationForm.vm	2013-05-03 02:42:42 +0000
@@ -8,31 +8,37 @@
 	<div id="tab-1">
 	  <table>
         <tr>
+			<th>$i18n.getString("display_name")</th>
 			<td>
-				<label for="dataelement">$i18n.getString( "dataelement" )</label>
-				<span align='right' style="background:#ADD8E6;padding-left:45px; padding-top:3px; padding-bottom:3px">
-					$i18n.getString( "sort_by" )
-					<input type='radio' name='sortBy' value='1' onchange="sortByOnChange('1')" checked >$i18n.getString("name")
-					<input type='radio' name='sortBy' value='2' onchange="sortByOnChange('2')">$i18n.getString("code") &nbsp;&nbsp;&nbsp;
-				</span>
+				<select id='displayNameOption' style="width:220px" onchange='displayNameOnChange( this.value )'>
+					<option value='1'>$i18n.getString("name")</option>
+					<option value='2'>$i18n.getString("code")</option>
+					<option value='3'>$i18n.getString("code_and_name")</option>
+				</select>
 			</td>
 			<td>
 				<label for="availableValues">$i18n.getString( "available_values" )</label>&nbsp;
 				<input type='button' title="$i18n.getString( 'insert_selected_values' )" value="&raquo;" class="small-button" onClick="insertMultiValues('suggestedDEValues');" >
 			</td>
         </tr>
-        
+		<tr>
+			<th>$i18n.getString( "sort_by" )</th>
+			<td>
+				<input type='radio' name='sortBy' value='1' onchange="sortByOnChange('1')" checked >$i18n.getString("name")
+				<input type='radio' name='sortBy' value='2' onchange="sortByOnChange('2')">$i18n.getString("code") &nbsp;&nbsp;&nbsp;
+			</td>
+			<td rowspan="3">
+				<select name="suggestedDEValues" size="12" multiple id='suggestedDEValues' ondblclick="insertSingleValue('suggestedDEValues');" ></select>			
+			</td>
+		</tr>
         <tr>
-			<td>
+			<td colspan='2'>
 				<input type='text' id='txtSearchValue' name='txtSearchValue' onKeyUp="filterDataElement(event, this.value, 'dataElements','dataElementBackups');" style='width:265px;'/>
 				<input type='button' value='$i18n.getString("clear")' onClick="setFieldValue('txtSearchValue', '');" style='width:50px'>			
 			</td>
-            <td rowspan="4">
-				<select name="suggestedDEValues" size="10" multiple id='suggestedDEValues' ondblclick="insertSingleValue('suggestedDEValues');" ></select>			
-			</td>
         </tr>
         <tr>
-			<td>
+			<td colspan='2'>
 				<select id="dataElements" name="dataElements" size="8" ondblclick="insertDataElement(this);" onclick="getSuggestedValues(this.id, 'suggestedDEValues' )"></select>
 				<select id="dataElementBackups" name="dataElementBackups" style='display:none;'></select>
 			</td>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2013-05-02 14:59:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js	2013-05-03 02:42:42 +0000
@@ -461,8 +461,7 @@
 		    
 }
 
-
-function sortByOnChange(sortBy)
+function sortByOnChange( sortBy )
 {
 	if( sortBy == 1)
 	{
@@ -500,3 +499,43 @@
 	} 
 }
 
+function displayNameOnChange( displayName )
+{
+	// display - name
+	if(displayName=='1'){
+		jQuery('#dataElements option').each(function(){
+			var item = jQuery(this);
+			item[0].text = item.attr('dename');
+			item[0].title = item[0].text;
+		});
+		jQuery('#dataElementBackups option').each(function(){
+			var item = jQuery(this);
+			item[0].text = item.attr('dename');
+		});
+	}
+	// display - code
+	else if(displayName=='2'){
+		jQuery('#dataElements option').each(function(){
+			var item = jQuery(this);
+			item[0].text = item.attr('decode');
+			item[0].title = item[0].text;
+		});
+		jQuery('#dataElementBackups option').each(function(){
+			var item = jQuery(this);
+			item[0].text = item.attr('decode');
+		});
+	}
+	// display - code and name
+	else{
+		jQuery('#dataElements option').each(function(){
+			var item = jQuery(this);
+			item[0].text = "(" + item.attr('decode') + ") " + item.attr('dename');
+			item[0].title = item[0].text;
+		});
+		jQuery('#dataElementBackups option').each(function(){
+			var item = jQuery(this);
+			item[0].text = "(" + item.attr('decode') + ") " + item.attr('dename');
+		});
+	}
+}
+