incubator-hise-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r.@apache.org
Subject svn commit: r984351 - /incubator/hise/trunk/hise-web-client/taskOperations.html
Date Wed, 11 Aug 2010 09:31:54 GMT
Author: rr
Date: Wed Aug 11 09:31:54 2010
New Revision: 984351

URL: http://svn.apache.org/viewvc?rev=984351&view=rev
Log:
HISE-71: Added development mode to AJAX client

Modified:
    incubator/hise/trunk/hise-web-client/taskOperations.html

Modified: incubator/hise/trunk/hise-web-client/taskOperations.html
URL: http://svn.apache.org/viewvc/incubator/hise/trunk/hise-web-client/taskOperations.html?rev=984351&r1=984350&r2=984351&view=diff
==============================================================================
--- incubator/hise/trunk/hise-web-client/taskOperations.html (original)
+++ incubator/hise/trunk/hise-web-client/taskOperations.html Wed Aug 11 09:31:54 2010
@@ -1,6 +1,7 @@
 <html>
 <head>
 <script type="text/javascript">
+var devMode = 0;
     function getText(n){
         var strings = [];
         getStrings(n, strings);
@@ -20,40 +21,224 @@
     }
 
 function sendRequest(content,soapAction) {
-    //alert(content);
-    var req;
-    if (window.XMLHttpRequest)
-      {// code for IE7+, Firefox, Chrome, Opera, Safari
-      req=new XMLHttpRequest();
-      }
-    else
-      {// code for IE6, IE5
-      req=new ActiveXObject("Microsoft.XMLHTTP");
-      }
+    if (devMode == 1) {
+        var parser;
+        var xmlDoc; 
+        var txt=
+'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">'+
+'   <soap:Body>'+
+'      <getMyTasksResponse xmlns="http://www.example.org/WS-HT/api/xsd" xmlns:ns2="http://www.example.org/WS-HT"
xmlns:ns3="http://www.example.org/WS-HT/api">'+
+'         <taskAbstract>'+
+'            <ns3:id>34</ns3:id>'+
+'            <ns3:taskType>TASK</ns3:taskType>'+
+'            <ns3:name xmlns:ns4="http://www.insurance.example.com/claims">ns4:Task4</ns3:name>'+
+'            <ns3:status>READY</ns3:status>'+
+'            <ns3:priority>0</ns3:priority>'+
+'            <ns3:taskStakeholders>'+
+'               <ns2:users>'+
+'                  <ns2:user>user3</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:taskStakeholders>'+
+'            <ns3:potentialOwners>'+
+'               <ns2:users>'+
+'                  <ns2:user>user1</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:potentialOwners>'+
+'            <ns3:businessAdministrators>'+
+'               <ns2:users>'+
+'                  <ns2:user>user1</ns2:user>'+
+'                  <ns2:user>user2</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:businessAdministrators>'+
+'            <ns3:actualOwner>someUser</ns3:actualOwner>'+
+'            <ns3:createdOn>2010-07-23T10:41:35.018+02:00</ns3:createdOn>'+
+'            <ns3:createdBy>user3</ns3:createdBy>'+
+'            <ns3:activationTime>2010-07-23T10:41:35.018+02:00</ns3:activationTime>'+
+'            <ns3:isSkipable>true</ns3:isSkipable>'+
+'            <ns3:presentationName>Approve Claim</ns3:presentationName>'+
+'            <ns3:presentationSubject>Approve the insurance claim for PLN 1234 on behalf
of EdmundZorn</ns3:presentationSubject>'+
+'            <ns3:renderingMethodExists>false</ns3:renderingMethodExists>'+
+'         </taskAbstract>'+
+'         <taskAbstract>'+
+'            <ns3:id>35</ns3:id>'+
+'            <ns3:taskType>TASK</ns3:taskType>'+
+'            <ns3:name xmlns:ns4="http://www.insurance.example.com/claims">ns4:Task5</ns3:name>'+
+'            <ns3:status>READY</ns3:status>'+
+'            <ns3:priority>0</ns3:priority>'+
+'            <ns3:taskStakeholders>'+
+'               <ns2:users>'+
+'                  <ns2:user>user6</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:taskStakeholders>'+
+'            <ns3:potentialOwners>'+
+'               <ns2:users>'+
+'                  <ns2:user>someUser</ns2:user>'+
+'                  <ns2:user>user4</ns2:user>'+
+'                  <ns2:user>user6</ns2:user>'+
+'                  <ns2:user>user2</ns2:user>'+
+'                  <ns2:user>user1</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:potentialOwners>'+
+'            <ns3:businessAdministrators>'+
+'               <ns2:users>'+
+'                  <ns2:user>user5</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:businessAdministrators>'+
+'            <ns3:actualOwner>someUser</ns3:actualOwner>'+
+'            <ns3:createdOn>2010-07-23T10:41:35.749+02:00</ns3:createdOn>'+
+'            <ns3:createdBy>user3</ns3:createdBy>'+
+'            <ns3:activationTime>2010-07-23T10:41:35.749+02:00</ns3:activationTime>'+
+'            <ns3:isSkipable>true</ns3:isSkipable>'+
+'            <ns3:presentationName>Approve Claim</ns3:presentationName>'+
+'            <ns3:presentationSubject>Approve the insurance claim for PLN 1234 on behalf
of EdmundZorn</ns3:presentationSubject>'+
+'            <ns3:renderingMethodExists>false</ns3:renderingMethodExists>'+
+'         </taskAbstract>'+
+'         <taskAbstract>'+
+'            <ns3:id>952</ns3:id>'+
+'            <ns3:taskType>TASK</ns3:taskType>'+
+'            <ns3:name xmlns:ns4="http://www.insurance.example.com/claims">ns4:Task4</ns3:name>'+
+'            <ns3:status>READY</ns3:status>'+
+'            <ns3:priority>0</ns3:priority>'+
+'            <ns3:taskStakeholders>'+
+'               <ns2:users>'+
+'                  <ns2:user>user3</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:taskStakeholders>'+
+'            <ns3:potentialOwners>'+
+'               <ns2:users>'+
+'                  <ns2:user>user1</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:potentialOwners>'+
+'            <ns3:businessAdministrators>'+
+'               <ns2:users>'+
+'                  <ns2:user>user1</ns2:user>'+
+'                  <ns2:user>user2</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:businessAdministrators>'+
+'            <ns3:actualOwner>someUser</ns3:actualOwner>'+
+'            <ns3:createdOn>2010-08-10T23:25:35.635+02:00</ns3:createdOn>'+
+'            <ns3:createdBy>soapui</ns3:createdBy>'+
+'            <ns3:activationTime>2010-08-10T23:25:35.635+02:00</ns3:activationTime>'+
+'            <ns3:isSkipable>true</ns3:isSkipable>'+
+'            <ns3:presentationName>Approve Claim</ns3:presentationName>'+
+'            <ns3:presentationSubject>Approve the insurance claim for PLN 1234 on behalf
of EdmundZorn</ns3:presentationSubject>'+
+'            <ns3:renderingMethodExists>false</ns3:renderingMethodExists>'+
+'         </taskAbstract>'+
+'         <taskAbstract>'+
+'            <ns3:id>953</ns3:id>'+
+'            <ns3:taskType>TASK</ns3:taskType>'+
+'            <ns3:name xmlns:ns4="http://www.insurance.example.com/claims">ns4:Task4</ns3:name>'+
+'            <ns3:status>READY</ns3:status>'+
+'            <ns3:priority>0</ns3:priority>'+
+'            <ns3:taskStakeholders>'+
+'               <ns2:users>'+
+'                  <ns2:user>user3</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:taskStakeholders>'+
+'            <ns3:potentialOwners>'+
+'               <ns2:users>'+
+'                  <ns2:user>user1</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:potentialOwners>'+
+'            <ns3:businessAdministrators>'+
+'               <ns2:users>'+
+'                  <ns2:user>user2</ns2:user>'+
+'                  <ns2:user>user1</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:businessAdministrators>'+
+'            <ns3:actualOwner>someUser</ns3:actualOwner>'+
+'            <ns3:createdOn>2010-08-11T00:03:08.547+02:00</ns3:createdOn>'+
+'            <ns3:createdBy>soapui</ns3:createdBy>'+
+'            <ns3:activationTime>2010-08-11T00:03:08.547+02:00</ns3:activationTime>'+
+'            <ns3:isSkipable>true</ns3:isSkipable>'+
+'            <ns3:presentationName>Approve Claim</ns3:presentationName>'+
+'            <ns3:presentationSubject>Approve the insurance claim for PLN 1234 on behalf
of EdmundZorn</ns3:presentationSubject>'+
+'            <ns3:renderingMethodExists>false</ns3:renderingMethodExists>'+
+'         </taskAbstract>'+
+'         <taskAbstract>'+
+'            <ns3:id>954</ns3:id>'+
+'            <ns3:taskType>TASK</ns3:taskType>'+
+'            <ns3:name xmlns:ns4="http://www.insurance.example.com/claims">ns4:Task4</ns3:name>'+
+'            <ns3:status>READY</ns3:status>'+
+'            <ns3:priority>0</ns3:priority>'+
+'            <ns3:taskStakeholders>'+
+'               <ns2:users>'+
+'                  <ns2:user>user3</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:taskStakeholders>'+
+'            <ns3:potentialOwners>'+
+'               <ns2:users>'+
+'                  <ns2:user>user1</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:potentialOwners>'+
+'            <ns3:businessAdministrators>'+
+'               <ns2:users>'+
+'                  <ns2:user>user2</ns2:user>'+
+'                  <ns2:user>user1</ns2:user>'+
+'               </ns2:users>'+
+'            </ns3:businessAdministrators>'+
+'            <ns3:actualOwner>someUser</ns3:actualOwner>'+
+'            <ns3:createdOn>2010-08-11T00:20:09.171+02:00</ns3:createdOn>'+
+'            <ns3:createdBy>soapui</ns3:createdBy>'+
+'            <ns3:activationTime>2010-08-11T00:20:09.171+02:00</ns3:activationTime>'+
+'            <ns3:isSkipable>true</ns3:isSkipable>'+
+'            <ns3:presentationName>Approve Claim</ns3:presentationName>'+
+'            <ns3:presentationSubject>Approve the insurance claim for PLN 1234 on behalf
of EdmundZorn</ns3:presentationSubject>'+
+'            <ns3:renderingMethodExists>false</ns3:renderingMethodExists>'+
+'         </taskAbstract>'+
+'      </getMyTasksResponse>'+
+'   </soap:Body>'+
+'</soap:Envelope>'
+            ;
+
+        if (window.DOMParser)
+          {
+          parser=new DOMParser();
+          xmlDoc=parser.parseFromString(txt,"text/xml");
+          }
+        else // Internet Explorer
+          {
+          xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
+          xmlDoc.async="false";
+          xmlDoc.loadXML(txt);
+          } 
+        return xmlDoc;
+    } else {
+        //alert(content);
+        var req;
+        if (window.XMLHttpRequest)
+          {// code for IE7+, Firefox, Chrome, Opera, Safari
+          req=new XMLHttpRequest();
+          }
+        else
+          {// code for IE6, IE5
+          req=new ActiveXObject("Microsoft.XMLHTTP");
+          }
+        
+        //req.open("GET", "http://localhost:8181/cxf/taskOperations/", false);   
+        //req.open("GET", "c.xml", false);   
+        req.open("POST", "cxf/taskOperationsPlainAuth/", false);   
+        req.setRequestHeader("Content-Type", "application/xml");
+        req.setRequestHeader("SOAPAction", soapAction);
+        //req.setRequestHeader("Content-Length", content.length);
+        //req.setRequestHeader("Connection", "close");
+        try {
+            req.send(content);  
+            var v=req.responseXML;       
     
-    //req.open("GET", "http://localhost:8181/cxf/taskOperations/", false);   
-    //req.open("GET", "c.xml", false);   
-    req.open("POST", "cxf/taskOperationsPlainAuth/", false);   
-    req.setRequestHeader("Content-Type", "application/xml");
-    req.setRequestHeader("SOAPAction", soapAction);
-    //req.setRequestHeader("Content-Length", content.length);
-    //req.setRequestHeader("Connection", "close");
-    try {
-        req.send(content);  
-        var v=req.responseXML;       
-
-        var d = v.getElementsByTagNameNS("http://schemas.xmlsoap.org/soap/envelope/", "Envelope")[0];
-        if (d != null) {
-            d = d.getElementsByTagNameNS("http://schemas.xmlsoap.org/soap/envelope/", "Fault")[0];
+            var d = v.getElementsByTagNameNS("http://schemas.xmlsoap.org/soap/envelope/",
"Envelope")[0];
             if (d != null) {
-                throw "SOAP Fault occurred: " + getText(d);
+                d = d.getElementsByTagNameNS("http://schemas.xmlsoap.org/soap/envelope/",
"Fault")[0];
+                if (d != null) {
+                    throw "SOAP Fault occurred: " + getText(d);
+                }
             }
+    
+            return v;
+        } catch (e) {
+            alert(e);
+            throw e;
         }
-
-        return v;
-    } catch (e) {
-        alert(e);
-        throw e;
     }
 }
 



Mime
View raw message