← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9133: local vn - Hide the download button after previewed the uploaded file

 

------------------------------------------------------------
revno: 9133
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-11-27 14:32:34 +0700
message:
  local vn - Hide the download button after previewed the uploaded file
modified:
  local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml
  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
  local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.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/resources/struts.xml'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-11-26 09:12:15 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/resources/struts.xml	2012-11-27 07:32:34 +0000
@@ -1342,7 +1342,8 @@
 			<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,
 				javascript/export.js,
 				javascript/preview.js,
-				javascript/import.js</param>
+				javascript/import.js,
+				javascript/jQuery/jquery.jqprint.0.3.js</param>
 			<param name="stylesheets">
 				style/style.css,
 				style/previewStyle.css</param>

=== 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-11-27 06:33:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/importDataParams.vm	2012-11-27 07:32:34 +0000
@@ -32,8 +32,8 @@
 		<td>					
 			<select name="period" id="period" style="min-width:20em;" type="text" #if(!$!fileExcel || !$!organisationUnit) disabled #end>
 			</select>
-			<input type="button" value="&lt;&lt;" id="lastYear" name="lastYear" onclick="getPreviousPeriod();"  #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
-			<input type="button" value="&gt;&gt;" id="nextYear" name="nextYear" onclick="getNextPeriod()" #if(!$!fileExcel || !$!organisationUnit) disabled #end />
+			<input type="button" value="&lt;&lt;" id="lastYear" name="lastYear" onclick="getImportingPeriod( 'previousPeriodsGeneric.action' );"  #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
+			<input type="button" value="&gt;&gt;" id="nextYear" name="nextYear" onclick="getImportingPeriod( 'nextPeriodsGeneric.action' )" #if(!$!fileExcel || !$!organisationUnit) disabled #end />
 		</td>
 	</tr>
 	<tr>
@@ -46,7 +46,7 @@
 <input type="button" onClick="javascript: getPreviewImportData();" style="width:100px" value="$i18n.getString('preview')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
 <input type="button" onClick="javascript: selectAllData( this );" style="width:100px" value="$i18n.getString('select_all')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
 <input type="button" onClick="javascript: importData();" style="width:100px" value="$i18n.getString('import')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
-<input type="button" onClick="javascript: rollbackImporting();" style="width:100px" value="$i18n.getString('roll_back_import')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
+<input type="button" onClick="javascript: rollbackImporting();" style="width:150px" value="$i18n.getString('roll_back_import')" #if(!$!fileExcel || !$!organisationUnit) disabled #end/>
 
 <br/><br/>
 

=== 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-11-27 06:33:42 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/import.js	2012-11-27 07:32:34 +0000
@@ -105,6 +105,18 @@
 	} );
 }
 
+function getImportingPeriod( url )
+{
+	var periodList = jQuery( '#period' );
+	periodList.empty();
+	
+	jQuery.get( url, {}, function ( json ) {
+		for ( var i = 0 ; i < json.periods.length ; i ++ ) {
+			periodList.append( '<option value="' + i + '">' + json.periods[i].name + '</option>' );
+		}
+	} );
+}
+
 function validateUploadExcelImportByJSON() {
 
 	jQuery( "#upload" ).upload( 'validateUploadExcelImport.action',

=== modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js'
--- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js	2012-11-27 04:26:35 +0000
+++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/preview.js	2012-11-27 07:32:34 +0000
@@ -16,8 +16,7 @@
 
 htmlPrintDownloadFunc = [ "<div align='right'>" ];
 htmlPrintDownloadFunc.push(	"<a href='javascript:printExportReport();' title='Print'>" );
-htmlPrintDownloadFunc.push( "<img src='../images/printer.png'/></a>&nbsp;&nbsp;" );
-htmlPrintDownloadFunc.push( "<a href='downloadFile.action' title='Download'><img src='images/download.png'/></a></div>" );
+htmlPrintDownloadFunc.push( "<img src='../images/printer.png'/></a>" );
 
 // ----------------------------------------------------------------------
 // Methods
@@ -117,6 +116,15 @@
 	var _cols 		= "";
 	var _sheets		= parentElement.getElementsByTagName( 'sheet' );
 	var _sHTML		= [];
+
+	if ( isImport )
+	{
+		htmlPrintDownloadFunc.push( "</div>" );
+	}
+	else {
+		htmlPrintDownloadFunc.push( "&nbsp;&nbsp;<a href='downloadFile.action' title='Download'><img src='images/download.png'/></a></div>" );
+	}
+	
 	var tabsHTML 	= [ htmlPrintDownloadFunc.join('') + '<div id="tabs"><ul>' ];
 
 	for (var s = 0 ; s < _sheets.length ; s ++)