[Mapbender-commits] r4484 - trunk/mapbender/http/php
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Aug 5 05:07:48 EDT 2009
Author: christoph
Date: 2009-08-05 05:07:48 -0400 (Wed, 05 Aug 2009)
New Revision: 4484
Modified:
trunk/mapbender/http/php/mod_layerMetadata.php
Log:
Modified: trunk/mapbender/http/php/mod_layerMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_layerMetadata.php 2009-08-05 08:57:58 UTC (rev 4483)
+++ trunk/mapbender/http/php/mod_layerMetadata.php 2009-08-05 09:07:48 UTC (rev 4484)
@@ -17,9 +17,14 @@
# 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_validateSession.php");
+require_once dirname(__FILE__) . "/../../core/globalSettings.php";
+require_once dirname(__FILE__) . "/../classes/class_user.php";
$redirectToMetadataUrl = $_GET["redirectToMetadataUrl"];
+$subscribe = intval($_GET["subscribe"]);
+$layer_id = $_GET['id'];
+$wms_getmap = urldecode($_GET['wms']);
+$layer_name = urldecode($_GET['name']);
function display_text($string) {
$string = mb_eregi_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "<a href=\"\\0\" target=_blank>\\0</a>", $string);
@@ -39,6 +44,7 @@
}
return trim($epsg_list);
}
+
$metadataStr = "";
$metadataStr .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">' .
'<head>' .
@@ -54,9 +60,6 @@
'<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">' .
'</head>'.
'<body>';
- $layer_id = $_GET['id'];
- $wms_getmap = urldecode($_GET['wms']);
- $layer_name = urldecode($_GET['name']);
if ($layer_id) {
$sql = "SELECT ";
@@ -140,6 +143,8 @@
$layer['Metadaten'] = $row['layer_metadataurl'];
$metadataUrl = $row['layer_metadataurl'];
+
+
if ($layer['Metadaten'] && $redirectToMetadataUrl) {
header("Location: " . $layer['Metadaten']);
}
@@ -161,20 +166,54 @@
$t = array('i');
$res = db_prep_query($sql,$v,$t);
$i=0;
- $layer = array();
+ $layerArray = array();
while ($row = db_fetch_array($res)) {
- $layer[$i] = array();
- $layer[$i]['Titel'] = $row['layer_title'];
- $layer[$i]['id'] = $row['layer_id'];
+ $layerArray[$i] = array();
+ $layerArray[$i]['Titel'] = $row['layer_title'];
+ $layerArray[$i]['id'] = $row['layer_id'];
$i++;
}
$metadataStr .= "<tr><th>Ebenen</th><td>";
- for ($i=0; $i<count($layer); $i++) {
+ for ($i=0; $i<count($layerArray); $i++) {
if ($i >0) $metadataStr .= ", ";
- $metadataStr .= "<a href='mod_layerMetadata.php?id=".$layer[$i]['id']."'>" . $layer[$i]['Titel'] . "</a>";
+ $metadataStr .= "<a href='mod_layerMetadata.php?id=".$layerArray[$i]['id']."'>" . $layerArray[$i]['Titel'] . "</a>";
}
}
- $metadataStr .= "</td></tr></table>\n";
+ $metadataStr .= "</td></tr>";
+
+ $user = new User();
+
+ //
+ // Monitoring is only available if the user is allowed to access this service
+ //
+ if ($user->isLayerAccessible($layer['ID'])) {
+ if ($subscribe === 1) {
+ $user->addSubscription($layer['WMS ID']);
+ }
+ else if ($subscribe === 0) {
+ $user = new User();
+ $user->cancelSubscription($layer['WMS ID']);
+ }
+
+ $currentUser = new User();
+ $is_subscribed = $currentUser->hasSubscription($wms_id);
+
+ $is_public = $currentUser->isPublic();
+ //show abo function to registred and authorized users
+ if ($is_subscribed && !$is_public) {
+ $metadataStr .= "<tr><th>Abo</th><td><img src = '../img/mail_delete.png'>" .
+ "<a href = '../php/mod_layerMetadata.php?id=" .
+ $layer_id . "&user_id=" . $currentUser->id . "&subscribe=0'>" .
+ _mb("Monitoring Abo löschen") . "</a></td></tr>";
+ }
+ else if (!$is_subscribed && !$is_public) {
+ $metadataStr .= "<tr><th>Abo</th><td><img src = '../img/mail_send.png'>" .
+ "<a href = '../php/mod_layerMetadata.php?id=" . $layer_id .
+ "&user_id=" . $currentUser->id . "&subscribe=1'>" .
+ _mb("Monitoring abonnieren") . "</a></td></tr>";
+ }
+ }
+ $metadataStr .= "</table>\n";
$metadataStr .= '</div></body></html>';
echo $metadataStr;
}
More information about the Mapbender_commits
mailing list