123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- var PAGE_BREAK_ERROR_XTAB = 1;
- var PAGE_BREAK_ERROR_LIST = 2;
- function CPageBreak()
- {
- this.m_sColExpr = "";
- };
- CPageBreak.prototype = new AFeatureObject();
- CPageBreak.prototype.proceedWithoutDialog = function ()
- {
- return this.execute(new Array(false, true));
- };
- CPageBreak.prototype.processErrorState = function ()
- {
- if (this.m_iErrorState === FEATURE_OBJECT_NO_ERROR)
- {
- return false;
- }
- else if (this.m_iErrorState === PAGE_BREAK_ERROR_XTAB)
- {
- dlgShowMessage("PAGEBREAK_TITLE", "", "PAGEBREAK_XTAB");
- return true;
- }
- else if (this.m_iErrorState === PAGE_BREAK_ERROR_LIST)
- {
- dlgShowMessage("PAGEBREAK_TITLE", "", "PAGEBREAK_LIST");
- return true;
- }
- };
- CPageBreak.prototype.setup = function (aFeatureParams)
- {
- this.m_aParams = new Array();
- this.m_iErrorState = FEATURE_OBJECT_NO_ERROR;
- this.m_bRequiresDialog = false;
- var oSelController = goApplicationManager.getSelectionController();
- var aSelColIds = oSelController.getSelectedColumnIds();
- var oMQMgr = goApplicationManager.getMiniQueryManager();
- var iNumSelCols = aSelColIds.length;
- var bIsXtab = oMQMgr.hasPivottedColumns();
- var sColRole = "";
- if (iNumSelCols == 1)
- {
- sColRole = oMQMgr.getColumnRole(aSelColIds[0]);
- }
- if (sColRole == MINI_QUERY_GROUP_SECTION || (sColRole == MINI_QUERY_GROUP_LIST && !bIsXtab))
- {
- var sColExpr = oMQMgr.getExpression(aSelColIds[0]);
- if (sColExpr == oMQMgr.getPageBreak())
- {
- this.m_bRequiresDialog = true;
- this.m_aParams["m"] = "/" + qs_dir + "/pageBreakDelete.xts";
- }
- else
- {
- this.m_sColExpr = sColExpr;
- }
- }
- else
- {
- if (bIsXtab)
- {
- this.m_iErrorState = PAGE_BREAK_ERROR_XTAB;
- }
- else
- {
- this.m_iErrorState = PAGE_BREAK_ERROR_LIST;
- }
- }
- };
- CPageBreak.prototype.execute = function (aParameters)
- {
- var aCmdParams = new Array();
- var bDeletePgBrk = false;
- var bProceedWithAddingPgBrk = false;
- if (aParameters.length > 0)
- {
- bDeletePgBrk = aParameters[0];
- if (aParameters.length === 2)
- {
- bProceedWithAddingPgBrk = aParameters[1];
- }
- }
- if (this.m_sColExpr !== "" && !bDeletePgBrk && bProceedWithAddingPgBrk)
- {
- aCmdParams[0] = escapeParam(this.m_sColExpr);
- }
- var sCommand = "";
- if (aCmdParams.length === 0 && bDeletePgBrk)
- {
- sCommand = createCommand("O", "P");
- }
- else if (aCmdParams.length > 0)
- {
- sCommand = createCommand("O", "P", aCmdParams);
- }
- if (sCommand !== "")
- {
- sendCmd(sCommand, "", true);
- }
- goApplicationManager.getWindowManager().hideDialogFrame();
- };
|