[Mapbender-commits] r7634 - in trunk/mapbender: http/classes http/javascripts http/php resources/locale/de_DE/LC_MESSAGES tools

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Feb 22 11:57:49 EST 2011


Author: armin11
Date: 2011-02-22 08:57:49 -0800 (Tue, 22 Feb 2011)
New Revision: 7634

Modified:
   trunk/mapbender/http/classes/class_wmc.php
   trunk/mapbender/http/javascripts/mod_loadwmc.js
   trunk/mapbender/http/php/mod_wmc2ol.php
   trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
   trunk/mapbender/tools/mod_mailAbo.php
Log:
Bugfix for delete wmc problem, wmc2ol and script for mail subscribers.

Modified: trunk/mapbender/http/classes/class_wmc.php
===================================================================
--- trunk/mapbender/http/classes/class_wmc.php	2011-02-21 21:56:11 UTC (rev 7633)
+++ trunk/mapbender/http/classes/class_wmc.php	2011-02-22 16:57:49 UTC (rev 7634)
@@ -281,6 +281,7 @@
 			$publicWmcIdArray = self::getPublicWmcIds();
 			$wmcIdArray = array_keys( array_flip(array_merge($wmcOwnerArray, $publicWmcIdArray)));
 		} else {
+			$publicWmcIdArray = array();
 			$wmcIdArray=$wmcOwnerArray;
 		}
 		// get WMC data

Modified: trunk/mapbender/http/javascripts/mod_loadwmc.js
===================================================================
--- trunk/mapbender/http/javascripts/mod_loadwmc.js	2011-02-21 21:56:11 UTC (rev 7633)
+++ trunk/mapbender/http/javascripts/mod_loadwmc.js	2011-02-22 16:57:49 UTC (rev 7634)
@@ -53,7 +53,7 @@
 	"labelOpenLayersUrl": "Link",
 	"labelCurrentState": "currentState",
 	"labelDeleteWmc": "delete this WMC",
-	"confirmDelete": "Do you really want to delete WMC '%s'?",
+	"confirmDelete": "Do you really want to delete WMC",
 	"labelLoadWmc": "load this WMC",
 	"labelMergeWmc": "merge this WMC",
 	"labelAppendWmc": "append WMC",

Modified: trunk/mapbender/http/php/mod_wmc2ol.php
===================================================================
--- trunk/mapbender/http/php/mod_wmc2ol.php	2011-02-21 21:56:11 UTC (rev 7633)
+++ trunk/mapbender/http/php/mod_wmc2ol.php	2011-02-22 16:57:49 UTC (rev 7634)
@@ -181,6 +181,14 @@
 	$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_serial_id = $1";
 	$res = db_prep_query($sql, array($wmc_id), array("s"));
 	$wmc = db_fetch_row($res);
+	//control if wmc was found else use old wmc_id
+	if (!$wmc[0]) {
+		$sql = "SELECT wmc FROM mb_user_wmc WHERE wmc_id = $1";
+		$res = db_prep_query($sql, array($wmc_id), array("s"));
+		$wmc = db_fetch_row($res);
+		//echo "Wmc with this id was not found in Database!<br>";
+		//die;
+	}
 	//Read out WMC into XML object
 	$xml=simplexml_load_string($wmc[0], "SimpleXMLElement", LIBXML_NOBLANKS);
 	if ($_REQUEST['withoutBody'] == '1') { 

Modified: trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po
===================================================================
--- trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-02-21 21:56:11 UTC (rev 7633)
+++ trunk/mapbender/resources/locale/de_DE/LC_MESSAGES/Mapbender.po	2011-02-22 16:57:49 UTC (rev 7634)
@@ -2311,4 +2311,6 @@
 msgid "Preview could not be created"
 msgstr "Vorschau konnte nicht gespeichert werden"
 
-
+#:../tools/mod_mailAbo.php
+msgid "test1"
+msgstr "test2"

Modified: trunk/mapbender/tools/mod_mailAbo.php
===================================================================
--- trunk/mapbender/tools/mod_mailAbo.php	2011-02-21 21:56:11 UTC (rev 7633)
+++ trunk/mapbender/tools/mod_mailAbo.php	2011-02-22 16:57:49 UTC (rev 7634)
@@ -1,8 +1,4 @@
 <?php
-# $Id: mod_monitorCapabilities_main.php 1240 2007-10-24 09:27:00Z baudson $
-# 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)
@@ -16,13 +12,10 @@
 # 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__)."/../core/globalSettings.php");
 require_once(dirname(__FILE__)."/../http/classes/class_administration.php");
 require_once(dirname(__FILE__)."/../http/classes/class_user.php");
-
 $admin = new administration();
-
 function getRootLayerId ($wms_id) {
 	$sql = "SELECT layer_id FROM layer, wms " . 
 		"WHERE wms.wms_id = layer.fkey_wms_id AND layer_pos='0' " . 
@@ -33,11 +26,9 @@
 	$row=db_fetch_array($res);
 	return $row ? $row["layer_id"] : null;
 }
-
-//Herauslesen der User die in der Tabelle mb_user_abo_ows eingetragen sind
+//Read out user which have subscribed some services (abo)
 $sql = "SELECT DISTINCT fkey_mb_user_id FROM mb_user_abo_ows";
 $res = db_query($sql);
-
 $cnt = 0;
 $user_id_all=array();
 while($row = db_fetch_array($res)){
@@ -46,9 +37,7 @@
 	echo "User_id: ". $row["fkey_mb_user_id"] ."\n";
 	$cnt++;
 }
-
 $cnt=0;
-
 $mail_user_topic = _mb("Mapbender subscribers notification"); // "GeoPortal.rlp Mitteilung WMS Abonennten"
 $number_of_users_text = _mb("Number of users"); // "Zahl der eingetragenen User IDs"
 $subscribed_wms_text = _mb("All WMS subscribed by this user"); // "Alle abonnierten WMS des Users"
@@ -72,49 +61,41 @@
 // Ihnen beantragt. Diese E-Mail-Benachrichtigung können Sie jederzeit 
 // abbestellen, indem Sie das Abonnement über die Metadatenanzeige im 
 // GeoPortal.rlp deaktivieren.\n http://www.geoportal.rlp.de				
-
 echo "\n" . $number_of_users_text . ": " . count($user_id_all) . "\n";
-
 for ($iz = 0; $iz < count($user_id_all); $iz++) {
 	$userid = $user_id_all[$iz];
 	echo "User: ".$userid."\n";
-	
-	//Herauslesen abonnierten Dienste aus Tabelle mb_user_abo_ows
+	//read out services from mb_user_abo_ows
 	$sql="SELECT fkey_wms_id FROM mb_user_abo_ows WHERE fkey_mb_user_id = $1";
 	$v=array($userid);
 	$t=array('i');
 	$res=db_prep_query($sql,$v,$t);
 	$cnt = 0;
-	//Initialisieren des Arrays
+	//initialize array
 	$wms_id_all=array();
-
 	echo $subscribed_wms_text . ":\n";
-	//Herauslesen der Ergebnisse
+	//read results
 	while($row = db_fetch_array($res)){
 		$wms_id_all[$cnt] = $row["fkey_wms_id"];
 		$cnt++;
 	}
 	echo "WMS: " . implode(",", $wms_id_all) . "\n";
-	
 	$mailhead="";
 	$body="";
-	//Auslesen der Monitoring Ergebnisse aus mb_monitor
+	//read results from mb_monitor
 	for ($iz2=0; $iz2<count($wms_id_all);$iz2++){
 		$wmsid = $wms_id_all[$iz2];
-		#echo "WMS: ".$wmsid."\n";
 		$sql = "SELECT status, status_comment, to_timestamp(timestamp_end) " . 
 			"AS timestamp_end FROM mb_monitor WHERE fkey_wms_id = $1 " . 
 			"ORDER BY timestamp_end DESC LIMIT 1";
 		$v = array($wmsid);
 		$t = array('i');
 		$res=db_prep_query($sql,$v,$t);
-
-		//Herauslesen der Ergebnisse
+		//read results
 		$row = db_fetch_array($res);
 		$wms_monitor_status = $row["status"];
 		$wms_monitor_status_comment = $row["status_comment"];
 		$wms_monitor_timestamp_end = $row["timestamp_end"];
-		
 		echo $wms_with_problems_text . ":\n";
 		#read wms_title
 		$sql="SELECT wms_title FROM wms WHERE wms_id = $1";
@@ -122,9 +103,7 @@
 		$t_wms_t = array('i');
 		$res_wms_t = db_prep_query($sql, $v_wms_t, $t_wms_t);
 		$row_wms_t = db_fetch_array($res_wms_t);
-		
 		if ($wms_monitor_status == '-1') {
-			
 			$metadataUrl = preg_replace(
 				"/(.*)frames\/login.php/", 
 				"$1php/mod_layerMetadata.php?id=", 
@@ -136,10 +115,9 @@
 				$metadata_text . ": " . $metadataUrl . getRootLayerId ($wmsid)."\n\n";
 		}			
 	}
-	//Absenden der Mail an einzelnen User (falls ein Dienst nicht erreichbar ist)
+	//send mail to subscribers (if a service (capabilities doc) is not available)
 	if ($body) {
 		$body .= "\n" . $body_text;
-
 		$time = strval(time()-2);
 		$error_msg = "";
 		if ($admin->getEmailByUserId($userid)) {
@@ -165,4 +143,4 @@
 	}
 }
 		
-?>
\ No newline at end of file
+?>



More information about the Mapbender_commits mailing list