[Mapbender-commits] r9954 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Sep 4 00:20:41 PDT 2018
Author: armin11
Date: 2018-09-04 00:20:41 -0700 (Tue, 04 Sep 2018)
New Revision: 9954
Modified:
trunk/mapbender/http/php/mod_editGuiWms.php
Log:
fix for ticket: http://www.geoportal.rlp.de/trac/ticket/39
Modified: trunk/mapbender/http/php/mod_editGuiWms.php
===================================================================
--- trunk/mapbender/http/php/mod_editGuiWms.php 2018-09-03 08:39:20 UTC (rev 9953)
+++ trunk/mapbender/http/php/mod_editGuiWms.php 2018-09-04 07:20:41 UTC (rev 9954)
@@ -42,6 +42,7 @@
$this_wms = $_POST["this_wms"];
$this_layer_count = $_POST["this_layer_count"];
$update_content = $_POST["update_content"];
+$userId = Mapbender::session()->get("mb_user_id");
require_once (dirname(__FILE__) . "/../classes/class_wms.php");
?>
@@ -515,8 +516,10 @@
echo ">" . $row["gui_wms_position"] . " - " . $row["wms_title"] . "</option>";
$count_wms++;
}
+
echo "</select>";
echo "</td><td>";
+
echo "<input class='myButton' type='button' name='up_wms' value=' up ' onClick='validate(\"up_wms\")'>";
echo "<input type='hidden' name='up' value=''><br><br>";
@@ -523,9 +526,33 @@
echo "<input class='myButton' type='button' name='down_wms' value='down' onClick='validate(\"down_wms\")'>";
echo "<input type='hidden' name='down' value=''><br><br>";
-echo "<input class='myButton' type='button' name='delete_wms' value='remove' onClick='validate(\"delete_wms\")'>";
-echo "<input type='hidden' name='del' value=''>";
+$may_delete = !isset($wmsList);
+if (isset($wmsList)) {
+ // check if user is not owner of the wms or if the wms is still referenced in another own application
+ $sql = <<<EOT
+select (not exists(
+ select * from wms where wms_id = $1 and wms_owner = $2
+) or exists(
+ select * from gui_wms
+ join gui_mb_user on (gui_wms.fkey_gui_id = gui_mb_user.fkey_gui_id)
+ where gui_wms.fkey_wms_id = $1 and gui_mb_user.fkey_mb_user_id = $2
+ and gui_mb_user.mb_user_type = 'owner' and gui_mb_user.fkey_gui_id != $3
+))::int as may_delete
+EOT;
+
+ $res = db_prep_query($sql, array($wmsList, $userId, $selected_gui_id), array('i', 'i', 's'));
+ $may_delete = (bool)db_fetch_array($res)["may_delete"];
+}
+
+if ($may_delete) {
+ echo "<input class='myButton' type='button' name='delete_wms' value='remove' onClick='validate(\"delete_wms\")'>";
+ echo "<input type='hidden' name='del' value=''>";
+}
+else {
+ echo "Bitte benutzen Sie !Vollständig Löschen! um den WMS vollständig zu entfernen.";
+}
+
echo "</td>";
echo "</tr>";
echo "</table>";
More information about the Mapbender_commits
mailing list