/* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| BI and PM: prmt *| *| US Government Users Restricted Rights - Use, duplication or *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp. *| *+------------------------------------------------------------------------+ */ /* CPromptButton.js This script defines the prompt button object */ //Constructor to create a button component // oParent: the button element // sType: the type of button (e.g. OK, Cancel, Back, Next, Finish, Reprompt) // bEnabled: the initial state of the button (true/false) function CPromptButton(oParent, iType, bEnabled, sCVId) { this.setCVId(sCVId); this.m_oParent = oParent; this.m_iType = iType; this.m_bEnabled = bEnabled; this.draw(); } CPromptButton.prototype = new CPromptControl(); //return the type of button function CPromptButton_getType() { return this.m_iType; } //change the state of the button function CPromptButton_setEnabled(bEnabled) { this.m_bEnabled = bEnabled; this.draw(); } //draw the button in its current state function CPromptButton_draw() { if (typeof this.m_oParent.disabled != K_PRMT_sUNDEFINED) { if (this.m_bEnabled == false) { this.m_oParent.disabled = true; PRMTUtils.f_removeClass( this.m_oParent, "bph" ); PRMTUtils.f_addClass( this.m_oParent, "bpd" ); } else { this.m_oParent.disabled = false; PRMTUtils.f_removeClass( this.m_oParent, "bpd" ); } // defect 185307; don't need mouseover and mouseout for disabled button // save generated mouseover and mouseout function in xslt file this.m_fParentMouseover = this.m_oParent.onmouseover; this.m_fParentMouseout = this.m_oParent.onmouseout; if (this.m_oParent.disabled) { this.m_oParent.onmouseover = null; this.m_oParent.onmouseout = null; } else { this.m_oParent.onmouseover = this.m_fParentMouseover; this.m_oParent.onmouseout = this.m_fParentMouseout; } } } //Prototypes to assign methods to new instances of the object CPromptButton.prototype.getType = CPromptButton_getType; CPromptButton.prototype.setEnabled = CPromptButton_setEnabled; CPromptButton.prototype.draw = CPromptButton_draw; //handle the cancel event, get the back URL from the page if it is available //perform a browser back if nothing else can be found function promptButtonCancel(s) { //detect for the existance of a predefined cancel //function in the page (e.g. RV or Cognos Connection page) //if it exists, call it if (typeof cancel != K_PRMT_sUNDEFINED) { cancel(); return; } if ( f_CSW_tryCVPromptAction('cancel',s) ) { return; } var sBackURL = s; if (sBackURL == K_PRMT_sEMPTY) { //close the window if RV does not have //a backURL //this function is part of RV if (typeof getConfigFrame != K_PRMT_sUNDEFINED) { var tf = getConfigFrame(); if (tf) { var sApp = tf.applicationName; if ((sApp == "QS") && (typeof tf.cancelPromptPage != K_PRMT_sUNDEFINED)) { tf.cancelPromptPage(); return; } else { sBackURL = tf.frameBackURL; if ((sBackURL==null) || (sBackURL==K_PRMT_sEMPTY)) { tf.close(); } else { tf.location = sBackURL; } } } } //check the form for a back URL if (typeof document.forms["formWarpRequest"] != K_PRMT_sUNDEFINED) { var elemBackUrl = document.forms["formWarpRequest"].elements["ui.backURL"]; if ((typeof elemBackUrl != K_PRMT_sUNDEFINED) && (elemBackUrl.value != K_PRMT_sEMPTY)) { sBackURL = elemBackUrl.value; } } } if (sBackURL == K_PRMT_sEMPTY) { self.history.back(); } else { self.location = sBackURL; } } //set the action method to go back //method=back function promptButtonBack() { if ( f_CSW_tryCVPromptAction('back') ) { return; } SetPromptContinue('true'); SetPromptMethod(K_ACTION_BACK); SetPromptControl(K_ACTION_PROMPT); } //set the action method to go next //method=forward function promptButtonNext() { if ( f_CSW_tryCVPromptAction('next') ) { return; } SetPromptContinue('true'); SetPromptMethod(K_ACTION_FORWARD); SetPromptControl(K_ACTION_PROMPT); } //run the report //method=forward //prevent further prompt pages function promptButtonFinish() { if ( f_CSW_tryCVPromptAction('finish') ) { return; } SetPromptContinue('false'); SetPromptMethod(K_ACTION_FORWARD); SetPromptControl(K_ACTION_PROMPT); } //submit the dialog //allow other prompts to show up depending on the user setting for 'prompt' //method=forward function promptButtonOK() { if ( f_CSW_tryCVPromptAction('ok') ) { return; } SetPromptMethod(K_ACTION_FORWARD); SetPromptControl(K_ACTION_PROMPT); } function promptAction(sAction, sArg) { if ( f_CSW_tryCVPromptAction(sAction, sArg) || f_getPromptRequestSubmitFlag() ) { return false; } switch(sAction) { case K_ACTION_BACK: promptButtonBack(); break; case K_ACTION_CANCEL: promptButtonCancel(sArg); break; case K_ACTION_NEXT: promptButtonNext(); break; case K_ACTION_FINISH: promptButtonFinish(); break; case K_ACTION_REPROMPT: SetPromptControl(sAction); break; default: promptButtonOK(); } f_setPromptRequestSubmitFlag(true); } //this function can be called to notify //any controls that want to observe the //state of page navigation function promptButtonNotify() { if (typeof bVerifyPageNavigation != K_PRMT_sUNDEFINED) { var bCheckNavigation = bVerifyPageNavigation(); notifyPageNavEnabled(bCheckNavigation); } } //this function will check to see if all controls are //ready for navigation to the next page function bVerifyPageNavigation() { var bFormValid = true; if ( typeof preProcessControlArray == K_PRMT_sOBJECT ) { var kCount = preProcessControlArray.length; var k = 0; for (k=0; k