123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194 |
- function CTemplateDialog(sXtsName, sReportTemplateSearchPath)
- {
- this.m_sXtsName = sXtsName;
- this.m_sReportTemplateSearchPath = sReportTemplateSearchPath;
- this.m_oCF = getConfigFrame();
- this.init();
- };
- CTemplateDialog.prototype.execute = function()
- {
-
- var cmd = "OL:";
- if (this.isTemplateSelected())
- {
- cmd += this.m_oCF.escapeParam(document.f.templateSearchPath.value);
- }
- this.m_oCF.addColumnsForReselection();
- if (document.f.resetStyles.checked)
- {
- cmd += ";ZR";
- }
- this.m_oCF.sendCmd(cmd, "", true);
- this.m_oCF.hideDialogFrame();
- };
- CTemplateDialog.prototype.init = function()
- {
- if (typeof document.getElementById("loadingIcon") === "object"
- && document.getElementById("loadingIcon") !== null
- && typeof document.getElementById("loadingContainer") === "object" && document.getElementById("loadingContainer") !== null)
- {
- document.getElementById("loadingIcon").src = this.m_oCF.TREE_LOADING;
- document.getElementById("loadingContainer").appendChild(document.createTextNode(this.m_oCF.PMT_TRE_TREE_LOADING));
- if (typeof attachMouseEvents === "function")
- {
- attachMouseEvents();
- }
- if (this.m_oCF)
- {
- if(typeof this.m_oCF.showDialogFrame == "function")
- {
- this.m_oCF.showDialogFrame(245);
- }
- if (this.m_sReportTemplateSearchPath)
- {
- this.m_oCF.dlgGlobalSetParm('sReportTemplateSearchPath', this.m_sReportTemplateSearchPath);
- }
- else
- {
- this.m_sReportTemplateSearchPath = this.m_oCF.dlgGlobalGetParm('sReportTemplateSearchPath');
- }
- if (this.m_sReportTemplateSearchPath !== "" && this.m_sReportTemplateSearchPath !== null)
- {
- this.setTemplateSelected(true);
- }
- }
- this.sendRequestForPath();
- }
- };
- CTemplateDialog.prototype.sendRequestForPath = function()
- {
- var url = "m=/" + this.m_oCF.qs_dir + "/reportTemplateRequest.xts&b_action=xts.run";
- var sPath = this.m_sReportTemplateSearchPath;
- if (!sPath)
- {
- sPath = this.m_oCF.dlgGlobalGetParm('sReportTemplateSearchPath');
- }
- if (sPath !== "" && sPath !== null)
- {
- url += "&xxPath=" + encodeURIComponent(sPath);
- }
- if (this.m_oCF.cafContextId !== "")
- {
- url += "&ui.cafcontextid=" + this.m_oCF.cafContextId;
- }
- this.m_oCF.sendDispatcherRequest(url, this.processResponse);
- };
- CTemplateDialog.prototype.processResponse = function(response)
- {
- var htmlMatch = response.match(/<HTML>/i);
- if (htmlMatch && (htmlMatch.length >= 1))
- {
- document.write(response);
- document.close();
- return;
- }
-
-
- eval(response);
-
- var sSearchPath = responseArray[0];
- var sFolderName = responseArray[1];
- document.f.templateSearchPath.value = sSearchPath;
-
-
- var oContents = document.getElementById("pathContents");
- if (oContents.lastChild)
- {
- oContents.removeChild(oContents.lastChild);
- }
- oContents.appendChild(document.createTextNode(sFolderName));
-
- document.getElementById("pathContainer").style.display = "inline";
- var loadingContainer = document.getElementById("loadingContainer");
- loadingContainer.parentNode.removeChild(loadingContainer);
- };
- CTemplateDialog.prototype.selectTmpl = function()
- {
- this.m_oCF.cfgSet("LAST_DIALOG", "reportTemplate");
- this.m_oCF.dlgReset();
- this.m_oCF.dlgSetParm("m", "portal/select/select.xts");
- this.m_oCF.dlgSetParm("so.select", "reportTemplate.query");
- this.m_oCF.dlgSetParm("so.defaultObject", encodeURIComponent(document.f.templateSearchPath.value));
- if (document.f.templateSearchPath.value)
- {
- this.m_oCF.dlgSetParm("so.defaultLocation", encodeURIComponent(document.f.templateSearchPath.value.replace(/\WreportTemplate.*/g, "")));
- }
- else
- {
- this.m_oCF.dlgSetParm("so.defaultLocation", this.m_oCF.cfgGet("ReportFolder"));
- }
- this.m_oCF.dlgSetParm("so.return.m", "/" + this.m_oCF.qs_dir + "/" + this.m_sXtsName);
- this.m_oCF.dlgSubmit();
- this.m_oCF.showDialogFrame(290);
- };
- CTemplateDialog.prototype.isTemplateSelected = function()
- {
- var bTemplateSelected = false
- if (typeof document.f === "object" && typeof document.f.templateMode === "object")
- {
- if (typeof document.f.templateMode[0] === "object")
- {
-
- bTemplateSelected = document.f.templateMode[1].checked;
- }
- else
- {
-
- bTemplateSelected = document.f.templateMode
- }
- }
- return bTemplateSelected;
- };
- CTemplateDialog.prototype.setTemplateSelected = function(bSelected)
- {
- if (typeof document.f === "object" && typeof document.f.templateMode === "object")
- {
- if (typeof document.f.templateMode[0] === "object")
- {
-
- document.f.templateMode[1].checked = bSelected;
- }
- else
- {
-
- document.f.templateMode.checked = bSelected;
- }
- }
- };
|