Skip to content

Commit

Permalink
Allow for SLD input.
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Mar 31, 2012
1 parent e424747 commit 46ba55d
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions examples/wps.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,9 @@ function buildForm() {
document.getElementById("input").innerHTML = "<h3>Input:</h3>";
document.getElementById("output").innerHTML = "";

var inputs = process.dataInputs, supported = true;
var input;
var inputs = process.dataInputs, supported = true,
sld = "text/xml; subtype=sld/1.0.0",
input;
for (var i=0,ii=inputs.length; i<ii; ++i) {
input = inputs[i];
if (input.complexData) {
Expand All @@ -92,6 +93,8 @@ function buildForm() {
addWFSCollectionInput(input);
} else if (formats["image/tiff"]) {
addRasterInput(input);
} else if (formats[sld]) {
addXMLInput(input, sld);
} else {
supported = false;
}
Expand Down Expand Up @@ -155,6 +158,22 @@ function addWKTInput(input, previousSibling) {
container.appendChild(field);
}

function addXMLInput(input, type) {
var name = input.identifier;
var field = document.createElement("input");
field.title = input["abstract"];
field.value = name + " (" + type + ")";
field.onblur = function() {
input.data = field.value ? {
complexData: {
mimeType: type,
value: this.value
}
} : undefined;
};
document.getElementById("input").appendChild(field);
}

// helper function to dynamically create a WFS collection reference input
function addWFSCollectionInput(input) {
var name = input.identifier;
Expand Down

0 comments on commit 46ba55d

Please sign in to comment.