svn commit: r958 - trunk/mapbender/http/php/mod_orphanWMS.php

astrid_emde at osgeo.org astrid_emde at osgeo.org
Fri Nov 24 04:17:20 EST 2006


Author: astrid_emde
Date: 2006-11-24 09:17:20+0000
New Revision: 958

Added:
   trunk/mapbender/http/php/mod_orphanWMS.php   (contents, props changed)

Log:
New modul for Mapbender administration (integrated in the gui admin1) to find out which WMS are not integrated in a gui and lost in the database.
The modul enables get information and to delete these orphanded WMS.

Thanks to Melchior Moos for this new modul.

Added: trunk/mapbender/http/php/mod_orphanWMS.php
Url: https://mapbender.osgeo.org/source/browse/mapbender/trunk/mapbender/http/php/mod_orphanWMS.php?view=auto&rev=958
==============================================================================
--- (empty file)
+++ trunk/mapbender/http/php/mod_orphanWMS.php	2006-11-24 09:17:20+0000
@@ -0,0 +1,140 @@
+<?php
+# $Id:
+# http://www.mapbender.org/index.php/OrphanWMS
+# Copyright (C) 2002 Melchior Moos 
+#
+# 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();
+import_request_variables("PG");
+require_once(dirname(__FILE__)."/../../conf/mapbender.conf");
+$con = db_connect(DBSERVER,OWNER,PW);
+db_select_db(DB,$con);
+require_once(dirname(__FILE__)."/../php/mb_validatePermission.php");
+$self = $PHP_SELF . "?".SID."&guiID=".$_REQUEST["guiID"]."&elementID=".$_REQUEST["elementID"];
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="0">
+<?php
+echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
+?>
+<title>Orphaned WMS</title>
+<?php
+include '../include/dyn_css.php';
+?>
+<script type="text/javascript">
+
+function validate()
+{
+   var ind = document.form1.wmsList.selectedIndex;
+   if(ind > -1) {
+     var permission =  confirm("delete: " + document.form1.wmsList.options[ind].text + " ?");
+     if(permission == true) {
+        document.form1.del.value = 1;
+        document.form1.submit();
+     }
+   }
+}
+
+-->
+</script>
+</head>
+<body>
+<?php
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+$admin = new administration();
+
+$error_msg='';
+{	
+	// delete WMS
+	if($del){
+	   $sql = "DELETE FROM wms WHERE wms_id = $1";
+	   $v = array($wmsList);
+	   $t = array('i');
+	   $res = db_prep_query($sql,$v,$t);
+	}
+	// display WMS List
+	$sql = "SELECT * from wms WHERE wms_id NOT IN (select fkey_wms_id from gui_wms)";
+	$res = db_query($sql);
+	$cnt = 0;
+	
+	if (db_numrows($res)>0){
+		echo "<form name='form1' action='" . $self ."' method='post'>";
+		echo "<select class='wmsList' size='20' name='wmsList' onchange='document.form1.wmsList.value = this.value;submit()'>";
+		while($row = db_fetch_array($res))
+		{
+			$wmsvalue = $row["wms_id"];
+		   echo "<option value='".$wmsvalue."'" . (($wmsvalue == $wmsList)?" selected":"") . ">".$row["wms_title"]."</option>";
+		   $cnt++;
+		}
+		echo "</select><br>";
+	
+	
+		//
+		//
+		// If WMS is selected, show more info
+		//
+		//
+		if($wmsList)
+		{
+			echo "<p class = 'guiList'>";
+			
+			// Show GetCapabilities of chosen WMS
+			$sql = "SELECT wms_getcapabilities FROM wms WHERE wms_id = $1";
+			$v = array($wmsList);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			
+			echo "<br><br><b>GetCapabilities</b><br><br>";
+		
+			$cnt = 0;
+			while($row = db_fetch_array($res))
+			{
+				echo $row["wms_getcapabilities"]."<br>";
+				$cnt++;
+			}
+			
+			// Show Abstract of Chosen WMS
+			$sql = "SELECT wms_abstract FROM wms WHERE wms_id = $1";
+			$v = array($wmsList);
+			$t = array('i');
+			$res = db_prep_query($sql,$v,$t);
+			
+			echo "<br><br><b>Abstract</b><br><br>";
+		
+			$cnt = 0;
+			while($row = db_fetch_array($res))
+			{
+				echo $row["wms_abstract"]."<br>";
+				$cnt++;
+			}
+			echo "</p>";
+	
+   			echo "<input class='button_del' type='button' value='delete' onclick='validate()'>";
+		}
+	}else{
+		echo "There are no orphaned WMS.<br>";
+	}
+}
+?>
+<input type='hidden' name='del'>
+</form>
+</body>
+</html>
+




More information about the Mapbender_commits mailing list