[Mapbender-commits] r1729 - branches/mapbender_sld/http/sld

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Oct 15 10:28:15 EDT 2007


Author: mschulz
Date: 2007-10-15 10:28:15 -0400 (Mon, 15 Oct 2007)
New Revision: 1729

Modified:
   branches/mapbender_sld/http/sld/sld_config.php
   branches/mapbender_sld/http/sld/sld_main.php
Log:
changed sld editor to use gui_id

Modified: branches/mapbender_sld/http/sld/sld_config.php
===================================================================
--- branches/mapbender_sld/http/sld/sld_config.php	2007-10-15 14:24:42 UTC (rev 1728)
+++ branches/mapbender_sld/http/sld/sld_config.php	2007-10-15 14:28:15 UTC (rev 1729)
@@ -24,10 +24,11 @@
 	return $s;
 }
 
-if (isset($_REQUEST["wms_id"]) && isset($_REQUEST["layer_name"]))
+if (isset($_REQUEST["wms_id"]) && isset($_REQUEST["gui_id"]) && isset($_REQUEST["layer_name"]))
 {
 	$_SESSION["sld_wms_id"] = $_REQUEST["wms_id"];
 	$_SESSION["sld_layer_name"] = $_REQUEST["layer_name"];
+	$_SESSION["sld_gui_id"] = $_REQUEST["gui_id"];
 }
 
 if (isset($_SESSION["sld_wms_id"]) && isset($_SESSION["sld_layer_name"]))

Modified: branches/mapbender_sld/http/sld/sld_main.php
===================================================================
--- branches/mapbender_sld/http/sld/sld_main.php	2007-10-15 14:24:42 UTC (rev 1728)
+++ branches/mapbender_sld/http/sld/sld_main.php	2007-10-15 14:28:15 UTC (rev 1729)
@@ -12,10 +12,11 @@
 //session_start();
 include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
 
-if (isset($_REQUEST["wms_id"]) && isset($_REQUEST["layer_name"]))
+if (isset($_REQUEST["wms_id"]) && isset($_REQUEST["layer_name"]) && isset($_REQUEST["gui_id"]))
 {
 	$_SESSION["sld_wms_id"] = $_REQUEST["wms_id"];
 	$_SESSION["sld_layer_name"] = $_REQUEST["layer_name"];
+	$_SESSION["sld_gui_id"] = $_REQUEST["gui_id"];
 }
 
 
@@ -25,13 +26,13 @@
 //include_once($SLD_PARSE);
 
 
-//read custom sld for this user&wms&layer from the db instead using sld.xml
+//read custom sld for this user&wms&layer&gui from the db instead using sld.xml
 
 $con = db_connect($DBSERVER,$OWNER,$PW);
 db_select_db($DB,$con);
 
 //Read the layer_id from the DB
-$sql = "SELECT * FROM layer WHERE layer_name='".$_SESSION["sld_layer_name"]."';";
+$sql = "SELECT * FROM layer WHERE fkey_wms_id=".$_SESSION["sld_wms_id"]." AND layer_name='".$_SESSION["sld_layer_name"]."';";
 $res = db_query($sql);
 
 $layer_id = "";
@@ -54,7 +55,7 @@
 else
 {
 	//Try to read sld from the DB
-	$sql = "SELECT * FROM sld_user_layer WHERE layer_id='".$layer_id."' AND mb_user_id='".$mb_user_id."';";
+	$sql = "SELECT * FROM sld_user_layer WHERE fkey_gui_id='".$_SESSION["sld_gui_id"]."' AND fkey_layer_id='".$layer_id."' AND fkey_mb_user_id='".$mb_user_id."';";
 	$res = db_query($sql);
 	if (!$res || db_numrows($res)== 0)
 	{
@@ -63,7 +64,7 @@
 		$data = readSld($file);
 		$data = char_encode($data);
 		//write the sld to the DB
-		$sql = "INSERT INTO sld_user_layer(mb_user_id, layer_id, sld_xml, use_sld) VALUES('".$mb_user_id."','".$layer_id."','".$data."',0);";
+		$sql = "INSERT INTO sld_user_layer(fkey_mb_user_id, fkey_layer_id, sld_xml, use_sld, fkey_gui_id) VALUES('".$mb_user_id."','".$layer_id."','".$data."',0,'".$_SESSION["sld_gui_id"]."' );";
 		$res = db_query($sql);
 		//Use the new sld
 	}
@@ -111,8 +112,10 @@
 
 ## - Build URL to SLD
 $sld_url = "";
+$mb_sld_url = "";
 //$sld_url = "http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/sld_function_handler.php?function=getusersld&layer_id=".$layer_id."&user_id=".$mb_user_id."&forcesld=1";
-$sld_url = $MAPBENDER_URL."/sld/sld_function_handler.php?function=getusersld&layer_id=".$layer_id."&user_id=".$mb_user_id."&forcesld=1";
+$sld_url = $MAPBENDER_URL."/sld/sld_function_handler.php?function=getusersld&gui_id=".$_SESSION["sld_gui_id"]."&layer_id=".$layer_id."&user_id=".$mb_user_id."&forcesld=1";
+$mb_sld_url = $MAPBENDER_URL."/sld/sld_function_handler.php?function=getusersld&gui_id=".$_SESSION["sld_gui_id"]."&wms_id=".$_SESSION["sld_wms_id"]."&user_id=".$mb_user_id;
 echo "<!-- $sld_url -->";
 ## - 2.Zeile
 echo " <tr align='right'>\n";
@@ -200,6 +203,8 @@
 //echo "      <form name=\"use_sld\" action=\"http://".$_SERVER["HTTP_HOST"]."/mapbender/sld/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
 echo "      <form name=\"use_sld\" action=\"".$MAPBENDER_URL."/sld/".$SLD_FUNCTION_HANDLER."\" method=post >\n";
 echo "      <input type=\"hidden\" name=\"function\" value=\"usesld\">\n";
+echo "      <input type=\"hidden\" name=\"sld_url\" value=\"".$sld_url."\">\n";
+echo "      <input type=\"hidden\" name=\"mb_sld_url\" value=\"".$mb_sld_url."\">\n";
 echo "      &nbsp;&nbsp;Ansicht in Mapbender&nbsp;&nbsp;<br>\n";
 	
 echo "      <input type=\"radio\" name=\"use_sld\" value=\"0\"";



More information about the Mapbender_commits mailing list