[Mapbender-commits] r10219 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Tue Aug 27 00:25:37 PDT 2019
Author: armin11
Date: 2019-08-27 00:25:37 -0700 (Tue, 27 Aug 2019)
New Revision: 10219
Modified:
trunk/mapbender/http/php/mod_showMetadata.php
trunk/mapbender/http/php/mod_subscribersServiceList.php
Log:
Fix and small enhancement for showing subscribed monitoring - add wfs to list
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2019-08-26 15:22:19 UTC (rev 10218)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2019-08-27 07:25:37 UTC (rev 10219)
@@ -948,11 +948,11 @@
$is_subscribed = $user->hasSubscription($resourceMetadata['serviceid'], "WFS");
if ($is_subscribed) {
$aboStr = "<tr><th>Abo</th><td><a href = '../php/mod_showMetadata.php?id=" .
- $featuretypeId . "&resource=featuretype&user_id=" . $user->id . "&subscribe=0'><img style='border: none;' src = '../img/mail_delete.png' title='"._mb("Monitoring Abo löschen")."'></a></td></tr>"; //TODO check wherefor user_id should be given as parameter?
+ $wfsId . "&resource=wfs&user_id=" . $user->id . "&subscribe=0'><img style='border: none;' src = '../img/mail_delete.png' title='"._mb("Monitoring Abo löschen")."'></a></td></tr>"; //TODO check wherefor user_id should be given as parameter?
}
else if (!$is_subscribed) {
- $aboStr = "<tr><th>Abo</th><td><a href = '../php/mod_showMetadata.php?id=" . $featuretypeId .
- "&resource=featuretype&user_id=" . $user->id . "&subscribe=1'><img style='border: none;' src = '../img/mail_send.png' title='"._mb("Monitoring abonnieren")."'></a></td></tr>";
+ $aboStr = "<tr><th>Abo</th><td><a href = '../php/mod_showMetadata.php?id=" . $wfsId .
+ "&resource=wfs&user_id=" . $user->id . "&subscribe=1'><img style='border: none;' src = '../img/mail_send.png' title='"._mb("Monitoring abonnieren")."'></a></td></tr>";
}
}
$html .= $aboStr;
Modified: trunk/mapbender/http/php/mod_subscribersServiceList.php
===================================================================
--- trunk/mapbender/http/php/mod_subscribersServiceList.php 2019-08-26 15:22:19 UTC (rev 10218)
+++ trunk/mapbender/http/php/mod_subscribersServiceList.php 2019-08-27 07:25:37 UTC (rev 10219)
@@ -73,6 +73,9 @@
$admin = new administration();
$user = new User();
+//********************************************************************************************************************************************************************************
+//wms
+//********************************************************************************************************************************************************************************
//echo $user->id."<br>";
//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";
@@ -79,13 +82,11 @@
$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++) {
@@ -110,7 +111,6 @@
$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") {
@@ -138,7 +138,6 @@
arsort($newArray);
}
}
-
$str .= "<form name = 'form1' method='post' action='".$_SERVER["SCRIPT_NAME"]."?sortby=".$_GET['sortby']."'>\n\t";
$str .= "<table cellpadding=10 cellspacing=0 border=0 style='font-family:verdana;font-size:0.8em;'>";
$str .= "<tr bgcolor='#f0f0f0'><th align='left'><a href='".$_SERVER["SCRIPT_NAME"]."?sortby=wms'>"._mb("WebMapService")."</a></th>";
@@ -147,7 +146,6 @@
$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";
@@ -208,10 +206,139 @@
}
$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>";
+ $str .= "\n\t\t<td><input type=button value='details' onclick=\"var newWindow = window.open('../php/mod_monitorCapabilities_read_single.php?serviceType=wms&id=".$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>";
+//********************************************************************************************************************************************************************************
+//wfs
+//********************************************************************************************************************************************************************************
+//only logged in user can see their subscribed services
+$sql = "SELECT DISTINCT mb_wfs_availability.fkey_wfs_id FROM mb_wfs_availability,mb_user_abo_ows WHERE mb_wfs_availability.fkey_wfs_id=mb_user_abo_ows.fkey_wfs_id AND mb_user_abo_ows.fkey_mb_user_id=$1";
+$res = db_prep_query($sql, array($user->id), array("i"));
+$cnt = 0;
+$wfs = array();
+while(db_fetch_row($res)){
+ $wfs[$cnt] = db_result($res,$cnt,"fkey_wfs_id");
+
+ $cnt++;
+}
+$status = array();
+$upload_id = array();
+for ($i=0; $i<count($wfs); $i++) {
+ //$e = new mb_exception("wfs: ".$wfs[$i]);
+ //$str.= "<br>"."wfs: ".$wfs[$i]."<br>";
+ $wfs_id[$wfs[$i]] = $wfs[$i];
+ $sql = "SELECT fkey_upload_id, last_status, status_comment, upload_url, availability, average_resp_time FROM mb_wfs_availability ";
+ $sql .= "WHERE fkey_wfs_id = $1";
+ $v = array($wfs_id[$wfs[$i]]);
+ $t = array('i');
+ $res = db_prep_query($sql,$v,$t);
+ $avg_response_time[$wfs[$i]] = round(db_result($res,0,"average_resp_time"),1);
+ $status[$wfs[$i]] = intval(db_result($res,0,"last_status"));
+ $comment[$wfs[$i]] = db_result($res,0,"status_comment");
+ $upload_url[$wfs[$i]] = db_result($res,0,"upload_url");
+ $percentage[$wfs[$i]]=db_result($res,0,"availability");
+ $upload_id[$wfs[$i]] = db_result($res,0,"fkey_upload_id");
+ //$image[$wms[$i]] =db_result($res,0,"image");
+ //$map_url[$wfs[$i]] =db_result($res,0,"map_url");
+}
+$newArray = $status;
+if ($_GET['sortby']) {
+ if ($_GET['sortby'] == "wfs") {
+ $newArray = $wfs_id;
+ asort($newArray);
+ }
+ elseif ($_GET['sortby'] == "status") {
+ $newArray = $status;
+ asort($newArray);
+ }
+ elseif ($_GET['sortby'] == "avgresp") {
+ $newArray = $avg_response_time;
+ asort($newArray);
+ }
+ elseif ($_GET['sortby'] == "avail") {
+ $newArray = $percentage;
+ arsort($newArray);
+ }
+ elseif ($_GET['sortby'] == "last") {
+ $newArray = $upload_id;
+ arsort($newArray);
+ }
+}
+$str .= "<form name = 'form2' method='post' action='".$_SERVER["SCRIPT_NAME"]."?sortby=".$_GET['sortby']."'>\n\t";
+$str .= "<table cellpadding=10 cellspacing=0 border=0 style='font-family:verdana;font-size:0.8em;'>";
+$str .= "<tr bgcolor='#f0f0f0'><th align='left'><a href='".$_SERVER["SCRIPT_NAME"]."?sortby=wfs'>"._mb("WebFeatureService")."</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=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=wfs&id=".$wfs_id[$k]."&subscribe=1' onclick='var metadataWindow=window.open(this.href,'"._mb("Metadata")."','width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes'); metadataWindow.focus();newWindow.href.location='test.php'; >"._mb("Service ID").": ".$wfs_id[$k]."</a><br>".$admin->getWfsTitleByWfsId($wfs_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> <span style='font-size:12'>(" . $total[$k] . " "._mb('cycles').")</span><br>";
+ $str .= "\n\t\t\t<td valign='top'><b>" . $percentage[$k] . " %</b> <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?serviceType=wfs&id=".$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;
?>
More information about the Mapbender_commits
mailing list