dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03503
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1176: Fix bug: Excel reports - Can't show dataelements into Category group.
------------------------------------------------------------
revno: 1176
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Mon 2009-12-07 16:08:23 +0700
message:
Fix bug: Excel reports - Can't show dataelements into Category group.
modified:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.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-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js 2009-12-04 09:37:23 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js 2009-12-07 09:08:23 +0000
@@ -234,22 +234,19 @@
sheetId = byId("targetSheetNo").value;
var message = '';
-
- if ( sheetId < 1 )
- {
- message = i18n_input_sheet_no;
- }
- if ( byId("targetReport").value == -1 )
- {
- message += "<br/>" + i18n_choose_report;
- }
-
- if ( message.length > 0 )
- {
+ if(sheetId < 1){
+ message = input_sheet_no;
+ }
+ if(byId("targetReport").value == -1){
+ message += "<br>"+ choose_report;
+ }
+
+ if(message.length > 0){
setMessage(message);
return;
}
+ if(byId("targetReport").value)
reportItemsCurTarget = null;
reportItemsDuplicated = null;
@@ -260,17 +257,14 @@
var request = new Request();
request.setResponseTypeXML( 'xmlObject' );
request.setCallbackSuccess( validateCopyReportItemsReceived );
-
var param = "reportId=" + byId("targetReport").value;
param += "&sheetNo=" + sheetId;
-
request.sendAsPost(param);
request.send("getReportExcelItems.action");
}
-function validateCopyReportItemsReceived( data ) {
-
+function validateCopyReportItemsReceived(data){
var items = data.getElementsByTagName('reportItem');
for (var i = 0 ; i < items.length ; i ++)
@@ -279,7 +273,6 @@
}
splitDuplicatedReportItems();
-
saveCopyItems();
}
@@ -294,7 +287,6 @@
reportItems = new Array();
for (var i = 0 ; i < listRadio.length ; i++) {
-
if ( listRadio.item(i).checked ) {
reportItemsChecked.push( listRadio.item(i).getAttribute("reportItemID") + "#" + listRadio.item(i).getAttribute("reportItemName"));
}
@@ -322,8 +314,6 @@
}
}
-warningMessage = "";
-
function saveCopyItems() {
var warningMessage = " ======= Sheet [" + sheetId + "] =======<br/>";
@@ -352,21 +342,28 @@
// do copy and prepare the message notes
if ( reportItems.length > 0 ) {
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( saveCopyItemsReceived );
-
- var params = "reportId=" + byId("targetReport").value;
- params += "&sheetId=" + sheetId;
-
- for (var i in reportItems)
- {
- params += "&reportItems=" + reportItems[i];
- }
-
- request.sendAsPost(params);
- request.send( "copyReportExcelItems.action");
-
+ $.post("copyReportExcelItems.action",
+ {
+ reportId:$("#targetReport").val(),
+ sheetNo:sheetId,
+ reportItems:reportItems
+ },
+ function (data)
+ {
+ var data = data.getElementsByTagName("message")[0];
+ var type = data.getAttribute("type");
+
+ if ( type == "success" ) {
+
+ warningMessage +=
+ "<br/><b>[" + (reportItems.length) + "/" + (iReportItemsChecked) + "]</b>:: "
+ + i18n_copy_successful
+ + "<br/>======================<br/><br/>";
+ }
+
+ setMessage( warningMessage );
+
+ },'xml');
}
// If have no any ReportItem(s) will be copied
// and also have ReportItem(s) in Duplicating list
@@ -375,26 +372,10 @@
setMessage( warningMessage );
}
- hideById("copyTo");
+ $("#copyTo").hide();
deleteDivEffect();
}
-function saveCopyItemsReceived (message) {
-
- var type = message.getAttribute("type");
-
- if ( type == "success" ) {
-
- warningMessage +=
- "<br/><b>[" + (reportItems.length) + "/" + (iReportItemsChecked) + "]</b>:: "
- + i18n_copy_successful
- + "<br/>======================<br/><br/>";
- }
-
- setMessage( warningMessage );
-
-}
-
/**
* Open dataelement expression
@@ -428,7 +409,7 @@
*/
function getDataElementsByGroup( )
-{
+{
var dataElementGroupId = $("#dataElementGroup").val();
var url = "../dhis-web-commons-ajax/getDataElements.action?id=" + $("#dataElementGroup").val();
@@ -445,7 +426,7 @@
dataElementList.options.length = 0;
var dataelements = xmlObject.getElementsByTagName( "dataElement" );
-
+
for ( var i = 0; i < dataelements.length; i++)
{
var id = dataelements[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
@@ -577,7 +558,7 @@
var request = new Request();
request.setResponseTypeXML( 'xmlObject' );
request.setCallbackSuccess( getDataElementGroupOrderReceived );
- request.send("getReportExcel.action?id=" + reportId);
+ request.send("getDataElementGroupOrder.action?id=" + $("#dataElementGroup_").val());
}
@@ -585,6 +566,7 @@
var availableDataElements = document.getElementById('availableDataElements_');
availableDataElements.options.length = 0;
var dataelEments = data.getElementsByTagName( "dataElement" );
+
for ( var i = 0; i < dataelEments.length; i++ )
{
var id = dataelEments[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;