[fusion-commits] r2155 - in trunk/widgets: . FeatureInfo Query
Query/classes Redline Search Theme
svn_fusion at osgeo.org
svn_fusion at osgeo.org
Fri Apr 30 18:28:44 EDT 2010
Author: chrisclaydon
Date: 2010-04-30 18:28:43 -0400 (Fri, 30 Apr 2010)
New Revision: 2155
Modified:
trunk/widgets/FeatureInfo/featureinfomain.php
trunk/widgets/Query/classes/query.php
trunk/widgets/Query/querymain.php
trunk/widgets/Redline.js
trunk/widgets/Redline/Redline.php
trunk/widgets/Search/ErrorPage.templ
trunk/widgets/Search/Search.php
trunk/widgets/Search/SearchPrompt.php
trunk/widgets/Search/SearchPrompt.templ
trunk/widgets/Theme/thememain.php
Log:
Re #347 - Fix handling of locale parameter.
Modified: trunk/widgets/FeatureInfo/featureinfomain.php
===================================================================
--- trunk/widgets/FeatureInfo/featureinfomain.php 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/FeatureInfo/featureinfomain.php 2010-04-30 22:28:43 UTC (rev 2155)
@@ -25,8 +25,8 @@
exit;
}
SetLocalizedFilesPath(GetLocalizationPath());
- if(isset($_REQUEST['locale'])) {
- $locale = $_REQUEST['locale'];
+ if(isset($_REQUEST['LOCALE'])) {
+ $locale = $_REQUEST['LOCALE'];
} else {
$locale = GetDefaultLocale();
}
Modified: trunk/widgets/Query/classes/query.php
===================================================================
--- trunk/widgets/Query/classes/query.php 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Query/classes/query.php 2010-04-30 22:28:43 UTC (rev 2155)
@@ -39,14 +39,14 @@
$this->args = $args;
$this->site = new MgSiteConnection();
$this->site->Open(new MgUserInformation($args['SESSION']));
-
+
SetLocalizedFilesPath(GetLocalizationPath());
- if(isset($_REQUEST['locale'])) {
- $locale = $_REQUEST['locale'];
+ if(isset($_REQUEST['LOCALE'])) {
+ $locale = $_REQUEST['LOCALE'];
} else {
$locale = GetDefaultLocale();
}
-
+
$equalToLocal = GetLocalizedString('QUERYEQUALTO', $locale );
$notEqualToLocal = GetLocalizedString('QUERYNOTEQUALTO', $locale );
$greatThanLocal = GetLocalizedString('QUERYGREATTHAN', $locale );
@@ -230,7 +230,7 @@
$featureClass = $layer->GetFeatureClassName();
$filter = $layer->GetFilter();
$featureGeometry = $layer->GetFeatureGeometryName();
-
+
// Initialize the coordinate system transform
$schemaAndClass = explode(":", $featureClass);
@@ -268,7 +268,7 @@
$propertyFilter .= sprintf($this->strExpressions[$this->args['OPERATOR']], $this->args['VALUE']);
else
$propertyFilter .= sprintf($this->numExpressions[$this->args['OPERATOR']], $this->args['VALUE']);
-
+
if($filter != '')
$propertyFilter = $propertyFilter . ' AND (' . $filter . ')';
}
@@ -279,7 +279,7 @@
}
if($propertyFilter != '')
$queryOptions->SetFilter($propertyFilter);
-
+
if ($this->args['USESPATIALFILTER'] == 'true')
{
$polygon = $this->CreatePolygonFromGeomText($this->args['GEOMTEXT']);
@@ -573,7 +573,7 @@
$coord = $geometryFactory->CreateCoordinateXY($coords->GetItem(0)->GetX(), $coords->GetItem(0)->GetY());
$coords->Add($coord);
}
-
+
$linearRing = $geometryFactory->CreateLinearRing($coords);
$polygon = $geometryFactory->CreatePolygon($linearRing, null);
Modified: trunk/widgets/Query/querymain.php
===================================================================
--- trunk/widgets/Query/querymain.php 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Query/querymain.php 2010-04-30 22:28:43 UTC (rev 2155)
@@ -29,8 +29,8 @@
require_once 'classes/query.php';
SetLocalizedFilesPath(GetLocalizationPath());
- if(isset($_REQUEST['locale'])) {
- $locale = $_REQUEST['locale'];
+ if(isset($_REQUEST['LOCALE'])) {
+ $locale = $_REQUEST['LOCALE'];
} else {
$locale = GetDefaultLocale();
}
Modified: trunk/widgets/Redline/Redline.php
===================================================================
--- trunk/widgets/Redline/Redline.php 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Redline/Redline.php 2010-04-30 22:28:43 UTC (rev 2155)
@@ -31,10 +31,10 @@
$fusionMGpath = '../../layers/MapGuide/php/';
include $fusionMGpath . 'Common.php';
-
+
SetLocalizedFilesPath(GetLocalizationPath());
-if(isset($_REQUEST['locale'])) {
- $locale = $_REQUEST['locale'];
+if(isset($_REQUEST['LOCALE'])) {
+ $locale = $_REQUEST['LOCALE'];
} else {
$locale = GetDefaultLocale();
}
@@ -104,7 +104,7 @@
}
</script>
-
+
<table id="RedlineWidgetOptions" borders="1" width="100%">
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 13pt">
@@ -129,8 +129,8 @@
</tr>
<tr>
<td style="font-family: Arial, Helvetica, sans-serif; font-weight: bold; font-size: 8pt; background-color: #DCDCDC; color: black; height: 20px;"><?php echo $drawLocal ?></td>
- </tr>
- <tr>
+ </tr>
+ <tr>
<td>
<input id="RedlineWidgetPointRadio" type="radio" name="RedlineWidgetDrawRadio"/>
<label for="RedlineWidgetPointeRadio"><?php echo $pointLocal ?></label><br/>
@@ -153,6 +153,7 @@
<form id="RedlineWidgetUploadForm" enctype="multipart/form-data" action="Redline.php" method="post">
<input type="file" name="uploadedfile"/>
<input type="hidden" name="action" value="upload"/>
+ <input type="hidden" name="LOCALE" value="<?=$locale?>"/>
<br/>
<input id="RedlineWidgetUploadButton" type="submit" name="submit_element" value="<?php echo $uploadLocal ?>" />
</form>
Modified: trunk/widgets/Redline.js
===================================================================
--- trunk/widgets/Redline.js 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Redline.js 2010-04-30 22:28:43 UTC (rev 2155)
@@ -23,12 +23,12 @@
* DEALINGS IN THE SOFTWARE.
*/
-/* ********************************************************************
+/* ********************************************************************
* Class: Fusion.Widget.Redline
-*
-* Allows the user to create a temporary OpenLayers Vector layer and
-* draw POINT, LINE and POLYGON features on that layer.
-*
+*
+* Allows the user to create a temporary OpenLayers Vector layer and
+* draw POINT, LINE and POLYGON features on that layer.
+*
**********************************************************************/
@@ -68,7 +68,7 @@
// the default feature styleMap
styleMap: null,
- activeControl: null,
+ activeControl: null,
activeLayer: null,
// the hidden html form for the save action
@@ -86,7 +86,7 @@
this.sTarget = json.Target ? json.Target[0] : "";
if (this.sTarget)
this.taskPane = new Fusion.Widget.Redline.DefaultTaskPane(this, widgetTag.location);
-
+
// Check in the user has defined his default feature style
var defaultFeatureStyle;
var jsonFeatureStyle = json.FeatureStyle ? json.FeatureStyle[0] : null;
@@ -99,12 +99,12 @@
} else {
defaultFeatureStyle = this.defaultFeatureStyle
}
-
+
this.styleMap = new OpenLayers.StyleMap(defaultFeatureStyle);
-
+
// create one default layer, unless other redline widgets have created it
this.vectorLayers = this.mapWidget.oMapOL.getLayersByName(this.defaultLayerName + '0');
-
+
if (!this.vectorLayers.length) {
this.vectorLayers[0] = new OpenLayers.Layer.Vector(this.defaultLayerName + '0', { styleMap: this.styleMap });
this.vectorLayers[0].redLineLayer = true;
@@ -115,7 +115,7 @@
// Check if the default control is specified
this.defaultControl = 'point';
- if (json.DefaultControl) {
+ if (json.DefaultControl) {
var control = json.DefaultControl[0].toLowerCase();
if (this.drawControls[control])
this.defaultControl = control;
@@ -137,8 +137,8 @@
line: new OpenLayers.Control.DrawFeature(this.vectorLayers[0],
OpenLayers.Handler.Path, {
handlerOptions: {
- freehandToggle: null,
- freehand: false,
+ freehandToggle: null,
+ freehand: false,
style: "default", // this forces default render intent
layerOptions: {
styleMap: this.styleMap
@@ -148,7 +148,7 @@
rectangle: new OpenLayers.Control.DrawFeature(this.vectorLayers[0],
OpenLayers.Handler.RegularPolygon, {
handlerOptions: {
- sides: 4,
+ sides: 4,
irregular: true,
style: "default", // this forces default render intent
layerOptions: {
@@ -159,7 +159,7 @@
polygon: new OpenLayers.Control.DrawFeature(this.vectorLayers[0],
OpenLayers.Handler.Polygon, {
handlerOptions: {
- freehand: false,
+ freehand: false,
style: "default", // this forces default render intent
layerOptions: {
styleMap: this.styleMap
@@ -167,13 +167,13 @@
}
})
};
-
+
for(var key in this.drawControls) {
this.drawControls[key].events.register('featureadded', this, this.featureAdded);
this.mapWidget.oMapOL.addControl(this.drawControls[key]);
}
- },
+ },
createSaveForm: function(panelDocument) {
/* Create a hidden form for the Save action */
@@ -223,25 +223,25 @@
this.activeControl = null;
this.getMap().supressContextMenu(false);
},
-
+
featureAdded: function(evt) {
- this.triggerEvent(Fusion.Event.REDLINE_FEATURE_ADDED, evt.feature);
- this.moveLayerToTop(evt.feature.layer);
+ this.triggerEvent(Fusion.Event.REDLINE_FEATURE_ADDED, evt.feature);
+ this.moveLayerToTop(evt.feature.layer);
},
-
- // move the redline layer to the top and redraw it
- moveLayerToTop: function(layer) {
- var map = layer.map;
- var baseIndex = map.getLayerIndex(layer);
-
- if(baseIndex != layer.map.layers.length-2)
- {
- // except for the current temp drawing layer, the redline layer is not on the top of the map.
- map.setLayerIndex(layer,layer.map.layers.length-2)
- }
- layer.redraw();
- },
-
+
+ // move the redline layer to the top and redraw it
+ moveLayerToTop: function(layer) {
+ var map = layer.map;
+ var baseIndex = map.getLayerIndex(layer);
+
+ if(baseIndex != layer.map.layers.length-2)
+ {
+ // except for the current temp drawing layer, the redline layer is not on the top of the map.
+ map.setLayerIndex(layer,layer.map.layers.length-2)
+ }
+ layer.redraw();
+ },
+
// change active layer
activateLayer: function(layerIndex) {
this.activeLayer = this.vectorLayers[layerIndex];
@@ -265,7 +265,7 @@
var fileContent = gmlParser.write(this.activeLayer.features);
this.saveForm.elements[0].value = "text/xml";
this.saveForm.elements[1].value = escape(fileContent);
- this.saveForm.elements[2].value = this.activeLayer.name + '.gml';
+ this.saveForm.elements[2].value = this.activeLayer.name + '.gml';
this.saveForm.submit();
},
@@ -275,7 +275,7 @@
this.vectorLayers[i].redLineLayer = true;
this.mapWidget.oMapOL.addLayer(this.vectorLayers[i]);
},
-
+
newLayerFromFile: function(fileName) {
var i = this.vectorLayers.length;
this.vectorLayers[i] = new OpenLayers.Layer.Vector(this.defaultLayerName + this.vectorLayers.length, {
@@ -321,7 +321,7 @@
}
});
-
+
Fusion.Widget.Redline.DefaultTaskPane = OpenLayers.Class(
{
// a reference to the redline widget
@@ -343,10 +343,22 @@
loadDisplayPanel: function() {
var url = Fusion.getFusionURL() + this.panelUrl;
-
+
+ var params = [];
+
+ // Add any additional params here
+ params.push('LOCALE='+Fusion.locale);
+
+ if (url.indexOf('?') < 0) {
+ url += '?';
+ } else if (url.slice(-1) != '&') {
+ url += '&';
+ }
+ url += params.join('&');
+
var taskPaneTarget = Fusion.getWidgetById(this.widget.sTarget);
var outputWin = window;
-
+
if ( taskPaneTarget ) {
taskPaneTarget.setContent(url);
outputWin = taskPaneTarget.iframe.contentWindow;
@@ -366,7 +378,7 @@
setTimeout(initFunction,300);
return;
}
-
+
// select the default control
var radioName = this.widget.defaultControl.charAt(0).toUpperCase() + this.widget.defaultControl.substr(1);
this.taskPaneWin.document.getElementById("RedlineWidget"+radioName+"Radio").checked = true;
@@ -380,12 +392,12 @@
this.updateLayerList();
this.updateFeatureList();
},
-
+
bindEvents: function() {
var doc = this.taskPaneWin.document;
-
+
// layers
- doc.getElementById("RedlineWidgetLayerList").onchange = OpenLayers.Function.bind(this.selectLayer, this);
+ doc.getElementById("RedlineWidgetLayerList").onchange = OpenLayers.Function.bind(this.selectLayer, this);
doc.getElementById("RedlineWidgetNewLayerButton").onclick = OpenLayers.Function.bind(this.newLayer, this);
doc.getElementById("RedlineWidgetRenameLayerButton").onclick = OpenLayers.Function.bind(this.renameLayer, this);
doc.getElementById("RedlineWidgetRemoveLayerButton").onclick = OpenLayers.Function.bind(this.removeLayer, this);
@@ -412,7 +424,7 @@
removeLayer: function() {
var i = this.taskPaneWin.document.getElementById("RedlineWidgetLayerList").selectedIndex;
this.widget.removeLayer(i);
- this.updateLayerList();
+ this.updateLayerList();
this.updateFeatureList();
},
@@ -452,7 +464,7 @@
this.widget.vectorLayers.push(olMap.layers[i]);
}
};
-
+
for ( var i = 0; i < this.widget.vectorLayers.length;i++)
{
var opt = document.createElement('option');
@@ -526,9 +538,9 @@
clearFeatureList: function() {
var select = this.taskPaneWin.document.getElementById('RedlineWidgetFeatureList');
- for (var i = (select.options.length-1); i>=0; i--) {
- select.options[i] = null;
- }
- select.selectedIndex = -1;
+ for (var i = (select.options.length-1); i>=0; i--) {
+ select.options[i] = null;
}
+ select.selectedIndex = -1;
+ }
});
Modified: trunk/widgets/Search/ErrorPage.templ
===================================================================
--- trunk/widgets/Search/ErrorPage.templ 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Search/ErrorPage.templ 2010-04-30 22:28:43 UTC (rev 2155)
@@ -65,7 +65,7 @@
<tr><td class="Title">%s<hr></td></tr>
<tr><td class="ErrorText">%s</td></tr>
<tr><td height="10"></td></tr>
- <tr><td><input type="button" value="OK" style="width: 70px;" class="Ctrl" onclick="history.back()"><input type="button" value="Cancel" style="width: 70px;" class="Ctrl" onclick="Back()"></td></tr>
+ <tr><td><input type="button" value="%s" style="width: 70px;" class="Ctrl" onclick="history.back()"><input type="button" value="%s" style="width: 70px;" class="Ctrl" onclick="Back()"></td></tr>
</table>
</body>
</html>
Modified: trunk/widgets/Search/Search.php
===================================================================
--- trunk/widgets/Search/Search.php 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Search/Search.php 2010-04-30 22:28:43 UTC (rev 2155)
@@ -274,9 +274,12 @@
function OnError($title, $msg)
{
- global $target, $popup, $mapName;
+ global $target, $popup, $mapName, $locale;
+ $ok = GetLocalizedString("BUTTONOK", $locale);
+ $cancel = GetLocalizedString("BUTTONCANCEL", $locale);
+
$templ = file_get_contents("./ErrorPage.templ");
- print sprintf($templ, $popup, $mapName, $title, $msg);
+ print sprintf($templ, $popup, $mapName, $title, $msg, $ok, $cancel);
}
function GetParameters($params)
Modified: trunk/widgets/Search/SearchPrompt.php
===================================================================
--- trunk/widgets/Search/SearchPrompt.php 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Search/SearchPrompt.php 2010-04-30 22:28:43 UTC (rev 2155)
@@ -44,7 +44,7 @@
SetLocalizedFilesPath(GetLocalizationPath());
$templ = Localize($templ, $locale, GetClientOS());
$vpath = GetSurroundVirtualPath();
- print sprintf($templ, $popup, $properties, $propNames, $title, $prompt, $target, $filter, $layer, $limit, $vpath."Search.php", $mapName, $sessionId);
+ print sprintf($templ, $popup, $properties, $propNames, $title, $prompt, $target, $filter, $layer, $limit, $vpath."Search.php", $mapName, $sessionId, $locale);
Modified: trunk/widgets/Search/SearchPrompt.templ
===================================================================
--- trunk/widgets/Search/SearchPrompt.templ 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Search/SearchPrompt.templ 2010-04-30 22:28:43 UTC (rev 2155)
@@ -60,7 +60,7 @@
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
@@ -111,6 +111,7 @@
<input class="Ctrl" type="edit" name="userinput" id="Fld">
<input type="hidden" name="mapname" value="%s">
<input type="hidden" name="session" value="%s">
+ <input type="hidden" name="locale" value="%s">
<input type="hidden" name="target" id="target">
<input type="hidden" name="popup" id="popup">
<input type="hidden" name="layer" id="layer">
Modified: trunk/widgets/Theme/thememain.php
===================================================================
--- trunk/widgets/Theme/thememain.php 2010-04-30 22:15:38 UTC (rev 2154)
+++ trunk/widgets/Theme/thememain.php 2010-04-30 22:28:43 UTC (rev 2155)
@@ -28,8 +28,8 @@
require_once 'classes/theme.php';
SetLocalizedFilesPath(GetLocalizationPath());
- if(isset($_REQUEST['locale'])) {
- $locale = $_REQUEST['locale'];
+ if(isset($_REQUEST['LOCALE'])) {
+ $locale = $_REQUEST['LOCALE'];
} else {
$locale = GetDefaultLocale();
}
@@ -268,7 +268,7 @@
return;
height = allowTransparency? 470: 445;
- w = window.open("../../layers/MapGuide/php/ColorPicker.php?LOCALE=en&CLR=" + clr + "&ALLOWTRANS=" + (allowTransparency? "1":"0") + "&TRANS=" + (transparent?"1":"0"), "colorPicker", "toolbar=no,status=no,width=355,height=" + height);
+ w = window.open("../../layers/MapGuide/php/ColorPicker.php?LOCALE=<?=$locale?>&CLR=" + clr + "&ALLOWTRANS=" + (allowTransparency? "1":"0") + "&TRANS=" + (transparent?"1":"0"), "colorPicker", "toolbar=no,status=no,width=355,height=" + height);
w.focus();
}
More information about the fusion-commits
mailing list