dojo.provide("kfc.report.BIPReport");
dojo.require("kfc.report._BIPReport");
dojo.require("kfc.kca._KCA");
dojo.declare("kfc.report.BIPReport", [kfc.report._BIPReport,kfc.kca._KCA], {
constructor: function() {
}
,templateString: dojo.cache("kfc.report","templates/BIPReport.html")
,server: 'http://ora07.knouse.com:9704/xmlpserver'
,folder: ''
,convertLinksAfterRun: false
/*
* Not using widgets here, it's pretty simple, don't need the overhead
,widgetsInTemplate: true
*/
// Maybe need to keep track of if the report was already run so we don't keep re-running it? Or let the calling function handle that? Probably calling...
,onBeforeRun: function() {
this.setData("
");
this.inherited(arguments);
}
,onAfterRun: function(p_report) {
this.setData(p_report);
if(this.convertLinksAfterRun) {
this.convertLinks();
}
// this.rptContainer.innerHTML = p_report;
}
,throwError: function(e) {
// Somehow check for status 500? Handle it more cleanly???
this.setData("An Error Ocurred...
");
this.inherited(arguments);
}
,convertLinks: function() {
var w = (this.rptContainer.contentWindow || this.rptContainer.documentWindow);
this.inherited('convertLinks',arguments,[w]);
}
,setData: function(d) {
var w = (this.rptContainer.contentWindow || this.rptContainer.documentWindow);
w.document.open();
w.document.write(d);
w.document.close();
}
,showReport: function() {
var w = (this.rptContainer.contentWindow || this.rptContainer.documentWindow);
// If plugin exists, it will load in this window
//this.setData('You may close this window.');
var f = dojo.create('form',{'method':'POST','action':this.reportFile});
var p = this.getParamObj();
var i = dojo.create('input',{'type':'hidden','name':'P_PARAMS','value':dojo.toJson(p)});
dojo.place(i,f);
i = dojo.create('input',{'type':'hidden','name':'P_REPORT','value':this.report});
dojo.place(i,f);
i = dojo.create('input',{'type':'hidden','name':'P_TEMPLATE','value':this.template});
dojo.place(i,f);
i = dojo.create('input',{'type':'hidden','name':'P_OUTPUT','value':this.output});
dojo.place(i,f);
/*
for(var o in p) {
var i = dojo.create('input',{'type':'hidden','name':o,'value':p[o]});
dojo.place(i,f);
}
*/
// Form must exist on the document in order to be submitted
dojo.place(f,w.document.body);
f.submit();
// Should we try to close the window?
// Can't close the window until the report finishes and we have no way of knowing.
}
,openReport: function() {
/*
http://ora07.knouse.com:9704/xmlpserver/KWO/Reports/test.xdo?_xpf=&_xpt=0&_xdo=%2FKWO%2FReports%2Ftest.xdo&_xmode=&_paramsNew_Parameter_2=&_paramsP_WO_NO=&_xt=KWOINV01&_xf=analyze&_xana=view
*/
var p = this.getParamObj();
var url = this.server+'/'+this.folder+'/Reports/'+this.report+
'.xdo?_xpf=&_xpt=0&_xdo=%2F'+this.folder+'%2FReports%2F'+this.report+
'.xdo&_xmode=2';
// xmode = 2 will display parameters + links
// xmode = 1 will show the report only + links
// xmode = 0 will be the full blown bip app (DO NOT USE)
// xmode = 4 will show the report only (no links, no parameters)
for(n in p) {
url += '&_params'+n+'='+p[n];
}
url += '&_xt='+this.template;
url += '&_xf=html&_xana=view';
// xf values are:
// analyze (interactive), html, pdf, rtf, excel, data
url += '&id=apiuser&passwd=apiuser';
this.rptContainer.src = url;
this.rptContainer.style.height = "99%";
this.rptContainer.style.width = "99%";
}
});