newwebdev
06-12-2003, 05:51 AM
Hi, I have a appl that opens a main window which I can click a button to run reports from a pop up search screen.
Steps to run reports.
MAIN APPLICATION WINDOW
click (REPORTS)
click (EMPOLYEE MASTER EMPLOYEE LIST)
click run button. Runs the report process, which opens a pop up window and displays a PDF report(file).
Run the report again, which opens a second pop up and displays a PDF report(file).
Close first report using the X.
Close search screen using the X.
The closing process seems to close the two pop up windows, but leaves a window tab on the bottom of the main window. Right click on the tab and End Program Second report window displays with program not responding. If you click End Now it closes down the window and the main application.
This close process seems to work if you close both report windows or report window 2 only.
report.html
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="SAPIEN Technologies PrimalSCRIPT(TM)">
<TITLE>SLDCADA Report</TITLE>
</HEAD>
<BODY leftMargin="0" topMargin="0" onload="
var cnt = opener.objectcache.currentRpt.opencnt;
var rptwindow = opener.objectcache.currentRpt.myWindowObjects[cnt];
rptwindow.document.title =opener.objectcache.currentRpt.myWindows[cnt];
document.getElementById('reportIframe').src = '../servlet/DisplayPDF.pdf?report=' + opener.objectcache.currentRpt.rptname;
//document.getElementById('reportIframe').src = '../servlet/DisplayPDF.pdf?report=' + opener.objectcache.currentRpt.rptname +'&d=.pdf';
opener.objectcache.currentRpt.opencnt = cnt + 1;" onunload="
opener.objectcache.currentRpt.myWindows.length = opener.objectcache.currentRpt.myWindows.length -1;
">
<IFRAME id="reportIframe" style="width:100%; height:100%"/>
</BODY>
</HTML>
****** My Javascript that creates these windows
//alert('final xml ' +xmldoc.xml);
this.xmldoc = xmldoc;
this.OpenPDFName();
var rpturl = this.rptname + '.do';
rpthttp = this.rptxmlhttp;
rpthttp.Open("POST", rpturl, true);
this.rptStartprogress();
rpthttp.OnReadyStateChange = this.rptcreate;
objectcache.currentRpt = this;
rpthttp.Send(this.xmldoc);
}
//**************************************************************
// Function rptcreate
//
// Purpose:
//**************************************************************
sldReport.prototype.rptcreate =
function ()
{
if (rpthttp.readyState == 4)
{
var result = rpthttp.responseXML;
try
{
if (result.selectSingleNode("/ROWSET").text == "DONE")
{
//alert('2 rptcreate result Done ' +result.selectSingleNode("/ROWSET").text );
// Create Window
objectcache.currentRpt.myWindowObjects[objectcache.currentRpt.opencnt]= window.open("reports/report.html", objectcache.currentRpt.pdfviewname,"resizable=yes,width=800,height=600,left=0,top=0");
objectcache.currentRpt.myWindowObjects[objectcache.currentRpt.opencnt].xmlObj = objectcache.currentRpt;
objectcache.currentRpt.myWindows[objectcache.currentRpt.opencnt]= objectcache.currentRpt.titletime;
// Stop progress indicator
objectcache.currentRpt.stopLight.src="common/images/sl_g.gif";
objectcache.currentRpt.statVerbage.innerHTML="Done";
objectcache.currentRpt.divClock('stop', objectcache.currentRpt.ET);
}
else if (result.selectSingleNode("/ROWSET").text == "ERROR")
{
alert('An error has occurred in the database. Could not generate report');
}
}
catch (ex)
{
alert('An error has occurred. Could not generate report');
objectcache.currentRpt.stopLight.src="common/images/sl_g.gif";
objectcache.currentRpt.statVerbage.innerHTML="Done";
objectcache.currentRpt.divClock('stop', objectcache.currentRpt.ET);
}
} // end if this.rptxmlhttp
else
{
//alert('other '+rptxmlhttp.readyState);
}
}
******* My Javascript Function for leave
//**************************************************************
// Function leave
//
// Purpose: Handle window close or navigation
//**************************************************************
sldReport.prototype.leave =
function ()
{
if (objectcache.currentRpt.openClosecnt < objectcache.currentRpt.opencnt)
{
var agree=confirm("Do you wish to close the open Report Windows?");
if (agree)
{
for(var i=0;i<objectcache.currentRpt.myWindowObjects.length;i++)
{
if(!objectcache.currentRpt.myWindowObjects[i].closed)
//if(objectcache.currentRpt.myWindowObjects[i] && !objectcache.currentRpt.myWindowObjects[i].closed)
{
// close PDF files
objectcache.currentRpt.myWindowObjects[i].close();
objectcache.currentRpt.myWindowObjects[i] = null;
}
objectcache.currentRpt.myWindowObjects[i] = null;
}
}
}
return "You may have attempted to open this report again from SLDCADA,alternatively another action attempted to close or navigate to a new page.";
}
Any help would be great.
Thanks,
Steps to run reports.
MAIN APPLICATION WINDOW
click (REPORTS)
click (EMPOLYEE MASTER EMPLOYEE LIST)
click run button. Runs the report process, which opens a pop up window and displays a PDF report(file).
Run the report again, which opens a second pop up and displays a PDF report(file).
Close first report using the X.
Close search screen using the X.
The closing process seems to close the two pop up windows, but leaves a window tab on the bottom of the main window. Right click on the tab and End Program Second report window displays with program not responding. If you click End Now it closes down the window and the main application.
This close process seems to work if you close both report windows or report window 2 only.
report.html
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="SAPIEN Technologies PrimalSCRIPT(TM)">
<TITLE>SLDCADA Report</TITLE>
</HEAD>
<BODY leftMargin="0" topMargin="0" onload="
var cnt = opener.objectcache.currentRpt.opencnt;
var rptwindow = opener.objectcache.currentRpt.myWindowObjects[cnt];
rptwindow.document.title =opener.objectcache.currentRpt.myWindows[cnt];
document.getElementById('reportIframe').src = '../servlet/DisplayPDF.pdf?report=' + opener.objectcache.currentRpt.rptname;
//document.getElementById('reportIframe').src = '../servlet/DisplayPDF.pdf?report=' + opener.objectcache.currentRpt.rptname +'&d=.pdf';
opener.objectcache.currentRpt.opencnt = cnt + 1;" onunload="
opener.objectcache.currentRpt.myWindows.length = opener.objectcache.currentRpt.myWindows.length -1;
">
<IFRAME id="reportIframe" style="width:100%; height:100%"/>
</BODY>
</HTML>
****** My Javascript that creates these windows
//alert('final xml ' +xmldoc.xml);
this.xmldoc = xmldoc;
this.OpenPDFName();
var rpturl = this.rptname + '.do';
rpthttp = this.rptxmlhttp;
rpthttp.Open("POST", rpturl, true);
this.rptStartprogress();
rpthttp.OnReadyStateChange = this.rptcreate;
objectcache.currentRpt = this;
rpthttp.Send(this.xmldoc);
}
//**************************************************************
// Function rptcreate
//
// Purpose:
//**************************************************************
sldReport.prototype.rptcreate =
function ()
{
if (rpthttp.readyState == 4)
{
var result = rpthttp.responseXML;
try
{
if (result.selectSingleNode("/ROWSET").text == "DONE")
{
//alert('2 rptcreate result Done ' +result.selectSingleNode("/ROWSET").text );
// Create Window
objectcache.currentRpt.myWindowObjects[objectcache.currentRpt.opencnt]= window.open("reports/report.html", objectcache.currentRpt.pdfviewname,"resizable=yes,width=800,height=600,left=0,top=0");
objectcache.currentRpt.myWindowObjects[objectcache.currentRpt.opencnt].xmlObj = objectcache.currentRpt;
objectcache.currentRpt.myWindows[objectcache.currentRpt.opencnt]= objectcache.currentRpt.titletime;
// Stop progress indicator
objectcache.currentRpt.stopLight.src="common/images/sl_g.gif";
objectcache.currentRpt.statVerbage.innerHTML="Done";
objectcache.currentRpt.divClock('stop', objectcache.currentRpt.ET);
}
else if (result.selectSingleNode("/ROWSET").text == "ERROR")
{
alert('An error has occurred in the database. Could not generate report');
}
}
catch (ex)
{
alert('An error has occurred. Could not generate report');
objectcache.currentRpt.stopLight.src="common/images/sl_g.gif";
objectcache.currentRpt.statVerbage.innerHTML="Done";
objectcache.currentRpt.divClock('stop', objectcache.currentRpt.ET);
}
} // end if this.rptxmlhttp
else
{
//alert('other '+rptxmlhttp.readyState);
}
}
******* My Javascript Function for leave
//**************************************************************
// Function leave
//
// Purpose: Handle window close or navigation
//**************************************************************
sldReport.prototype.leave =
function ()
{
if (objectcache.currentRpt.openClosecnt < objectcache.currentRpt.opencnt)
{
var agree=confirm("Do you wish to close the open Report Windows?");
if (agree)
{
for(var i=0;i<objectcache.currentRpt.myWindowObjects.length;i++)
{
if(!objectcache.currentRpt.myWindowObjects[i].closed)
//if(objectcache.currentRpt.myWindowObjects[i] && !objectcache.currentRpt.myWindowObjects[i].closed)
{
// close PDF files
objectcache.currentRpt.myWindowObjects[i].close();
objectcache.currentRpt.myWindowObjects[i] = null;
}
objectcache.currentRpt.myWindowObjects[i] = null;
}
}
}
return "You may have attempted to open this report again from SLDCADA,alternatively another action attempted to close or navigate to a new page.";
}
Any help would be great.
Thanks,