← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7876: ocal vn - Some fixed:

 

------------------------------------------------------------
revno: 7876
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-08-08 17:57:13 +0700
message:
  ocal vn - Some fixed:
  - Problem when the selected org-unit changed the same params should not be changed.
  - Changed entry-hospital params area back to as same as the global interface.
  - Removed hidden function of parameter section and org unit in data entry form.
modified:
  local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties
  local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js
  local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.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 'local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2012-07-06 19:43:15 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module.properties	2012-08-08 10:57:13 +0000
@@ -107,6 +107,7 @@
 hide_export_params = Hide export params
 disconnect_server = Disconnect to server
 please_select_organisation_unit = Please select organisation unit
+please_select_data_set = Please select data set
 show_icd_report = Show ICD report
 get_report_as_csv = Get report as CSV
 get_report_as_xls = Get report as XLS
@@ -133,4 +134,5 @@
 chapter = Chapter
 select_chapter = Select chapter
 explore_icd_report_result = Explore ICD report result
-collapse_icd_report_result = Collapse ICD report result
\ No newline at end of file
+collapse_icd_report_result = Collapse ICD report result
+disease = Disease
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties'
--- local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties	2012-07-06 19:43:15 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/resources/org/hisp/dhis/de/i18n_module_vi_VN.properties	2012-08-08 10:57:13 +0000
@@ -113,6 +113,7 @@
 hide_export_params = \u1ea8n khung ch\u1ecdn
 disconnect_server = Kh\u00f4ng th\u1ec3 k\u1ebft n\u1ed1i t\u1edbi m\u00e1y ch\u1ee7
 please_select_organisation_unit = H\u00e3y ch\u1ecdn \u0111\u01a1n v\u1ecb
+please_select_data_set = H\u00e3y ch\u1ecdn m\u1eabu nh\u1eadp
 show_icd_report = Xu\u1ea5t b\u00e1o c\u00e1o ICD
 get_report_as_csv = Xu\u1ea5t b\u00e1o c\u00e1o d\u1ea1ng CSV
 get_report_as_xls = Xu\u1ea5t b\u00e1o c\u00e1o d\u1ea1ng XLS
@@ -139,4 +140,5 @@
 chapter = Ch\u01b0\u01a1ng
 select_chapter = Ch\u1ecdn ch\u01b0\u01a1ng
 explore_icd_report_result = Hi\u1ec3n th\u1ecb k\u1ebft qu\u1ea3 b\u00e1o c\u00e1o ICD
-collapse_icd_report_result = Thu nh\u1ecf k\u1ebft qu\u1ea3 b\u00e1o c\u00e1o ICD
\ No newline at end of file
+collapse_icd_report_result = Thu nh\u1ecf k\u1ebft qu\u1ea3 b\u00e1o c\u00e1o ICD
+disease = B\u1ec7nh
\ No newline at end of file

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-07-06 19:43:15 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js	2012-08-08 10:57:13 +0000
@@ -37,6 +37,9 @@
 // Currently selected data set identifier
 var currentDataSetId = null;
 
+// Currently selected period type name
+var currentPeriodType = "";
+
 // Current offset, next or previous corresponding to increasing or decreasing
 // value with one
 var currentPeriodOffset = 0;
@@ -110,24 +113,36 @@
 			//async: false,
 			success: function( json )
 			{
-				var dataSetList = json.dataSets;
-
-				$( '#selectedDataSetId' ).removeAttr( 'disabled' );
-
-				var dataSetId = $( '#selectedDataSetId option:selected' ).val();
-				var periodId = $( '#selectedPeriodId option:selected' ).val();
-
 				clearListById( 'selectedDataSetId' );
-				//addOptionById( 'selectedDataSetId', '-1', '[ ' + i18n_select_data_set + ' ]' );
-
-				var dataSetValid = false;
-
-				for ( i in dataSetList )
+
+				if ( json.dataSets.length > 0 )
 				{
-					$('#selectedDataSetId').append('<option value=' + dataSetList[i].id  + ' formType="'+ dataSetList[i].formType + '" periodType="' + dataSetList[i].periodType + '" >' + dataSetList[i].name + '</option>');
+					$( '#selectedDataSetId' ).removeAttr( 'disabled' );
+					
+					addOptionById( 'selectedDataSetId', '-1', '[ ' + i18n_select_data_set + ' ]' );
+
+					jQuery.each( json.dataSets, function( i, item )
+					{
+						if ( item.id == currentDataSetId )
+						{
+							$('#selectedDataSetId').append('<option value=' + item.id  + ' formType="'+ item.formType + '" periodType="' + item.periodType + '" selected="true">' + item.name + '</option>');
+						}
+						else
+						{
+							$('#selectedDataSetId').append('<option value=' + item.id  + ' formType="'+ item.formType + '" periodType="' + item.periodType + '" >' + item.name + '</option>');
+						}
+					} );
+					
+					enable( 'selectedDataSetId' );
+					var periodType = $( '#selectedDataSetId option:selected' ).attr( 'periodType' );
+					
+					if ( currentPeriodType && currentPeriodType != -1 && currentPeriodType == periodType )
+					{
+						loadForm( currentDataSetId, getFieldValue( 'valueInput' ) );
+					}
+				} else {
+					resetCriteriaDiv();
 				}
-				
-				enable('selectedDataSetId');
 			}
 		});
 	}
@@ -198,9 +213,19 @@
     } );
 }
 
-function clearPeriod()
+function resetCriteriaDiv()
 {
-    clearListById( 'selectedPeriodId' );
+	currentDataSetId = null;
+	currentPeriodType = null;
+	
+	clearListById( 'selectedPeriodId' );
+	
+	hideById( 'chapterTR' );
+	hideById( 'attributeTR' );
+	
+	byId( 'inputCriteria' ).style.width = '504px';
+	byId( 'inputCriteria' ).style.height = '80px';
+    
     clearEntryForm();
 }
 
@@ -218,7 +243,7 @@
 
 function loadForm( dataSetId, value )
 {
-	hideExportDiv();
+	//hideExportDiv();
 	showLoader();
 
 	$( '#contentDiv' ).load( 'loadForm.action',
@@ -326,6 +351,8 @@
 
     clearListById( 'selectedPeriodId' );
 
+	addOptionById( 'selectedPeriodId', '-1', '[ ' + i18n_select_period + ' ]' );
+	
     for ( i in periods )
     {
         addOptionById( 'selectedPeriodId', periods[i].id, periods[i].name );
@@ -348,6 +375,7 @@
     $( '#prevButton' ).removeAttr( 'disabled' );
     $( '#nextButton' ).removeAttr( 'disabled' );
 	$( '#valueInput' ).val('');
+
     var dataSetId = $( '#selectedDataSetId option:selected' ).val();
     var periodId = $( '#selectedPeriodId option:selected' ).val();
     var periodType = $( '#selectedDataSetId option:selected' ).attr('periodType');
@@ -356,14 +384,14 @@
 
     if ( dataSetId != -1 )
     {
+		addOptionById( 'selectedPeriodId', "-1", '[ ' + i18n_select_period + ' ]' );
+	
         for ( i in periods )
         {
             addOptionById( 'selectedPeriodId', periods[i].id, periods[i].name );
         }
 
-        var previousPeriodType = currentDataSetId ? periodType : null;
-
-        if ( periodId && periodId != -1 && previousPeriodType && previousPeriodType == periodType )
+        if ( periodId && periodId != -1 && currentPeriodType && currentPeriodType == periodType )
         {
             $( '#selectedPeriodId' ).val( periodId );
         }
@@ -373,8 +401,10 @@
         }
 
         currentDataSetId = dataSetId;
+		currentPeriodType = periodType;
 		
-		loadSubDataSets( dataSetId );
+		//loadSubDataSets( dataSetId );
+		loadAttributeValues( dataSetId );
     }
 }
 
@@ -441,20 +471,25 @@
 
 			autoCompletedField();
 
-			byId( 'inputCriteria' ).style.width = '670px';
-			byId( 'inputCriteria' ).style.height = '320px';
-
-			hideById( 'departmentTitleDiv' );
-			hideById( 'departmentDiv' );
-			showById( 'attributeDiv' );
+			byId( 'inputCriteria' ).style.width = '504px';
+			byId( 'inputCriteria' ).style.height = '130px';
+
+			//hideById( 'departmentTitleDiv' );
+			//hideById( 'departmentDiv' );
+
+			showById( 'chapterTR' );
+			showById( 'attributeTR' );
 		}
 		else
 		{
-			byId( 'inputCriteria' ).style.width = '640px';
-			byId( 'inputCriteria' ).style.height = '250px';
+			byId( 'inputCriteria' ).style.width = '504px';
+			byId( 'inputCriteria' ).style.height = '80px';
 			
-			hideById( 'attributeDiv' );
+			hideById( 'chapterTR' );
+			hideById( 'attributeTR' );
 		}
+		
+		jQuery( '#selectedPeriodId' ).bind( 'change', periodSelected );
 	} );
 }
 
@@ -529,29 +564,34 @@
 function periodSelected()
 {
 	var periodName = $( '#selectedPeriodId option:selected' ).text();
-    var dataSetId = $( '#selectedDataSetId option:selected' ).val();
-
-    $( '#currentPeriod' ).html( periodName );
-
-    var periodId = getFieldValue( 'selectedPeriodId' );
-
-    if ( periodId && periodId != -1 )
-    {
-		if ( hasElements( 'subDataSetId' ) && getFieldValue( 'subDataSetId' ) == null )
-		{
-			return;
-		}
-		else if ( getFieldValue( 'subDataSetId' ) )
-		{
-			dataSetId = $( '#subDataSetId option:selected' ).val();
-		}
-
-		showLoader();
-		loadForm( dataSetId, getFieldValue( 'valueInput' ) );
-    }
-	else
+	var dataSetId = $( '#selectedDataSetId option:selected' ).val();
+
+	if ( dataSetId && dataSetId != -1 )
 	{
-		clearEntryForm();
+		$( '#currentPeriod' ).html( periodName );
+
+		var periodId = getFieldValue( 'selectedPeriodId' );
+
+		if ( periodId && periodId != -1 )
+		{
+			if ( hasElements( 'subDataSetId' ) && getFieldValue( 'subDataSetId' ) == null )
+			{
+				return;
+			}
+			else if ( getFieldValue( 'subDataSetId' ) )
+			{
+				dataSetId = $( '#subDataSetId option:selected' ).val();
+			}
+
+			showLoader();
+			loadForm( dataSetId, getFieldValue( 'valueInput' ) );
+		}
+		else
+		{
+			clearEntryForm();
+		}
+	} else {
+		setHeaderDelayMessage( i18n_please_select_data_set );
 	}
 }
 

=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm'
--- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm	2012-07-06 19:43:15 +0000
+++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/select.vm	2012-08-08 10:57:13 +0000
@@ -26,65 +26,48 @@
     <input type="button" value="$i18n.getString( 'run_validation' )" onclick="validate()" id="validationButton" style="width:150px;" disabled="disabled"/>
 </div>
 
-<div id="showButtonDiv" style="display:none">
-	<input type="button" onclick="showExportDiv();" value="$i18n.getString( 'show_export_params' )"/>
-</div>
-
 <br/>
 
-<div class="inputCriteria" id='inputCriteria' style="width:640px;height:250px;">
+<div class="inputCriteria" id='inputCriteria' style="width:504px;height:80px;">
 <input type='hidden' id='dataSetId' name='dataSetId'/>
 <table>
 	<tr>
-		<td><label class='bold' for="selectedOrganisationUnit">$i18n.getString( "organisation_unit" )</label>
-	</tr>
-	
-	<tr>
-		<td>
-			<span id="selectedOrganisationUnit">[ $i18n.getString( 'select_from_tree' ) ]</span></td>
-		</td>
-	</tr>
-	
+		<td><label class='bold' for="selectedOrganisationUnit">$i18n.getString( "organisation_unit" )</label></td>
+		<td><span id="selectedOrganisationUnit">[ $i18n.getString( 'select_from_tree' ) ]</span></td>
+	</tr>
+
 	<tr>
 		<td><label class='bold' for="selectedDataSetId">$i18n.getString( "data_set" )</label></td>
+		<td><select id="selectedDataSetId" name="selectedDataSetId" style="width:371px" onchange="dataSetSelected()" disabled="disabled"></select>
+			<span id="loaderSpan" style="display:none"><img src='../images/ajax-loader-bar.gif'/></span>
+		</td>
+	</tr>
+	
+	<tr>
 		<td><label class='bold' for="selectedPeriodId">$i18n.getString( "period" )</label></td>
-		<td id='departmentTitleDiv' style='display:none;'><label class='bold' for="selectedPeriodId">$i18n.getString( "department" )</label></td>
-	</tr>
-	
-	<tr>
-		<td><select id="selectedDataSetId" name="selectedDataSetId" size='10' style="width:371px" onchange="dataSetSelected()" disabled="disabled"></select>
-			<span id="loaderSpan" style="display:none"><img src='../images/ajax-loader-bar.gif'/></span>
-		</td>
-		<td><select id="selectedPeriodId" name="selectedPeriodId" size='9' style="width:230px" disabled="disabled"></select><br/>
+		<td><select id="selectedPeriodId" name="selectedPeriodId" style="width:215px" disabled="disabled"></select>
 			<input type="button" id="prevButton" style="width:75px" value="$i18n.getString( 'prev_year' )" title="$i18n.getString('earlier_periods')" onclick="previousPeriodsSelected()" disabled="disabled"/>
 			<input type="button" id="nextButton" style="width:75px" value="$i18n.getString( 'next_year' )" title="$i18n.getString('later_periods')" onclick="nextPeriodsSelected()" disabled="disabled"/>
 		</td>
-		<td id='departmentDiv' style='display:none;'>
-			<select id='subDataSetId' name='subDataSetId' size="10" onchange='javascript:loadDepartmentFormSelected();'/></select>
-		</td>
 	</tr>	
 	
-	<tr id='attributeDiv' style='display:none;'>
-		<td>
-			<br/><label class='bold' for="chapterId">$i18n.getString( "chapter" )</label>
-			<select id='chapterId' name='chapterId' style="width:330px" onchange="loadAttributeValuesByChapter( this.value );"></select><br/>
-			<label class='bold' for="attributeId">$i18n.getString( "attribute" )</label>
+	<tr id='chapterTR' style='display:none;'>
+		<td><label class='bold' for="chapterId">$i18n.getString( "chapter" )</label></td>
+		<td><select id='chapterId' name='chapterId' style="width:370px" onchange="loadAttributeValuesByChapter( this.value );"></select></td>
+	</tr>
+
+	<tr id='attributeTR' style='display:none;'>
+		<td>
+			<label class='bold' for="attributeId">$i18n.getString( "disease" )</label>
+		</td>
+		<td>
 			<select id='value' name='value' style='display:none;' ></select>
-			<input type="text" id="valueInput" style="width:330px" name="valueInput" />
+			<input type="text" id="valueInput" style="width:210px" name="valueInput" />
 			<button type='button' id='valueButton' class='small-button' >&nbsp;</button>
-		</td>
-		<td><br/><br/>
-			<input type="button" id="showReportButton" value="$i18n.getString( 'show_icd_report' )"
-				style="display:none" onclick="showICDReport();"/>
+			<input type="button" id="showReportButton" value="$i18n.getString( 'show_icd_report' )" style="display:none;width:120px" onclick="showICDReport();"/>
 		</td>
 	</tr>
-
-	<tr>
-		<td colspan="3" align="right">
-			<a title="$i18n.getString( 'hide_params' )" href="javascript:hideExportDiv();">
-			<img width="16" height="16" title="$i18n.getString( 'hide_export_params' )" src="../images/up_left.png"/></a>
-		</td>
-    </tr>
+	
 
 </table>
 </div>
@@ -144,7 +127,7 @@
 
 <script type="text/javascript">
 
-leftBar.hideAnimated();
+//leftBar.hideAnimated();
 
 var openICD = true;
 
@@ -190,6 +173,7 @@
 var i18n_show_all_items = '$encoder.jsEscape( $i18n.getString( "show_all_items" ) , "'")';
 var i18n_select_department = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_department" ) , "'")' + " ]";
 var i18n_please_select_unit = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_organisation_unit" ) , "'")' + " ]";
+var i18n_please_select_data_set = "[ " + '$encoder.jsEscape( $i18n.getString( "please_select_data_set" ) , "'")' + " ]";
 var i18n_select_chapter = "[ " + '$encoder.jsEscape( $i18n.getString( "select_chapter" ) , "'")' + " ]";
 var i18n_explore_icd_report_result = '$encoder.jsEscape( $i18n.getString( "explore_icd_report_result" ) , "'")';
 var i18n_collpase_icd_report_result = '$encoder.jsEscape( $i18n.getString( "collapse_icd_report_result" ) , "'")';