← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6728: local vn - Fixed import data.

 

------------------------------------------------------------
revno: 6728
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-04-25 12:39:27 +0700
message:
  local vn - Fixed import data.
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.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 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm	2012-03-29 10:05:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm	2012-04-25 05:39:27 +0000
@@ -13,7 +13,7 @@
 			<td width="18%" style=" width:25% ">$i18n.getString( 'select_excel_file' )</td>
 			<td width="82%">
 				<input type="file" id="upload" name="upload" onChange="enable('uploadButton');">
-				<input name="uploadButton" id="uploadButton" type="button" value="$i18n.getString( 'upload_file' )" onclick="validateUploadExcelImportByXML();" disabled />
+				<input name="uploadButton" id="uploadButton" type="button" value="$i18n.getString( 'upload_file' )" onclick="validateUploadExcelImportByJSON();" disabled />
 			</td>   
 		</tr>
 	</form>

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js	2012-02-28 08:50:46 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js	2012-04-25 05:39:27 +0000
@@ -89,25 +89,28 @@
 function getPeriodsByImportReport( importReportId ) {
 	
 	var url = 'getPeriodsByImportReport.action';
+	var periodList = jQuery( '#period' );
+	periodList.empty();
 	
-	jQuery.postJSON( url, { 'importReportId' : importReportId }, responseListPeriodReceived );
+	jQuery.postJSON( url, { 'importReportId' : importReportId }, function ( json ) {
+		for ( var i = 0 ; i < json.periods.length ; i ++ ) {
+			periodList.append( '<option value="' + i + '">' + json.periods[i].name + '</option>' );
+		}
+	} );
 }
 
-function validateUploadExcelImportByJSON(){
+function validateUploadExcelImportByJSON() {
 
 	jQuery( "#upload" ).upload( 'validateUploadExcelImport.action',
 		{ 'draft': true },
 		function ( data )
 		{
-			if ( data.response == 'error' )
-			{              
+			if ( data.response == 'error' )	{              
 				setMessage( data.message );
-			}
-			else
-			{
+			} else {
 				uploadExcelImport();
 			}
-		}, 'json'
+		}
 	);
 }
 
@@ -120,12 +123,9 @@
 			data = data.getElementsByTagName('message')[0];
 			var type = data.getAttribute("type");
 			
-			if ( type == 'error' )
-			{              
+			if ( type == 'error' ) {              
 				setMessage( data.firstChild.nodeValue );
-			}
-			else
-			{
+			} else {
 				uploadExcelImport();
 			}
 		}, 'xml'