svn commit: r771 - trunk/mapbender/http/php/mod_loadCapabilitiesList.php
uli at osgeo.org
uli at osgeo.org
Tue Sep 26 10:26:15 EDT 2006
Author: uli
Date: 2006-09-26 14:26:14+0000
New Revision: 771
Modified:
trunk/mapbender/http/php/mod_loadCapabilitiesList.php
Log:
highlight own and external services
Modified: trunk/mapbender/http/php/mod_loadCapabilitiesList.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_loadCapabilitiesList.php?view=diff&rev=771&p1=trunk/mapbender/http/php/mod_loadCapabilitiesList.php&p2=trunk/mapbender/http/php/mod_loadCapabilitiesList.php&r1=770&r2=771
==============================================================================
--- trunk/mapbender/http/php/mod_loadCapabilitiesList.php (original)
+++ trunk/mapbender/http/php/mod_loadCapabilitiesList.php 2006-09-26 14:26:14+0000
@@ -18,11 +18,11 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
session_start();
-include("../../conf/mapbender.conf");
+include(dirname(__FILE__)."/../../conf/mapbender.conf");
$con = db_connect(DBSERVER,OWNER,PW);
db_select_db(DB,$con);
-include("../php/mb_validateSession.php");
+include(dirname(__FILE__)."/../php/mb_validateSession.php");
import_request_variables("PG");
?>
@@ -119,7 +119,7 @@
<?php
-require_once("../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
$admin = new administration();
$ownguis = $admin->getGuisByOwner($_SESSION["mb_user_id"]);
@@ -127,42 +127,47 @@
###INSERT
if(isset($wmsID) && isset($guiID)){
+ $sql_pos = "SELECT MAX(gui_wms_position) AS my_gui_wms_position FROM gui_wms WHERE fkey_gui_id = $1";
+ $v = array($guiList);
+ $t = array('s');
+ $res_pos = db_prep_query($sql_pos,$v,$t);
+ if(db_result($res_pos,0,"my_gui_wms_position") > -1){
+ $gui_wms_position = db_result($res_pos,0,"my_gui_wms_position") + 1;
+ }
+ else{
+ $gui_wms_position = 0;
+ }
- $sql_pos = "SELECT MAX(gui_wms_position) AS my_gui_wms_position FROM gui_wms WHERE fkey_gui_id = '".$guiList."'";
- $res_pos = db_query($sql_pos);
- if(db_result($res_pos,0,"my_gui_wms_position") > -1){
- $gui_wms_position = db_result($res_pos,0,"my_gui_wms_position") + 1;
- }
- else{
- $gui_wms_position = 0;
- }
-
-#echo $gui_wms_position."<br>";
- $sql = "SELECT * FROM gui_wms WHERE fkey_gui_id = '".$guiID."' AND fkey_wms_id = ".$wmsID;
- $res = db_query($sql);
- $cnt = 0;
- while($row = db_fetch_array($res)){
- $sql_ins = "INSERT INTO gui_wms (fkey_gui_id,fkey_wms_id,gui_wms_position,gui_wms_mapformat,gui_wms_featureinfoformat,gui_wms_exceptionformat,gui_wms_epsg,gui_wms_visible) ";
- $sql_ins .= "VALUES ('".$guiList."',".$wmsID.",".$gui_wms_position.",'".$row["gui_wms_mapformat"]."','".$row["gui_wms_featureinfoformat"]."','".$row["gui_wms_exceptionformat"]."','".$row["gui_wms_epsg"]."',".$row["gui_wms_visible"].")";
- #echo $sql_ins."<br>";
- db_query($sql_ins);
- $cnt++;
- }
+ $sql = "SELECT * FROM gui_wms WHERE fkey_gui_id = $1 AND fkey_wms_id = $2";
+ $v = array($guiID,$wmsID);
+ $t = array('s','i');
+ $res = db_query($sql,$v,$t);
+ $cnt = 0;
+ while($row = db_fetch_array($res)){
+ $sql_ins = "INSERT INTO gui_wms (fkey_gui_id,fkey_wms_id,gui_wms_position,gui_wms_mapformat,";
+ $sql_ins .= "gui_wms_featureinfoformat,gui_wms_exceptionformat,gui_wms_epsg,gui_wms_visible) ";
+ $sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8)";
+ $v = array($guiList,$wmsID,$gui_wms_position,$row["gui_wms_mapformat"],$row["gui_wms_featureinfoformat"],
+ $row["gui_wms_exceptionformat"],$row["gui_wms_epsg"],$row["gui_wms_visible"]);
+ $t = array('s','i','i','s','s','s','s','i');
+ db_prep_query($sql_ins,$v,$t);
+ $cnt++;
+ }
- $sql = "SELECT * FROM gui_layer WHERE fkey_gui_id = '".$guiID."' AND gui_layer_wms_id = ".$wmsID;
- $res = db_query($sql);
- $cnt = 0;
- while($row = db_fetch_array($res)){
- $sql_ins = "INSERT INTO gui_layer (fkey_gui_id,fkey_layer_id,gui_layer_wms_id,gui_layer_status,gui_layer_selectable,";
- $sql_ins .= "gui_layer_visible,gui_layer_queryable,gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale,gui_layer_priority) ";
- $sql_ins .= "VALUES ('".$guiList."',".$row["fkey_layer_id"].",".$wmsID.",".$row["gui_layer_status"];
- $sql_ins .= ",".$row["gui_layer_selectable"].",".$row["gui_layer_visible"];
- $sql_ins .= ",".$row["gui_layer_queryable"].",".$row["gui_layer_querylayer"];
- $sql_ins .= ",".$row["gui_layer_minscale"].",".$row["gui_layer_maxscale"].",".$row["gui_layer_priority"].")";
- #echo $sql_ins."<br>";
- db_query($sql_ins);
- $cnt++;
- } #die;
+ $sql = "SELECT * FROM gui_layer WHERE fkey_gui_id = '".$guiID."' AND gui_layer_wms_id = ".$wmsID;
+ $res = db_query($sql);
+ $cnt = 0;
+ while($row = db_fetch_array($res)){
+ $sql_ins = "INSERT INTO gui_layer (fkey_gui_id,fkey_layer_id,gui_layer_wms_id,gui_layer_status,gui_layer_selectable,";
+ $sql_ins .= "gui_layer_visible,gui_layer_queryable,gui_layer_querylayer,gui_layer_minscale,gui_layer_maxscale,gui_layer_priority) ";
+ $sql_ins .= "VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,10,$11)";
+ $v = array($guiList,$row["fkey_layer_id"],$wmsID,$row["gui_layer_status"],$row["gui_layer_selectable"],
+ $row["gui_layer_visible"],$row["gui_layer_queryable"],$row["gui_layer_querylayer"],$row["gui_layer_minscale"],
+ $row["gui_layer_maxscale"],$row["gui_layer_priority"]);
+ $t = array('s','i','i','i','i','i','i','i','i','i','i');
+ db_prep_query($sql_ins,$v,$t);
+ $cnt++;
+ }
}
echo "<form name='form1' action='" . $PHP_SELF . "?".SID."' method='post'>";
@@ -173,16 +178,13 @@
if (count($ownguis)>0){
echo"GUI";
echo"<br>";
- #$sql = "SELECT * from gui_mb_user, gui WHERE gui.gui_id=gui_mb_user.fkey_gui_id AND gui.gui_public=1 AND gui_mb_user.fkey_mb_user_id=".$_SESSION["mb_user_id"]." Order BY fkey_gui_id ;";
$sql = "SELECT * FROM gui WHERE gui_id IN (";
- for($i=0; $i<count($ownguis); $i++){
+ for($i=0; $i<count($ownguis); $i++){
if($i>0){ $sql .= ",";}
$sql .= "'".$ownguis[$i]."'";
}
- $sql .= ") ORDER BY gui_name";
-
-
+ $sql .= ") ORDER BY gui_name";
$res = db_query($sql);
$count=0;
echo"<select size='8' name='guiList' style='width:200px' onClick='submit()'>";
@@ -192,79 +194,84 @@
$gui_description[$count]=$row["gui_description"];
$count++;
echo "<option value='".$row["gui_id"]."' ";
- if($guiList && $guiList == $row["gui_name"]){
- echo "selected";
- }
- echo ">".$row["gui_name"]."</option>";
+ if($guiList && $guiList == $row["gui_name"]){
+ echo "selected";
+ }
+ echo ">".$row["gui_name"]."</option>";
}
- $arrayGUIs=$_SESSION["mb_user_guis"];
- echo count($arrayGUIs);
+ $arrayGUIs=$_SESSION["mb_user_guis"];
+ echo count($arrayGUIs);
echo "</select><br><br>";
echo "</td>";
echo "<td>";
echo"WMS";
echo"<br>";
- ###
-
-
- If (isset($guiList) && $guiList!=""){
- $sql="SELECT Distinct wms.wms_title, gui_wms_position from gui_wms JOIN gui ON gui_wms.fkey_gui_id=gui.gui_id JOIN wms ON gui_wms.fkey_wms_id=wms.wms_id and gui_wms.fkey_gui_id=gui.gui_id where gui.gui_name='".$guiList."' order by gui_wms_position";
- $res = db_query($sql);
-
- $count=0;
- echo"<select size='8' name='wmsList' style='width:200px'>";
+ if(isset($guiList) && $guiList!=""){
+ $sql = "SELECT DISTINCT wms.wms_title, gui_wms_position FROM gui_wms ";
+ $sql .= "JOIN gui ON gui_wms.fkey_gui_id = gui.gui_id JOIN wms ON gui_wms.fkey_wms_id=wms.wms_id ";
+ $sql .= "AND gui_wms.fkey_gui_id=gui.gui_id WHERE gui.gui_name = $1 ORDER BY gui_wms_position";
+ $v = array($guiList);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ $count=0;
+ echo"<select size='8' name='wmsList' style='width:200px'>";
- while($row = db_fetch_array($res)){
- if ($row["wms_title"]!=""){
- echo "<option value='' ";
- echo ">".$row["wms_title"]."</option>";
+ while($row = db_fetch_array($res)){
+ if ($row["wms_title"]!=""){
+ echo "<option value='' ";
+ echo ">".$row["wms_title"]."</option>";
+ }
+ $count++;
}
- $count++;
- }
- echo "</select><br><br>";
+ echo "</select><br><br>";
}else{
- echo"<select size='8' name='wmsList' style='width:200px' on Click='submit()'>";
- echo "</select><br><br>";
+ echo"<select size='8' name='wmsList' style='width:200px' on Click='submit()'>";
+ echo "</select><br><br>";
}
echo "</td>";
echo "<tr></table><br>";
echo"<div class='text1'>Load WMS</div>";
- $sql = "SELECT DISTINCT wms.wms_id,wms.wms_title,wms.wms_abstract FROM gui_wms JOIN wms ON wms.wms_id = gui_wms.fkey_wms_id WHERE gui_wms.fkey_gui_id IN(";
+ $sql = "SELECT DISTINCT wms.wms_id,wms.wms_title,wms.wms_abstract,wms.wms_owner FROM gui_wms JOIN wms ON ";
+ $sql .= "wms.wms_id = gui_wms.fkey_wms_id WHERE gui_wms.fkey_gui_id IN(";
for($i=0; $i<count($arrayGUIs); $i++){
- if($i>0){$sql .= ",";}
- $sql .= "'".$arrayGUIs[$i]."'";
+ if($i>0){$sql .= ",";}
+ $sql .= "'".$arrayGUIs[$i]."'";
}
$sql .= ") ORDER BY wms.wms_title";
- //echo $sql;
$res = db_query($sql);
echo "<select class='select1' name='wmsID' size='20' onchange='submit()'>";
$cnt = 0;
while($row = db_fetch_array($res)){
- echo "<option value='".$row["wms_id"]."' ";
- if(isset($wmsID) && $wmsID == $row["wms_id"]){
- echo "selected";
- $wms_getcapabilities = $row["wms_getcapabilities"];
- }
- echo ">".$row["wms_title"]."</option>";
- $cnt++;
+ echo "<option value='".$row["wms_id"]."' ";
+ if($row["wms_owner"] == $_SESSION["mb_user_id"]){
+ echo "style='color:green' ";
+ }
+ else{
+ echo "style='color:red' ";
+ }
+ if(isset($wmsID) && $wmsID == $row["wms_id"]){
+ echo "selected";
+ $wms_getcapabilities = $row["wms_getcapabilities"];
+ }
+ echo ">".$row["wms_title"]."</option>";
+ $cnt++;
}
echo "</select>";
if(isset($wmsID)){
- echo "<div class='text2'>FROM:</div>";
- $sql = "SELECT * from gui_wms WHERE fkey_wms_id ='".$wmsID."' ORDER BY fkey_gui_id";
- $res = db_query($sql);
-
- echo "<select class='select2' name='guiID' size='20' onchange='load()'>";
- $cnt = 0;
- while($row = db_fetch_array($res)){
- echo "<option value='".$row["fkey_gui_id"]."' ";
- echo ">".$row["fkey_gui_id"]."</option>";
- $cnt++;
- }
+ echo "<div class='text2'>FROM:</div>";
+ $sql = "SELECT * from gui_wms WHERE fkey_wms_id ='".$wmsID."' ORDER BY fkey_gui_id";
+ $res = db_query($sql);
+ echo "<select class='select2' name='guiID' size='20' onchange='load()'>";
+ $cnt = 0;
+ while($row = db_fetch_array($res)){
+ echo "<option value='".$row["fkey_gui_id"]."' ";
+ echo ">".$row["fkey_gui_id"]."</option>";
+ $cnt++;
+ }
echo "</select>";
}
echo "</form>";
More information about the Mapbender_commits
mailing list