1 |
- var __certlistui=function(a){var x=function(d){function r(a){if(!a)return alert("UI load error."),!1;var b=document.createElement("div");document.body.insertBefore(b,document.body.firstChild);b.innerHTML=a;return!0}function g(){h&&h.restoreOnMouseEvent();d.onCancel()}function e(b,c){if(!b||!c)return!1;if(!a.certsList||0>h.selectedIndex())return a.uiUtil().msgBox(c.IDS_MSGBOX_COMMON_ERROR_NO_SELECTED_CERT),!1;var d=a.loadUI("certview")({type:null,args:{type:"Base64",idx:parseInt(h.selectedIndex()),cert:a.certsList.list[parseInt(h.selectedIndex())-1].cert},onConfirm:function(){d.dispose();b.focus()},onCancel:function(){d.dispose();b.focus()}});d.show();a.uiUtil().loadingBox(!1,"us-div-cert-list-load");return!0}function q(b,c){if(!b||!c)return!1;y=a.loadUI("gridlist");h=y({type:"certslist",tblid:"us-tbl-cert-list",tbltitleid:"us-tbl-cert-list-th",titlelistid:"us-grid2-head-div",titlerowid:"us-cert-list-title-row",titleelementid:"us-cert-list-title-element",titledividerid:"us-cert-list-title-divider",titlelistcn:"us-layout-grid-head-div",titlerowcn:"us-layout-grid-head-row",titleelementcn:"us-layout-grid-row-title-element",titledividercn:"us-layout-grid-row-title-divider",tblbodyid:"us-tbl-cert-list-td",datalistid:"us-grid2-body-div",datarowid:"us-cert-list-body-row",dataelementid:"us-cert-list-data-element",datalistcn:"us-layout-grid-body-div",datarowcn:"us-layout-grid-body-row",dataelementcn:"us-layout-grid-row-data-element",dataselectcn:"us-layout-grid-row-data-selected-element",textObj:c});var p=!0;"opera"==a.browserName&&(p=!1);h.drawList(b,b.length,null,0,z,p);u(A,B,c,"",function(b){if(0!=b)a.uiUtil().errMsgBox(c.IDS_MSGBOX_COMMON_ERROR_GET_CERT,b);else{if(a.certsList){b=a.certsList;var m=b.list.length,p=[],l=d.args.dn,e=null;null!=a.ESVS.Policy&&(-1!=a.ESVS.Policy.indexOf("|")?e=a.ESVS.Policy.split("|"):(e=[],e[0]=a.ESVS.Policy));var n=null;null!=a.ESVS.Organization&&(-1!=a.ESVS.Organization.indexOf("|")?n=a.ESVS.Organization.split("|"):(n=[],n[0]=a.ESVS.Organization));for(var f=0;f<m;f++){a.usWebToolkit.x509Certificate.parser(b.list[f].cert,"Base64");var v=a.usWebToolkit.x509Certificate.getCertificatePoliciesOid(),t=a.usWebToolkit.x509Certificate.getSubjectName(),F=a.usWebToolkit.x509Certificate.getNotAfter(),C=a.usWebToolkit.x509Certificate.getNotAfter(),g=b.list[f].index,w=a.certUtil().getIssuerName(v);"undefined"==w&&(w=a.certUtil().getO(t));if(null==l||"DIGITAL_SIGNATURE_P1"!=d.type&&"DIGITAL_SIGNATURE_P7"!=d.type&&"DIGITAL_SIGNATURE_P7_EXT"!=d.type||t.toLowerCase()==l.toLowerCase()){if(null!=a.ESVS.Policy){for(var k=0;k<e.length&&e[k]!=v;k++);if(e.length<=k)continue}if(null!=a.ESVS.Organization&&("CERT_RENEWAL"==d.type||"CERT_REVOCATION"==d.type||"CERT_SOE"==d.type||"CERT_RENEWAL_SIGN"==d.type)){for(k=0;k<n.length&&n[k].toLowerCase()!=a.certUtil().getO(t).toLowerCase();k++);if(n.length<=k)continue}if(a.ESVS.ShowExpiredCerts||"DIGITAL_SIGNATURE_P1"!=d.type&&"DIGITAL_SIGNATURE_P7"!=d.type&&"DIGITAL_SIGNATURE_P7_EXT"!=d.type||2!==a.certUtil().getExpirationStateValue(C))k=[""],k[1]=a.certUtil().getCertType(v),k[2]=a.certUtil().getCN(t),k[3]=w,k[4]=a.certUtil().getLocalDate(F),k[5]=g,k[6]=a.certUtil().getExpirationStateValue(C),p.push(k)}}b={list:p}}else b=null;b?h.redrawList(b.list,b.list.length):h.redrawList(null,0)}});return!0}function u(b,c,e,h,m){if(a.CONST.__USFB_M_DISK.device>b||0>c||!e)return-1;var g=0,p=0;B=c;a.certsList&&(a.certsList=null);if(a.CONST.__PF_M_LS.device===b&&2&a.ESVS.Mode){a.PFSH||m(-1);try{a.PFSH.SelectStorage(1)}catch(f){l.log("***** Plugin Free SelectStorage error *****"),l.log("e.code : ",f.code,"e.message : ",f.message,"e.detail : ",f.detail)}try{a.PFSH.LoadAllCerts(document.domain)}catch(f){301E5===f.code?(a.PFSH.InstallCACerts(document.domain),a.PFSH.LoadAllCerts(document.domain)):(l.log("***** Plugin Free LoadAllCerts error *****"),l.log("e.code : ",f.code,"e.message : ",f.message,"e.detail : ",f.detail))}c=null;try{c=a.PFSH.GetUserCerts(document.domain),a.PFUC=c}catch(f){l.log("***** Plugin Free GetUserCerts error *****"),l.log("e.code : ",f.code,"e.message : ",f.message,"e.detail : ",f.detail)}c&&(g=c.length-1);l.log("***** Plugin Free *****");l.log("user certificate counts : ",g);if(0<g){e=[];for(h=0;h<g;h++){var q=h+1,n={};n.index=q;n.cert=c[q].signcert;e[h]=n}a.certsList={list:e}}else a.certsList=null,p=0;m(p)}else if(b==a.CONST.__PF_M_SS.device&&a.CCPFSH()){try{a.PFSH.SelectStorage(1)}catch(f){l.log("***** Plugin Free SelectStorage error *****"),l.log("e.code : ",f.code,"e.message : ",f.message,"e.detail : ",f.detail)}try{a.PFSH.LoadAllCerts(document.domain)}catch(f){301E5===f.code&&(a.PFSH.InstallCACerts(document.domain),a.PFSH.LoadAllCerts(document.domain))}a.CCPFSH().GetCCStorageHandler(a.ESVS.EncAlgo,a.ESVS.HashAlgo,a.ESVS.BSPKI,function(b,c){0==b&&a.CCPFSH().GetCertificateList(function(b,c){if(0==b){var f=0;(a.PFUC=c)&&(f=c.length-1);l.log("***** Plugin Free *****");l.log("user certificate counts : ",f);if(0<f){for(var d=[],e=0;e<f;e++){var k=e+1,g={};g.index=k;g.cert=c[k].signcert;d[e]=g}a.certsList={list:d}}}m(b)})})}else!a.uiUtil().isItPFDevice(b)&&4&a.ESVS.Mode?a.nimservice()?b==a.CONST.__USFB_M_SECUREDISK.device&&d.type&&"BACKUPED_CERT"==d.type?a.nimservice().GetBackupedCertList(c,function(b,c,d){c=0;d&&(c=d.length);if(0==b&&0<c){for(var f=[],e=0;e<c;e++){var g=e+1;var h={};h.index=g;h.cert=d[e];f[e]=h}a.certsList={list:f}}else a.certsList=null,a.uiUtil().errMsgBox(a.nimservice().GetLastErrorMessage(),b);a.uiUtil().loadingBox(!1,"us-div-cert-list-load");m(b)}):a.nimservice().GetAllUserCertListNum(b,c,h,function(c,d,e){g=e;if(0==c)0<g?a.nimservice().GetAllUserCert(e,function(b,c){0==b?a.certsList={list:c}:a.uiUtil().errMsgBox(a.nimservice().GetLastErrorMessage(),b);a.uiUtil().loadingBox(!1,"us-div-cert-list-load");m(b)}):(a.certsList=null,a.uiUtil().loadingBox(!1,"us-div-cert-list-load"),m(0));else{if(b==a.CONST.__USFB_M_MOBILE.device&&61E6==c)return a.ERROR.Code=11003,a.ERROR.Message=x.IDS_MSGBOX_NOT_INSTALL_MOBILE,document.getElementById("us-cls-btn").click(),"firefox"==a.browserName?window.open(a.ubiKeyEnv.downloadURL,"ubikey_url","scrollbars=1, op=100px, left=100px, height=500px, width=500px"):window.open(a.ubiKeyEnv.downloadURL,"ubikey_url","top=100px, left=100px, height=500px, width=500px"),a.certsList=null,m(c),!1;-1!==g&&(a.nimservice().GetLastErrorCode(),a.nimservice().GetLastErrorMessage());m(c);a.certsList=null;a.uiUtil().loadingBox(!1,"us-div-cert-list-load")}}):(a.uiUtil().msgBox(e.IDS_MSGBOX_NIM_ERROR_UNLOAD),m(-1)):m(p)}var G=function(){var b=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");b.open("GET",a.ESVS.SRCPath+"unisignweb/rsrc/layout/certlistui.html?version="+a.ver,!1);b.send(null);return b.responseText},D=function(){var b=window.XMLHttpRequest?new window.XMLHttpRequest:new ActiveXObject("MSXML2.XMLHTTP.3.0");b.open("GET",a.ESVS.SRCPath+"unisignweb/rsrc/lang/"+a.ESVS.Language+"/certlist_ui_"+a.ESVS.Language+".js?version="+a.ver,!1);b.send(null);return b.responseText},x=a.CustomEval(D,!0),y=null,h=null,E=a.ESVS.TabIndex,z=0,A=d.args&&d.args.device?d.args.device:2==a.ESVS.Mode?a.CONST.__PF_M_LS.device:a.CONST.__USFB_M_HDD.device,B=A==a.CONST.__USFB_M_SECUREDISK.device?1:0,l=window.console||{log:function(){}};return function(){var b=a.CustomEval(G),c=a.CustomEval(D,!0);r(b());document.getElementById("us-div-cert-list-lbl-notice").appendChild(document.createTextNode(c.IDS_CERT_STATE_NOTICE_3));var l=document.getElementById("us-list-lbl-title");l.appendChild(document.createTextNode(c.IDS_DIALOG_TITLE));l.setAttribute("tabindex",E,0);b=document.getElementById("us-cert-view-btn");b.setAttribute("value",c.IDS_CERT_VIEW,0);b.setAttribute("title",c.IDS_CERT_VIEW,0);b.onclick=function(){e(this,c)};b=document.getElementById("us-cert-list-confirm-btn");b.setAttribute("value",c.IDS_DIALOG_BTN_CONFIRM,0);b.setAttribute("title",c.IDS_DIALOG_BTN_CONFIRM,0);b.onclick=function(){h&&h.restoreOnMouseEvent();var a=parseInt(h.selectedIndex());d.onConfirm(a)};b=document.getElementById("us-cls-btn");b.setAttribute("title",c.IDS_DIALOG_BTN_CANCEL,0);b.setAttribute("value",c.IDS_DIALOG_BTN_CANCEL,0);b.onclick=function(){g()};b.onfocus=function(){l.focus()};b=document.getElementById("us-cert-list-cls-img-btn");b.onclick=function(){g()};b.onfocus=function(){l.focus()};b=document.getElementById("us-cert-list-cls-btn-img");b.setAttribute("src",a.ESVS.SRCPath+"unisignweb/rsrc/img/x-btn.png",0);b.onclick=function(){g()};var u=[{title:c.IDS_CERT_STATUS},{title:c.IDS_CERT_CLASSIFY},{title:c.IDS_CERT_USER},{title:c.IDS_CERT_ISSUER},{title:c.IDS_CERT_EXPIRATION_DAY}];z=E++;setTimeout(function(){q(u,c)},100);return document.getElementById("us-div-cert-list")}()};return function(d){var r=a.uiLayerLevel,g=a.uiUtil().getOverlay(r),e=x({type:d.type,args:d.args,onConfirm:d.onConfirm,onCancel:d.onCancel});e.style.zIndex=r+1;a.ESVS.TargetObj.insertBefore(g,a.ESVS.TargetObj.firstChild);var q=window.onresize;return{show:function(){draggable(e,document.getElementById("us-div-list-title"));g.style.display="block";a.uiUtil().offsetResize(e);window.onresize=function(){a.uiUtil().offsetResize(e);q&&q()};a.uiLayerLevel+=10;a.ESVS.TabIndex+=30;setTimeout(function(){var a=e.getElementsByTagName("p");if(0<a.length)for(var d=0;d<a.length;d++)"us-view-lbl-title"==a[d].id&&a[d].focus()},10)},hide:function(){g.style.display="none";e.style.display="none"},dispose:function(){window.onresize=function(){q&&q()};e.parentNode.parentNode.removeChild(e.parentNode);g.parentNode.removeChild(g);a.uiLayerLevel-=10;a.ESVS.TabIndex-=30}}}};
|