← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2071: Add Filter Excel file when uploading a file - Finished.

 

------------------------------------------------------------
revno: 2071
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2010-11-16 14:42:09 +0700
message:
  Add Filter Excel file when uploading a file - Finished.
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientParams.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientResult.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/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 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientParams.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientParams.vm	2010-11-16 05:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientParams.vm	2010-11-16 07:42:09 +0000
@@ -6,7 +6,7 @@
      <td width="18%" style=" width:25% ">$i18n.getString( 'excel_file' )</td>
       <td width="82%">
           <input type="file" id="upload" name="upload" onChange="enable('uploadButton');">
-          <input name="uploadButton" id="uploadButton" type="submit" value="$i18n.getString( 'upload' )" />    
+          <input name="uploadButton" id="uploadButton" type="button" value="$i18n.getString( 'upload' )" onclick='validateUploadExcelFile();' />    
 	  </td>   
   </tr>
 </table>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientResult.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientResult.vm	2010-11-16 05:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/importPatientResult.vm	2010-11-16 07:42:09 +0000
@@ -1,5 +1,6 @@
 #parse( "/dhis-web-maintenance-patient/importPatientParams.vm" )
 
+#if($errPatients.keySet().size() > 0 )
 <h4>$i18n.getString( 'not_save_patient' )</h4>  
 <table width=100%>
 	<tr>
@@ -20,3 +21,4 @@
 	#set ($mark = !$mark)
 	#end
 </table>
+#end

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/import.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/import.js	2010-11-16 05:45:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/import.js	2010-11-16 07:42:09 +0000
@@ -18,4 +18,31 @@
 function saveConfigurationCompleted( messageElement )
 {
     showSuccessMessage( i18n_save_successfull );
+}
+
+function validateUploadExcelFile()
+{
+	$.ajaxFileUpload
+	(
+		{
+			url:'validateUploadExcelFile.action',
+			secureuri:false,
+			fileElementId:'upload',
+			dataType: 'xml',
+			success: function (data, status)
+			{
+				data = data.getElementsByTagName('message')[0]; 
+				var type = data.getAttribute("type");
+				if(type=='error'){                    
+					showErrorMessage(data.firstChild.nodeValue);
+				}else{
+					byId('importingParam').submit();
+				} 
+			},
+			error: function (data, status, e)
+			{
+			
+			}
+		}
+	);
 }
\ No newline at end of file