svn commit: r737 - trunk/mapbender/http/javascripts/mod_initWmc.php

christoph at osgeo.org christoph at osgeo.org
Thu Aug 3 08:44:11 EDT 2006


Author: christoph
Date: 2006-08-03 12:44:11+0000
New Revision: 737

Modified:
   trunk/mapbender/http/javascripts/mod_initWmc.php

Log:
highlights the meetingpoint with a given image attached to a flagpole.

Modified: trunk/mapbender/http/javascripts/mod_initWmc.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_initWmc.php?view=diff&rev=737&p1=trunk/mapbender/http/javascripts/mod_initWmc.php&p2=trunk/mapbender/http/javascripts/mod_initWmc.php&r1=736&r2=737
==============================================================================
--- trunk/mapbender/http/javascripts/mod_initWmc.php	(original)
+++ trunk/mapbender/http/javascripts/mod_initWmc.php	2006-08-03 12:44:11+0000
@@ -1,6 +1,8 @@
 <?php
 session_start();
 require_once("../classes/class_wmc.php");
+require_once("../classes/class_kml.php");
+//require_once("../javascripts/point.js");
 require_once("../classes/class_administration.php");
 
 $con = db_connect($DBSERVER,$OWNER,$PW);
@@ -19,18 +21,68 @@
 	echo "alert('digitize_button: ID not unique!');";
 }
 
+$wmc_id = $_SESSION['mb_myWmc'];
+$user = $_SESSION['mb_user_id'];
+$x;
+$y;
+$icon;
+
 $js = "function mod_initWMC_init() {";
 
 $adm = new administration();
-if ($_SESSION['mb_myWmc']) {
-	if ($adm->getWmcById($_SESSION['mb_myWmc']) != false) {
-		$valid_wmcs = $adm->getWmcByOwner($_SESSION["mb_user_id"]);
-		if (in_array($_SESSION['mb_myWmc'], $valid_wmcs)) {
+
+//KML
+if ($_SESSION['mb_myKml']) {
+	$sql = "SELECT * FROM mb_meetingpoint WHERE mb_meetingpoint_id = $1";
+	$v = array($_SESSION['mb_myKml']);
+	$t = array('s');
+	$res = db_prep_query($sql,$v,$t);
+	if($row = db_fetch_array($res)){
+		$user = $row['fkey_mb_user_id'];
+		$password = $row['mb_user_password'];
+		$gui = $row['fkey_gui_id'];
+		$wmc_id = $row['fkey_wmc_id'];
+		$kml_doc = $row['kml'];
+		
+		$kml = new kml("", "", 0, 0, "");
+		$value = $kml->createObjFromKML($kml_doc);
+		
+		$x = $kml->x;
+		$y = $kml->y;
+		$icon = $kml->icon;
+	}
+	else {
+		$js .= "alert('Meetingpoint ID id ".$_SESSION['mb_myKml']." is not valid. Default GUI will be loaded instead.');"; 
+	}
+}
+//WMC
+if ($wmc_id) {
+	if ($adm->getWmcById($wmc_id) != false) {
+
+		$valid_wmcs = $adm->getWmcByOwner($user);
+		if (in_array($wmc_id, $valid_wmcs)) {
 			echo "var wmc_id = false;";
-			echo "wmc_id = '".$_SESSION['mb_myWmc']."';";
+			echo "wmc_id = '".$wmc_id."';";
 			$wmc = new wmc();
-			$wmc->createObjFromWMC($_SESSION['mb_myWmc']);
+			$wmc->createObjFromWMC($wmc_id);
 			$js .= $wmc->createJsObjFromWMC("", $e_target[0], "load");
+			
+			if ($x && $y && $icon) {
+				$js .= "var myPoint = realToMap('".$e_target[0]."', new Point(".$x.",".$y."));\n";
+				$js .= "var poleheight = 100;";
+				$js .= "myPoint.y -= poleheight;";
+				$js .= "var attributes = new Array();\n";
+				$js .= "attributes[0] = new Array();\n";
+				$js .= "attributes[0][0] = 'style';\n";
+				$js .= "attributes[0][1] = 'position:absolute; top:'+myPoint.y+'px; left:'+myPoint.x+'px; z-index:100; font-size:10px';\n"; 
+				$js .= "node = mb_checkTag('".$e_target[0]."', 'div', 'meeting_pole', 'body', attributes);\n";
+				$js .= "if (node == false) {\n";
+				$js .= "\talert('Fatal error: Element id is already taken!');\n";
+				$js .= "}\n";
+				$js .= "else {\n";
+				$js .= "node.innerHTML = \"<table cellspacing=0 cellpadding=0><tr><td><img width=0 height=100 border=1></td><td valign=top><img src='".$icon."'></td></tr></table>\";";
+				$js .= "}\n";
+			}
 		}
 		else {
 			$js .= "alert('".$adm->getUserNameByUserId($_SESSION["mb_user_id"])." is not allowed to access WMC ".$_SESSION['mb_myWmc'].". Default GUI will be loaded instead.');"; 




More information about the Mapbender_commits mailing list