svn commit: r926 - trunk/mapbender/http: javascripts php
christoph at osgeo.org
christoph at osgeo.org
Tue Nov 21 07:49:21 EST 2006
Author: christoph
Date: 2006-11-21 12:49:21+0000
New Revision: 926
Added:
trunk/mapbender/http/javascripts/mod_insertLayerPreviewIntoDb.php
trunk/mapbender/http/javascripts/mod_saveLayerPreview.php
trunk/mapbender/http/php/mod_editWMS_Metadata.php
trunk/mapbender/http/php/mod_layerMetadata.php
Log:
files for layer preview
Added: trunk/mapbender/http/javascripts/mod_insertLayerPreviewIntoDb.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_insertLayerPreviewIntoDb.php?view=auto&rev=926
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/javascripts/mod_insertLayerPreviewIntoDb.php 2006-11-21 12:49:21+0000
@@ -0,0 +1,158 @@
+<?php
+#$Id: mod_insertWmcIntoDb.php 359 2006-10-09 16:41:18Z christoph $
+#$Header: /cvsroot/mapbender/mapbender/http/javascripts/mod_insertWmcIntoDb.php,v 1.19 2006/03/09 14:02:42 uli_rothstein Exp $
+# 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();
+include("../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$gui_id = $_REQUEST["gui_id"];
+
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db(DB,$con);
+
+
+function escByteA($binData) {
+ /**
+ * \134 = 92 = backslash, \000 = 00 = NULL, \047 = 39 = Single Quote
+ *
+ * str_replace() replaces the searches array in order.
+ * Therefore, we must
+ * process the 'backslash' character first. If we process it last, it'll
+ * replace all the escaped backslashes from the other searches that came
+ * before. tomATminnesota.com
+ */
+ $search = array();
+ $replace = array();
+ array_push($search, chr(92));
+ array_push($replace, '\\134');
+ array_push($search, chr(0));
+ array_push($replace, '\\000');
+ array_push($search, chr(39));
+ array_push($replace, '\\047');
+ array_push($search, chr(13));
+ array_push($replace, '\\015');
+ array_push($search, chr(10));
+ array_push($replace, '\\012');
+
+ $binData = str_replace($search, $replace, $binData);
+ return $binData;
+}
+
+
+if ($_POST["data"]) {
+ $d = explode("____", $_POST["data"]);
+
+ $mapurl = $d[0];
+ $legendurl = $d[1];
+
+ $mapurl = eregi_replace("(&width=)[0-9]+($|[^0-9])", "\\1200\\2", $mapurl);
+ $mapurl = eregi_replace("(&height=)[0-9]+($|[^0-9])", "\\1200\\2", $mapurl);
+
+ $adm = new administration();
+ $layer_id = $_SESSION['layer_preview'];
+ if (!$layer_id) {
+ echo "<script>alert('Could not find wms: ".$wms_getmap."');</script>";
+ }
+ else {
+ $map_img = file_get_contents($mapurl);
+ $legend_img = file_get_contents($legendurl);
+
+ $rlp_4326_box = array(6.10988942079081,48.987785376052,8.58790010810365,50.9273496139233);
+
+ $sql = "SELECT * FROM layer_epsg WHERE fkey_layer_id = $1 AND epsg = 'EPSG:4326'";
+ $v = array($layer_id);
+ $t = array('i');
+ $res = db_prep_query($sql, $v, $t);
+ $row = db_fetch_array($res);
+ if ($row['minx'] && $row['miny'] && $row['maxx'] && $row['maxy']) {
+ $extent_layer_id = $layer_id;
+ $layer_4326_box = array($row['minx'], $row['miny'], $row['maxx'], $row['maxy']);
+ }
+ else {
+ $sql = "SELECT * FROM (SELECT fkey_wms_id FROM layer WHERE layer_id = $1 LIMIT 1) AS w, layer_epsg AS e, layer AS l WHERE l.fkey_wms_id = w.fkey_wms_id AND l.layer_pos = 0 AND l.layer_id = e.fkey_layer_id AND e.epsg = 'EPSG:4326'";
+ $v = array($layer_id);
+ $t = array('i');
+ $res = db_prep_query($sql, $v, $t);
+ $row = db_fetch_array($res);
+ if ($row['epsg'] && $row['minx'] && $row['miny'] && $row['maxx'] && $row['maxy']) {
+ $layer_4326_box = array($row['minx'], $row['miny'], $row['maxx'], $row['maxy']);
+ $extent_layer_id = $row['layer_id'];
+ }
+ else {
+ $layer_4326_box = $rlp_4326_box;
+ $extent_layer_id = $layer_id;
+ }
+ }
+ if ($layer_4326_box[0] < $rlp_4326_box[0] || $layer_4326_box[2] > $rlp_4326_box[2]) {
+ if ($layer_4326_box[0] < $rlp_4326_box[0]) {
+ $rlp_4326_box[0] = $layer_4326_box[0];
+ }
+ if ($layer_4326_box[2] > $rlp_4326_box[2]) {
+ $rlp_4326_box[2] = $layer_4326_box[2];
+ }
+ $d_x = $rlp_4326_box[2] - $rlp_4326_box[0];
+ $new_minx = $rlp_4326_box[0] - 0.1*($d_x);
+ $new_maxx = $rlp_4326_box[2] + 0.1*($d_x);
+ if ($new_minx < -180) $rlp_4326_box[0] = -180; else $rlp_4326_box[0] = $new_minx;
+ if ($new_maxx > 180) $rlp_4326_box[2] = 180; else $rlp_4326_box[2] = $new_maxx;
+ }
+ if ($layer_4326_box[1] < $rlp_4326_box[1] || $layer_4326_box[3] > $rlp_4326_box[3]) {
+ if ($layer_4326_box[1] < $rlp_4326_box[1]) {
+ $rlp_4326_box[1] = $layer_4326_box[1];
+ }
+ if ($layer_4326_box[3] > $rlp_4326_box[3]) {
+ $rlp_4326_box[3] = $layer_4326_box[3];
+ }
+ $d_y = $rlp_4326_box[3] - $rlp_4326_box[1];
+ $new_miny = $rlp_4326_box[1] - 0.1*($d_y);
+ $new_maxy = $rlp_4326_box[3] + 0.1*($d_y);
+ if ($new_miny < -90) $rlp_4326_box[1] = -90; else $rlp_4326_box[1] = $new_miny;
+ if ($new_maxy > 90) $rlp_4326_box[3] = 90; else $rlp_4326_box[3] = $new_maxy;
+ }
+
+ $extent_img = file_get_contents("http://212.79.172.107/cgi-bin/mapserv?map=/data/umn/service_layer.map&VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&LAYERS=rlp,ows_layer&STYLES=&SRS=EPSG:4326&BBOX=".$rlp_4326_box[0].",".$rlp_4326_box[1].",".$rlp_4326_box[2].",".$rlp_4326_box[3]."&WIDTH=120&HEIGHT=120&FORMAT=image/png&BGCOLOR=0xffffff&TRANSPARENT=TRUE&EXCEPTIONS=application/vnd.ogc.se_inimage&layer_id=".$extent_layer_id);
+
+ $sql = "SELECT * FROM layer_preview WHERE fkey_layer_id = $1";
+ $v = array($layer_id);
+ $t = array('i');
+ $res = db_prep_query($sql, $v, $t);
+ $row = db_fetch_array($res);
+ if ($row['fkey_layer_id'] == $layer_id) {
+ $sql = "UPDATE layer_preview SET layer_map_preview = $1, layer_extent_preview = $2, layer_legend_preview = $3 WHERE fkey_layer_id = $4";
+ $v = array( escByteA($map_img), escByteA($extent_img), escByteA($legend_img), $layer_id);
+ $t = array('s', 's', 's', 'i');
+ }
+ else {
+ $sql = "INSERT INTO layer_preview (fkey_layer_id, layer_map_preview, layer_extent_preview, layer_legend_preview) VALUES ($1, $2, $3, $4)";
+ $v = array($layer_id, escByteA($map_img), escByteA($extent_img), escByteA($legend_img));
+ $t = array('i', 's', 's', 's');
+ }
+
+
+ $res = db_prep_query($sql, $v, $t);
+ if (db_error()) {
+ echo "<script>alert(\"Error while saving layer preview: ".addslashes(db_error())."\");</script>";
+ }
+ else {
+ echo "<script>try{parent.opener.document.getElementById('".$layer_id."_dp').style.display='';}catch(e){};alert(\"Layer preview has been saved!\")</script>";
+ }
+ }
+}
+?>
+</body>
+<html>
Added: trunk/mapbender/http/javascripts/mod_saveLayerPreview.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/javascripts/mod_saveLayerPreview.php?view=auto&rev=926
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/javascripts/mod_saveLayerPreview.php 2006-11-21 12:49:21+0000
@@ -0,0 +1,53 @@
+<?php
+# $Id: mod_savewmc.php 264 2006-05-12 11:07:19Z vera_schulze
+# http://www.mapbender.org/index.php/mod_savewmc.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.
+
+
+$gui_id = $_REQUEST["gui_id"];
+require_once("../../conf/mapbender.conf");
+$con = db_connect($DBSERVER,$OWNER,$PW);
+db_select_db(DB,$con);
+$sql = "SELECT e_src, e_target FROM gui_element WHERE e_id = 'savewmc' AND fkey_gui_id = $1";
+$v = array($gui_id);
+$t = array('s');
+$res = db_prep_query($sql, $v, $t);
+$cnt = 0;
+while($row = db_fetch_array($res)){
+ $e_src = $row["e_src"];
+ $e_target = $row["e_target"];
+ $cnt++;
+}
+if($cnt > 1){
+ echo "alert('savewmc: ID not unique!');";
+}
+
+$e_id_css = "saveLayerPreview";
+include("../include/dyn_js.php");
+
+echo "mod_savewmc_target = '".$e_target."';";
+?>
+var mod_saveLayerPreview_img = new Image(); mod_saveLayerPreview_img.src = "<?php echo $e_src; ?>";
+
+function mod_saveLayerPreview(){
+// document.sendData.target = "_blank";
+ document.sendData.action = "../javascripts/mod_insertLayerPreviewIntoDb.php";
+ document.sendData.data.value = mb_mapObj[0].mapURL[0] + "____" + wms[0].wms_getlegendurl;
+ document.sendData.submit();
+}
+
+
Added: trunk/mapbender/http/php/mod_editWMS_Metadata.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_editWMS_Metadata.php?view=auto&rev=926
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/php/mod_editWMS_Metadata.php 2006-11-21 12:49:21+0000
@@ -0,0 +1,472 @@
+<?php
+# $Id: mod_editWMS_Metadata.php 11 2006-09-06 12:15:35Z wieth�lter/strotmann $
+# 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();
+include_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+require_once(dirname(__FILE__)."/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$secParams = SID."&guiID=".$_REQUEST["guiID"]."&elementID=".$_REQUEST["elementID"];
+$self = $PHP_SELF."?".$secParams;
+
+?>
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>Edit WMS Metadata</title>
+
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+include_once '../include/dyn_css.php';
+#Error reporting
+error_reporting(E_ALL);
+ini_set('display_errors', TRUE);
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+$adm = new administration();
+
+?>
+
+<script language="JavaScript">
+var dTarget;
+function save()
+{
+ document.forms[0].update_content.value=1;
+ document.forms[0].submit();
+}
+
+function deletepreview(layer_id)
+{
+ var url = String(document.location);
+ url = url.substr(0, url.indexOf('?'));
+ window.open(url+"?<?php echo strip_tags(SID);?>&guiID=<?php echo $_REQUEST["guiID"]?>&elementID=<?php echo $_REQUEST["elementID"];?>&delete_preview=1&layer_id="+layer_id,'delete preview', 'height=50, width=150, dependent=yes');
+ document.getElementById(layer_id+"_dp").style.display="none";
+}
+
+function pick_the_date(obj)
+{
+ dTarget = obj;
+ var dp =
+window.open('../tools/datepicker/datepicker.php?m=Jan_Feb_Mrz_Apr_Mai_Jun_Jul_Aug_Sep_Okt_Nov_Dez&d=Mo_Di_Mi_Do_Fr_Sa_So&t=heute','dp','left=200,top=200,width=230,height=210,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0');
+ dp.focus();
+ return false
+}
+</script>
+</head>
+<body>
+<?php
+
+function guessTimestamp($timestr)
+{
+
+ if (strstr($timestr, '.'))
+ {
+ list($day, $month, $year) = explode(".", $timestr);
+ }
+ elseif (strstr($timestr, '/'))
+ {
+ list($month, $day, $year) = explode("/", $timestr);
+ }
+ elseif (strstr($timestr, '-'))
+ {
+ list($year, $month, $day) = explode("-", $timestr);
+ }
+ else
+ {
+ $year = 0;
+ $month = 0;
+ $day = 0;
+ }
+ return mktime(0, 0, 0, $month, $day, intval($year));
+
+}
+
+#Update handling
+
+if(isset($_REQUEST['update_content']) && $_REQUEST['update_content'] == true)
+{
+
+ $update_wms_sql = "UPDATE wms SET " .
+ "wms_title = '".$_REQUEST['wms_title_box']."', " .
+ "wms_abstract = '".$_REQUEST['wms_abstract_box']."', " .
+ "fees = '".$_REQUEST['fees_box']."', " .
+ "accessconstraints = '".$_REQUEST['accessconstraints_box']."', " .
+ "contactperson = '".$_REQUEST['contactperson_box']."', " .
+ "contactposition = '".$_REQUEST['contactposition_box']."', " .
+ "contactorganization = '".$_REQUEST['contactorganization_box']."', " .
+ "address = '".$_REQUEST['address_box']."', " .
+ "city = '".$_REQUEST['city_box']."', " .
+ "stateorprovince = '".$_REQUEST['stateorprovince_box']."', " .
+ "postcode = '".$_REQUEST['postcode_box']."', " .
+ "country = '".$_REQUEST['country_box']."', " .
+ "contactvoicetelephone = '".$_REQUEST['contactvoicetelephone_box']."', " .
+ "contactfacsimiletelephone = '".$_REQUEST['contactfacsimiletelephone_box']."', " .
+ "contactelectronicmailaddress = '".$_REQUEST['contactelectronicmailaddress_box']."'";
+ if (isset($_REQUEST['wms_timestamp_box']) && $_REQUEST['wms_timestamp_box'] <> "")
+ {
+ $update_wms_sql .= ", " . "wms_timestamp = " .
+ "'".guessTimestamp($_REQUEST['wms_timestamp_box'])."' ";
+ }
+ $update_wms_sql .= "WHERE wms_id = '".$_REQUEST['wms_id']."'";
+ $res_update_wms_sql = db_query($update_wms_sql);
+ while(list($key,$val) = each($_REQUEST))
+ {
+ if(preg_match("/___/", $key))
+ {
+ $myKey = explode("___", $key);
+ $layer_id = str_replace("L_","",$myKey[0]);
+ if($myKey[1]=="layer_abstract")
+ {
+ $layer_sql = "UPDATE layer SET layer_abstract = '$val' " .
+ "WHERE layer_id = $layer_id AND fkey_wms_id = '".$_REQUEST['wms_id']."'";
+ $res_keyword_sql = db_query($layer_sql);
+ }
+ if($myKey[1]=="layer_keywords")
+ {
+ #Get all keywords depending on the given layer after user modification
+ $keywords = explode(",",$val);
+ #delete all blanks from the keywords list
+ for($j = 0; $j < count($keywords); $j++)
+ {
+ $word = $keywords[$j];
+ $word = trim($word);
+ $keywords[$j] = $word;
+ }
+ #echo "1: Keywords eines Layers: id des Layers: ", $layer_id, ", �bergebener String: ", $val, ";<br>";
+ #Get all keywords depending on this layer from database
+ $keyword_sql = "SELECT keyword_id, keyword FROM keyword, layer_keyword, layer " .
+ "WHERE keyword.keyword_id = layer_keyword.fkey_keyword_id " .
+ "AND layer_keyword.fkey_layer_id = layer.layer_id " .
+ "AND layer.fkey_wms_id = '".$_REQUEST['wms_id']."'" .
+ "AND layer.layer_id = $layer_id";
+ $res_keyword_sql = db_query($keyword_sql);
+ while($keyword_row = db_fetch_array($res_keyword_sql))
+ {
+ $keyword = $keyword_row['keyword'];
+ $keyword_id = $keyword_row['keyword_id'];
+ #keyword has been deleted or has been modified
+ #keyword exists in database but not in user data
+ $index = -1;
+ #echo "1a: Abfrage ob DB Keywords in User Liste: Keyword: ", $keyword, ";<br>";
+ if(in_array($keyword, $keywords) == false)
+ {
+ #echo "1c: Keyword nicht in User Liste: Keyword: ", $keyword, ";<br>";
+ #Deleting reference to the keyword from the layer_keyword table.
+ $keyword_sql = "DELETE FROM layer_keyword " .
+ "WHERE fkey_layer_id = $layer_id " .
+ "AND fkey_keyword_id = $keyword_id";
+ db_query($keyword_sql);
+ #Checking, if the keyword is in use by any layer
+ $layer_sql = "SELECT * FROM layer_keyword " .
+ "WHERE fkey_keyword_id = $keyword_id";
+ $res_layer_sql = db_query($layer_sql);
+ if(!($row = db_fetch_array($res_layer_sql)))
+ {
+ #If keyword will not longer be in use, delete it from keyword table
+ $keyword_sql = "DELETE FROM keyword " .
+ "WHERE keyword_id = $keyword_id";
+ db_query($keyword_sql);
+ }
+ }
+ #Keyword exists in the database and in the user data
+ else
+ {
+ #echo "1d: Keyword ist in User Liste: Keyword: ", $keyword, ";<br>";
+ for($i = 0; $i < count($keywords); $i++)
+ {
+ #Delete keyword from the user data list, because the data
+ #have not to be updated within the database
+ if($keywords[$i] == $keyword)
+ {
+ $keywords[$i] = null;
+ }
+ }
+ }
+ }
+ #Inserting keyword, that are not existing in the database
+ for($i = 0; $i < count($keywords); $i++)
+ {
+ #echo "2: Alle Eintr�ge des Keyword arrays: Keyword: ", $keywords[$i], "; Index: ", $i, ";<br>";
+ if($keywords[$i] != null)
+ {
+ #echo "3: Eintr�ge ungleich null: Keyword: ", $keywords[$i], "; Index: ", $i, ";<nr>";
+ $keyword = $keywords[$i];
+ #Check, if the keyword is exsiting in the database
+ $keyword_sql = "SELECT keyword_id FROM keyword " .
+ "WHERE keyword = '$keyword'";
+ $res_keyword_sql = db_query($keyword_sql);
+ $keyword_row = db_fetch_array($res_keyword_sql);
+ #Keyword exists in the database
+ if($keyword_row != null)
+ {
+ $keyword_id = $keyword_row[0];
+ #echo "4: Keyword in Datenbank vorhanden: id des Keywords: ", $keyword_id, ";<br>";
+ }
+ #Keyword does not exist in the database
+ else
+ {
+ $keyword_sql = "INSERT INTO keyword (keyword) VALUES ('$keyword')";
+ $res_keyword_sql = db_query($keyword_sql);
+ $keyword_sql = "SELECT keyword_id FROM keyword WHERE keyword = '$keyword'";
+ $res_keyword_sql = db_query($keyword_sql);
+ $keyword_row = db_fetch_array($res_keyword_sql);
+ if($keyword_row != null)
+ {
+ $keyword_id = $keyword_row[0];
+ #echo "4: Keyword in der Datenbank nicht vorhanden: id des Keywords: ", $keyword_id, ";<br>";
+ }
+ }
+ #Inserting the reference between layer and keyword in the layer_keyword table
+ $keyword_sql = "INSERT INTO layer_keyword (fkey_layer_id, fkey_keyword_id) " .
+ "VALUES ('$layer_id', '$keyword_id')";
+ $res_keyword_sql = db_query($keyword_sql);
+ }
+ }
+ #Delete all elements from array
+ unset($keywords);
+ }
+ }
+ }
+}
+unset($update_content);
+
+#delete preview
+
+if(isset($_REQUEST['delete_preview']) && $_REQUEST['delete_preview']=='1'
+ && isset($_REQUEST['layer_id']))
+{
+ $preview_sql = "DELETE FROM layer_preview WHERE fkey_layer_id = ".$_REQUEST['layer_id']."";
+ $res_preview_sql = db_query($preview_sql);
+ die("Preview has been deleted!</body></html>");
+}
+?>
+<form name='form1' action='<?php $self ?>' method='post'>
+
+<table>
+
+<td WIDTH="300">
+<B><FONT FACE="Arial">WMS Metadaten<FONT/><B/>
+<td/>
+<td WIDTH="200">
+<input type='button' style='width:100px;height:40px;' value='save' onclick='save()'>
+<td/>
+
+</table>
+
+<?php
+
+#Use select box to select a wms
+
+if (isset($_REQUEST['show_wms_list']) && $_REQUEST['show_wms_list'] == true)
+{
+
+ #Querying information from wms data table
+ $wms_sql = "SELECT wms_id, wms_title FROM wms WHERE wms_owner = ".$_SESSION["mb_user_id"];
+ $res_wms_sql = db_query($wms_sql);
+ #wms-selection
+
+ ?>
+ <br/>
+ <select size='4' name='wmsList' style='width:200px' onchange='submit()'>
+
+ <?php
+
+ while($row = db_fetch_array($res_wms_sql))
+ {
+ if ($adm->getWmsPermission($row["wms_id"], $_SESSION['mb_user_id'])) {
+ echo "<option value='".$row["wms_id"]."' ";
+ if(isset($_REQUEST['wmsList']) && $_REQUEST['wmsList'] == $row["wms_id"])
+ {
+ echo "selected";
+ $count_wms = 0;
+ }
+ echo "> ".$row["wms_title"]."</option>";
+ }
+ }
+ $count_wms++;
+ ?>
+ </select>
+
+
+ <?php
+ if(isset($_REQUEST['wmsList']) == true && $_REQUEST['wmsList'] <>0)
+ editWMSByWMSID ($_REQUEST['wmsList']);
+}
+
+$wms_id;
+function editWMSByWMSID($param_wms_id)
+{
+ global $wms_id;
+ $wms_id = $param_wms_id;
+
+}
+
+
+if(isset($wms_id) == true && $wms_id <>0)
+{
+ $selected_wms_sql = "SELECT * FROM wms WHERE wms_id = '".$wms_id."'";
+ $res_selected_wms_sql = db_query($selected_wms_sql);
+ $selected_row = db_fetch_array($res_selected_wms_sql);
+
+?>
+ <br/>
+ <br/>
+ <table cellpadding='3' cellspacing='3' border='0' class='table_top'>
+ <tr>
+ <td>WMS-Titel:<td><td/>
+ <input type='text' name='wms_title_box' value='<?php echo $selected_row["wms_title"];?>' /><td/>
+
+ <td>WMS- Abstract:<td><td/>
+ <input type='text' name='wms_abstract_box' value='<?php echo $selected_row["wms_abstract"];?>' /><td/>
+
+ <td>Fees:<td><td/>
+ <input type='text' name='fees_box' value='<?php echo $selected_row["fees"]?>'/><td/>
+ <tr/>
+
+ <tr>
+ <td>Access Constraints:<td><td/>
+ <input type='text' name='accessconstraints_box' value='<?php echo $selected_row["accessconstraints"]?>'/><td/>
+
+ <td>Contact Person:<td><td/>
+ <input type='text' name='contactperson_box' value='<?php echo $selected_row["contactperson"]?>'/><td/>
+
+ <td>Contact Position:<td><td/>
+ <input type='text' name='contactposition_box' value='<?php echo $selected_row["contactposition"]?>'/><td/>
+ <tr/>
+
+ <tr>
+ <td>Contact Organization:<td><td/>
+ <input type='text' name='contactorganization_box' value='<?php echo $selected_row["contactorganization"]?>'/><td/>
+
+ <td>Address:<td><td/>
+ <input type='text' name='address_box' value='<?php echo $selected_row["address"]?>'/><td/>
+
+ <td>City:<td><td/>
+ <input type='text' name='city_box' value='<?php echo $selected_row["city"]?>'/><td/>
+ <tr/>
+
+ <tr>
+ <td>State or Province:<td><td/>
+ <input type='text' name='stateorprovince_box' value='<?php echo $selected_row["stateorprovince"]?>'/><td/>
+
+ <td>Postcode:<td><td/>
+ <input type='text' name='postcode_box' value='<?php echo $selected_row["postcode"]?>'/><td/>
+
+ <td>Country:<td><td/>
+ <input type='text' name='country_box' value='<?php echo $selected_row["country"]?>'/><td/>
+ <tr/>
+
+ <tr>
+ <td>Telephone:<td><td/>
+ <input type='text' name='contactvoicetelephone_box'
+ value='<?php echo $selected_row["contactvoicetelephone"]?>'/><td/>
+
+ <td>Fax:<td><td/>
+ <input type='text' name='contactfacsimiletelephone_box' value='<?php echo $selected_row["contactfacsimiletelephone"]?>'/><td/>
+
+ <td>E-Mail:<td><td/>
+ <input type='text' name='contactelectronicmailaddress_box' value='<?php echo $selected_row["contactelectronicmailaddress"]?>'/><td/>
+ <tr/>
+ <tr>
+ <?php
+ if (isset($selected_row["wms_timestamp"]) && $selected_row["wms_timestamp"] <> "")
+ {
+ $datum = date("d.m.Y",$selected_row["wms_timestamp"]);
+ }
+ else $datum = ""
+?>
+ <td>Date:<td><td/>
+ <input type='text' name='wms_timestamp_box' value='<?php echo $datum?>' onClick='pick_the_date(document.form1.wms_timestamp_box)'/><td/>
+ <tr/>
+ <table border='1' cellpadding='1'>
+ <tr><td>Nr.</td><td>Title</td><td>Abstract</td><td>Keywords</td><td></td></tr>
+
+
+<?php
+
+ $layer_sql = "SELECT * FROM layer WHERE layer.fkey_wms_id = '".$wms_id."'" .
+ " ORDER BY layer_pos";
+ $res_layer_sql = db_query($layer_sql);
+
+ while($layer_row = db_fetch_array($res_layer_sql))
+ {
+ ?>
+ <tr align='center'>
+ <td><input type='text' size='1' name='L_<?php echo $layer_row['layer_id']?>___layer_nr'
+ value='<?php echo $layer_row['layer_pos']?>' readonly></td>
+ <td><input type='text' size='15' name='L_<?php echo $layer_row['layer_id']?>___layer_title'
+ value='<?php echo $layer_row['layer_title']?>' readonly></td>
+ <td><input type='text' size='42' name='L_<?php echo $layer_row['layer_id']?>___layer_abstract'
+ value='<?php echo $layer_row['layer_abstract']?>'>
+
+ <?php
+ $keyword_sql = "SELECT keyword FROM keyword, layer_keyword, layer " .
+ "WHERE keyword.keyword_id = layer_keyword.fkey_keyword_id " .
+ "AND layer_keyword.fkey_layer_id = layer.layer_id " .
+ "AND layer.fkey_wms_id = '".$wms_id."' " .
+ "AND layer.layer_id = ".$layer_row['layer_id']."";
+ $res_keyword_sql = db_query($keyword_sql);
+ $keywordList = "";
+ $seperator = "";
+ while($keyword_row = db_fetch_array($res_keyword_sql))
+ {
+ if($keywordList != "")
+ {
+ $seperator = ",";
+ }
+ $keywordList .= $seperator.$keyword_row["keyword"];
+ }
+ ?>
+ <td><input type='text' size='42' name='L_<?php echo $layer_row['layer_id']?>___layer_keywords'
+ value='<?php echo $keywordList?>'>
+ </td>
+ <td><input type="button" value='preview' onclick="window.open('../frames/index.php?&gui_id=layer_preview&layer_preview=1&portal_services=<?php echo $layer_row['layer_id'];?>', 'mini_mapbender', 'height=370, width=370, dependent=yes');"></td>
+ <td>
+<?php
+ $preview_sql = "SELECT * FROM layer_preview " .
+ "WHERE fkey_layer_id = ".$layer_row['layer_id']."";
+ $res_preview_sql = db_query($preview_sql);
+ if(db_numrows($res_preview_sql)>0){?>
+ <input id="<?php echo $layer_row['layer_id'];?>_dp" type="button" value='delete preview' onclick="deletepreview('<?php echo $layer_row['layer_id'];?>');">
+<?php }else{?>
+ <input id="<?php echo $layer_row['layer_id'];?>_dp" type="button" value='delete preview' style="display:none;" onclick="deletepreview('<?php echo $layer_row['layer_id'];?>');">
+<?php }?>
+ </td>
+ </tr>
+
+
+ <?php
+ }
+
+
+ #editWMSByWMSID(961);
+ ?>
+
+ </table>
+ <input type='hidden' name='update_content' value=''/>
+ <input type='hidden' name='wms_id' value='<?php echo $wms_id ?>'/>
+ <input type="hidden" value='' name='delete_preview'>
+ <input type="hidden" value='' name='layer_id'>
+ </form>
+ </body>
+ </html>
+<?php
+}
+?>
Added: trunk/mapbender/http/php/mod_layerMetadata.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_layerMetadata.php?view=auto&rev=926
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/php/mod_layerMetadata.php 2006-11-21 12:49:21+0000
@@ -0,0 +1,165 @@
+<?php
+# $Id: mod_layerMetadata.php 235 2006-05-11 08:34:48Z uli $
+# http://www.mapbender.org/index.php/Administration
+# 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("../../conf/mapbender.conf");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+
+function display_text($string) {
+ $string = eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);
+ $string = eregi_replace("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@([0-9a-z](-?[0-9a-z])*\.)+[a-z]{2}([zmuvtg]|fo|me)?$", "<a href=\"mailto:\\0\" target=_blank>\\0</a>", $string);
+ $string = eregi_replace("\n", "<br>", $string);
+ return $string;
+}
+?>
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
+ <head>
+ <title>GeoPortal Rheinland-Pfalz - Metadaten</title>
+ <meta name="description" content="Metadaten" xml:lang="de" />
+ <meta name="keywords" content="Metadaten" xml:lang="de" />
+ <meta http-equiv="cache-control" content="no-cache">
+ <meta http-equiv="pragma" content="no-cache">
+ <meta http-equiv="expires" content="0">
+ <meta http-equiv="content-language" content="de" />
+ <meta http-equiv="content-style-type" content="text/css" />
+<?php
+ echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
+?>
+ <link rel="stylesheet" type="text/css" href="../../../portal/fileadmin/design/css/screen.css" media="screen" />
+ <link rel="stylesheet" type="text/css" href="../../../portal/fileadmin/design/css/print.css" media="print" />
+ </head>
+ <body id="top" class="popup">
+
+ <div id="header_graybottom"></div>
+ <div id="header_gray"><a href="javascript:window.close()"><?php echo utf8_encode('Fenster schließen');?></a></div>
+ <div id="header_redbottom"></div>
+ <div id="header_red"></div>
+
+ <div class="content">
+<?php
+ $layer_id = $_GET['id'];
+ $wms_getmap = urldecode($_GET['wms']);
+ $layer_name = urldecode($_GET['name']);
+
+ if ($layer_id) {
+ $sql = "SELECT ";
+ $sql .= "layer.layer_id, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, layer.layer_minscale, layer.layer_maxscale, ";
+ $sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
+ $sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, ";
+ $sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
+ $sql .= "wms.contactelectronicmailaddress, wms.country ";
+ $sql .= "FROM layer, wms WHERE layer.layer_id = $1 AND layer.fkey_wms_id = wms.wms_id LIMIT 1";
+ $v = array($layer_id);
+ $t = array('i');
+ }
+ else if ($wms_getmap && $layer_name) {
+ $sql = "SELECT ";
+ $sql .= "layer.layer_id, layer.layer_title, layer.layer_abstract, layer.layer_pos, layer.layer_parent, layer.layer_minscale, layer.layer_maxscale, ";
+ $sql .= "wms.wms_title, wms.wms_abstract, wms.wms_id, wms.fees, wms.accessconstraints, wms.contactperson, ";
+ $sql .= "wms.contactposition, wms.contactorganization, wms.address, wms.city, ";
+ $sql .= "wms.stateorprovince, wms.postcode, wms.contactvoicetelephone, wms.contactfacsimiletelephone, ";
+ $sql .= "wms.contactelectronicmailaddress, wms.country ";
+ $sql .= "FROM layer, wms WHERE layer.layer_pos <> 0 AND layer.layer_name = $1 AND layer.fkey_wms_id = wms.wms_id AND wms.wms_getmap LIKE $2 LIMIT 1";
+ $v = array($layer_name, $wms_getmap."%");
+ $t = array('s', 's');
+ }
+ else die();
+ $res = db_prep_query($sql,$v,$t);
+ echo db_error();
+ $layer = array();
+ $row = db_fetch_array($res);
+ $layer_id = $row['layer_id'];
+
+ $sql_p = "SELECT * FROM layer_preview WHERE fkey_layer_id = $1 LIMIT 1";
+ $v_p = array($layer_id);
+ $t_p = array('i');
+ $res_p = db_prep_query($sql_p, $v_p, $t_p);
+ $row_p = db_fetch_array($res_p);
+ if ($row_p['layer_map_preview'] != "") {
+ $layer['Voransicht'] = "<img src = 'mod_displayImage.php?id=".$layer_id."&col=layer_map_preview'>";
+ if ($row_p['layer_legend_preview'] != "") $layer['Voransicht'] .= "<img src = 'mod_displayImage.php?id=".$layer_id."&col=layer_legend_preview'>";
+ }
+
+ $layer['ID'] = $row['layer_id'];
+ $layer['Titel'] = $row['layer_title'];
+ $layer['Zusammenfassung'] = $row['layer_abstract'];
+ if ($row['layer_pos'] || $row['layer_parent']) {
+ $layer['Minscale'] = $row['layer_minscale'];
+ $layer['Maxscale'] = $row['layer_maxscale'];
+ }
+ $layer['WMS Titel'] = $row['wms_title'];
+ $layer['WMS Zusammenfassung'] = $row['wms_abstract'];
+ $layer['Gebühren'] = $row['fees'];
+ $layer['Zugriffsbeschränkung'] = $row['accessconstraints'];
+ $layer['Ansprechpartner'] = $row['contactperson'];
+ $layer['Organisation'] = $row['contactorganization'];
+ $layer['Adresse'] = $row['address'];
+ $layer['Stadt'] = $row['city'];
+ $layer['Bundesland'] = $row['stateorprovince'];
+ $layer['PLZ'] = $row['postcode'];
+ $layer['Telefon'] = $row['contactvoicetelephone'];
+ $layer['Fax'] = $row['contactfacsimiletelephone'];
+ $layer['E-Mail'] = $row['contactelectronicmailaddress'];
+ $layer['Land'] = $row['country'];
+
+ $sql_p = "SELECT layer_extent_preview FROM layer_preview WHERE fkey_layer_id = $1 LIMIT 1";
+ $v_p = array($layer_id);
+ $t_p = array('i');
+ $res_p = db_prep_query($sql_p, $v_p, $t_p);
+ $row_p = db_fetch_array($res_p);
+ if ($row_p['layer_extent_preview'] != "") $layer['Ausdehnung'] = "<img src = 'mod_displayImage.php?id=".$layer_id."&col=layer_extent_preview'>";
+
+
+
+ echo "<table class='contenttable-0-wide'>\n";
+ $t_a = "\t<tr>\n\t\t<th>\n\t\t\t";
+ $t_b = "\n\t\t</th>\n\t\t<td>\n\t\t\t";
+ $t_c = "\n\t\t</td>\n\t</tr>\n";
+
+ $keys = array_keys($layer);
+ for ($j=0; $j<count($layer); $j++) {
+ echo $t_a . utf8_encode($keys[$j]) . $t_b . display_text($layer[$keys[$j]]) . $t_c;
+ }
+
+ if (!$row['layer_pos'] && !$row['layer_parent']) {
+ $wms_id = $row['wms_id'];
+ $sql = "SELECT layer.layer_title, layer.layer_id FROM layer WHERE fkey_wms_id = $1 AND layer_pos <> 0";
+ $v = array($wms_id);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $i=0;
+ $layer = array();
+ while ($row = db_fetch_array($res)) {
+ $layer[$i] = array();
+ $layer[$i]['Titel'] = $row['layer_title'];
+ $layer[$i]['id'] = $row['layer_id'];
+ $i++;
+ }
+ echo "<tr><th>Ebenen</th><td>";
+ for ($i=0; $i<count($layer); $i++) {
+ if ($i >0) echo ", ";
+ echo "<a href='mod_layerMetadata.php?id=".$layer[$i]['id']."'>" . $layer[$i]['Titel'] . "</a>";
+ }
+ }
+ echo "</td></tr></table>\n";
+?>
+ </div>
+ <div id="footer_red"></div>
+ </body>
+</html>
More information about the Mapbender_commits
mailing list