[Mapbender-commits] r9469 - in trunk/mapbender: http/javascripts http/php resources/locale/de_DE/LC_MESSAGES
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon May 23 01:59:55 PDT 2016
Author: verenadiewald
Date: 2016-05-23 01:59:54 -0700 (Mon, 23 May 2016)
New Revision: 9469
Modified:
trunk/mapbender/http/javascripts/mod_coordsLookup.php
trunk/mapbender/http/php/mod_coordsLookup_server.php
trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
Log:
cleaned up module (clean separate use of coords functionality without mapcode, updated server script postgis function calls st_, new message in Mapbender.po file)
Modified: trunk/mapbender/http/javascripts/mod_coordsLookup.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_coordsLookup.php 2016-05-19 09:18:43 UTC (rev 9468)
+++ trunk/mapbender/http/javascripts/mod_coordsLookup.php 2016-05-23 08:59:54 UTC (rev 9469)
@@ -84,7 +84,7 @@
typeof options.perimeters === 'undefined' || options.perimeters.length === 0
) {
}
- if (typeof options.useMapcode === 'undefined' || options.useMapcode == false) {
+ if (typeof options.useMapcode === 'undefined' || options.useMapcode == false || options.useMapcode == 'false') {
options.useMapcode = false;
} else {
options.useMapcode = true;
@@ -106,7 +106,6 @@
this.searchRadioButton = this.searchSwitchContainer.append('<label><input type="radio" id="coords" name="searchswitcher" value="coords" /><?php echo _mb("Coordinates");?></label><label><input type="radio" id="mapcode" name="searchswitcher" value="mapcode" /><?php echo _mb("Mapcode");?><a target="_blank" href="http://www.mapcode.com"><img src="../img/help.png"></a></label>');
}
//enable coords by default
-
$('#coords').attr("checked", "checked");
// Coordinates input with label
@@ -184,15 +183,27 @@
}
this.zoomToCoordinates = function() {
- //switch coords / mapcode
- activatedRadioButton = $("input[name='searchswitcher']:checked").val();
- if (activatedRadioButton == "coords") {
+ //if radio button selection between coords and mapcode exists, check for selection
+ if($("input[name='searchswitcher']").length > 0) {
+ //switch coords / mapcode
+ activatedSearchMode = $("input[name='searchswitcher']:checked").val();
+ }
+ //use default selection coords
+ else {
+ activatedSearchMode = "coords";
+ }
+
+ if (activatedSearchMode == "coords") {
this.coords = {};
this.coords.x = this.coordXInput.val().replace(',','.');
this.coords.y = this.coordYInput.val().replace(',','.');
//check if deg/minutes/seconds have been inserted
//validate
this.regexdms = /([0-9.]+)\°([0-9.]+)\'([0-9.]+)\'\'/;
+ if($("#projection-select option:selected").index() == 0) {
+ alert('<?php echo _mb("Invalid spatial reference system! Please select a value from list!");?>');
+ return;
+ }
this.coords.sourceProjection = (this.projectionSelect.val()) ?
this.projectionSelect.val() : null;
this.coords.targetProjection = Mapbender.modules[options.target].getSRS();
Modified: trunk/mapbender/http/php/mod_coordsLookup_server.php
===================================================================
--- trunk/mapbender/http/php/mod_coordsLookup_server.php 2016-05-19 09:18:43 UTC (rev 9468)
+++ trunk/mapbender/http/php/mod_coordsLookup_server.php 2016-05-23 08:59:54 UTC (rev 9469)
@@ -32,11 +32,11 @@
}
if(SYS_DBTYPE=='pgsql'){
$con = db_connect(DBSERVER, OWNER, PW);
- $sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as minx";
+ $sqlMinx = "SELECT X(ST_Transform(ST_GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as minx";
$resMinx = db_query($sqlMinx);
$minx = floatval(db_result($resMinx,0,"minx"));
- $sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as miny";
+ $sqlMiny = "SELECT Y(ST_Transform(ST_GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as miny";
$resMiny = db_query($sqlMiny);
$miny = floatval(db_result($resMiny,0,"miny"));
@@ -48,11 +48,11 @@
/*
* @security_patch sqli done
*/
- $sqlMinx = "SELECT X(transform(GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as minx";
+ $sqlMinx = "SELECT X(ST_Transform(ST_GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as minx";
$resMinx = pg_query($con,$sqlMinx);
$minx = floatval(pg_fetch_result($resMinx,0,"minx"));
- $sqlMiny = "SELECT Y(transform(GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as miny";
+ $sqlMiny = "SELECT Y(ST_Transform(ST_GeometryFromText('POINT(".pg_escape_string($x)." ".pg_escape_string($y).")',".pg_escape_string($oldEPSG)."),".pg_escape_string($newEPSG).")) as miny";
$resMiny = pg_query($con,$sqlMiny);
$miny = floatval(pg_fetch_result($resMiny,0,"miny"));
}
Modified: trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po 2016-05-19 09:18:43 UTC (rev 9468)
+++ trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po 2016-05-23 08:59:54 UTC (rev 9469)
@@ -1908,6 +1908,11 @@
msgid "coordinates"
msgstr "Koordinaten"
+#: ../http/javascripts/mod_coordsLookup.php:204
+msgid "Invalid spatial reference system! Please select a value from list!"
+msgstr ""
+"Ungültiges räumliches Bezugssystem! Bitte selektieren Sie einen Wert aus der Liste!"
+
#: ../http/javascripts/mod_coordsLookup.php:128
#: ../http/javascripts/mod_coordsLookup.php:153
msgid "Invalid X coordinate! Must be a float or a DMS value!"
More information about the Mapbender_commits
mailing list