[Mapbender-commits] r7574 - trunk/mapbender/http/php

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Feb 12 08:01:57 EST 2011


Author: armin11
Date: 2011-02-12 05:01:57 -0800 (Sat, 12 Feb 2011)
New Revision: 7574

Added:
   trunk/mapbender/http/php/mod_subscribersServiceList.php
Modified:
   trunk/mapbender/http/php/mod_abo_show.php
Log:
Possibility to show users their subscribed wms & bugfixes.

Modified: trunk/mapbender/http/php/mod_abo_show.php
===================================================================
--- trunk/mapbender/http/php/mod_abo_show.php	2011-02-11 19:48:56 UTC (rev 7573)
+++ trunk/mapbender/http/php/mod_abo_show.php	2011-02-12 13:01:57 UTC (rev 7574)
@@ -99,7 +99,7 @@
 		if (preg_match("/^[0-9]+(,[0-9]+)*$/", $_POST['wmslist'])) {
 			$wms_array = explode(',',$_POST['wmslist']);
 
-			$metadataUrl = preg_replace("/(.*)frames\/login.php/", "$1php/mod_layerMetadata.php?id=", LOGIN);
+			$metadataUrl = preg_replace("/(.*)frames\/login.php/", "$1php/mod_showMetadata.php?resource=layer&id=", LOGIN);
 
 			for ($i=0; $i<count($wms_array); $i++) {
 				// get layer id
@@ -285,7 +285,7 @@
 		$str .= "\n\t\t\t<td><input name='cb".$cnt."' value='" . $wms_id[$k] . "' type=checkbox  />";
 	#<input type=hidden name='upl_id".$cnt."' value='".$upload_id[$k]."'>
 		$str .= "</td>";
-	$str .= "\n\t\t\t<td valign='top'><a href='../php/mod_layerMetadata.php?id=" . $layer_id[$k] ."' onclick='window.open(this.href,'Metadaten','width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes'); return false' target='_blank' >Dienst ID: ". $wms_id[$k] ."</a><br>" . $admin->getWmsTitleByWmsId($wms_id[$k]) . "</td>";
+	$str .= "\n\t\t\t<td valign='top'><a href='../php/mod_showMetadata.php?resource=layer&id=" . $layer_id[$k] ."' onclick='window.open(this.href,'Metadaten','width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes'); return false' target='_blank' >Dienst ID: ". $wms_id[$k] ."</a><br>" . $admin->getWmsTitleByWmsId($wms_id[$k]) . "</td>";
 		#$str .= "\n\t\t\t<td valign='top'><b>" . $wms_id[$k] . "</b><br>" . $admin->getWmsTitleByWmsId($wms_id[$k]) . "</td>";
 		$str .= "\n\t\t\t<td valign='top'><a href='".$upload_url[$k]."' target=_blank><img title='Connect to service' border=0 src = '../img/trafficlights/". $img. "'></a></td>";
 		$str .= "\n\t\t\t<td valign='top'>" . $comment[$k] . "<br><div style='font-size:12'>".date("F j, Y, G:i:s", $upload_id[$k])."</div></td>";

Added: trunk/mapbender/http/php/mod_subscribersServiceList.php
===================================================================
--- trunk/mapbender/http/php/mod_subscribersServiceList.php	                        (rev 0)
+++ trunk/mapbender/http/php/mod_subscribersServiceList.php	2011-02-12 13:01:57 UTC (rev 7574)
@@ -0,0 +1,182 @@
+
+<?php
+# $Id: mod_monitorCapabilities_read.php 517 2006-11-21 12:37:01Z christoph $
+# http://www.mapbender.org/index.php/Monitor_Capabilities
+# 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(dirname(__FILE__)."/../php/mb_validatePermission.php");
+require_once(dirname(__FILE__)."/../classes/class_administration.php");
+require_once(dirname(__FILE__)."/../classes/class_user.php");
+?>
+<!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.'">';	
+?>
+</head>
+<body>
+<?php
+$admin = new administration();
+$user = new User();
+//only logged in user can see their subscribed services
+$sql = "SELECT DISTINCT mb_wms_availability.fkey_wms_id FROM mb_wms_availability,mb_user_abo_ows WHERE mb_wms_availability.fkey_wms_id=mb_user_abo_ows.fkey_wms_id AND mb_user_abo_ows.fkey_mb_user_id=$1";
+$res = db_prep_query($sql, array($user->id), array("i"));
+$cnt = 0;
+$wms = array();
+while(db_fetch_row($res)){
+	$wms[$cnt] = db_result($res,$cnt,"fkey_wms_id");
+	$cnt++;
+}
+
+$status = array();
+$upload_id = array();
+for ($i=0; $i<count($wms); $i++) {
+	$wms_id[$wms[$i]] = $wms[$i];
+        // get layer id
+        $sql = "select layer_id from layer where fkey_wms_id= $1 and layer_pos=0";
+        $v = array($wms[$i]);
+        $t = array('i');
+        $res = db_prep_query($sql,$v,$t);
+        $layer_id[$wms[$i]] = db_result($res,0,0);
+	$sql = "SELECT fkey_upload_id,last_status, status_comment, upload_url,availability ,average_resp_time, map_url, image FROM mb_wms_availability ";
+	$sql .= "WHERE fkey_wms_id = $1";
+	$v = array($wms_id[$wms[$i]]);
+	$t = array('i');
+	$res = db_prep_query($sql,$v,$t);
+        $avg_response_time[$wms[$i]] = round(db_result($res,0,"average_resp_time"),1);
+	$status[$wms[$i]] = intval(db_result($res,0,"last_status"));
+	$comment[$wms[$i]] = db_result($res,0,"status_comment");
+	$upload_url[$wms[$i]] = db_result($res,0,"upload_url");
+	$percentage[$wms[$i]]=db_result($res,0,"availability");
+	$upload_id[$wms[$i]] = db_result($res,0,"fkey_upload_id");
+	$image[$wms[$i]] =db_result($res,0,"image");
+	$map_url[$wms[$i]] =db_result($res,0,"map_url");
+}
+
+
+$newArray = $status;
+if ($_GET['sortby']) {
+	if ($_GET['sortby'] == "wms") {
+		$newArray = $wms_id;
+		asort($newArray);
+	}
+	elseif ($_GET['sortby'] == "status") {
+		$newArray = $status;
+		asort($newArray);
+	}
+	elseif ($_GET['sortby'] == "avgresp") {
+		$newArray = $avg_response_time;
+		asort($newArray);
+	}
+	elseif ($_GET['sortby'] == "image") {
+		$newArray = $image;
+		asort($newArray);
+	}
+	elseif ($_GET['sortby'] == "avail") {
+		$newArray = $percentage;
+		arsort($newArray);
+	}
+	elseif ($_GET['sortby'] == "last") {
+		$newArray = $upload_id;
+		arsort($newArray);
+	}
+}
+
+#$str = "<span style='font-size:30'>Statusübersicht der abonnierten Dienste im GeoPortal.rlp</span><hr><br>\n";
+$str .= "<form name = 'form1' method='post' action='".$_SERVER["SCRIPT_NAME"]."?sortby=".$_GET['sortby']."'>\n\t";
+#$str .= "\n\t<input type=submit value='update selected WMS'>\n";
+#$str .= "\n\t<input type=button onclick=\"self.location.href='".$_SERVER["SCRIPT_NAME"]."?sortby=".$_GET['sortby']."'\" value='refresh'>\n<br/><br/>\n	";
+$str .= "<table cellpadding=10 cellspacing=0 border=0 style='font-family:verdana;font-size:0.8em;'>";
+$str .= "<tr bgcolor='#dddddd'><th align='left'><a href='".$_SERVER["SCRIPT_NAME"]."?sortby=wms'>"._mb("WebMapService")."</a></th>";
+$str .= "<th align='left' colspan = 2><a href='".$_SERVER["SCRIPT_NAME"]."?sortby=status'>"._mb("Availability of Capabilities")."</a></th>";//Verfügbarkeit Dienstebeschreibung
+$str .= "<th align='left'><a href='".$_SERVER["SCRIPT_NAME"]."?sortby=avgresp'>"._mb("Average Response Time for GetCapabilities")."</a></th>";//Durchschnittliche Antwortzeit Beschreibung
+$str .= "<th align='left'><a href='".$_SERVER["SCRIPT_NAME"]."?sortby=image'>"._mb("Availability of GetMap")."</a></th>";//Verfügbarkeit Kartenbild
+$str .= "<th align='left'><a href='".$_SERVER["SCRIPT_NAME"]."?sortby=avail'>"._mb("Availability (2 month)")."</a></th><th></th></tr>";//Verfügbarkeit (2 Monate)
+$cnt = 0;
+
+foreach ($newArray as $k => $value) {
+	$img = "stop.png";
+	$img_map = "nopicture.png";
+	if ($status[$k]==0) $img = "wait.png";
+	elseif ($status[$k]==1) $img = "go.png";
+	if ($image[$k]==1) $img_map = "picture.png";
+
+	if ($updated[$k] == "0" && $status[$k] == 0) $fill = "checked"; else $fill = "disabled";
+
+	if (fmod($cnt, 2) == 1) {
+		$str .= "\n\t\t<tr bgcolor='#e6e6e6'>";
+	}
+	else {
+		$str .= "\n\t\t<tr bgcolor='#f0f0f0'>";
+	}
+
+$str .= "\n\t\t\t<td valign='top'><a href='../php/mod_showMetadata.php?resource=layer&id=" . $layer_id[$k] ."' onclick='var newWindow1=window.open(this.href,'"._mb("Metadata")."','width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes');'  >Dienst ID: ". $wms_id[$k] ."</a><br>" . $admin->getWmsTitleByWmsId($wms_id[$k]) . "</td>";
+	$str .= "\n\t\t\t<td valign='top'><a href='".$upload_url[$k]."' target=_blank><img title='"._mb("Request GetCapabilities")."' border=0 src = '../img/trafficlights/". $img. "'></a></td>";//Aufruf des Capabilities Dokument
+	$str .= "\n\t\t\t<td valign='top'>" . $comment[$k] . "<br><div style='font-size:12'>".date("F j, Y, G:i:s", $upload_id[$k])."</div></td>";
+	$str .= "\n\t\t\t<td valign='top' align = 'left'>";
+	if ($avg_response_time[$k] == NULL) {
+		$str .= "n/a";
+	}
+	else {  	
+		if($avg_response_time[$k] == 0){
+		$str .= "< 1 s";
+		}
+		else
+		{
+			$str .= $avg_response_time[$k] . " s";
+		}
+	}
+	$str .= "</td>";
+	$str .= "\n\t\t\t<td valign='top'>";
+
+	$str .= "<a href='".$map_url[$k]."' target=_blank><img title='"._mb("Tested GetMap Request")."' border=0 src = '../img/trafficlights/". $img_map. "'></a>";//Getesteter GetMap Aufruf
+
+	$str .= "</td>";
+	$str .= "\n\t\t\t<td valign='top'><b>" . $percentage[$k] . " %</b>&nbsp;&nbsp;<span style='font-size:12'>(" . $total[$k] . " cycles)</span><br>";
+	$str .= "<table bgcolor='black' border=1 cellspacing=1 cellpadding=0><tr>";
+	$val = $percentage[$k];
+	for ($i=0; $i<10; $i++) {
+		if ($val>=10) {
+			$str .= "<td height=10 width='10' bgcolor='red'></td>";
+			$val-=10;
+		}
+		elseif($val>0){
+			$str .= "<td height=10 width='" . round($val) . "' bgcolor='red'></td>";
+			if (round($val) < 10) {
+				$str .= "<td height=10 width='" . (9-round($val)) . "' bgcolor='white'></td>";
+			}
+			$val=-1;
+		}
+		else {
+			$str .= "<td height=10 width='10' bgcolor='white'></td>";
+		}
+	}
+	$str .= "</tr></table></td>";
+	
+	$str .= "\n\t\t<td><input type=button value='details' onclick=\"var newWindow = window.open('../php/mod_monitorCapabilities_read_single.php?wmsid=".$wms_id[$k]."','wms','width=500,height=700,scrollbars');newWindow.href.location='test.php'\"></td></tr>";
+	$cnt++;
+}
+$str .= "\n\t</table>\n\t<br/>\n</form>";
+echo $str;
+
+?>
+</body></html>



More information about the Mapbender_commits mailing list