[Mapbender-commits] r7594 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Mon Feb 14 09:45:16 EST 2011
Author: armin11
Date: 2011-02-14 06:45:15 -0800 (Mon, 14 Feb 2011)
New Revision: 7594
Modified:
trunk/mapbender/http/php/mod_showMetadata.php
trunk/mapbender/http/php/mod_subscribersServiceList.php
Log:
some further translations and bugfixing in subscription handling of metadata view module
Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php 2011-02-14 14:36:28 UTC (rev 7593)
+++ trunk/mapbender/http/php/mod_showMetadata.php 2011-02-14 14:45:15 UTC (rev 7594)
@@ -91,8 +91,21 @@
$layout = $testMatch;
$testMatch = NULL;
}
-$subscribe = intval($_GET["subscribe"]);
+if (isset($_REQUEST["subscribe"]) & $_REQUEST["subscribe"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["subscribe"];
+ if (!($testMatch == '1' or $testMatch == '0')){
+ echo 'layout: <b>'.$testMatch.'</b> is not valid.<br/>';
+ die();
+ }
+ $subscribe = $testMatch;
+ $testMatch = NULL;
+}
+
+
+$subscribe = intval($subscribe);
+
$hostName = $_SERVER['HTTP_HOST'];
if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
@@ -690,33 +703,32 @@
}
$user = new User();
+
//
// Monitoring is only available if the user is allowed to access this service
//
if ($resource == 'wms' or $resource == 'layer'){
- if ($user->isLayerAccessible($layerId)) {
- if ($subscribe === 1) {
- $user->addSubscription($resourceMetadata['serviceid']);
- }
- else if ($subscribe === 0) {
- $user = new User();
- $user->cancelSubscription($resourceMetadata['serviceid']);
- }
- $currentUser = new User();
- $is_subscribed = $currentUser->hasSubscription($resourceMetadata['serviceid']);
- $is_public = $currentUser->isPublic();
+ if ($user->isLayerAccessible($layerId)) {
+ $is_public = $user->isPublic();
//show abo function to registred and authorized users
- //if ($is_subscribed && !$is_public) {
- if ($is_subscribed) {
- $aboStr = "<tr><th>Abo</th><td><a href = '../php/mod_showMetadata.php?id=" .
- $layerId . "&resource=layer&user_id=" . $currentUser->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 && !$is_public) {
- else if (!$is_subscribed) {
- $aboStr = "<tr><th>Abo</th><td><a href = '../php/mod_showMetadata.php?id=" . $layerId .
- "&resource=layer&user_id=" . $currentUser->id . "&subscribe=1'><img style='border: none;' src = '../img/mail_send.png' title='"._mb("Monitoring abonnieren")."'></a></td></tr>";
- }
+ if (!$is_public) {
+ if ($subscribe == 1) {
+ $user->addSubscription($resourceMetadata['serviceid']);
+ }
+ else if ($subscribe == 0) {
+ $user->cancelSubscription($resourceMetadata['serviceid']);
+ }
+ $is_subscribed = $user->hasSubscription($resourceMetadata['serviceid']);
+ if ($is_subscribed) {
+ $aboStr = "<tr><th>Abo</th><td><a href = '../php/mod_showMetadata.php?id=" .
+ $layerId . "&resource=layer&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=" . $layerId .
+ "&resource=layer&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 2011-02-14 14:36:28 UTC (rev 7593)
+++ trunk/mapbender/http/php/mod_subscribersServiceList.php 2011-02-14 14:45:15 UTC (rev 7594)
@@ -17,8 +17,7 @@
# 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__)."/../php/mb_validateSession.php");
require_once(dirname(__FILE__)."/../classes/class_administration.php");
require_once(dirname(__FILE__)."/../classes/class_user.php");
?>
@@ -29,21 +28,61 @@
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
+<style type="text/css">
+*{margin:0;padding:0;font-size:1em;font-family:Arial,Helvetica,"Sans Serif" !important;}
+a:link {
+COLOR: #000000;
+text-decoration:none;
+font-weight:bold;
+}
+a:visited {
+COLOR: #000000;
+text-decoration:none;
+font-weight:bold;
+}
+a:hover {
+COLOR: #871d33;
+text-decoration:underline;
+font-weight:bold;
+}
+a:active {
+COLOR: #000000;
+text-decoration:none;
+font-weight:bold;
+}
+</style>
<?php
echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';
?>
</head>
<body>
<?php
+if (isset($_REQUEST["languageCode"]) & $_REQUEST["languageCode"] != "") {
+ //validate to csv integer list
+ $testMatch = $_REQUEST["languageCode"];
+ if (!($testMatch == 'de' or $testMatch == 'fr' or $testMatch == 'en')){
+ echo 'languageCode: <b>'.$testMatch.'</b> is not valid.<br/>';
+ die();
+ }
+ $languageCode = $testMatch;
+ $testMatch = NULL;
+ Mapbender::session()->set("mb_lang",$languageCode);
+ //set session var to languageCode
+ $localeObj = new Mb_locale(Mapbender::session()->get("mb_lang"));
+}
+
$admin = new administration();
$user = new User();
+//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";
$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++;
}
@@ -72,7 +111,6 @@
$map_url[$wms[$i]] =db_result($res,0,"map_url");
}
-
$newArray = $status;
if ($_GET['sortby']) {
if ($_GET['sortby'] == "wms") {
@@ -101,10 +139,7 @@
}
}
-#$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='#f0f0f0'><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
@@ -129,7 +164,7 @@
$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 metadataWindow=window.open(this.href,'"._mb("Metadata")."','width=500,height=600,left=100,top=200,scrollbars=yes ,dependent=yes'); metadataWindow.focus();' >"._mb("Service 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]."&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").": ".$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'>";
@@ -151,7 +186,8 @@
$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> <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++) {
More information about the Mapbender_commits
mailing list