[fusion-commits] r1765 - in branches/fusion2-mg21/widgets: . Search
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Feb 3 14:23:41 EST 2009
Author: chrisclaydon
Date: 2009-02-03 14:23:41 -0500 (Tue, 03 Feb 2009)
New Revision: 1765
Modified:
branches/fusion2-mg21/widgets/InvokeURL.js
branches/fusion2-mg21/widgets/Search.js
branches/fusion2-mg21/widgets/Search/SearchPrompt.php
branches/fusion2-mg21/widgets/Search/SearchPrompt.templ
Log:
Fix #207 in the fusion-mg21 branch
Modified: branches/fusion2-mg21/widgets/InvokeURL.js
===================================================================
--- branches/fusion2-mg21/widgets/InvokeURL.js 2009-02-03 18:59:39 UTC (rev 1764)
+++ branches/fusion2-mg21/widgets/InvokeURL.js 2009-02-03 19:23:41 UTC (rev 1765)
@@ -27,10 +27,10 @@
* Class: Fusion.Widget.InvokeURL
*
* A widget that will open the configured URL in the target element.
- *
+ *
* If the Target property points to TaskPane widget, the task will be listed in
* the menu list of the TaskPane and loaded there.
- * Otherwise if the target is an existing HTML elementt in the page it will be
+ * Otherwise if the target is an existing HTML elementt in the page it will be
* loaded there, otherwise it will open a new window with that name.
*
* **********************************************************************/
@@ -43,11 +43,11 @@
var json = widgetTag.extension;
this.sTarget = json.Target ? json.Target[0] : "InvokeUrlWindow";
this.sBaseUrl = json.Url[0]; //must be supplied
-
+
this.bSelectionOnly = (json.DisableIfSelectionEmpty &&
(json.DisableIfSelectionEmpty[0] == 'true' ||
json.DisableIfSelectionEmpty[0] == '1')) ? true : false;
-
+
this.additionalParameters = [];
if (json.AdditionalParameter) {
for (var i=0; i<json.AdditionalParameter.length; i++) {
@@ -57,7 +57,7 @@
this.additionalParameters.push(k+'='+encodeURIComponent(v));
}
}
-
+
this.enable = Fusion.Widget.InvokeURL.prototype.enable;
this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON, OpenLayers.Function.bind(this.enable, this));
this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF, OpenLayers.Function.bind(this.enable, this));
@@ -88,11 +88,11 @@
}
}
},
-
+
activate: function() {
var url = this.sBaseUrl;
//add in other parameters to the url here
-
+
var map = this.getMap();
var params = [];
params.push('LOCALE='+Fusion.locale);
@@ -113,7 +113,7 @@
if ( pageElement ) {
pageElement.src = url;
} else {
- window.open(url, this.sTarget, this.sWinFeatures);
+ window.open(url, this.sTarget, this.sFeatures);
}
}
}
Modified: branches/fusion2-mg21/widgets/Search/SearchPrompt.php
===================================================================
--- branches/fusion2-mg21/widgets/Search/SearchPrompt.php 2009-02-03 18:59:39 UTC (rev 1764)
+++ branches/fusion2-mg21/widgets/Search/SearchPrompt.php 2009-02-03 19:23:41 UTC (rev 1765)
@@ -39,21 +39,31 @@
SetLocalizedFilesPath(GetLocalizationPath());
$templ = Localize($templ, $locale, GetClientOS());
$vpath = GetSurroundVirtualPath();
- print sprintf($templ, $popup, $widgetName, $vpath."Search.php", $mapName, $sessionId);
+ print sprintf($templ, $popup, $properties, $propNames, $title, $prompt, $target, $filter, $layer, $limit, $vpath."Search.php", $mapName, $sessionId);
function GetParameters($params)
{
global $popup, $locale;
- global $mapName, $sessionId, $widgetName;
+ global $mapName, $sessionId;
+ global $title, $prompt, $target, $filter, $layer, $limit;
+ global $propNames, $properties;
- if(isset($params['locale']))
+ if(isset($params['locale'])) {
$locale = $params['locale'];
+ }
$popup = $params['popup'];
- $widgetName = $params['widgetname'];
$mapName = $params['mapname'];
$sessionId = $params['session'];
+ $propNames = $params['propNames'];
+ $properties = $params['properties'];
+ $title = $params['title'];
+ $prompt = $params['prompt'];
+ $target = $params['target'];
+ $filter = $params['filter'];
+ $layer = $params['layer'];
+ $limit = $params['limit'];
}
function GetRequestParameters()
Modified: branches/fusion2-mg21/widgets/Search/SearchPrompt.templ
===================================================================
--- branches/fusion2-mg21/widgets/Search/SearchPrompt.templ 2009-02-03 18:59:39 UTC (rev 1764)
+++ branches/fusion2-mg21/widgets/Search/SearchPrompt.templ 2009-02-03 19:23:41 UTC (rev 1765)
@@ -38,25 +38,37 @@
var msie = agent.indexOf("msie") != -1;
var popup = %s;
-var widgetId = '%s';
-var resultColumns;
+var propsIn = "%s";
+var properties = [];
+var namesIn = "%s";
+var names = [];
+var title = "%s";
+var prompt = "%s";
+var target = "%s";
+var filter = "%s";
+var layer = "%s";
+var limit = "%s";
function InitDocument()
{
if(!msie) document.getElementById("lf").innerHTML = "<br>";
if(!popup) document.onmousedown = OnMouseDown;
- var widget = GetParent().Fusion.getWidgetById(widgetId);
- resultColumns = widget.resultColumns;
+ if (propsIn != "") {
+ properties = propsIn.split(',');
+ }
+ if (namesIn != "") {
+ names = namesIn.split(',');
+ }
+
+ document.getElementById('title').innerHTML = title; //TODO use a better property than this
+ document.getElementById('prompt').innerHTML = prompt; //TODO use a better property than this
+ document.getElementById('target').value = target; //TODO use a better property than this
+ document.getElementById('filter').value = filter; //TODO use a better property than this
+ document.getElementById('layer').value = layer; //TODO use a better property than this
+ document.getElementById('limit').value = limit; //TODO use a better property than this
+ document.getElementById('popup').value = popup?"true":"false"; //TODO use a better property than this
- document.getElementById('title').innerHTML = widget.title; //TODO use a better property than this
- document.getElementById('prompt').innerHTML = widget.prompt; //TODO use a better property than this
- document.getElementById('target').value = widget.sTarget; //TODO use a better property than this
- document.getElementById('filter').value = widget.filter; //TODO use a better property than this
- document.getElementById('layer').value = widget.layer; //TODO use a better property than this
- document.getElementById('limit').value = widget.limit; //TODO use a better property than this
- document.getElementById('popup').value = popup; //TODO use a better property than this
-
var field = document.getElementById("Fld")
field.focus();
}
@@ -76,11 +88,11 @@
function SetMatchLabel()
{
- var colDef = "<input type=\"hidden\" name=\"cols\" value=\"" + resultColumns.length + "\">";
- for(var i = 0; i < resultColumns.length; i++)
+ var colDef = "<input type=\"hidden\" name=\"cols\" value=\"" + properties.length + "\">";
+ for(var i = 0; i < properties.length; i++)
{
- colDef += "<input type=\"hidden\" name=\"CN" + i + "\" value=\"" + resultColumns[i].Name + "\">";
- colDef += "<input type=\"hidden\" name=\"CP" + i + "\" value=\"" + resultColumns[i].Property + "\">";
+ colDef += "<input type=\"hidden\" name=\"CN" + i + "\" value=\"" + names[i] + "\">";
+ colDef += "<input type=\"hidden\" name=\"CP" + i + "\" value=\"" + properties[i] + "\">";
}
document.getElementById("MatchLabel").innerHTML = colDef;
}
Modified: branches/fusion2-mg21/widgets/Search.js
===================================================================
--- branches/fusion2-mg21/widgets/Search.js 2009-02-03 18:59:39 UTC (rev 1764)
+++ branches/fusion2-mg21/widgets/Search.js 2009-02-03 19:23:41 UTC (rev 1765)
@@ -29,11 +29,12 @@
* A widget that displays a pre-configured search form to the user and then
* runs the search. Searches are done on the attributes of specifiedd layers.
*
- * uses JavaScript Scale Bar for MapServer
+ * uses JavaScript Scale Bar for MapServer
* (http://mapserver.commenspace.org/tools/scalebar/
* **********************************************************************/
Fusion.Widget.Search = OpenLayers.Class(Fusion.Widget, {
+ uiClass: Jx.Button,
sFeatures : 'menubar=no,location=no,status=no,scrollbars=yes',
initializeWidget: function(widgetTag) {
@@ -51,7 +52,7 @@
activate: function() {
var url = this.sBaseUrl;
//add in other parameters to the url here
-
+
var map = this.getMap();
var mapLayers = map.getAllMaps();
var taskPaneTarget = Fusion.getWidgetById(this.sTarget);
@@ -66,7 +67,20 @@
} else {
params.push('popup=true');
}
- params.push('widgetname='+this.id);
+ params.push('title='+this.title);
+ params.push('prompt='+this.prompt);
+ params.push('target='+this.sTarget);
+ params.push('filter='+this.filter);
+ params.push('layer='+this.layer);
+ params.push('limit='+this.limit);
+ var names = [];
+ var props = [];
+ for (var i=0; i<this.resultColumns.length; ++i) {
+ names.push(this.resultColumns[i].Name);
+ props.push(this.resultColumns[i].Property);
+ }
+ params.push('properties='+props.join(","));
+ params.push('propNames='+names.join(","));
if (url.indexOf('?') < 0) {
url += '?';
@@ -80,7 +94,7 @@
if ( pageElement ) {
pageElement.src = url;
} else {
- window.open(url, this.sTarget, this.sWinFeatures);
+ window.open(url, this.sTarget, this.sFeatures);
}
}
}
More information about the fusion-commits
mailing list