[Mapbender-commits] r2542 - in trunk/mapbender/http: classes
javascripts php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Jun 23 12:00:40 EDT 2008
Author: christoph
Date: 2008-06-23 12:00:40 -0400 (Mon, 23 Jun 2008)
New Revision: 2542
Added:
trunk/mapbender/http/classes/class_element.php
trunk/mapbender/http/javascripts/initOpenLayersWms.php
trunk/mapbender/http/javascripts/initWms.php
trunk/mapbender/http/javascripts/mod_openlayers.php
trunk/mapbender/http/javascripts/mod_openlayers_layerSwitch.js
trunk/mapbender/http/php/mod_editApplication.php
trunk/mapbender/http/php/mod_editApplication_server.php
Log:
Added: trunk/mapbender/http/classes/class_element.php
===================================================================
--- trunk/mapbender/http/classes/class_element.php (rev 0)
+++ trunk/mapbender/http/classes/class_element.php 2008-06-23 16:00:40 UTC (rev 2542)
@@ -0,0 +1,246 @@
+<?php
+# $Id: class_bbox.php 1965 2008-01-15 08:24:29Z christoph $
+# http://www.mapbender.org/index.php/
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+session_start();
+
+define("ELEMENT_PATTERN", "/sessionID/");
+
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../classes/class_mb_exception.php");
+
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+class Element {
+
+ var $guiId;
+ var $id;
+ var $pos;
+ var $isPublic;
+ var $comment;
+ var $title;
+ var $element;
+ var $src;
+ var $attributes;
+ var $left;
+ var $top;
+ var $width;
+ var $height;
+ var $zIndex;
+ var $moreStyles;
+ var $content;
+ var $closeTag;
+ var $jsFile;
+ var $mbMod;
+ var $target;
+ var $requires;
+ var $helpUrl;
+
+ public function __contruct() {
+
+ }
+
+ public function select ($id, $applicationId) {
+ $sql = "SELECT fkey_gui_id, e_id, e_pos, e_public, e_comment, e_public, ".
+ "gettext($1, e_title) as e_title, e_element, e_src, e_attributes, " .
+ "e_left, e_top, e_width, e_height, e_z_index, e_more_styles, " .
+ "e_content, e_closetag, e_js_file, e_mb_mod, e_target, " .
+ "e_requires, e_url FROM gui_element WHERE e_id = $2 AND " .
+ "fkey_gui_id = $3 LIMIT 1";
+ $v = array ($_SESSION["mb_lang"], $id, $applicationId);
+ $t = array ("s", "s", "s");
+ $res = db_prep_query($sql, $v, $t);
+ $row = db_fetch_array($res);
+ if ($row) {
+ $this->guiId = $applicationId;
+ $this->id = $row["e_id"];
+ $this->pos = $row["e_pos"];
+ $this->isPublic = $row["e_public"];
+ $this->comment = $row["e_comment"];
+ $this->title = $row["e_title"];
+ $this->element = $row["e_element"];
+ $this->src = $row["e_src"];
+ $this->attributes = $row["e_attributes"];
+ $this->left = $row["e_left"];
+ $this->top = $row["e_top"];
+ $this->width = $row["e_width"];
+ $this->height = $row["e_height"];
+ $this->zIndex = $row["e_z_index"];
+ $this->moreStyles = $row["e_more_styles"];
+ $this->content = $row["e_content"];
+ $this->closeTag = $row["e_closetag"];
+ $this->jsFile = $row["e_js_file"];
+ $this->mbMod = $row["e_mb_mod"];
+ $this->target = $row["e_target"];
+ $this->requires = $row["e_requires"];
+ $this->helpUrl = $row["e_url"];
+ return true;
+ }
+ return false;
+ }
+
+ public function __toString () {
+ return $this->toHtml();
+ }
+
+ public function getJavaScriptModules () {
+ $jsArray = array();
+ if ($this->mbMod != "") {
+ $moduleArray = explode(",", $this->mbMod);
+ for ($i = 0; $i < count($moduleArray); $i++) {
+ $currentFile = dirname(__FILE__) . "/../javascripts/" . trim($moduleArray[$i]);
+ if (file_exists($currentFile)) {
+ array_push($jsArray, $currentFile);
+ }
+ else {
+ $e = new mb_exception("Javascript module not found: " . $currentFile);
+ }
+ }
+ }
+ return $jsArray;
+ }
+
+ public function toHtmlArray () {
+ if ($this->isPublic) {
+ return array($this->getHtmlOpenTag(), $this->getHtmlContent(), $this->getHtmlCloseTag());
+ }
+ return array("", "", "");
+ }
+
+ public function toHtml () {
+ if ($this->isPublic) {
+ return implode("", $this->toHtmlArray());
+ }
+ return "";
+ }
+
+ private function getHtmlOpenTag () {
+ $openTag = "";
+
+ if ($this->id) {
+ // tag name
+ $openTag .= "<" . $this->element . " ";
+
+ // id and name
+ $openTag .= "id='" . $this->id . "' name='" . $this->id . "' ";
+
+ // attributes
+ if ($this->attributes) {
+ $openTag .= stripslashes($this->replaceSessionStringByUrlParameters($this->attributes)) . " ";
+ }
+
+ // title
+ if ($this->title) {
+ $openTag .= "title='" . $this->title . "' ";
+ }
+
+ // src
+ if ($this->src) {
+ $openTag .= "src = '" . $this->replaceSessionStringByUrlParameters($this->src);
+
+ // for iframes which are not "loadData",
+ // add additional parameters
+ if ($this->closeTag == "iframe" && $this->id != "loadData") {
+ if(mb_strpos($this->src, "?")) {
+ $openTag .= "&";
+ }
+ else {
+ $openTag .= "?";
+ }
+ $openTag .= "e_id_css=" . $this->id . "&" .
+ "e_id= " . $this->id . "&" .
+ "e_target=" . $this->target . "&" .
+ $this->getUrlParameters();
+ }
+ $openTag .= "' ";
+ }
+
+ // style
+ $openTag .= " style = '";
+ if ($this->top != "" && $this->left != "") {
+ $openTag .= "position:absolute;" .
+ "left:" . $this->left . ";" .
+ "top:" . $this->top . ";";
+ }
+ if ($this->width != "" && $this->height != "") {
+ $openTag .= "width:" . $this->width . ";" .
+ "height:" . $this->height . ";";
+ }
+ if ($this->zIndex) {
+ $openTag .= "z-index:" . $this->zIndex . ";";
+ }
+ if ($this->moreStyles) {
+ $openTag .= $this->moreStyles;
+ }
+ $openTag .= "'>";
+
+ if ($this->element == "body" && USE_LOAD_MESSAGE) {
+ $htmlWhileLoading = "<img src='../img/indicator_wheel.gif'> " .
+ "<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " .
+ MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
+ "loading application '" . $this->guiId . "'";
+
+ $openTag .= "<div id='loading_mapbender' " .
+ "style='position:absolute;top:100;left:100'>" .
+ $htmlWhileLoading . "</div>" .
+ "<div id='complete_mapbender' " .
+ "style='display:none'>";
+ }
+ }
+ return $openTag;
+ }
+
+ private function getHtmlContent () {
+ $htmlContent = "";
+ if ($this->content != "") {
+ $htmlContent .= stripslashes($this->content);
+ }
+ return $htmlContent;
+ }
+
+ private function getHtmlCloseTag () {
+ if ($this->element == "body" && USE_LOAD_MESSAGE) {
+ return "</div></body>";
+ }
+ if ($this->closeTag != "") {
+ return "</" . $this->closeTag . ">";
+ }
+ return "";
+ }
+
+ private function getUrlParameters () {
+ $urlParameters = SID;
+ if (isset($this->guiId)) {
+ $urlParameters .= "&guiID=" . $this->guiId;
+ }
+ if (isset($this->id)) {
+ $urlParameters .= "&elementID=" . $this->id;
+ }
+ return $urlParameters;
+ }
+
+ private function replaceSessionStringByUrlParameters ($string) {
+ $urlParameters = $this->getUrlParameters();
+ return preg_replace(ELEMENT_PATTERN, $urlParameters, $string);
+ }
+
+}
+
+
+?>
\ No newline at end of file
Added: trunk/mapbender/http/javascripts/initOpenLayersWms.php
===================================================================
--- trunk/mapbender/http/javascripts/initOpenLayersWms.php (rev 0)
+++ trunk/mapbender/http/javascripts/initOpenLayersWms.php 2008-06-23 16:00:40 UTC (rev 2542)
@@ -0,0 +1,34 @@
+<?php
+# $Id: mod_createJSObjFromDB.php 2144 2008-02-26 23:16:14Z christoph $
+# http://www.mapbender.org/index.php/mod_createJSObjectFromDB.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_wms.php");
+
+$sql = "SELECT fkey_wms_id FROM gui_wms WHERE fkey_gui_id = $1 ORDER BY gui_wms_position";
+$v = array($_SESSION["mb_user_gui"]);
+$t = array('s');
+$res = db_prep_query($sql,$v,$t);
+
+$cnt=0;
+while($row = db_fetch_array($res)){
+ $mywms = new wms();
+ $mywms->createObjFromDB($_SESSION["mb_user_gui"],$row["fkey_wms_id"]);
+ $mywms->createOlObjFromWMS($cnt==0);
+ $cnt++;
+}?>
\ No newline at end of file
Added: trunk/mapbender/http/javascripts/initWms.php
===================================================================
--- trunk/mapbender/http/javascripts/initWms.php (rev 0)
+++ trunk/mapbender/http/javascripts/initWms.php 2008-06-23 16:00:40 UTC (rev 2542)
@@ -0,0 +1,14 @@
+<?php
+//
+// Load WMS
+//
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_wms.php");
+
+$wmsArray = wms::selectMyWmsByApplication($gui_id);
+
+for ($i = 0; $i < count($wmsArray); $i++) {
+ $currentWms = $wmsArray[$i];
+ $currentWms->createJsObjFromWMS();
+}
+?>
\ No newline at end of file
Added: trunk/mapbender/http/javascripts/mod_openlayers.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_openlayers.php (rev 0)
+++ trunk/mapbender/http/javascripts/mod_openlayers.php 2008-06-23 16:00:40 UTC (rev 2542)
@@ -0,0 +1,42 @@
+<?php
+# $Id$
+# http://www.mapbender.org/index.php/Openlayers
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+?>
+ var ol_options = { scales: [50000000, 30000000, 10000000, 5000000],
+ resolutions: [1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125],
+ minScale: 50000000,
+ maxResolution: "auto",
+ maxExtent: new OpenLayers.Bounds(-180, -90, 90, 180),
+ maxResolution: 0.17578125,
+ maxScale: 10000000,
+ minResolution: "auto",
+ minExtent: new OpenLayers.Bounds(-1, -1, 1, 1),
+ minResolution: 0.0439453125,
+ numZoomLevels: 5,
+ units: "degrees"
+ };
+
+
+var ol_map;
+OpenLayers.ImgPath = "../img/openlayers/";
+ol_map = new OpenLayers.Map('<?php echo $e_id;?>', {'maxResolution': 1.40625/2});
+
+eventAfterInit.register(function () {
+ ol_map.zoomToMaxExtent();
+
+});
\ No newline at end of file
Added: trunk/mapbender/http/javascripts/mod_openlayers_layerSwitch.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_openlayers_layerSwitch.js (rev 0)
+++ trunk/mapbender/http/javascripts/mod_openlayers_layerSwitch.js 2008-06-23 16:00:40 UTC (rev 2542)
@@ -0,0 +1 @@
+ol_map.addControl(new OpenLayers.Control.LayerSwitcher());
\ No newline at end of file
Added: trunk/mapbender/http/php/mod_editApplication.php
===================================================================
--- trunk/mapbender/http/php/mod_editApplication.php (rev 0)
+++ trunk/mapbender/http/php/mod_editApplication.php 2008-06-23 16:00:40 UTC (rev 2542)
@@ -0,0 +1,252 @@
+<?php
+# $Id: mod_editElements.php 2413 2008-04-23 16:21:04Z christoph $
+# http://www.mapbender.org/index.php/mod_editElements.php
+# Copyright (C) 2002 CCGIS
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+require_once(dirname(__FILE__)."/../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_user.php");
+
+$editApplicationId = $_REQUEST["editApplicationId"];
+
+$user = new User($_SESSION["mb_user_id"]);
+$myApplicationArray = $user->getApplicationsByPermission(false);
+if (!in_array($editApplicationId, $myApplicationArray)) {
+ die("You are not allowed to edit the application '" . $editApplicationId . "'");
+}
+?>
+<html>
+<head>
+<style type="text/css">
+.ui-selecting {
+ border-width:thin;
+ border-style:solid;
+ border-color:red;
+ background-color:transparent;
+ font-size:9px;
+}
+.ui-selected {
+ border-width:thin;
+ border-style:solid;
+ border-color:red;
+ background-color:transparent;
+ font-size:9px;
+}
+.ui-draggable {
+}
+.div-border {
+ border-width:thin;
+ border-style:solid;
+ border-color:black;
+ background-color:transparent;
+ font-size:9px;
+}
+</style>
+<link rel='stylesheet' type='text/css' href='../css/popup.css'>
+<script type='text/javascript' src='../extensions/jquery-1.2.6.min.js'></script>
+<script type='text/javascript' src='../extensions/jquery-ui-personalized-1.5.min.js'></script>
+<script type='text/javascript' src='../extensions/jqjson.js'></script>
+<script type='text/javascript' src='../javascripts/popup.js'></script>
+<script language="JavaScript" type="text/javascript">
+<?php
+ include("../../lib/event.js");
+ include("../../lib/buttonNew.js");
+ include("../../lib/draggableButton.js");
+ include("../../lib/selectableButton.js");
+ include("../../lib/resizableButton.js");
+ include("../../lib/alignButton.js");
+ include("../../lib/saveButton.js");
+
+ echo "var editApplicationId = '" . $editApplicationId . "';";
+?>
+
+$(function() {
+ //
+ // create the toolbox
+ //
+ var controlPopup;
+ controlPopup = new mb_popup({
+ left:300,
+ top:300,
+ width:180,
+ height:80,
+ html:"<div id='controls'></div>",
+ title:"Toolbox"
+ });
+ var toolbox = new ButtonGroup("controls");
+
+ //
+ // add tools to the toolbox
+ //
+
+ // select tool
+ var selectButton = new Button(Selectable.buttonParameters);
+ toolbox.add(selectButton);
+
+ // drag tool
+ var dragButton = new Button(Draggable.buttonParameters);
+ toolbox.add(dragButton);
+
+ // resize tool
+ var resizeButton = new Button(Resizable.buttonParameters);
+ toolbox.add(resizeButton);
+
+ // save tool
+ var saveButton = new Button(Save.buttonParameters);
+ toolbox.add(saveButton);
+
+ //align top
+ alignTopButton = new Button(Align.top.buttonParameters);
+ toolbox.add(alignTopButton);
+
+ //align left
+ alignLeftButton = new Button(Align.left.buttonParameters);
+ toolbox.add(alignLeftButton);
+
+ //align bottom
+ alignBottomButton = new Button(Align.bottom.buttonParameters);
+ toolbox.add(alignBottomButton);
+
+ //align right
+ alignRightButton = new Button(Align.right.buttonParameters);
+ toolbox.add(alignRightButton);
+
+ //
+ // add functionality to the buttons
+ //
+
+ selectButton.registerPush(Selectable.makeSelectable);
+ selectButton.registerRelease(Selectable.removeSelection);
+
+ dragButton.registerPush(Draggable.makeDraggable);
+ dragButton.registerStop(Draggable.removeDraggable);
+
+ resizeButton.registerPush(Selectable.removeSelection);
+ resizeButton.registerPush(Resizable.makeResizable);
+ resizeButton.registerStop(Resizable.removeResizable);
+
+ saveButton.registerPush(function () {
+ Save.updateDatabase(saveButton.triggerStop);
+ });
+
+ alignTopButton.registerPush(Align.top.align);
+ alignLeftButton.registerPush(Align.left.align);
+ alignBottomButton.registerPush(Align.bottom.align);
+ alignRightButton.registerPush(Align.right.align);
+
+ //
+ // display the toolbox
+ //
+ controlPopup.show();
+
+});
+
+</script>
+</head>
+<?php
+$pattern = "/sessionID/";
+
+$sql = "SELECT fkey_gui_id,e_id,e_pos,e_public,e_comment,gettext($1, e_title) as e_title, e_element,";
+$sql .= "e_src,e_attributes,e_left,e_top,e_width,e_height,e_z_index,e_more_styles,";
+$sql .= "e_content,e_closetag,e_js_file,e_mb_mod,e_target,e_requires,e_url FROM gui_element WHERE ";
+$sql .= "e_public = 1 AND fkey_gui_id = $2 ORDER BY e_pos";
+$v = array($_SESSION["mb_lang"], $editApplicationId);
+$t = array('s', 's');
+$res = db_prep_query($sql,$v,$t);
+$i = 0;
+while(db_fetch_row($res)){
+ $replacement = $urlParameters."&elementID=".db_result($res,$i,"e_id");
+ if (db_result($res,$i,"e_element") == "body" ) {
+ echo "<".db_result($res,$i,"e_element")." ";
+ echo "' ><div class='collection'>";
+ }
+ else {
+ if (db_result($res,$i,"e_left") && db_result($res,$i,"e_top")) {
+ //
+ // open tag
+ //
+ if (db_result($res,$i,"e_closetag") != "iframe" && db_result($res,$i,"e_closetag") != "form" ) {
+ echo "<".db_result($res,$i,"e_element")." ";
+ }
+ else {
+ echo "<div ";
+ }
+ echo " class='div-border' ";
+
+ //
+ // style
+ //
+ echo " style = '";
+ if(db_result($res,$i,"e_left") != "" && db_result($res,$i,"e_top") != ""){
+ echo "position:absolute;";
+ echo "left:".db_result($res,$i,"e_left").";";
+ echo "top:".db_result($res,$i,"e_top").";";
+ }
+ if(db_result($res,$i,"e_width") != "" && db_result($res,$i,"e_height") != ""){
+ echo "width:".db_result($res,$i,"e_width").";";
+ echo "height:".db_result($res,$i,"e_height").";";
+ }
+ echo "' ";
+
+ //
+ // attributes
+ //
+ if(db_result($res,$i,"e_id") != ""){
+ echo " id='".db_result($res,$i,"e_id")."' ";
+ echo " name='".db_result($res,$i,"e_id")."' ";
+ }
+ if (db_result($res,$i,"e_closetag") == "select" ) {
+ echo " disabled ";
+ }
+ if(db_result($res,$i,"e_title") != ""){
+ echo " title='".db_result($res,$i,"e_title")."' ";
+ }
+ if(db_result($res,$i,"e_src") != "" && db_result($res,$i,"e_closetag") != "iframe" ){
+ if(db_result($res,$i,"e_closetag") == "iframe" && db_result($res,$i,"e_id") != 'loadData'){
+ echo " src = '".preg_replace($pattern,$replacement,db_result($res,$i,"e_src"));
+ if(mb_strpos(db_result($res,$i,"e_src"), "?")) {
+ echo "&";
+ }
+ else {
+ echo "?";
+ }
+ echo "e_id_css=".db_result($res,$i,"e_id")."&e_id=".db_result($res,$i,"e_id") .
+ "&e_target=".db_result($res,$i,"e_target").
+ "&" . $urlParameters . "'";
+ }
+ else{
+ echo " src = '".preg_replace($pattern,$replacement,db_result($res,$i,"e_src"))."'";
+ }
+ }
+ echo "' >";
+
+ if (db_result($res,$i,"e_closetag") == "iframe" || db_result($res,$i,"e_closetag") == "div") {
+ echo db_result($res,$i,"e_id");
+ }
+ if (db_result($res,$i,"e_closetag") != "iframe" && db_result($res,$i,"e_closetag") != "form" ) {
+ echo "</".db_result($res,$i,"e_element").">";
+ }
+ else {
+ echo "</div>";
+ }
+ }
+ }
+ $i++;
+}
+?>
+</div></body>
+</html>
\ No newline at end of file
Added: trunk/mapbender/http/php/mod_editApplication_server.php
===================================================================
--- trunk/mapbender/http/php/mod_editApplication_server.php (rev 0)
+++ trunk/mapbender/http/php/mod_editApplication_server.php 2008-06-23 16:00:40 UTC (rev 2542)
@@ -0,0 +1,58 @@
+<?php
+require_once(dirname(__FILE__) . "/../php/mb_validateSession.php");
+require_once(dirname(__FILE__) . "/../classes/class_user.php");
+require_once(dirname(__FILE__) . "/../classes/class_json.php");
+
+/**
+ * encodes and delivers the data
+ *
+ * @param object the un-encoded object
+ */
+function sendOutput($out){
+ global $json;
+ $output = $json->encode($out);
+ header("Content-Type: text/x-json");
+ echo $output;
+}
+
+
+$json = new Mapbender_JSON();
+$queryObj = $json->decode(stripslashes($_REQUEST['queryObj']));
+$resultObj = array();
+
+$e = new mb_exception("command: " . $queryObj->command);
+
+$userId = $_SESSION[mb_user_id];
+
+switch($queryObj->command){
+
+ // gets available WMCs
+ case 'update':
+ $elementArray = $queryObj->parameters->data;
+ for ($i = 0; $i < count($elementArray); $i++) {
+ $currentElement = $elementArray[$i];
+ $id = $currentElement->id;
+ $top = $currentElement->top;
+ $left = $currentElement->left;
+ $width = $currentElement->width;
+ $height = $currentElement->height;
+ $app = $queryObj->parameters->applicationId;
+ $sql = "UPDATE gui_element SET e_left = $1, e_top = $2, " .
+ "e_width = $3, e_height = $4 " .
+ "WHERE e_id = $5 AND fkey_gui_id = $6";
+ $v = array($left, $top, $width, $height, $id, $app);
+ $t = array("i", "i", "i", "i", "s", "s");
+ $res = db_prep_query($sql, $v, $t);
+ $e = new mb_notice("updating element '" . $id . "'");
+ }
+ $resultObj["success"] = "Elements have been updated in the database.";
+ break;
+
+
+ // Invalid command
+ default:
+ $resultObj["error"] = "no action specified...";
+}
+
+sendOutput($resultObj);
+?>
\ No newline at end of file
More information about the Mapbender_commits
mailing list