[Pywps-commits] r1188 - branches/pywps-3.2-soap/webclient trunk/webclient

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Aug 22 11:26:10 CEST 2011


Author: jesus
Date: 2011-08-22 11:26:09 +0200 (Mon, 22 Aug 2011)
New Revision: 1188

Modified:
   branches/pywps-3.2-soap/webclient/WPS.js
   trunk/webclient/WPS.js
Log:
Format support in input, format object: format:{mimeType:"text/xml",schema:"http://foo",encoding:"UTF-8"}. This hels with GRASS-WPS-Bridge

Modified: branches/pywps-3.2-soap/webclient/WPS.js
===================================================================
--- branches/pywps-3.2-soap/webclient/WPS.js	2011-08-08 11:28:30 UTC (rev 1187)
+++ branches/pywps-3.2-soap/webclient/WPS.js	2011-08-22 09:26:09 UTC (rev 1188)
@@ -670,6 +670,8 @@
         for (var i  = 0; i < process.inputs.length; i++ ) {
             var input = process.inputs[i];
             var tmpl = "";
+            var format = (input.format ? input.format : input.formats[0]);
+            var formatStr ="";
             if (input.CLASS_NAME.search("Complex")>-1) {
                 if (input.asReference) {
                     tmpl = OpenLayers.WPS.complexInputReferenceTemplate.replace("$REFERENCE$",escape(input.getValue()));
@@ -677,7 +679,19 @@
                 else {
                     tmpl = OpenLayers.WPS.complexInputDataTemplate.replace("$DATA$",input.getValue());
                 }
-            }
+                if (format) {
+                    if (format.mimeType) {
+                        formatStr += " mimeType=\""+format.mimeType+"\"";
+                    }
+                    if (format.schema) {
+                        formatStr += " schema=\""+format.schema+"\"";
+                    }
+                    if (format.encoding) {
+                        formatStr += " encoding=\""+format.encoding+"\"";
+                    }
+                }
+                tmpl = tmpl.replace("$FORMAT$",formatStr);
+            }       
             else if (input.CLASS_NAME.search("Literal") > -1) {
                 tmpl = OpenLayers.WPS.literalInputTemplate.replace("$DATA$",input.getValue());
             }
@@ -820,7 +834,6 @@
         }
         else if (complexData.length > 0) {
             // set output do DOM
-        	// set output do DOM
         	nodes=new Array();
             for (var i = 0; i < complexData[0].childNodes.length; i++) {
                 var node = complexData[0].childNodes[i];
@@ -1339,7 +1352,7 @@
 OpenLayers.WPS.complexInputReferenceTemplate = "<wps:Input>"+
                                 "<ows:Identifier>$IDENTIFIER$</ows:Identifier>"+
                                 "<wps:Data>"+
-                                '<wps:Reference xlink:href="$REFERENCE$"/>'+
+                                '<wps:Reference xlink:href="$REFERENCE$" $FORMAT$ />'+
                                 "</wps:Data>"+
                                 "</wps:Input>";
 
@@ -1350,7 +1363,7 @@
 OpenLayers.WPS.complexInputDataTemplate = "<wps:Input>"+
                                 "<ows:Identifier>$IDENTIFIER$</ows:Identifier>"+
                                 "<wps:Data>"+
-				"<wps:ComplexData>"+
+				"<wps:ComplexData $FORMAT$>"+
                                 "$DATA$"+
 				"</wps:ComplexData>"+
                                 "</wps:Data>"+

Modified: trunk/webclient/WPS.js
===================================================================
--- trunk/webclient/WPS.js	2011-08-08 11:28:30 UTC (rev 1187)
+++ trunk/webclient/WPS.js	2011-08-22 09:26:09 UTC (rev 1188)
@@ -670,6 +670,8 @@
         for (var i  = 0; i < process.inputs.length; i++ ) {
             var input = process.inputs[i];
             var tmpl = "";
+            var format = (input.format ? input.format : input.formats[0]);
+            var formatStr ="";
             if (input.CLASS_NAME.search("Complex")>-1) {
                 if (input.asReference) {
                     tmpl = OpenLayers.WPS.complexInputReferenceTemplate.replace("$REFERENCE$",escape(input.getValue()));
@@ -677,7 +679,19 @@
                 else {
                     tmpl = OpenLayers.WPS.complexInputDataTemplate.replace("$DATA$",input.getValue());
                 }
-            }
+                if (format) {
+                    if (format.mimeType) {
+                        formatStr += " mimeType=\""+format.mimeType+"\"";
+                    }
+                    if (format.schema) {
+                        formatStr += " schema=\""+format.schema+"\"";
+                    }
+                    if (format.encoding) {
+                        formatStr += " encoding=\""+format.encoding+"\"";
+                    }
+                }
+                tmpl = tmpl.replace("$FORMAT$",formatStr);
+            }       
             else if (input.CLASS_NAME.search("Literal") > -1) {
                 tmpl = OpenLayers.WPS.literalInputTemplate.replace("$DATA$",input.getValue());
             }
@@ -819,7 +833,7 @@
             output.setValue(literalData[0].firstChild.nodeValue);
         }
         else if (complexData.length > 0) {
-        	// set output do DOM
+            // set output do DOM
         	nodes=new Array();
             for (var i = 0; i < complexData[0].childNodes.length; i++) {
                 var node = complexData[0].childNodes[i];
@@ -1338,7 +1352,7 @@
 OpenLayers.WPS.complexInputReferenceTemplate = "<wps:Input>"+
                                 "<ows:Identifier>$IDENTIFIER$</ows:Identifier>"+
                                 "<wps:Data>"+
-                                '<wps:Reference xlink:href="$REFERENCE$"/>'+
+                                '<wps:Reference xlink:href="$REFERENCE$" $FORMAT$ />'+
                                 "</wps:Data>"+
                                 "</wps:Input>";
 
@@ -1349,7 +1363,7 @@
 OpenLayers.WPS.complexInputDataTemplate = "<wps:Input>"+
                                 "<ows:Identifier>$IDENTIFIER$</ows:Identifier>"+
                                 "<wps:Data>"+
-				"<wps:ComplexData>"+
+				"<wps:ComplexData $FORMAT$>"+
                                 "$DATA$"+
 				"</wps:ComplexData>"+
                                 "</wps:Data>"+



More information about the Pywps-commits mailing list