dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #02540
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 849: Upgraded and improved GUI - Preview excel report function ...
------------------------------------------------------------
revno: 849
committer: hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2009-10-12 16:32:38 +0700
message:
Upgraded and improved GUI - Preview excel report function ...
added:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseSheets.vm
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/javascript/preview.js
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/style/previewStyle.css
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/viewReportPreview.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-09 08:02:34 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-10-12 09:32:38 +0000
@@ -323,7 +323,7 @@
<action name="getListSheet"
class="org.hisp.dhis.reportexcel.item.action.GetListSheetAction">
<result name="success" type="velocity-xml">
- /dhis-web-excel-reporting/sheets.vm</result>
+ /dhis-web-excel-reporting/responseSheets.vm</result>
</action>
<action name="getDataElementOrder"
@@ -621,8 +621,6 @@
/dhis-web-excel-reporting/responseReportPreview.vm</result>
<result name="error" type="velocity-xml">
/dhis-web-excel-reporting/responseError.vm</result>
- <param name="stylesheets">style/previewStyle.css</param>
- <param name="javascripts">javascript/preview.js</param>
</action>
<!-- GERERATE ADVANCE -->
=== 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-09 08:02:34 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/export.js 2009-10-12 09:32:38 +0000
@@ -112,36 +112,12 @@
}, "xml");
}
-function getNoSheetsOfReportExcel() {
-
- if ( $("#report").val() == '-1' ) {
- clearListById('sheetNoExcelFile');
- }
- else {
- $.post("getListSheet.action", {
- reportId:$("#report").val()
- }, function ( xmlObject ) {
- clearListById('sheetNoExcelFile');
- xmlObject = xmlObject.getElementsByTagName('sheets')[0];
- nodes = xmlObject.getElementsByTagName('sheet');
- for (var i = 0 ; i < nodes.length ; i++)
- {
- var id = nodes[i].getElementsByTagName('id')[0].firstChild.nodeValue;
- var name = nodes[i].getElementsByTagName('name')[0].firstChild.nodeValue;
- addOption('sheetNoExcelFile', name, id);
- }
- }, "xml");
- }
-}
function openPreviewReport() {
- var reportId = $('#report').val();
- var periodId = $('#period').val();
- var url = "openPreviewReport.action?reportId=" + reportId + "&periodId=" + periodId + "&sheetId=1";
-
-
- if ( byId('advancedCheck').checked ) {
+ var url = "openPreviewReport.action?reportId=" + $('#report').val() + "&periodId=" + $('#period').val() + "&sheetId=1";
+
+ if ( byId('availableOrgunitGroups') != null ) {
url = url + "&orgunitGroupId=" + byId('availableOrgunitGroups').value;
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2009-10-09 08:16:09 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/preview.js 2009-10-12 09:32:38 +0000
@@ -4,6 +4,28 @@
globalReportId = 0;
globalPeriodId = 0;
+function getNoSheetsOfReportExcel( reportId ) {
+
+ if ( reportId == '-1' ) {
+ clearListById('sheetNoExcelFile');
+ }
+ else {
+ $.post("getListSheet.action", {
+ reportId:reportId
+ }, function ( xmlObject ) {
+ clearListById('sheetNoExcelFile');
+ xmlObject = xmlObject.getElementsByTagName('sheets')[0];
+ nodes = xmlObject.getElementsByTagName('sheet');
+ for (var i = 0 ; i < nodes.length ; i++)
+ {
+ var id = nodes[i].getElementsByTagName('id')[0].firstChild.nodeValue;
+ var name = nodes[i].getElementsByTagName('name')[0].firstChild.nodeValue;
+ addOptionToList(document.getElementById('sheetNoExcelFile'), id, name);
+ }
+ }, "xml");
+ }
+}
+
function previewReport(reportId, periodId, sheetId, orgunitGroupId, message) {
var url = "reportId="+reportId+"&periodId="+periodId+"&sheetId="+sheetId;
@@ -16,25 +38,27 @@
url = "previewReportExcel.action?" + url;
}
- globalReportId = reportId;
- globalPeriodId = periodId;
-
setMessage(message);
+ disable('sheetNoExcelFile');
var request = new Request();
request.setResponseTypeXML( 'reportXML' );
request.setCallbackSuccess( previewReportReceived );
request.send( url );
+
}
function previewReportReceived( reportXML ) {
setMergedNumberForEachCell( reportXML );
exportFromXMLtoHTML( reportXML );
+
+ hideMessage();
+ enable('sheetNoExcelFile');
}
function setMergedNumberForEachCell( parentElement ) {
-
+
aKey = new Array();
aMerged = new Array();
@@ -61,20 +85,13 @@
function exportFromXMLtoHTML( parentElement ) {
var _index = 0;
- var _sHTML = "";
+ var _sHTML = "<table>";
var _sPattern = "";
var _rows = new Array();
var _cols = new Array();
var _sheets = parentElement.getElementsByTagName( 'sheet' );
var _title = parentElement.getElementsByTagName( 'name' )[0].firstChild.nodeValue;
-
- _sHTML =
- "<html><head><title>"+_title+"<title>"
- +"<link rel='stylesheet' type='text/css' href='style/previewStyle.css'/></head>"
- +"<body><table>";
-
- document.write(_sHTML);
-
+
for (var s = 0 ; s < _sheets.length ; s ++) {
_rows = _sheets[s].getElementsByTagName( 'row' );
@@ -82,7 +99,7 @@
for (var i = 0 ; i < _rows.length ; i ++) {
_index = 0;
- document.write("<tr>");
+ _sHTML = _sHTML + "<tr>";
_cols = _rows[i].getElementsByTagName( 'col' );
@@ -93,7 +110,7 @@
// Printing out the unformatted cells
for (; _index < _number ; _index ++) {
- document.write("<td/>");
+ _sHTML = _sHTML + "<td/>";
}
if ( _index == _number ) {
@@ -110,23 +127,42 @@
j = Number(j) + Number(_no_of_merged_cell);
_index = Number(_index) + Number(_no_of_merged_cell);
- document.write("<td align='" + _align + "' colspan='" + _no_of_merged_cell) ;
+ _sHTML = _sHTML + "<td align='" + _align + "' colspan='" + _no_of_merged_cell;
if ( isNaN(_sData) == false ) {
- document.write("' class='formatNumber");
+ _sHTML = _sHTML + "' class='formatNumber";
}
- document.write("'>"+ _sData + "</td>");
+ _sHTML = _sHTML + "'>"+ _sData + "</td>";
}
}
- document.write("</tr>");
+ _sHTML = _sHTML + "</tr>";
}
- document.write("<br/>");
+ _sHTML = _sHTML + "<br/>";
}
- document.write("</table></body></html>");
+ _sHTML = _sHTML + "</table>";
+
+ document.getElementById("previewContentDiv").innerHTML = _sHTML;
window.status= "DATAWARE HOUSE - "+ _title;
window.stop();
}
// END OF Previewed Report Excel //
+/**
+ * Clears the list.
+ *
+ * @param listId the id of the list.
+ */
+function clearListById( listId ) {
+ var list = document.getElementById( listId );
+ clearList( list );
+}
+
+/**
+ * Clears the list.
+ * @param list the list.
+ */
+function clearList( list ) {
+ list.options.length = 0;
+}
\ No newline at end of file
=== 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-09 06:06:43 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/reportparams.vm 2009-10-12 09:32:38 +0000
@@ -50,7 +50,7 @@
<br>
<hr>
<p>
-<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" value='$i18n.getString( "preview_report" )' onclick="javascript: generic_type = 'preview'; openPreviewReport();" #if(!$organisationUnit) disabled #end/>
<input name="generate_report" id="generate_report" type="button" onClick="generateReportExcel()" value='$i18n.getString( "generate_report" )' #if(!$organisationUnit) disabled #end/>
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseSheets.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseSheets.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/responseSheets.vm 2009-10-12 09:32:38 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sheets>
+ <sheet>
+ <id>-1</id>
+ <name>[$!i18n.getString("all")]</name>
+ </sheet>
+ #foreach($sheet in $sheets)
+ <sheet>
+ <id>$sheet</id>
+ <name>$sheet</name>
+ </sheet>
+ #end
+</sheets>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/style/previewStyle.css'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/style/previewStyle.css 2009-10-07 10:20:08 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/style/previewStyle.css 2009-10-12 09:32:38 +0000
@@ -31,3 +31,14 @@
margin:60%;
text-align:center;
}
+
+/* label sector
+-----------------------------------------*/
+
+ label.formatLabel {
+ color:red;
+ font-weight:bold;
+ text-transform:uppercase;
+ text-decoration:blink;
+
+ }
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/viewReportPreview.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/viewReportPreview.vm 2009-09-30 07:03:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/viewReportPreview.vm 2009-10-12 09:32:38 +0000
@@ -1,6 +1,22 @@
-<body onload="javascript: previewReport('$!reportId', '$!periodId', '$!sheetId', '$!i18n.getString("working_in_progress")');">
-
- <span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="hideById(this.id);"></span>
-
-</body>
\ No newline at end of file
+<div id="showSheetDiv">
+ <table>
+ <tr>
+ <td><label class='formatLabel'>$i18n.getString('sheet_of_excel_file')</label></td>
+ <td>
+ <select id="sheetNoExcelFile" name="sheetNoExcelFile" onchange="javascript: previewReport('$!reportId', '$!periodId', this.value, '$!orgunitGroupId', '$!i18n.getString("working_in_progress")');">
+ </select>
+ </td>
+ </tr>
+ </table>
+</div>
+<br/>
+<div id="previewContentDiv">
+</div>
+
+<span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="hideById(this.id);"/>
+
+<script>
+ getNoSheetsOfReportExcel( '$!reportId' );
+ previewReport('$!reportId', '$!periodId', '$!sheetId', '$!orgunitGroupId', '$!i18n.getString("working_in_progress")');
+</script>
\ No newline at end of file