[fusion-commits] r1764 - in trunk/widgets: . Search
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Tue Feb 3 13:59:39 EST 2009
Author: madair
Date: 2009-02-03 13:59:39 -0500 (Tue, 03 Feb 2009)
New Revision: 1764
Modified:
trunk/widgets/Search.js
trunk/widgets/Search/SearchPrompt.php
trunk/widgets/Search/SearchPrompt.templ
Log:
closes #207: pass in parameters explicitly to the SearchPrompt.php and make Search.js a ui class object
Modified: trunk/widgets/Search/SearchPrompt.php
===================================================================
--- trunk/widgets/Search/SearchPrompt.php 2009-02-02 20:10:06 UTC (rev 1763)
+++ trunk/widgets/Search/SearchPrompt.php 2009-02-03 18:59:39 UTC (rev 1764)
@@ -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: trunk/widgets/Search/SearchPrompt.templ
===================================================================
--- trunk/widgets/Search/SearchPrompt.templ 2009-02-02 20:10:06 UTC (rev 1763)
+++ trunk/widgets/Search/SearchPrompt.templ 2009-02-03 18:59:39 UTC (rev 1764)
@@ -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: trunk/widgets/Search.js
===================================================================
--- trunk/widgets/Search.js 2009-02-02 20:10:06 UTC (rev 1763)
+++ trunk/widgets/Search.js 2009-02-03 18:59:39 UTC (rev 1764)
@@ -34,6 +34,7 @@
* **********************************************************************/
Fusion.Widget.Search = OpenLayers.Class(Fusion.Widget, {
+ uiClass: Jx.Button,
sFeatures : 'menubar=no,location=no,status=no,scrollbars=yes',
initializeWidget: function(widgetTag) {
@@ -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 += '?';
More information about the fusion-commits
mailing list