dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02446
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 814: fixed javascript bug
------------------------------------------------------------
revno: 814
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Fri 2009-10-02 14:58:30 +0700
message:
fixed javascript bug
modified:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml
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/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-10-02 02:58:42 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-10-02 07:58:30 +0000
@@ -522,7 +522,7 @@
/dhis-web-excel-reporting/responseDataSets.vm</result>
</action>
- <!-- DATA ENTRY STATUS ACTION -->
+ <!-- DATA SET COMPLETED REPORT ACTION -->
<action name="selectDataSetCompletedReport"
class="org.hisp.dhis.reportexcel.datasetcompleted.action.SelectParamsAction">
@@ -555,7 +555,7 @@
<param name="page">/dhis-web-excel-reporting/viewCustomDataSetReport.vm</param>
</action>
- <!-- Preview report actions -->
+ <!-- PREVIEW REPORT EXCEL ACTION -->
<action name="validateGenerateReport"
class="org.hisp.dhis.reportexcel.export.action.ValidateGenerateReportAction">
=== 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:58:30 +0000
@@ -49,228 +49,26 @@
}
function generateReportExcel() {
-<<<<<<< TREE
if(byId('advancedCheck').checked){
generateAdvancedReportExcel();
}else{
- var reportId = $('#report').val();
- var periodId = $('#period').val();
-
- window.location = "generateReportExcel.action?reportId=" + reportId + "&periodId=" + periodId ;
- }
-}
-
-// 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 //
+ $("#loading").showAtCenter( true );
+ $.post("generateReportExcel.action",{
+ reportId:$('#report').val(),
+ periodId:$('#period').val()
+ },function(data){
+ window.location = "downloadExcelOutput.action";
+ deleteDivEffect();
+ $("#loading").hide();
+ },'xml');
+ }
+}
function generateAdvancedReportExcel() {
- //var reportId = $('#report').val();
- //var periodId = $('#period').val();
-
- //window.location = "generateAdvancedReportExcel.action?reportId=" + reportId + "&periodId=" + periodId + "&reportType=category";
-
var reportId = $('#report').val();
var periodId = $('#period').val();
var organisationGroupId = byId('availableOrgunitGroups').value;
@@ -308,47 +106,16 @@
}
- byId('availableOrgunitGroups').disabled = false;
- //$("#generate_advanced_report").show();
-
- //$("#generate_report").hide();
- //$("#generateAdvance").show();
-
- //hideById('generate_report');
- //showById('generate_advanced_report');
- //showById('generateAdvance')
+ byId('availableOrgunitGroups').disabled = false;
}
else
- {
-
-
- byId('availableOrgunitGroups').disabled=true;
- //$("#generate_advanced_report").hide();
- //$("#generate_report").show();
- //$("#generateAdvance").hide();
-
- //byId('generate_report').style.visibility = true;
- //byId(('generate_advanced_report').style.visibility = false;
-
- //hideById('generate_advanced_report');
- //showById('generate_report');
-
- //hideById('generateAdvance');
+ {
+
+ byId('availableOrgunitGroups').disabled=true;
}
}
- $("#loading").showAtCenter( true );
- $.post("generateReportExcelAjax.action",{
- reportId:$('#report').val(),
- periodId:$('#period').val()
- },function(data){
- window.location = "downloadExcelOutput.action";
- deleteDivEffect();
- $("#loading").hide();
- },'xml');
-
-}
generic_type = '';
@@ -405,9 +172,6 @@
function openPreviewReport() {
var reportId = $('#report').val();
- var periodId = $('#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");
+ var periodId = $('#period').val();
window.open("openPreviewReport.action?reportId=" + reportId + "&periodId=" + periodId, "_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:58:30 +0000
@@ -1,4 +1,4 @@
-<h2>$i18n.getString( "generate_report" )</h2>
+<h2>$i18n.getString( "generate_report" )</h2>
<table >
<tr>
<td ><label>$i18n.getString('group')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
@@ -66,13 +66,8 @@
<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 type="button" value='$i18n.getString( "preview_report" )' onclick="javascript: generic_type = 'preview'; validateGenerateReport('$!i18n.getString("please_wait")');" #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/>
</p>