← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 814: Quickly fixed !

 

------------------------------------------------------------
revno: 814
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Fri 2009-10-02 14:05:55 +0700
message:
  Quickly fixed !
modified:
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js
  dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.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 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js	2009-10-02 02:58:42 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js	2009-10-02 07:05:55 +0000
@@ -48,8 +48,7 @@
     }
 }
 
-function generateReportExcel() {	
-<<<<<<< TREE
+function generateReportExcel() {
 
 	if(byId('advancedCheck').checked){
 		
@@ -63,207 +62,6 @@
 	}
 }
 
-// Previewed Report Excel //
-function previewReport() {
-	
-	var reportId = getFieldValue('report');
-	var periodId = getFieldValue('period');
-	var url = "previewReport.action?reportId=" + reportId + "&periodId=" + periodId;
-	
-	setMessage(globalMessage);
-	
-	var request = new Request();
-	request.setResponseTypeXML( 'reportXML' );
-	request.setCallbackSuccess( previewReportReceived );
-	request.send( url );
-	
-	//window.open(url, 'Preview Report Form', "toolbar='0',scrollbars='1',location='0',statusbar='0',menubar='0',resizable='1',width='700',height='900'");
-}
-
-function previewReportReceived( reportXML ) {
-
-	//var type = xmlObject.getAttribute( 'type' );
-	
-	initNewArray();
-	setMergedNumberForEachCell( reportXML );
-	exportXMLtoHTML( reportXML );
-	
-}
-
-aData	= null;
-aMerged = null;
-
-
-function initNewArray() {
-
-	aData		= null;
-	aMerged		= null;
-	aData 		= new Array();
-	aMerged 	= new Array();
-}
-
-
-function setMergedNumberForEachCell( parentElement ) {
-	
-	var cells 	 = parentElement.getElementsByTagName( 'cell' );
-	
-	for (var i = 0 ; i < cells.length ; i ++) {
-		
-		var _iRow		 = cells[i].getAttribute( 'iRow' );
-		var _iCol		 = cells[i].getAttribute( 'iCol' );
-		var _iMerged	 = cells[i].firstChild.nodeValue;
-		
-		if ( (_iRow > 0) || (_iCol > 0) ) {
-		
-			aData[i] = (_iRow-1) + "#" + (_iCol-1);
-			
-			if ( _iMerged < 0 ) {
-			
-				_iMerged = -_iMerged;
-			}
-			aMerged[i] = _iMerged;
-		}
-	}
-}
-	
-
-//--------------------------------------------------------------------------------------------------------//
-
-function getMergedNumberForEachCell( sKey )
-{			
-	for (var i = 0 ; i < aData.length ; i ++) {
-	
-		if ( sKey == aData[i] ) {
-
-			return Number(aMerged[i]);
-		}
-	}
-return 1;
-}
-
-
-//--------------------------------------------------------------------------------------------------------//
-
-function exportXMLtoHTML( parentElement ) {
-
-	var _index		= 0;
-	var sHTML		= "";
-	var _sPattern	= "";
-	var _title		= parentElement.getElementsByTagName( 'name' )[0].firstChild.nodeValue;
-	
-	var rows = parentElement.getElementsByTagName( 'row' );
-	
-	for (var i = 0 ; i < rows.length ; i ++) {
-		
-		_index		= 0;
-		sHTML 		= sHTML + "<tr>";
-		
-		var cols = rows[i].getElementsByTagName( 'col' );
-		
-		for (var j = 0 ; j < cols.length ; ) {
-			
-			var _number	= cols[j].getAttribute( 'number' );
-	
-			var _bgcolour	 = new Array(1);
-			_bgcolour[0]	 = "#E1FFFF";
-			var background	 = cols[j].getElementsByTagName( 'background' )[0];
-			
-			if ( background != null ) {
-				_bgcolour = background.getAttribute( 'colour' ).split(' ');
-			}
-			
-			// Printing out the unformatted cells
-			
-			for (; _index < _number ; _index ++) {
-				
-				sHTML 	= sHTML 
-							+ "<td "
-							+ "bgcolor='" + _bgcolour[0] 
-							+ "'/>";
-			}
-			
-			
-			
-			if ( _index == _number ) {
-				
-
-				
-				var _number_of_merged_cell = 1;
-				var _sData		 = cols[j].getElementsByTagName( 'data' )[0].firstChild.nodeValue;					
-				var _align		 = cols[j].getElementsByTagName( 'format' )[0].getAttribute( 'align' );
-				var _valign		 = cols[j].getElementsByTagName( 'format' )[0].getAttribute( 'valign' );
-				var _colour		 = cols[j].getElementsByTagName( 'font' )[0].getAttribute( 'colour' );
-				var _italic		 = cols[j].getElementsByTagName( 'font' )[0].getAttribute( 'italic' );
-				var _underline	 = cols[j].getElementsByTagName( 'font' )[0].getAttribute( 'underline' );
-				var _point_size	 = cols[j].getElementsByTagName( 'font' )[0].getAttribute( 'point_size' );
-				var _bold_weight = cols[j].getElementsByTagName( 'font' )[0].getAttribute( 'bold_weight' );
-				
-
-				
-				// Checking for Alignment //
-				if ( _align == "centre" ) {
-					_align 	= "center";
-				}
-
-			
-				// If this cell is merged
-				// Key with form: Row#Col
-				
-				_sPattern 				= i + "#" + _number;
-				_number_of_merged_cell 	= getMergedNumberForEachCell( _sPattern );
-								
-				// Jumping for <For Loop> AND <Empty Cells>
-				j 		= Number(j) + Number(_number_of_merged_cell);
-				_index 	= Number(_index) + Number(_number_of_merged_cell);
-
-			
-				sHTML 	= sHTML 
-							+ "<td align='" + _align 
-							+ "' valign='" + _valign 
-							+ "' bgcolor='" + _bgcolour[0] 
-							+ "' colspan='" + _number_of_merged_cell 
-							+ "'style='border-style: solid; border-width: 0px; width:10%'>";
-							
-					
-				// Setting for FONT //
-				sFont = "<font"
-						+ " color='" + _colour + "'"
-						+ " size='" + _point_size/4 + "'>"
-						+ _sData
-						+ "</font>";
-				
-				// Checking for BOLD //
-				if ( _bold_weight != 400 ) {
-					sFont = "<b>" + sFont + "</b>";
-				}
-				
-				// Checking for ITALIC //
-				if ( _italic == true ) {
-					sFont = "<i>" + sFont + "</i>";
-				}
-				
-				// Checking for UNDERLINE //
-				if ( _underline != "none" ) {
-					sFont = "<u>" + sFont + "</u>";
-				}
-				
-				sHTML	= sHTML + sFont + "</td>";		
-			}
-			/**/
-		}
-		sHTML 			= sHTML + "</tr>";
-	}
-	
-	sHTML = "<html><head><title>" 
-				+ _title
-				+ "</title></head><body><table border='1' width='100%' >"
-				+ sHTML
-				+ "</table></body></html>";
-				
-	document.write(sHTML);
-}
-// END OF Previewed Report Excel //
-
 function generateAdvancedReportExcel() {	
 
 	//var reportId = $('#report').val();
@@ -350,8 +148,6 @@
 
 }
 
-generic_type = '';
-
 function validateGenerateReport(message) {
 
 	setMessage(message);
@@ -406,8 +202,7 @@
 	
 	var reportId = $('#report').val();
 	var periodId = $('#period').val();
-	//var sheetId  = $('#period').val();
+	var sheetId  = $('#period').val();
 	
-	//window.open("openPreviewReport.action?reportId=" + reportId + "&periodId=" + periodId + "&sheetId=" + sheetId,"_blank","width=900,height=600,scrollbars=yes,menubar=yes,resizable=yes");
-	window.open("openPreviewReport.action?reportId=" + reportId + "&periodId=" + periodId, "_blank", "width=900,height=600,scrollbars=yes,menubar=yes,resizable=yes");
+	window.open("openPreviewReport.action?reportId=" + reportId + "&periodId=" + periodId + "&sheetId=" + sheetId,"_blank","width=900,height=600,scrollbars=yes,menubar=yes,resizable=yes");
 }

=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm	2009-10-02 02:58:42 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm	2009-10-02 07:05:55 +0000
@@ -15,7 +15,7 @@
 	<tr>
 		<td><label>$i18n.getString('reports')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
 		<td>
-			<select type="text" id="report" name="report" style="min-width:20em" #if(!$organisationUnit) disabled #end>
+			<select type="text" id="report" name="report" style="min-width:20em" onchange="javascript: getNoSheetsOfReportExcel();" #if(!$organisationUnit) disabled #end>
 				#foreach($report in $reports)
 					<option value='$report.id'>$encoder.htmlEncode( $report.name )</option>				
 				#end
@@ -60,25 +60,17 @@
 	
 </div>
 
-
-		  
 <span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="hideById(this.id);"></span>
-<br>
-<hr>
+<br/>
+<hr/>
 <p>
 
-<input type="button" value='$i18n.getString( "preview_report" )' onclick="javascript: generic_type = 'preview'; var message = '$!i18n.getString("please_wait")'; validateGenerateReport(message);" #if(!$organisationUnit) disabled #end/>
 <input name="generate_report" id="generate_report"  type="button" onClick="generateReportExcel()" value='$i18n.getString( "generate_report" )' #if(!$organisationUnit) disabled #end/>
 <input name="generate_advanced_report" id="generate_advanced_report" type="button" onClick="generateAdvancedReportExcel()" value='$i18n.getString( "fasd_generate_report" )' style="visibility:hidden " />
-
-<input type="button" value='$i18n.getString( "preview_report" )' onclick="javascript: generic_type = 'preview'; validateGenerateReport('$!i18n.getString("please_wait")');" #if(!$organisationUnit) disabled #end/>
-<input type="button" id="generate_report" value='$i18n.getString( "generate_report" )' onclick="generateReportExcel();" #if(!$organisationUnit) disabled #end/>
-
+<input name="preview_report" id="preview_report"  type="button" value='$i18n.getString( "preview_report" )' onclick="javascript: ('$!i18n.getString("please_wait")');" #if(!$organisationUnit) disabled #end/>
 
 </p>
-<span id="info" style="display:none;top:70px;right:5px;position:fixed;" onclick="hideById(this.id)">
-	
-</span>
+<span id="info" style="display:none;top:70px;right:5px;position:fixed;" onclick="hideById(this.id)"></span>
 <span id="loading" style="display:none;position:fixed;"><img src="../images/ajax-loader.gif" /></span>
 
 <script>