| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874 |
- /* Copyright (c) Business Objects 2006. All rights reserved. */
- if (typeof bobj.crv.PrintUI == 'undefined') {
- bobj.crv.PrintUI = {};
- }
- if (typeof bobj.crv.ExportUI == 'undefined') {
- bobj.crv.ExportUI = {};
- }
- if (typeof bobj.crv.ErrorDialog == 'undefined') {
- bobj.crv.ErrorDialog = {};
- }
- if (typeof bobj.crv.ReportProcessingUI == 'undefined') {
- bobj.crv.ReportProcessingUI = {};
- }
- /*
- ================================================================================
- PrintUI
- ================================================================================
- */
- bobj.crv.newPrintUI = function(kwArgs) {
- if (!kwArgs.id) {
- kwArgs = MochiKit.Base.update({id: bobj.uniqueId()}, kwArgs);
- }
-
- var lbl = kwArgs.submitBtnLabel;
- if (!lbl) {
- lbl = L_bobj_crv_submitBtnLbl;
- }
-
- var infoTitle = kwArgs.infoTitle;
- if (!infoTitle) {
- infoTitle = L_bobj_crv_PrintInfoTitle;
- }
-
- var dialogTitle = kwArgs.dialogTitle;
- if (!dialogTitle) {
- if (kwArgs.isActxPrinting) {
- dialogTitle = L_bobj_crv_ActiveXPrintDialogTitle;
- }
- else {
- dialogTitle = L_bobj_crv_PDFPrintDialogTitle;
- }
- }
-
- var infoMsg = kwArgs.infoMsg;
- if (!infoMsg) {
- infoMsg = L_bobj_crv_PrintInfo1;
- infoMsg += '\n';
- infoMsg += L_bobj_crv_PrintInfo2;
- }
-
- var o = newDialogBoxWidget(kwArgs.id + '_dialog',
- dialogTitle,
- 250,
- 100,
- null,
- bobj.crv.PrintUI._cancel,
- false);
-
- o.actxId = o.id + '_actx';
- o.actxContainerId = o.id + '_actxdiv';
- o._processingPrinting = false;
- o._initOld = o.init;
- o._showOld = o.show;
-
- if (!kwArgs.isActxPrinting) {
- o._fromBox = newIntFieldWidget(o.id + "_fromBox",
- null,
- null,
- null,
- null,
- true,
- '',
- 50);
- o._fromBox.setDisabled = bobj.crv.PrintUI.disabledTextFieldWidget;
- o._toBox = newIntFieldWidget(o.id + "_toBox",
- null,
- null,
- null,
- null,
- true,
- '',
- 50);
- o._toBox.setDisabled = bobj.crv.PrintUI.disabledTextFieldWidget;
-
- o._submitBtn = newButtonWidget(o.id + "_submitBtn",
- lbl,
- MochiKit.Base.bind(bobj.crv.PrintUI._submitBtnCB, o));
-
- o._allRadio = newRadioWidget(o.id + "_allRadio",
- o.id + "_grp",
- L_bobj_crv_PrintAllLbl,
- MochiKit.Base.bind(bobj.crv.PrintUI.disabledPageRange ,o, true));
-
- o._rangeRadio = newRadioWidget(o.id + "_rangeRadio",
- o.id + "_grp",
- L_bobj_crv_PrintPagesLbl,
- MochiKit.Base.bind(bobj.crv.PrintUI.disabledPageRange ,o, false));
-
- o._optionsFrame = newFrameZoneWidget(o.id + "_optionsFrame", 250);
-
- if (!kwArgs.isExporting) {
- o._info = newInfoWidget(o.id + "_info",
- infoTitle,
- null,
- infoMsg,
- 100 );
- }
- }
-
- o.widgetType = 'PrintUI';
-
- // Update instance with constructor arguments
- bobj.fillIn(o, kwArgs);
-
- // Update instance with member functions
- MochiKit.Base.update(o, bobj.crv.PrintUI);
-
- return o;
- };
- bobj.crv.PrintUI.disabledTextFieldWidget = function(disabled)
- {
- TextFieldWidget_setDisabled.call(this,disabled);
-
- if(disabled)
- {
- MochiKit.DOM.addElementClass(this.layer, "textDisabled");
- }
- else {
- MochiKit.DOM.removeElementClass(this.layer, "textDisabled");
- }
- }
- bobj.crv.PrintUI.disabledPageRange = function(bool)
- {
- if(this._fromBox && this._toBox)
- {
- this._fromBox.setDisabled(bool);
- this._toBox.setDisabled(bool);
- }
- }
- bobj.crv.PrintUI._submitBtnCB = function() {
- var start = null;
- var end = null;
- if (this._rangeRadio.isChecked()) {
- start = parseInt(this._fromBox.getValue(), 10);
- end = parseInt(this._toBox.getValue(), 10);
-
- if (!start || !end || (start < 0) || (start > end)) {
- alert(L_bobj_crv_PrintPageRangeError);
- return;
- }
- }
-
- if (this.widgetType == 'PrintUI') {
- MochiKit.Signal.signal(this, 'printSubmitted', start, end);
- }
- else {
- MochiKit.Signal.signal(this, 'exportSubmitted', start, end, this._comboBox.getSelection().value);
- }
-
- this.show(false);
- };
- bobj.crv.PrintUI._getRPSafeURL = function(url) {
- if (!url) {
- return;
- }
-
- if (url.indexOf('/') === 0) {
- return url;
- }
-
- var winLoc = window.location.href;
- var lPos = winLoc.lastIndexOf('/');
-
- if (lPos < 0) {
- return url;
- }
-
- winLoc = winLoc.substring(0, lPos);
- return winLoc + '/' + url;
- };
- bobj.crv.PrintUI._getObjectTag = function(postData) {
- var oa = [];
-
- oa.push('<OBJECT width="0" height="0" ID="');
- oa.push(this.actxId);
- oa.push('" CLASSID="CLSID:');
- oa.push(bobj.crv.ActxPrintControl_CLSID);
- oa.push('" CODEBASE="');
- oa.push(this._getRPSafeURL(this.codeBase));
- oa.push('#Version=');
- oa.push(bobj.crv.ActxPrintControl_Version);
- oa.push('" VIEWASTEXT>');
-
- oa.push('<PARAM NAME="PostBackData" VALUE="');
- oa.push(postData);
- oa.push('">');
-
- oa.push('<PARAM NAME="ServerResourceVersion" VALUE="');
- oa.push(bobj.crv.ActxPrintControl_Version);
- oa.push('">');
-
- if (this.lcid) {
- oa.push('<PARAM NAME="LocaleID" VALUE="');
- oa.push(this.lcid);
- oa.push('">');
- }
-
- if (this.url) {
- oa.push('<PARAM NAME="URL" VALUE="');
- oa.push(this._getRPSafeURL(this.url));
- oa.push('">');
- }
-
- if (this.title) {
- oa.push('<PARAM NAME="Title" VALUE="');
- oa.push(this.title);
- oa.push('">');
- }
-
- if (this.maxPage) {
- oa.push('<PARAM NAME="MaxPageNumber" VALUE="');
- oa.push(this.maxPage);
- oa.push('">');
- }
-
- if (this.paperOrientation) {
- oa.push('<PARAM NAME="PageOrientation" VALUE="');
- oa.push(this.paperOrientation);
- oa.push('">');
- }
-
- if (this.paperSize) {
- oa.push('<PARAM NAME="PaperSize" VALUE="');
- oa.push(this.paperSize);
- oa.push('">');
- }
-
- if (this.paperWidth) {
- oa.push('<PARAM NAME="PaperWidth" VALUE="');
- oa.push(this.paperWidth);
- oa.push('">');
- }
-
- if (this.paperLength) {
- oa.push('<PARAM NAME="PaperLength" VALUE="');
- oa.push(this.paperLength);
- oa.push('">');
- }
-
- if (this.driverName) {
- oa.push('<PARAM NAME="PrinterDriverName" VALUE="');
- oa.push(this.driverName);
- oa.push('">');
- }
-
- if (this.useDefPrinter) {
- oa.push('<PARAM NAME="UseDefaultPrinter" VALUE="');
- oa.push(this.useDefPrinter);
- oa.push('">');
- }
-
- if (this.useDefPrinterSettings) {
- oa.push('<PARAM NAME="UseDefaultPrinterSettings" VALUE="');
- oa.push(this.useDefPrinterSettings);
- oa.push('">');
- }
-
- if (this.sendPostDataOnce) {
- oa.push('<PARAM NAME="SendPostDataOnce" VALUE="');
- oa.push(this.sendPostDataOnce);
- oa.push('">');
- }
- oa.push('</OBJECT>');
-
- // Add waiting UI while the control is loading
- oa.push('<table id="')
- oa.push(this.actxId);
- oa.push('_wait" border="0" cellspacing="0" cellpadding="0" width="100%" ><tbody>');
- oa.push('<tr><td align="center" valign="top">');
-
- // Frame Zone
- var o = this;
- var zoneW=o.getContainerWidth()-10;
- var zoneH=o.getContainerHeight()-(2*o.pad+21+10);
- oa.push('<table class="waitdialogzone" style="');
- oa.push(sty("width",zoneW));
- oa.push(sty("height",zoneH));
- oa.push('" id="frame_table_');
- oa.push(o.id);
- oa.push('" cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" class="dialogzone" id="frame_cont_');
- oa.push(o.id);
- oa.push('">');
-
- oa.push('<table border="0" cellspacing="0" cellpadding="0" width="100%"><tbody>');
- oa.push('<tr><td align="center" style="padding-top:5px;">');
- oa.push(img(_skin+'wait01.gif',200,40));
- oa.push('</td></tr>');
- oa.push('<tr><td align="left" style="padding-left:2px;padding-right:2px;padding-top:5px;">');
- oa.push('<div class="icontext" style="wordWrap:break_word;">');
- oa.push(convStr(L_bobj_crv_PrintControlProcessingMessage,false,true));
- oa.push('</div></td></tr></tbody></table>');
-
- oa.push('</td></tr></tbody></table>');
-
- oa.push('</td></tr></tbody></table>');
-
- return oa.join('');
- };
- bobj.crv.PrintUI._cancel = function () {
- if (this.isActxPrinting) {
- document.getElementById(this.actxContainerId).innerHTML = '';
- this._processingPrinting = false;
- }
- };
- bobj.crv.PrintUI._processPrinting = function(){
- if (!this._processingPrinting){
- var o = document.getElementById(this.actxId);
- var w = document.getElementById(this.actxId + '_wait');
- if (o && w){
- o.width = "100%";
- o.height = "100%";
- w.style.display="none";
- }
- this._processingPrinting = true;
- }
-
- };
- bobj.crv.PrintUI.show = function(visible, postBackData) {
- this._processingPrinting = false;
- if (visible) {
- if (!this.layer) {
- targetApp(this.getHTML());
- this.init();
- }
- if (this.isActxPrinting) {
- document.getElementById(this.actxContainerId).innerHTML = this._getObjectTag(postBackData);
- }
- this._showOld(true);
- }
- else if (this.layer) {
- this._showOld(false);
- }
- };
- bobj.crv.PrintUI.init = function() {
- this._initOld();
-
- if (!this.isActxPrinting) {
- this._fromBox.init();
- this._toBox.init();
- this._submitBtn.init();
-
- this._optionsFrame.init();
- this._allRadio.init();
- this._rangeRadio.init();
-
- if (!this.isExporting) {
- this._info.init();
- }
-
- this._allRadio.check(true);
- this._toBox.setDisabled(true);
- this._fromBox.setDisabled(true);
-
- if (this.widgetType == 'ExportUI') {
- this._initExportList();
- }
- }
- };
- bobj.crv.PrintUI.getHTML = function(){
- var h = bobj.html;
-
- var o = this;
- var strArr = [];
-
- strArr.push( o.beginHTML());
-
- if (!this.isActxPrinting) {
- strArr.push( '<table class="dialogzone" border=0 cellpadding=0 cellspacing=2>');
- strArr.push( '<tr>');
- strArr.push( ' <td style="padding-top:4px;">');
-
- strArr.push( o._optionsFrame.beginHTML());
-
- if (this.widgetType == 'ExportUI') {
- strArr.push( this._getExportList());
- }
-
- if(_ie)
- {
- strArr.push('<label tabIndex="0">' + L_bobj_crv_PrintRangeLbl + '</label>');
- }
- else
- {
- strArr.push(L_bobj_crv_PrintRangeLbl);
- }
- strArr.push( o._allRadio.getHTML());
- strArr.push( o._rangeRadio.getHTML());
- strArr.push( '<span style="padding-left:20px">' + L_bobj_crv_PrintFromLbl + '</span>');
- strArr.push( o._fromBox.getHTML());
- strArr.push( '<span style="padding-left:4px">' + L_bobj_crv_PrintToLbl + '</span>');
- strArr.push( o._toBox.getHTML());
- strArr.push( o._optionsFrame.endHTML());
-
- strArr.push( ' </td>');
- strArr.push( '</tr><tr>');
-
- if (!this.isExporting) {
- strArr.push( ' <td style="padding-top:8px;">');
- strArr.push( o._info.getHTML());
- strArr.push( ' </td>');
- strArr.push( '</tr><tr>');
- }
-
- strArr.push( ' <td align="right" style="padding-top:4px;">');
- strArr.push( o._submitBtn.getHTML());
- strArr.push( ' </td>');
- strArr.push( '</tr></table>');
- }
- else {
- strArr.push( h.DIV({id:this.actxContainerId}));
- strArr.push( '<script for="' + this.actxId + '" EVENT="Finished(status, statusText)" language="javascript">');
- strArr.push( 'getWidgetFromID("' + this.id + '").show(false);');
- strArr.push( '</script>');
- strArr.push( '<script for="' + this.actxId + '" EVENT="PrintingProgress(pageNumber)" language="javascript">');
- strArr.push( 'getWidgetFromID("' + this.id + '")._processPrinting();');
- strArr.push( '</script>');
-
- }
-
- strArr.push( o.endHTML());
- strArr.push( bobj.crv.getInitHTML(this.widx));
-
- return strArr.join('');
- };
- /*
- ================================================================================
- ExportUI
- ================================================================================
- */
- bobj.crv.newExportUI = function(kwArgs) {
- kwArgs = MochiKit.Base.update({ submitBtnLabel:L_bobj_crv_ExportBtnLbl,
- dialogTitle:L_bobj_crv_ExportDialogTitle,
- infoTitle:L_bobj_crv_ExportInfoTitle,
- infoMsg:L_bobj_crv_PrintInfo1,
- isExporting:true}, kwArgs);
-
- var o = bobj.crv.newPrintUI(kwArgs);
-
- o._comboBox = newCustomCombo(
- o.id + "_combo",
- MochiKit.Base.bind(bobj.crv.ExportUI._onSelectFormat, o),
- false,
- 270,
- L_bobj_crv_ExportFormatLbl,
- _skin + "../transp.gif", // Screen reader can't read its text without transp.gif
- 0,
- 14);
- //Adjustment to combo box after adding transp.gif as icon
- if(o._comboBox) {
- o._comboBox.icon.border=0;
- o._comboBox.icon.h=14;
- o._comboBox.arrow.h=12;
- o._comboBox.arrow.dy+=2
- o._comboBox.arrow.disDy+=2
- }
-
- o.availableFormats = (o.availableFormats ? eval(o.availableFormats) : null);
- var itemsCount = (bobj.isArray(o.availableFormats) ? o.availableFormats.length : 0);
-
- for (var i = 0; i < itemsCount; i++) {
- var item = o.availableFormats[i];
- o._comboBox.add(item.name, item.value, item.isSelected);
- }
-
- o.widgetType = 'ExportUI';
-
- MochiKit.Base.update(o, bobj.crv.ExportUI);
-
- return o;
- };
- bobj.crv.ExportUI._onSelectFormat = function() {
- var format = this._comboBox.getSelection().value;
- if (format == 'CrystalReports' || format == 'RecordToMSExcel' || format == 'CharacterSeparatedValues' || format == 'XML') {
- this._fromBox.setDisabled(true);
- this._toBox.setDisabled(true);
-
- this._rangeRadio.check(false);
- this._rangeRadio.setDisabled(true);
-
- this._allRadio.check(true);
- }
- else {
- this._rangeRadio.setDisabled(false);
- }
- };
- bobj.crv.ExportUI._initExportList = function() {
- if(!this._comboBox.initialized())
- {
- this._comboBox.init();
- var item0 = this._comboBox.getItemByIndex(0);
- if(item0 != null)
- {
- this._comboBox.selectItem(item0);
- }
- }
- this._onSelectFormat();
- };
- bobj.crv.ExportUI._getExportList = function() {
- var exportLabel = L_bobj_crv_ExportFormatLbl;
- if(_ie) {
- exportLabel = '<label tabIndex="0">' + L_bobj_crv_ExportFormatLbl + '</label>';
- }
- return exportLabel + this._comboBox.getHTML();
- };
- /*
- ================================================================================
- ErrorDialog
- TODO Dave: If time permits, make dialog resizable with mouse
- ================================================================================
- */
- /**
- * Static function.
- * @returns [ErrorDialog] Returns a shared Error Dialog
- */
- bobj.crv.ErrorDialog.getInstance = function() {
- if (!bobj.crv.ErrorDialog.__instance) {
- bobj.crv.ErrorDialog.__instance = bobj.crv.newErrorDialog();
- }
- return bobj.crv.ErrorDialog.__instance;
- };
- bobj.crv.newErrorDialog = function(kwArgs) {
- kwArgs = MochiKit.Base.update({
- id: bobj.uniqueId(),
- title: L_bobj_crv_Error,
- text: null,
- detailText: null,
- okLabel: L_bobj_crv_OK,
- promptType: _promptDlgCritical
- }, kwArgs);
-
- var o = newPromptDialog(
- kwArgs.id,
- kwArgs.title,
- kwArgs.text,
- kwArgs.okLabel,
- null, // cancelLabel
- kwArgs.promptType,
- null, // yesCB
- null, // noCB,
- true); // noCloseButton
-
- o.widgetType = 'ErrorDialog';
-
- // Update instance with constructor arguments
- bobj.fillIn(o, kwArgs);
- // Update instance with member functions
- o._promptDlgInit = o.init;
- o._promptDialogSetText = o.setText;
- o._promptDialogShow = o.show;
- o._promptDialogSetTitle = o.setTitle;
- o._promptDialogSetPromptType = o.setPromptType;
- MochiKit.Base.update(o, bobj.crv.ErrorDialog);
-
- o.noCB = MochiKit.Base.bind(o._onClose, o);
- o.yesCB = o.noCB;
-
- o._detailBtn = newIconWidget(
- o.id + "_detailBtn",
- bobj.skinUri('../help.gif'),
- MochiKit.Base.bind(bobj.crv.ErrorDialog._onDetailBtnClick, o),
- L_bobj_crv_showDetails, // Text
- null, // Tooltip
- 16,16,0,0,22,0);
-
- return o;
- };
- bobj.crv.ErrorDialog.init = function() {
- this._promptDlgInit();
- this._detailBtn.init();
- this._detailRow = document.getElementById(this.id + '_detRow');
- this._detailArea = document.getElementById(this.id + '_detArea');
-
- if (!this.detailText) {
- this._detailBtn.show(false);
- }
- };
- bobj.crv.ErrorDialog.getHTML = function() {
- var TABLE = bobj.html.TABLE;
- var TBODY = bobj.html.TBODY;
- var TR = bobj.html.TR;
- var TD = bobj.html.TD;
- var PRE = bobj.html.PRE;
- var DIV = bobj.html.DIV;
-
- var imgPath = PromptDialog_getimgPath(this.promptType);
- var imgAlt = PromptDialog_getimgAlt(this.promptType);
-
- var width = "320";
- var detailWidth = "300px";
- var detailHeight = "100px";
-
- var contentHTML =
- TABLE({'class':"dialogzone", width: width, cellpadding:"0", cellspacing:"5", border:"0"},
- TBODY(null,
- TR(null, TD(null,
- TABLE({'class':"dialogzone", cellpadding:"5", cellspacing:"0", border:"0"},
- TBODY(null,
- TR(null,
- TD({align:"right", width:"32"},
- img(imgPath, 32, 32, null, 'id="dlg_img_' + this.id + '"', imgAlt)),
- TD(),
- TD({id:"dlg_txt_" + this.id, align:"left", tabindex:"0"},
- convStr(this.text, false, true))))))),
- TR({id: this.id + '_detRow', style: {display: "none"}},
- TD(null, DIV({'class': "infozone", style: {width: detailWidth, 'height': detailHeight, overflow: "auto"}},
- PRE({id: this.id + '_detArea'}, this.detailText)))),
- TR(null, TD(null, getSep())),
- TR(null, TD(null,
- TABLE({cellpadding:"5", cellspacing:"0", border:"0", width:"100%"},
- TBODY(null,
- TR(null,
- TD({align:"left"}, this._detailBtn.getHTML()),
- TD({align:"right"}, this.yes.getHTML()))))))));
-
-
- return this.beginHTML() + contentHTML + this.endHTML();
- };
- /**
- * Set the error message and detail text.
- *
- * @param text [String] Error message
- * @param detailText [String] Detailed error message or technical info
- */
- bobj.crv.ErrorDialog.setText = function (text, detailText) {
- this.text = text;
- this.detailText = detailText;
-
- if (this.layer) {
- this._promptDialogSetText(text || '');
-
- if (this._detailArea) {
- this._detailArea.innerHTML = detailText || '';
- }
-
- var showDetails = detailText ? true : false;
- this._detailBtn.show(showDetails);
- if (!showDetails) {
- this.showDetails(false);
- }
- }
- };
- bobj.crv.ErrorDialog.setTitle = function (title) {
- this.title = title;
- if (this.layer) {
- this._promptDialogSetTitle(title || '');
- }
- };
- bobj.crv.ErrorDialog.setPromptType = function (promptType) {
- this.promptType = promptType;
- if (this.layer) {
- this._promptDialogSetPromptType(promptType);
- }
- };
- /**
- * Show/Hide the dialog
- *
- * @param isShow [bool(=true)] True value displays the dialog, false hides it.
- * @param closeCB [function] Callback to call after the next close event
- */
- bobj.crv.ErrorDialog.show = function(isShow, closeCB) {
- if (typeof isShow == 'undefined') {
- isShow = true;
- }
-
- if (isShow) {
- this._closeCB = closeCB;
- if (!this.layer) {
- targetApp(this.getHTML());
- this.init();
- }
- this.layer.onkeyup = DialogBoxWidget_keypress;
- DialogBoxWidget_keypress = MochiKit.Base.noop;
-
- this._promptDialogShow(true);
- }
- else if (this.layer){
- this._closeCB = null;
- this._promptDialogShow(false);
- }
- };
- /**
- * Show/Hide the detailed error message
- *
- * @param isShow [bool(=true)] True value displays the details, false hides them.
- */
- bobj.crv.ErrorDialog.showDetails = function(isShow) {
- if (typeof isShow == 'undefined') {
- isShow = true;
- }
-
- if (this._detailRow && this._detailBtn) {
- if (isShow) {
- this._detailRow.style.display = '';
- this._detailBtn.changeText(L_bobj_crv_hideDetails);
- }
- else {
- this._detailRow.style.display = 'none';
- this._detailBtn.changeText(L_bobj_crv_showDetails);
- }
- }
- };
- /**
- * Private. Handles detail button clicks.
- */
- bobj.crv.ErrorDialog._onDetailBtnClick = function() {
- if (this._detailRow) {
- this.showDetails(this._detailRow.style.display == 'none');
- }
- };
- /**
- * Private. Notifies listener that dialog has closed;
- */
- bobj.crv.ErrorDialog._onClose = function() {
- if (this._closeCB) {
- this._closeCB();
- this._closeCB = null;
- }
- DialogBoxWidget_keypress = this.layer.onkeyup;
- this.layer.onkeyup = null;
- };
- /*
- ================================================================================
- Report Processing Dialog
- ================================================================================
- kwArgs
- delay - the wait time prior to showing the dialog.
- message - a customized message to display in the dialog.
- */
- bobj.crv.newReportProcessingUI = function(kwArgs) {
- kwArgs = MochiKit.Base.update({
- id: bobj.uniqueId(),
- delay: 3000,
- message: L_bobj_crv_ReportProcessingMessage
- }, kwArgs);
-
- /* Since JSON escapes the '\' in unicode character references (\uXXXX) in Viewer
- * process indicator text is converted to html numeric referece (&#ddddd) which Javascript
- * don't display as expected. Little hack here to it as HTML string */
- var d = document.createElement('div');
- d.style.visibility = 'hidden';
- d.innerHTML = kwArgs.message;
- var newMsg = d.innerHTML;
- d = null;
-
- var o = newWaitDialogBoxWidget(
- kwArgs.id, // id
- 0, // width
- 0, // height
- '', // title
- true, // show cancel
- bobj.crv.ReportProcessingUI.cancelCB, // cancel callback
- true, // show label
- newMsg // label text
- );
-
-
- o.widgetType = 'ReportProcessingUI';
- o.delay = kwArgs.delay;
-
- // Update instance with member functions
- MochiKit.Base.update(o, bobj.crv.ReportProcessingUI);
-
- return o;
- };
- bobj.crv.reportProcessingDialog = null;
- bobj.crv.timerID = null;
- bobj.crv.ReportProcessingUI.cancelCB = function ()
- {
- bobj.crv.reportProcessingDialog.cancelled = true;
- if (bobj.crv.reportProcessingDialog.deferred !== null) {
- bobj.crv.reportProcessingDialog.deferred.cancel ();
- }
- bobj.crv.reportProcessingDialog.cancelShow ();
- };
- bobj.crv.ReportProcessingUI.wasCancelled = function ()
- {
- return bobj.crv.reportProcessingDialog.cancelled;
- };
- bobj.crv.ReportProcessingUI.delayedShow = function (showCancel) {
- // cleanup any existing dialog?
- if (bobj.crv.reportProcessingDialog !== null) {
- bobj.crv.reportProcessingDialog.cancelShow ();
- }
-
- if (!this.layer) {
- targetApp(this.getHTML());
- this.init();
- }
- this.cancelled = false;
- this.deferred = null;
- this.setShowCancel (showCancel, showCancel ? this.cancelCB : null);
- bobj.crv.reportProcessingDialog = this;
- bobj.crv.timerID = setTimeout("bobj.crv._showReportProcessingDialog ()", bobj.crv.reportProcessingDialog.delay);
- };
-
- bobj.crv.ReportProcessingUI.cancelShow = function () {
- if (bobj.crv.timerID) {
- clearTimeout (bobj.crv.timerID);
- }
-
- if (bobj.crv.reportProcessingDialog){
- bobj.crv.reportProcessingDialog.show (false);
- }
-
- bobj.crv.reportProcessingDialog = null;
- bobj.crv.timerID = null;
- };
- bobj.crv.ReportProcessingUI.setDeferred = function (deferred) {
- bobj.crv.reportProcessingDialog.deferred = deferred;
-
- if (bobj.crv.reportProcessingDialog.wasCancelled () === true) {
- deferred.cancel ();
- }
- };
- bobj.crv._showReportProcessingDialog = function () {
- if (bobj.crv.reportProcessingDialog && bobj.crv.reportProcessingDialog.delay !== 0) {
- bobj.crv.logger.info('ShowReportProcessingDialog');
- bobj.crv.reportProcessingDialog.show (true);
- }
- };
|