[Mapbender-commits] r2504 - branches/beck_dev/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Jun 16 12:17:14 EDT 2008


Author: Greq
Date: 2008-06-16 12:17:14 -0400 (Mon, 16 Jun 2008)
New Revision: 2504

Added:
   branches/beck_dev/mapbender/http/php/mod_editApplication.php
Log:
tool to manipulate an application via drag and drop

Added: branches/beck_dev/mapbender/http/php/mod_editApplication.php
===================================================================
--- branches/beck_dev/mapbender/http/php/mod_editApplication.php	                        (rev 0)
+++ branches/beck_dev/mapbender/http/php/mod_editApplication.php	2008-06-16 16:17:14 UTC (rev 2504)
@@ -0,0 +1,205 @@
+<?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_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+
+$editApplicationId = "gui1";
+
+?>
+<html>
+<head>
+<style type="text/css">
+.playground { position:static; }
+.wrap { position:static; }
+.ui-selecting {
+  background-color: #eee;
+}
+.ui-selected {
+  background-color: #E6F7D4;
+}
+
+</style><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 language="JavaScript" type="text/javascript">
+	$(function() {
+
+//		$("#example2").selectable({
+//			stop:function() {
+//				$(".ui-selected").each(function() {
+//					console.log("is %s", this.firstChild.nodeValue);
+//				});
+//			}
+//		});
+
+	
+		$all = $(".collection");
+		$all.selectable({
+			stop:function() {
+				$div = $("<div></div>").appendTo($(".collection"));
+				$(".ui-selected").each(function() {
+					$clone = $(this).clone()
+					$div.append($clone);
+					$(this).remove();
+				});
+//				$(".ui-selected").remove();
+				$div.draggable({
+					grid:[20,20],
+					stop:function () {
+						var divX;
+						var divY;
+						$div.each(function() {
+							divX = this.style.left;
+							divY = this.style.top;
+						});
+						$div.children().each(function() {
+							console.log("vorher: %s, %s", this.style.left, this.style.top);
+							console.log("vektor: %s, %s", divX, divY);
+//							var newX = Number(this.style.left) + divX;
+//							var newY = Number(this.style.left) + divX;
+							var newX = (parseInt(this.style.left) + parseInt(divX));
+							var newY = (parseInt(this.style.top) + parseInt(divY));
+							console.log("nachher: %s, %s", newX, newY);
+							this.style.left = newX + "px";
+							this.style.top = newY + "px";
+							console.log("nachher: %s, %s", this.style.left, this.style.top);
+							$clone = $(this).clone();
+							$(".collection").append($clone);
+						});
+						$div.remove();
+					}
+				});
+//				$all.selectable("destroy");
+			}
+		});
+	});
+</script>
+  
+</head>
+
+<!--
+<body>
+<div class="playground">
+	<ul id="example2" style="list-style:none; height: 40px; cursor: default;">
+		<li style='float: left; padding: 5px; border: 1px solid #bbb; margin: 3px;'>Item 1</li>
+		<li style='float: left; padding: 5px; border: 1px solid #bbb; margin: 3px;'>Select Me</li>
+		<li style='float: left; padding: 5px; border: 1px solid #bbb; margin: 3px;'>Item 3</li>
+		<li style='float: left; padding: 5px; border: 1px solid #bbb; margin: 3px;'>And Me</li>
+		<li style='float: left; padding: 5px; border: 1px solid #bbb; margin: 3px;'>Item 5</li>
+
+	</ul>
+</div>
+</body>
+</html>
+-->
+<?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 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_closetag") != "iframe" ) {
+			echo "<".db_result($res,$i,"e_element")." ";
+		}
+		else {
+			echo "<div ";
+		}
+//			echo "<div class='wrap' ";
+		echo " style = 'background-color:#ff0000;";
+		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").";";
+		}
+		if(db_result($res,$i,"e_z_index") != ""){
+	    	echo "z-index:".db_result($res,$i,"e_z_index").";";
+		}
+		if(db_result($res,$i,"e_more_styles") != ""){
+	    	echo db_result($res,$i,"e_more_styles");
+		}
+//			echo "' >";
+//			echo "<".db_result($res,$i,"e_element")." ";
+		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_attributes") != ""){
+//				echo " ".stripslashes(preg_replace($pattern,$replacement,db_result($res,$i,"e_attributes")));
+		}
+		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_content") != ""){
+			echo " ".stripslashes(db_result($res,$i,"e_content"));
+		}
+		if(db_result($res,$i,"e_closetag") != "" && db_result($res,$i,"e_closetag") != "body"){
+			if (db_result($res,$i,"e_closetag") != "iframe" ) {
+				echo "</".db_result($res,$i,"e_closetag").">";
+			}
+			else {
+				echo "</div>";
+			}
+		}
+//			echo "</div>";
+	}
+//		if (db_result($res,$i,"e_element") == "body" && USE_LOAD_MESSAGE) {
+//			echo "<div id='loading_mapbender' style='position:absolute;top:100;left:100'>" . 
+//				$htmlWhileLoading . "</div>" . 
+//				"<div id='complete_mapbender' style='display:none'>";
+//		}
+	$i++;
+}
+?>
+<div></body>
+</html>
\ No newline at end of file



More information about the Mapbender_commits mailing list