码迷,mamicode.com
首页 > Web开发 > 详细

Launcher.js

时间:2015-01-07 20:45:37      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

技术分享
window.launcherInit = function() {
    com.citi.sao.SAOConstants.BTMFunctionId = BTMFunctionId;
    com.citi.sao.SAOConstants.CONTEXTROOT = CIContextRoot;
    com.citi.sao.SAOConstants.FROM_CID = FromCID;
    com.citi.sao.SAOConstants.B_SEGMENT = B_SEGMENT;
    com.citi.sao.SAOConstants.B_USER_ID = B_USER_ID;
    com.citi.sao.SAOConstants.B_ROLE_NAME = B_ROLE_NAME;
    com.citi.sao.SAOConstants.B_ROLE_CHANNEL = B_ROLE_CHANNEL;
    com.citi.sao.SAOConstants.B_USER_NAME = B_USER_NAME;
    com.citi.sao.SAOConstants.ECLIPSE_URL = ECLIPSE_URL;
    com.citi.sao.SAOConstants.PROFILE_SUMMARY_SUFFIX = PROFILE_SUMMARY_SUFFIX;
    com.citi.sao.SAOConstants.CRM_URL_SUFFIX = CRM_URL_SUFFIX;
    com.citi.sao.SAOConstants.B_HOSTDATE = B_HOSTDATE;
    com.citi.sao.SAOConstants.B_BIZ_ID = B_BIZ_ID;
    com.citi.sao.SAOConstants.CURRENCY = CURRENCY;
    com.citi.sao.SAOConstants.CURRENCY_ALPHA = CURRENCY_ALPHA;
    com.citi.sao.SAOConstants.B_CTRL_1=CTRL_1;
    com.citi.sao.SAOConstants.B_CTRL_2=CTRL_2;
    com.citi.sao.SAOConstants.WORK_ITEM_TAG = WORK_ITEM_TAG;
    com.citi.sao.SAOConstants.ECRM_FLAG = ECRM_FLAG;
    com.citi.sao.SAOConstants.APP_CHANNEL = APP_CHANNEL;            
    com.citi.sao.SAOConstants.SCREEN_KEY = SCREEN_KEY;
    com.citi.sao.SAOConstants.SELECTED_LANG = SELECTED_LANG;
    com.citi.sao.SAOConstants.supportedCountryCodes = supportedCountryCodes;
    com.citi.sao.SAOConstants.supportedCountryAbbrs = supportedCountryAbbrs;
    com.citi.sao.SAOConstants.CITIKYCURL = CITIKYCURL;
    com.citi.sao.SAOConstants.PERFORMANCE_LOG_ON = PERFORMANCE_LOG_ON;
    com.citi.sao.SAOConstants.POPUP_SCREEN_KEY = "";
    com.citi.sao.SAOConstants.disableStyle = {backgroundColor:"#E0E0E0"};
    com.citi.sao.SAOConstants.eCRM_URL=eCRM_URL;
    com.citi.sao.SAOConstants.PROCESSING_BIZ_ENTITY = PROCESSING_BIZ_ENTITY;
    
    if(CTRL_1==98){
        com.citi.sao.SAOConstants.DateFORMAT = "mm/dd/yyyy";
        com.citi.sao.SAOConstants.numberFormat = {"decimals":"2","symbol":"","thousandTag":",","decimalTag":".","percentTag":""};
        com.citi.sao.SAOConstants.percentFormat = {"decimals":"2","symbol":"","thousandTag":",","decimalTag":".","percentTag":"%"};
        com.citi.sao.SAOConstants.amountFormat = {"decimals":"2","symbol":"$","thousandTag":",","decimalTag":".","percentTag":""};
        com.citi.sao.SAOConstants.rateFormat= {"decimals":"7","symbol":"","thousandTag":",","decimalTag":".","percentTag":""};
        // ‘eRateFormat‘ used for populating exception rate along with four decimals-Non RPS CD product. 
        com.citi.sao.SAOConstants.eRateFormat= {"decimals":"4","symbol":"","thousandTag":",","decimalTag":".","percentTag":""};
    }else{
        com.citi.sao.SAOConstants.DateFORMAT = "ddMMMyyyy";
        com.citi.sao.SAOConstants.numberFormat = {"decimals":"2","symbol":"","thousandTag":",","decimalTag":".","percentTag":""};
        com.citi.sao.SAOConstants.percentFormat = {"decimals":"2","symbol":"","thousandTag":",","decimalTag":".","percentTag":"%"};
        com.citi.sao.SAOConstants.amountFormat = {"decimals":"2","symbol":"","thousandTag":",","decimalTag":".","percentTag":""};
        com.citi.sao.SAOConstants.rateFormat= {"decimals":"7","symbol":"","thousandTag":",","decimalTag":".","percentTag":""};
    }
    dojo.byId("initProgBarLbl").innerText = "Loading Application...";
    PageConfig.init();
    PageConfig.loadEntitlement();//sync SAOApplicationProxyServlet call
    quickJumpObj.setLabelStore(RSRS_JP_MENUSTORE, RSRS_LANGSTORE);
    quickJumpObj.init();    
    SAOMessage.loadClientMessages();//action=getI18Cache&type=Message, async call
    routePage();
    Timer.clockEnd("Init loading");
}

window.loadScreen = function (screenKey, args) {
    var options = args || {},
             divID = args && args.divID,
             screenLoader;
    quickJumpObj.hide();
    if(divID==null || divID==‘undefined‘ || divID==‘‘){
        com.citi.sao.SAOConstants.CURRENT_SCREEN_SCREENKEY = screenKey;
    }
    Timer.clockStart("Screen loading (" + screenKey + ")");    
    options.screenKey = screenKey;
    options.async = ASYNC_SCREEN_LOADING;
    
    try {
        screenLoader = new ScreenLoader(options);
        screenLoader.load();
    } catch (e) {
        if(e.message == ScreenLoader.Error.SCREEN_NOT_FOUND)
            alert("Screen " + screenKey + " is not found!");
        else
            throw e;
    }
}

window.routePage = function() {
    Logger.log(‘routePage::g_action:‘+g_action+‘,g_appID:‘+g_appID+‘,g_appType:‘+g_appType+‘,g_custType:‘+g_custType);
    if (‘jfp‘ == g_action) {
        com.citi.sao.SAOConstants.APP_ID = g_appID;
        com.citi.sao.SAOConstants.APP_TYPE = g_appType
        Logger.log(‘ jfp com.citi.sao.SAOConstants.APP_ID:: ‘ + com.citi.sao.SAOConstants.APP_ID
                + ‘    com.citi.sao.SAOConstants.APP_TYPE:: ‘ + com.citi.sao.SAOConstants.APP_TYPE);
        loadScreen("JFPEntry");
    } else if (‘step1‘ == g_action) {
        com.citi.sao.SAOConstants.APP_ID = g_appID;
        com.citi.sao.SAOConstants.APP_TYPE = g_appType;
        PageConfig.loadCustomerSetup(g_custType);
    } else if (‘step2‘ == g_action) {
        com.citi.sao.SAOConstants.APP_ID = g_appID;
        com.citi.sao.SAOConstants.APP_TYPE = g_appType;
        PageConfig.loadProductionSetup();
    } else if (‘step3‘ == g_action) {
        com.citi.sao.SAOConstants.APP_ID = g_appID;
        com.citi.sao.SAOConstants.APP_TYPE = g_appType;
        if(com.citi.sao.SAOConstants.getCountryAbbr() == ‘US‘){
            loadScreen("USVerifySign");
        }else{
            loadScreen("VerifySign");
        }
    } else if (‘step4‘ == g_action) {
        com.citi.sao.SAOConstants.APP_ID = g_appID;
        com.citi.sao.SAOConstants.APP_TYPE = g_appType;
        loadScreen("Fulfillment");
    } else if (‘SAOWORKQ‘ == g_action) {
        loadScreen("WccLogic");
    } else if (‘CRM2SAO‘ == g_action) {
        ResourceLoader.loadJSFile(‘sao/jsp/Common/js/SAOCRMEntry.js‘);
        com.citi.sao.SAOConstants.APP_ID = g_appID;
        com.citi.sao.SAOCRMEntry.init();
    } else if (‘SAO‘ == g_action) {
        loadScreen("SessionSetup");
    } else if (‘SAODocumentumQ‘ == g_action) {
        loadScreen("DocumentumQ");
    } else if (‘APPSEARCH‘ == g_action) {
        loadScreen("AppSearch");
    } else if (‘Report‘ == g_action) {
        loadScreen("Report");        
    } else if (g_action != ‘‘) {
        loadScreen(g_action);
    } else {
        loadScreen("SessionSetup");
    }
}

window.clearCalendarPopUp = function () {
    try{
        clase("panelCalendar","titleBarCalendar",false);
    }catch(e){
        Logger.log("ClearCalendar pop up error");
    }
}

window.clearPopUp = function () {
        for(var i=0;i<existPopupList.length;i++){
            var paneName = existPopupList[i];
            var paneObj = $(paneName);
            if(paneObj!=null){
                paneObj.parentElement.removeChild(paneObj);
            }
        }
}

//window.loadPopup = function (popupKey, popupTitle, width, height, left, top, closeCallBack, ctx, readOnlyMode) {
window.loadPopup = function (popupKey, width, height, left, top, closeCallBack, ctx, readOnlyMode,otherTitle, ignoreScreenConfigError) {
    com.citi.sao.SAOConstants.POPUP_SCREEN_KEY = popupKey;
    var screenConfig;
    try {
        //if(null != otherTitle && typeof(otherTitle) == ‘object‘){
        if(isJsonString(otherTitle)){
            screenLoader = new ScreenLoader({screenKey: popupKey, async: false, popup:true,
                width: width, height: height, left: left, top: top, closeCallback: closeCallBack, ctx: ctx,
                readOnlyMode: readOnlyMode,otherTitle: otherTitle.otherTitle, ignoreScreenConfigError: ignoreScreenConfigError});
        }else{
            screenLoader = new ScreenLoader({screenKey: popupKey, async: false, popup:true,
                width: width, height: height, left: left, top: top, closeCallback: closeCallBack, ctx: ctx,
                readOnlyMode: readOnlyMode, ignoreScreenConfigError: ignoreScreenConfigError});
        }
        
        return screenLoader.load();
    } catch (e) {
        if(e.message == ScreenLoader.Error.SCREEN_NOT_FOUND)
            alert(‘Screen ‘ + popupKey + ‘ is not found!‘);
        else
            throw e;
    }
}

window.callService = function (serviceName, operationName, jsonData, onSuccessHandler, onErrorHandler, isMaskScreen, isIgnore, isPreCall) {
    var serviceOperation = serviceName + ‘.‘ + operationName,
        data = {"service": serviceName, "operation": operationName, "json": jsonData, "applicationId": com.citi.sao.SAOConstants.APP_ID, "archivalInd": com.citi.sao.SAOConstants.ARCGIVAL_IND},
        logCollector = new SAOLogCollector({actionType: SAOLogCollector.ActionType.CALLSERVICE, 
            currentScreen: com.citi.sao.SAOConstants.CURRENT_SCREEN_SCREENKEY, 
            actionID: serviceOperation}),
        sendActionLog = true,
        xhrArgs = {
                url : proxyURL,
                content : data,
                load : _onload,
                error : _onerror
            };
    
    Timer.clockStart("Service Call " + serviceOperation);
    Logger.log(operationName + " requestData :: "+dojo.toJson(jsonData));
    
    if (isMaskScreen==true) {showMask();}
    
    function _onload(response, ioargs) {
        try{
            //logCollector.token = ioargs.xhr.getResponseHeader(‘TOKEN‘);
            
            Timer.clockEnd("Service Call " + serviceName + "." + operationName);
            Logger.log("data:: -succ--- serviceName:: "+dojo.toJson(response));
            
            if (isMaskScreen==true) hideMask();
            
            if(isPreCall) {//added by Jack Yang, for preInitServiceCall in ScreenLoader
                logCollector.startLog(SAOLogCollector.LogType.POST_ACTION_TIME2);
                onSuccessHandler(response, ioargs);
                logCollector.endLog(SAOLogCollector.LogType.POST_ACTION_TIME2);
                logCollector.endTotalLog();
                logCollector.send();
                return;
            }
            
            var respData;
            try{
              respData = dojo.fromJson(response);
            }catch(e){
                if(dojo.isString(response) && (response.indexOf(‘HTML‘) != -1 ||  response.indexOf(‘html‘) != -1)){
                    document.body.innerHTML = response;
                    return response;
                }else{
                    alert("APP_ID:: "+ com.citi.sao.SAOConstants.APP_ID+ " operation::" + operationName+"\n Invalid Json format:\n "+response);
                    hideMask();
                    return response;
                }
            }
            
            var respContent = respData.content,
                respCode = respData.responseCode;
            
            logCollector.startLog(SAOLogCollector.LogType.POST_ACTION_TIME2);
            if( respCode != 2 ){
                var responseContentCode = successProcess(respContent,isIgnore);
                Logger.log("responseContentCode:: " + responseContentCode);
                
                // process responseContentCode 0,4, success, 123 fault.
                if( responseContentCode==‘W‘ || responseContentCode==0 || responseContentCode==4 || responseContentCode==‘0‘ || responseContentCode==‘4‘ ){
                    if (onSuccessHandler != null)
                        onSuccessHandler(respContent, ioargs);
                }else if( responseContentCode == 1 || responseContentCode == 2){
                    if (onErrorHandler != null)
                        onErrorHandler(response, ioargs);
                }else
                     hideMask();
            }else{
                if(isIgnore == true)    onErrorHandler(response, ioargs);
                else    errorProcess(respContent);
            }
            logCollector.endLog(SAOLogCollector.LogType.POST_ACTION_TIME2);
            logCollector.endTotalLog();
            if(sendActionLog) logCollector.send();
            else Logger.log(‘logCollector.send cancelled cause this callservice read from state table‘);//cause for this case, TOKEN is expired when doing the pre real call
        }catch(e){
            Logger.log("exception :: "+e);
            hideMask();    
            throw e;
        }
        return response;
    };
    
    function _onerror(response, ioargs) {
        Logger.log("data:: -error--- serviceName:: "+dojo.toJson(response));
        Timer.clockEnd("Service Call " + serviceName + "." + operationName);
        
        if( response.description != "xhr cancelled" ){
            Logger.log("isIgnore::"+isIgnore);
            if(isIgnore == true){
                // alert("IProcess called time out !");
                if(com.citi.sao.SAOConstants.B_ACTION == "APPROVE")    loadScreen("Fulfillment");    
                else    hideMask();
                
          }else {
               errorProcess(response);
                hideMask();
                if (onErrorHandler != null) onErrorHandler(response, ioargs);
          }    
        }else{
            hideMask();
        }
        
        return response;
    };
    
    var currentScreenLoadState = SCREEN_LOAD_STATE_TABLE[com.citi.sao.SAOConstants.SCREEN_KEY], deferred;
    Logger.log(‘currentScreenLoadState‘+currentScreenLoadState);
    Logger.log(‘com.citi.sao.SAOConstants.SCREEN_KEY‘+com.citi.sao.SAOConstants.SCREEN_KEY);
    if(currentScreenLoadState && currentScreenLoadState.initService 
            && currentScreenLoadState.initService.service == serviceName 
            && currentScreenLoadState.initService.operation == operationName 
            && currentScreenLoadState.initService.response) {
                
        Logger.log(‘+++++++++++callservice::‘+serviceName+‘, operation::‘+operationName+‘, do _onload() from state table‘);
        Logger.log(‘state table initService.response: ‘ + SCREEN_LOAD_STATE_TABLE[com.citi.sao.SAOConstants.SCREEN_KEY].initService.response);
        
        sendActionLog = false;//read callservice response for state table doesn‘t need send action log
        _onload(currentScreenLoadState.initService.response, currentScreenLoadState.initService.ioargs);
        
        //clear state table
        SCREEN_LOAD_STATE_TABLE[com.citi.sao.SAOConstants.SCREEN_KEY] = null;
        
    } else {
        Logger.log(‘callservice::‘+serviceName+‘, operation::‘+operationName+‘, do dojo.xhrPost()‘);
        logCollector.startTotalLog();
        deferred = dojo.xhrPost(xhrArgs);
    }
}

window.callEditService = function (funcId, actionId, jsonData, onSuccessHandler, onErrorHandler, isMaskScreen, isIgnore, BTMFunctionId) {
    Timer.clockStart("Servlet Call " + funcId + "." + actionId);
        if (isMaskScreen==true) {showMask();}
        var xhrArgs = {
            url : proxyEditURL,
            content : {FUNC_ID: funcId, ACTION_ID: actionId, BTMFunciton_ID: BTMFunctionId, json: jsonData},
            load : function(reponse, ioargs) {
                        Timer.clockEnd("Servlet Call " + funcId + "." + actionId);
                        Logger.log("data:: -succ--- funcId:: "+dojo.toJson(reponse));
                        if (isMaskScreen==true) {hideMask();}
                        var resData = dojo.fromJson(reponse);
                        var errorData;
                        if(resData!=null){
                            errorData = resData.ERROR;
                        }
                        if(resData==null||errorData==null||""==errorData){
                            if (onSuccessHandler != null) {onSuccessHandler(reponse, ioargs);}
                        }else{
                            alert(errorData);
                        }
                        return reponse;
                    },
            error : function(reponse, ioargs) {
                Logger.log("data:: -error--- funcId:: "+dojo.toJson(reponse));
                Timer.clockEnd("Servlet Call " + funcId + "." + actionId);
                if (onErrorHandler != null) {onErrorHandler(reponse, ioargs);}
                return reponse;
            }
        };
            var deferred = dojo.xhrPost(xhrArgs);    
}
window.getSAOFault = function (respContent) {
    var saofault;
    try{
        saofault = getSubNode(respContent);
        Logger.log("getSAOFault:: " + saofault);
        // saofault = respContent.Fault.detail.SAOFault;
    }catch(e){
        // try{ saofault = respContent.ExecuteStatementRs.SAOFault;}catch(e){};
    }
    return saofault;
}
window.getPromptHeader = function (saofault) {
    var promptMsg = "Service Call Failed, Please Contact Application Support Team.\n-------------------------------\n";
    var respCode;
    if( saofault && saofault.ResponseCode ){
        respCode = saofault.ResponseCode;
        if (saofault.ESBUUID)
            promptMsg += "ESBUUID: " + saofault.ESBUUID + "\n-------------------------------\n";
        Logger.log("getPromptHeader::respCode:: " + respCode);
        if( respCode==‘W‘ || respCode==‘0‘ || respCode==‘4‘ || respCode==0 || respCode==4 ){
            promptMsg = "Warning: \n-------------------------------\n";
        }
    }
    return promptMsg;
}
window.successProcess = function (respContent,isIgnore) {
    Logger.log("data:: -successProcess--- serviceName:: "+dojo.toJson(respContent));
    var responseContentCode = 0;
    try{
            var saofault = getSAOFault(respContent);
            if( !saofault ){
                return responseContentCode;
            }
            var size = saofault.Errors.length;
            var BWErrors;
            Logger.log("size:: "+size);
            if(size!=null)
              BWErrors = saofault.Errors;
            else
              BWErrors = saofault.Errors.ErrorItem;

            if( BWErrors ){
                if(isIgnore == true){
                    return 1;
                }else{
                    var errorItems = BWErrors;
                    if(errorItems){
                        var errorMsg = getPromptHeader(saofault);
                        alert(getErrorMsg(errorItems,errorMsg));
                        responseContentCode = 1;
                        Logger.log("SAOFault.ResponseCode:: "+saofault.ResponseCode);
                        if( saofault.ResponseCode ){
                            var responseContentCode = saofault.ResponseCode;
                            if(!responseContentCode) responseContentCode = 1;
                        }
                    }
                }
            }
    }catch(e){}
    return responseContentCode;
}

window.getErrorMsg = function (errorItems,errorMsg) {
    var len = errorItems.length;
    if(len){
        for(var i = 0 ; i < len; i++){
            var record = errorItems[i];
            Logger.log("record:: "+dojo.toJson(record));
            if(record.ErrorItem!=null) {
                record = record.ErrorItem; 
                errorMsg = getErrorMsg(record,errorMsg);
            }else{
                var code = record.code;
                var msg = record.msg;
                var stackTrace = record.stackTrace;
                if(code){
                    errorMsg = errorMsg + "Code: " + code + " -- " + "Message: " + msg + "\n";
                    if(len > 1 && i != len-1){
                        errorMsg = errorMsg + "-------------------------------"+"\n";
                    }
                }
            }
        }
    }else{
        var record = errorItems;
        var code = record.code;
        var msg = record.msg;
        var stackTrace = record.stackTrace;
        errorMsg = errorMsg + "Code: " + code + " -- " + "Message: " + msg + "\n";
    }
    return errorMsg;
}

window.errorProcess = function (response) {
        var myStatus = response.status, errorMsg = ‘‘, description, extraDesc;
        Logger.log("errorProcess:: "+dojo.toJson(response));
        if(myStatus==500){
            errorMsg += "Service Call Failed, Please Contact Application Support Team.\n";
            description = response.responseText;
            extraDesc = description.substring(11);
            errorMsg += extraDesc;
        }else if(myStatus==12029){
            errorMsg += "Service Call Failed, Please Contact Application Support Team.\n";
            description = response.description;
            extraDesc = description.substring(0,description.length-13);
            errorMsg += extraDesc;            
        }else if(myStatus==404){
            errorMsg += "Service Call Failed, Please Contact Application Support Team.\n";
            description = response.responseText;
            extraDesc = description.substring(11);
            errorMsg += extraDesc;
        }else{
            errorMsg = "Process failed, Please Contact Application Support Team.\n"+response.message;
        }
        alert(errorMsg);
}

window.onerror = function(){
     var date = new Date(),
             msg = date.getHours()+":"
                 +date.getMinutes()+":"
                 +((date.getSeconds()<10)?"0"+date.getSeconds():date.getSeconds())+":"
                 +((date.getMilliseconds()<100)?date.getMilliseconds()+"0":date.getMilliseconds())
                 +"  (ERROR) - " + arguments[0] + " (line : "+arguments[2]+", file : "+arguments[1]+") ";
             
    if(monitor)    Logger.log(msg,"ERROR"); 
    else    alert(msg); 
}

window.getDownLoadData = function (type , onSuccessHandler , sync, filter) {
    var data = {action : "getDataCache" , type : type}, result = ‘‘, p, xhrArgs;
    if(filter)
        for(p in filter)
            data[p] = filter[p];
        
    xhrArgs = {
        url : proxyURL,
        content : data,
        sync: sync,
        load : function(reponse, ioargs) {
            result=reponse;
            onSuccessHandler(reponse,ioargs);
            return reponse;
        },
        error : function(reponse, ioargs) {
            errorProcess(reponse);
        }    
    }
    dojo.xhrGet(xhrArgs);
    return result;
}

window.getPinBlockFromApp = function (pinType,pinlength){
    var cidInterfaceFrame = document.getElementById("iframe_cid_interface").contentWindow, extUrl;
    if (true)// hard code twice till now
        extUrl = "EXT:://<OnEvent ID = ‘SAO.CIDGetPinTwiceAndVerifyRequest‘><CIDGetPinTwiceAndVerify><Interface>DeviceInterface-CID</Interface><pintype>"+pinType+"</pintype><pinlength>"+pinlength+"</pinlength></CIDGetPinTwiceAndVerify></OnEvent>";
    else
        extUrl = "EXT:://<OnEvent ID = ‘SAO.CIDGetPinBlockRequest‘><CIDGetPinBlock><Interface>DeviceInterface-CID</Interface><pintype>"+pinType+"</pintype><pinlength>"+pinlength+"</pinlength></CIDGetPinBlock></OnEvent>";

    cidInterfaceFrame.document.getElementById("cidRequestForm").action = extUrl;
    cidInterfaceFrame.document.getElementById("cidRequestForm").submit();
}
  
//MY KAD Data
window.getMYKadDataFromApp = function (rowIndex, colIndex){
    //Load MY KAD Util JS and call init method
    ResourceLoader.loadJSFile(‘sao/jsp/Common/js/SAOMYKadDataUtil.js‘);
    com.citi.sao.myKadUtil.init();
     var cidInterfaceFrame = document.getElementById("iframe_cid_interface").contentWindow,
          extUrl = "EXT:://<OnEvent ID=‘SAO.ReadMyKAD‘><Interface>DeviceInterface-MyKAD.dll</Interface></OnEvent>";
     //Set the Session Setup specifc data
     Logger.log("rowIndex="+rowIndex+"  ColumnIndex="+colIndex);
     com.citi.sao.myKadUtil.rowIndex = rowIndex;
     
       cidInterfaceFrame.document.getElementById("cidRequestForm").action = extUrl;
     cidInterfaceFrame.document.getElementById("cidRequestForm").submit();
}

window.forwardToCRM = function (URL){
      var parent = window.opener;
      if(parent){
          parent.top.location = URL;
          window.close();
      }else{
          var frmForward = document.frmCRM;
          frmForward.action = URL;
          frmForward.target = "eclipse_frame";
          frmForward.submit();
     }
}

window.printDocViaFireFly = function (url) {
    var printFrame = document.getElementById("iframe_print_interface").contentWindow;
    Logger.log("printFrame: \n" + printFrame.name)
    com.citi.sao.SAOConstants.printingURL = url;
    var parames = "<OnEvent ID=‘Eclipse.SAOPrintPDF‘><URL>" + url + "</URL><PrinterName>Normal</PrinterName><Preview>false</Preview><PrintToFit>true</PrintToFit></OnEvent>";
    var myform = printFrame.document.getElementById("eclipseForm");
    myform.action="EXT:://"+parames;
    Logger.log("myform.action \n" + myform.action);
    myform.submit();
}

window.SAOPrintResponse = function (printStatus, errorCode, errorDescription) {
    if (errorCode==‘0‘)
    {
    alert(‘Printing Successfully.‘);    
    }
    else if (errorCode==‘-3‘||errorCode==‘-5‘||errorCode==‘-6‘)
    {
        var printFrame = document.getElementById("iframe_print_interface").contentWindow;
        Logger.log("printFrame: \n" + printFrame.name)
        var parames = "<OnEvent ID = ‘Eclipse.SetupPDFPrint‘><SetupPDFPrint></SetupPDFPrint></OnEvent>";
        var myform = printFrame.document.getElementById("eclipseForm");
        myform.action="EXT:://"+parames;
        Logger.log("myform.action \n" + myform.action);
        myform.submit();
    }
    else
    {
        openWindowWithIE(com.citi.sao.SAOConstants.printingURL, "CheckListDocument");
    }
    
}


/* 
 * these three methods are callback functions invoke by hardware.
 * although can‘t find any reference to them, they can‘t be deleted
 * commented by Jack Yang 20130725
 */
window.callSAOCIDGetPinBlockResponse = function (result, pinblock){
      com.citi.sao.Fulfillment.clearPinBlock();
      if(dojo.trim(result).toLowerCase() == "success")
          com.citi.sao.Fulfillment.changeFlagForTask(pinblock);    
      else
          alert("Get Pin Block Failed !");
}

window.callSAOCIDGetPinTwiceAndVerifyResponse = function (result, pinblock){
      com.citi.sao.Fulfillment.clearPinBlock();
      if(dojo.trim(result).toLowerCase() == "success")
          com.citi.sao.Fulfillment.changeFlagForTask(pinblock);    
      else
          alert("Get Pin Block Failed !");
}

window.callSAOMYKadGetDataResponse = function (myKadDataXml){
     alert("Data Received from MyKad");
     Logger.log("myKadDataXml ::"+myKadDataXml);
     com.citi.sao.myKadUtil.getMYKadData(myKadDataXml);
}
View Code

 

Launcher.js

标签:

原文地址:http://www.cnblogs.com/daishuguang/p/4209195.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!