4
function runAndViewReport( reportId, reportUrl )
6
var url = "reCreateTable.action?id=" + reportId + "&mode=report";
8
if ( document.getElementById( "reportingPeriod" ) != null )
10
url += "&reportingPeriod=" + getListValue( "reportingPeriod" );
13
if ( document.getElementById( "parentOrganisationUnitId" ) != null )
15
url += "&parentOrganisationUnitId=" + getListValue( "parentOrganisationUnitId" );
18
if ( document.getElementById( "organisationUnitId" ) != null )
20
url += "&organisationUnitId=" + getListValue( "organisationUnitId" );
25
var request = new Request();
26
request.setCallbackSuccess( runAndViewReportReceived );
30
function runAndViewReportReceived( messageElement )
35
function getReportStatus()
37
var url = "getStatus.action";
39
var request = new Request();
40
request.setResponseTypeXML( "status" );
41
request.setCallbackSuccess( reportStatusReceived );
45
function reportStatusReceived( xmlObject )
47
var statusMessage = getElementValue( xmlObject, "statusMessage" );
48
var finished = getElementValue( xmlObject, "finished" );
50
if ( finished == "true" )
52
setMessage( i18n_process_completed );
54
viewReport( tempUrl );
56
else if ( statusMessage == null )
58
setMessage( i18n_please_wait );
60
waitAndGetReportStatus( 2000 );
64
setMessage( i18n_please_wait + ". " + statusMessage + "..." );
66
waitAndGetReportStatus( 2000 );
70
function waitAndGetReportStatus( millis )
72
setTimeout( "getReportStatus();", millis );
75
function viewReport( url )
77
var dialog = window.open( url, "_blank", "directories=no, height=800, width=800, \
78
location=no, menubar=no, status=no, toolbar=no, resizable=yes, scrollbars=yes" );
83
selectAllById( "selectedReportTables" );
85
document.getElementById( "reportForm" ).submit();
88
function removeReport( id )
90
var dialog = window.confirm( i18n_confirm_remove_report );
94
window.location.href = "removeReport.action?id=" + id;
98
function addToDashboard( id )
100
var dialog = window.confirm( i18n_confirm_add_to_dashboard );
104
var request = new Request();
105
request.send( "addReportToDashboard.action?id=" + id );