doodream.html 5.41 KB
Newer Older
Spencer Chang's avatar
Spencer Chang committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script type="text/javascript">
    function isIE() {
        var ua = navigator.userAgent;
        if (ua.indexOf("MSIE") < 0 && ua.indexOf("Trident") < 0) { // not IE
            return false;
        } else { // IE
            return true;
        }
    }

    function ConnData(xml) {
        // Packing XML Code
        xml = '' + xml;
        var xmlDom;
        if (!isIE()) { // code for others
            var parser = new DOMParser();
            xmlDom = parser.parseFromString(xml, "text/xml");
        } else { // code for IE
            xmlDom = new ActiveXObject("Microsoft.XMLDOM");
            xmlDom.loadXML(xml);
        }

        // XMLHttpRequest Open &  Send
        var xmlHttp;
        if (window.XMLHttpRequest)
        {   // code for IE7+, Firefox, Chrome, Opera, Safari
            xmlHttp=new XMLHttpRequest();
        }
        else {// code for IE6, IE5
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
        }

        try {
            xmlHttp.open("POST", "http://gpwfstg.hlcm.com/wp/approval/Forms/Facade.aspx", false);
        } catch (e) {
            // Exception Handling
            /* ### Write Code ### */
        }
        try {
            xmlHttp.send(xmlDom);
        }
        catch (e) {

        }
        // Get XHR Result
        var xmlResult = xmlHttp.responseXML;

        // Extract Result Code
        var resultCode = "";
        if (xmlResult.evaluate) {
            var nodes = xmlResult.evaluate("RESULT/RESULTCODE", xmlResult, null, XPathResult.ANY_TYPE, null);
            resultCode = nodes.iterateNext().textContent;
        } else {
            resultCode = xmlResult.selectSingleNode("RESULT/RESULTCODE").text;
        }

        // Extract Result URL
        var draftUrl = "";
        if (xmlResult.evaluate) {
            var nodes = xmlResult.evaluate("RESULT/DRAFTURL", xmlResult, null, XPathResult.ANY_TYPE, null);
            draftUrl = nodes.iterateNext().textContent;
        } else {
            draftUrl = xmlResult.selectSingleNode("RESULT/DRAFTURL").text;
        }

        if (resultCode != "00000") { // Error Handling
            /* ### Write Error Handling Code ### */
            if (resultCode.indexOf('Z') > -1) {

            } else if (resultCode.indexOf('A') > -1) {

            } else if (resultCode.indexOf('B') > -1) {

            } else if (resultCode.indexOf('F') > -1) {

            } else {

            }
        } else { //
            // Open Doodream Approval Popup
            window.open(draftUrl, "", "width=940, height=650, scrollbars=yes, toolbar=no, location=no, status=no, menubar=no");
        }
    }


    function xx() {
        return "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" +
            "<CONNROOT>\n" +
            "  <CONN>\n" +
            "    <KEYCODE>EHR-487F7D8F-5799-411E-943A-F0FAC161C8BC</KEYCODE>\n" +
            "    <UNIQUEID>924556</UNIQUEID>\n" +
            "    <RETURNURL>\n" +
            "      <URLPATH>http://dghr.corp.hlcm.com/odm/dg_odm010_dd_r04.jsp</URLPATH>\n" +
            "      <LOGINID></LOGINID>\n" +
            "      <PASSWORD></PASSWORD>\n" +
            "      <RETURNFIELDLIST>UNIQUEID,DOCID,APRDOCSTATE,APRDOCSTATEMESSAGE,APPROVER_USERID,PPROVER_USERNM,APPROVER_TITLE,APRTYPE,\n" +
            "                                     APPROVER_PROCESSDATE, AGENTAPPROVER_USERID,AGENTAPPROVER_USERNM,AGENTAPPROVER_TITLE </RETURNFIELDLIST>\n" +
            "    </RETURNURL>\n" +
            "  </CONN>\n" +
            "  <DOC>\n" +
            "    <DOCTITLE>工作申请禀议</DOCTITLE>\n" +
            "    <BODYTEXT><![CDATA[<!-----     * 1. 考勤申请人信息----><table style=“font-size:9pt;font-family:Gulim字体;\" cellpadding=\"0\" cellspacing=\"0\" ><tr>\n" +
            "                        <td height=“23” style=“font-size:11pt;padding-left:0px;“><b>1. 考勤申请人信息</b></td></tr>....................]]></BODYTEXT>\n" +
            "    <DRAFTERUSERID></DRAFTERUSERID>\n" +
            "    <DRAFTEREMPNO>20110007</DRAFTEREMPNO>\n" +
            "    <ISPUBLIC>Y</ISPUBLIC>\n" +
            "    <FORMNAME>工作申请禀议</FORMNAME>\n" +
            "  </DOC>\n" +
            "  <EXTRA>\n" +
            "    <ISTEMPSAVE>N</ISTEMPSAVE>\n" +
            "    <REDRAFT>N</REDRAFT>\n" +
            "    <AUTODRAFT>N</AUTODRAFT>\n" +
            "    <DRAFTSYNC>Y</DRAFTSYNC>\n" +
            "    <PROCESSYNC>N</PROCESSYNC>\n" +
            "    <RETURNSYNC>Y</RETURNSYNC>\n" +
            "    <ISAPRLINE>Y</ISAPRLINE>\n" +
            "    <ISRECIPIENTCC>Y</ISRECIPIENTCC>\n" +
            "    <ISPROPERTY>Y</ISPROPERTY>\n" +
            "  </EXTRA>\n" +
            "  <PROPERTY>\n" +
            "    <SECURITYCODE>200</SECURITYCODE>\n" +
            "    <STORAGEPERIOD>5yr</STORAGEPERIOD>\n" +
            "    <ISEDMS>Y</ISEDMS>\n" +
            "    <DUEDATE></DUEDATE>\n" +
            "    <TAG>근태</TAG>\n" +
            "    <TASKCODE></TASKCODE>\n" +
            "    <SUBCODE></SUBCODE>\n" +
            "  </PROPERTY>\n" +
            "  <APRLINE>\n" +
            "    <APPROVER>\n" +
            "      <USERID></USERID>\n" +
            "      <EMPNO>20061613</EMPNO>\n" +
            "      <DEPTID></DEPTID>\n" +
            "      <APRTYPE>Approve</APRTYPE>\n" +
            "    </APPROVER>\n" +
            "  </APRLINE>\n" +
            "</CONNROOT>\n"

    }


</script>
<body>
</body>
</html>