1
|
/*
|
2
|
Author: Tom Kralidis
|
3
|
License: LGPL as per: http://www.gnu.org/copyleft/lesser.html
|
4
|
|
5
|
$Id$
|
6
|
*/
|
7
|
|
8
|
// Ensure this object's dependancies are loaded.
|
9
|
mapbuilder.loadScript(baseDir+"/widget/WidgetBaseXSL.js");
|
10
|
|
11
|
/**
|
12
|
* Widget to display a list of resources in a context doc to be selected for use
|
13
|
* as input to another form.
|
14
|
* @constructor
|
15
|
* @base WidgetBaseXSL
|
16
|
* @param widgetNode This widget's object node from the configuration document.
|
17
|
* @param model The model that this widget is a view of.
|
18
|
*/
|
19
|
|
20
|
|
21
|
function ResourceDropDown(widgetNode, model) {
|
22
|
WidgetBaseXSL.apply(this, new Array(widgetNode, model));
|
23
|
|
24
|
/**
|
25
|
* Change the AOI coordinates from select box choice of prefined locations
|
26
|
* @param bbox the bbox value of the location keyword chosen
|
27
|
*/
|
28
|
|
29
|
this.selectResource = function(selectedOption) {
|
30
|
if (selectedOption.value.length>0) {
|
31
|
var httpPayload = null;
|
32
|
var feature = this.model.getFeatureNode(selectedOption.value);
|
33
|
var resourceType = selectedOption.getAttribute("resourceType");
|
34
|
switch(resourceType) {
|
35
|
case "OGC:WFS":
|
36
|
httpPayload = config.objects.wfsController.createHttpPayload(feature);//TBD: remove hard-coded ID
|
37
|
break;
|
38
|
case "OGC:WCS":
|
39
|
httpPayload = config.objects.wcsController.createHttpPayload(feature);//TBD: remove hard-coded ID
|
40
|
break;
|
41
|
case "wms":
|
42
|
alert("not implemented yet; this will populate the URI input box with the URI to:"+featureName);
|
43
|
break;
|
44
|
case "OGC:GML":
|
45
|
httpPayload = new Object();
|
46
|
httpPayload.url = feature.selectSingleNode("wmc:Server/wmc:OnlineResource/@xlink:href").nodeValue;
|
47
|
break;
|
48
|
}
|
49
|
this.targetInput.value = httpPayload.url;
|
50
|
this.targetInput.focus();
|
51
|
}
|
52
|
}
|
53
|
|
54
|
this.setTargetListener = function(objRef) {
|
55
|
objRef.targetModel.addListener("refresh",objRef.paint,objRef);
|
56
|
}
|
57
|
this.model.addListener("loadModel",this.setTargetListener,this);
|
58
|
}
|