Author: saminda
Date: Wed Jan  2 03:47:07 2008
New Revision: 11760

Log:

Fixes for codegen file upload 


Modified:
   trunk/wsas/java/modules/www/extensions/tools/divs.html
   trunk/wsas/java/modules/www/extensions/tools/js/tools.js

Modified: trunk/wsas/java/modules/www/extensions/tools/divs.html
==============================================================================
--- trunk/wsas/java/modules/www/extensions/tools/divs.html      (original)
+++ trunk/wsas/java/modules/www/extensions/tools/divs.html      Wed Jan  2 
03:47:07 2008
@@ -1 +1,2 @@
-<div id="divWSDL2Code" style="display:none;"></div>
\ No newline at end of file
+<div id="divWSDL2Code" style="display:none;"></div>
+<div id="divCodegenFileupload" style="display:none;"></div>        
\ No newline at end of file

Modified: trunk/wsas/java/modules/www/extensions/tools/js/tools.js
==============================================================================
--- trunk/wsas/java/modules/www/extensions/tools/js/tools.js    (original)
+++ trunk/wsas/java/modules/www/extensions/tools/js/tools.js    Wed Jan  2 
03:47:07 2008
@@ -9,6 +9,9 @@
     wso2.wsas = {};
 }
 
+var codegenFileUploadOption = "";
+var codegenParentTextId = "";
+
 // static tools methods 
 wso2.wsas.Tools = {
 
@@ -19,12 +22,12 @@
         }
     },
 
-    avAARTool : function(thisObj, index){
+    avAARTool : function(thisObj, index) {
         this.renderHelper(thisObj, index);
         wso2.tool.AV.showValidatorServicesXML();
     },
 
-    avMARTool : function(thisObj, index){
+    avMARTool : function(thisObj, index) {
         this.renderHelper(thisObj, index);
         wso2.tool.AV.showValidatorModuleXML();
     },
@@ -34,13 +37,13 @@
         wso2.tool.WC.showWC();
     },
 
-    tryitTool : function(thisObj, index){
+    tryitTool : function(thisObj, index) {
         this.renderHelper(thisObj, index);
         wso2.tool.WC.showTryit();
     },
 
-    wsdlview : function(thisObj, index){
-       this.renderHelper(thisObj, index);
+    wsdlview : function(thisObj, index) {
+        this.renderHelper(thisObj, index);
         wso2.tool.WSDLView.showWSDLView();
     },
 
@@ -216,4 +219,48 @@
         tmpURL += GURL;
     }
     window.location = tmpURL + responseTextValue;
-}
\ No newline at end of file
+}
+
+function codeGenFileUploadeHelper(opt, txtObjId) {
+    codegenFileUploadOption = opt;
+    codegenParentTextId = txtObjId;
+    FileExcutor.execute = exeCodegenFileUpload;
+    var tmpTransformationNode;
+    /* The checking for the existance for window.XMLHttpRequest to figure out
+    the browser and the functionality was dropped since the new version of
+    IE has this object. */
+    if (wso2.wsf.Util.isIE()) {
+        tmpTransformationNode = new ActiveXObject("Microsoft.XmlDom");
+        var sXml = "<codegenFileUpload></codegenFileUpload>";
+        tmpTransformationNode.loadXML(sXml);
+    } else {
+        tmpTransformationNode =
+        document.implementation.createDocument("", "codegenFileUpload", null);
+    }
+    var divObject = document.getElementById("divCodegenFileupload");
+    var xsltHelperObj = new wso2.wsf.XSLTHelper();
+    xsltHelperObj.transform(divObject, tmpTransformationNode, 
"codegen_file_upload.xsl", false, "tools");
+    showYUIPanel("Upload File", divObject.innerHTML, "500px", 
"innerCodegenId", "divCodegenFileupload");
+}
+
+function exeCodegenFileUpload(val) {
+    var body_xml = '<req:getCodegenOptionsWithValues 
xmlns:req="http://org.wso2.wsf/tools";>\n' +
+                   '<codegenOption>' + codegenFileUploadOption + 
'</codegenOption>' +
+                   '<codegenOptionValue>' + val + '</codegenOptionValue>' +
+                   '</req:getCodegenOptionsWithValues>\n';
+
+    var callURL = wso2.wsf.Util.getServerURL() + "/WSDL2Code" ;
+    new wso2.wsf.WSRequest(callURL, "urn:getCodegenOptionsWithValues", 
body_xml, function () {
+        var divObj = document.getElementById("divCodegenFileupload");
+        if (divObj) {
+            divObj.innerHTML = "";
+            divObj.style.display = "none";
+        }
+        var responseTextValue = 
this.req.responseXML.getElementsByTagName("uploadFileValue")[0].firstChild.nodeValue;
+        divObj = document.getElementById(codegenParentTextId);
+        divObj.value = responseTextValue;
+//        divObj.disabled = true;
+    });
+
+}
+

_______________________________________________
Wsas-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/wsas-java-dev

Reply via email to