[Mapbender-commits] r8388 - in trunk/mapbender: http/classes http/php http/plugins resources/db/pgsql/UTF-8/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Jun 21 00:11:53 PDT 2012


Author: armin11
Date: 2012-06-21 00:11:53 -0700 (Thu, 21 Jun 2012)
New Revision: 8388

Modified:
   trunk/mapbender/http/classes/class_wms.php
   trunk/mapbender/http/php/mod_loadCapabilities.php
   trunk/mapbender/http/php/mod_updateWMS.php
   trunk/mapbender/http/plugins/mb_metadata_server.php
   trunk/mapbender/http/plugins/mb_metadata_submit.js
   trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
Log:
Bugfixes and possibility to decide, if loading/update/edit metadata of a wms will result in a twitter and/or rss entry.

Modified: trunk/mapbender/http/classes/class_wms.php
===================================================================
--- trunk/mapbender/http/classes/class_wms.php	2012-06-20 14:18:07 UTC (rev 8387)
+++ trunk/mapbender/http/classes/class_wms.php	2012-06-21 07:11:53 UTC (rev 8388)
@@ -80,7 +80,7 @@
 	const GEORSS_APPEND_ON_UPDATE_NEWLAYERS = true;
 	  
 	function __construct() {
-	    	if (TWITTER_NEWS) {
+	    	if (defined("TWITTER_NEWS") && TWITTER_NEWS == true) {
     	    		$this->twitterNews = true;
     	    		require_once dirname(__FILE__) . "/class_twitter.php";
     		}

Modified: trunk/mapbender/http/php/mod_loadCapabilities.php
===================================================================
--- trunk/mapbender/http/php/mod_loadCapabilities.php	2012-06-20 14:18:07 UTC (rev 8387)
+++ trunk/mapbender/http/php/mod_loadCapabilities.php	2012-06-21 07:11:53 UTC (rev 8388)
@@ -178,7 +178,7 @@
 		echo"<input type='text' name='password' size='50' value=''><br>";
 	}
 
-	if (!TWITTER_NEWS) {
+	if (defined("TWITTER_NEWS") && TWITTER_NEWS == true) {
 		echo"<input type='checkbox' name='twitter_news' checked='checked'>Publish via Twitter<br>";
 	}
 	if (defined("GEO_RSS_FILE") &&  GEO_RSS_FILE != "") {

Modified: trunk/mapbender/http/php/mod_updateWMS.php
===================================================================
--- trunk/mapbender/http/php/mod_updateWMS.php	2012-06-20 14:18:07 UTC (rev 8387)
+++ trunk/mapbender/http/php/mod_updateWMS.php	2012-06-21 07:11:53 UTC (rev 8388)
@@ -119,6 +119,12 @@
 	echo "REQUEST=GetCapabilities&SERVICE=WMS&VERSION=1.1.0<br>";
 	echo "REQUEST=capabilities&WMTVER=1.0.0<br><br>";
 	echo "Link to new WMS Capabilities URL:<br><input size='120' type='text' name='myURL'><br>";
+	if (defined("TWITTER_NEWS") && TWITTER_NEWS == true) {
+		echo"<input type='checkbox' name='twitter_news' checked='checked'>Publish via Twitter<br>";
+	}
+	if (defined("GEO_RSS_FILE") &&  GEO_RSS_FILE != "") {
+		echo"<input type='checkbox' name='rss_news' checked='checked'>Publish via RSS<br>";
+	}
 	echo "<input type='button' value='Preview Capabilities' onclick='window.open(this.form.myURL.value,\"\",\"\")'> ";
 	echo "<input type='button' value='Upload Capabilities' onclick='validate()'><br>";
 
@@ -132,8 +138,13 @@
 	if (!MD_OVERWRITE) {
 		$mywms->overwrite=false;
 	} 
-	$mywms->twitterNews = true;	
-	$mywms->setGeoRss = true;	
+	//possibility to see update information in georss and/or twitter channel
+	if(empty($_POST['twitter_news'])) {
+		$mywms->twitterNews = false;
+	}
+	if(empty($_POST['rss_news'])) {
+		$mywms->setGeoRss = false;
+	}	
 	$mywms->updateObjInDB($myWMS);
 	$mywms->displayWMS();
 

Modified: trunk/mapbender/http/plugins/mb_metadata_server.php
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_server.php	2012-06-20 14:18:07 UTC (rev 8387)
+++ trunk/mapbender/http/plugins/mb_metadata_server.php	2012-06-21 07:11:53 UTC (rev 8388)
@@ -547,9 +547,39 @@
 		} else {
 			$wms->wms_network_access = intval('0');
 		}
-		//$wms->twitterNews = false;	
-		//$wms->setGeoRss = false;
+
+
+
+
+
+
+		if ($ajaxResponse->getParameter("twitterNews") == true) {
+			$e = new mb_exception("twitter activated");
+		}
+		if ($ajaxResponse->getParameter("setGeoRss") == true) {
+			$e = new mb_exception("GeoRSS activated");
+		} 
+		if ($ajaxResponse->getParameter("setGeoRss") == false) {
+			$e = new mb_exception("GeoRSS deactivated");
+		}
+		if ($ajaxResponse->getParameter("twitterNews") == false) {
+			$e = new mb_exception("twitter deactivated");
+		}
+
+		if (defined("TWITTER_NEWS") && TWITTER_NEWS == true) {
+    	    		$wms->twitterNews = $ajaxResponse->getParameter("twitterNews");
+			$twitterIsConfigured == true;
+    		} else {
+			$twitterIsConfigured == false;
+		}
+    		if(defined("GEO_RSS_FILE") && GEO_RSS_FILE != "") {
+        		$wms->setGeoRss = $ajaxResponse->getParameter("setGeoRss");
+			$rssIsConfigured == true;
+    		} else {
+			$rssIsConfigured == false;
+		}
 		//try {
+		$e = new mb_exception("update object in db");
 			$wms->updateObjInDB($wmsId,true);
 		//}
 		//catch (Exception $e) {
@@ -557,9 +587,16 @@
 		//	$ajaxResponse->setMessage(_mb("Could not update wms object in database!"));
 		//	$ajaxResponse->send();						
 		//}
-		
-		
-		$ajaxResponse->setMessage("Updated WMS metadata for ID " . $wmsId);
+		$e = new mb_exception("object in db updated");
+		$messResult = "Updated WMS metadata for ID " . $wmsId.". ";
+		//Add helpful hint if publishing is demanded, but not configured in mapbender.conf
+		if ($wms->twitterNews && !$twitterIsConfigured) {
+			$messResult .= " Publishing via twitter was requested, but this is not configured. Please check your mapbender.conf! ";
+		}
+		if ($wms->setGeoRss && !$rssIsConfigured) {
+			$messResult .= " Publishing via rss was requested, but this is not configured. Please check your mapbender.conf! ";
+		}
+		$ajaxResponse->setMessage($messResult);
 		$ajaxResponse->setSuccess(true);		
 		
 		break;

Modified: trunk/mapbender/http/plugins/mb_metadata_submit.js
===================================================================
--- trunk/mapbender/http/plugins/mb_metadata_submit.js	2012-06-20 14:18:07 UTC (rev 8387)
+++ trunk/mapbender/http/plugins/mb_metadata_submit.js	2012-06-21 07:11:53 UTC (rev 8388)
@@ -33,7 +33,9 @@
 		this.events.submit.trigger({
 			callback: serializeCallback
 		});
-
+		//get publish options
+		twitterNews = $("#twitter_news").is(':checked');
+		setGeoRss = $("#rss_news").is(':checked');
 		// The form didn't validate
 		if (formData === null) {
 			alert("Please complete or correct the data in the form.");
@@ -45,7 +47,9 @@
 			url: "../plugins/mb_metadata_server.php",
 			method: "save",
 			parameters: {
-				"data": formData
+				"data": formData,
+				"twitterNews": twitterNews,
+				"setGeoRss": setGeoRss
 			},
 			callback: function (obj, result, message) {
 				if (!result) {

Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2012-06-20 14:18:07 UTC (rev 8387)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.7.2_to_2.7.3_pgsql_UTF-8.sql	2012-06-21 07:11:53 UTC (rev 8388)
@@ -443,6 +443,6 @@
 ALTER TABLE ows_relation_metadata ADD COLUMN relation_type TEXT;
 --update table ows_relation_metadata set type from table mb_metadata -- it is better to have it for relation not for instance - this is only a initial filling, afterwards the code handles the updates and inserts automatical
 UPDATE ows_relation_metadata SET relation_type = origin FROM  mb_metadata WHERE ows_relation_metadata.fkey_metadata_id = mb_metadata.metadata_id AND ows_relation_metadata.relation_type IS NULL;
+--allow to decide if update of wms metadata will be published via twitter/rss
+UPDATE gui_element set e_content = '<span style=''float:right''><input type=''checkbox'' id=''twitter_news''>Publish via Twitter<input type=''checkbox'' id=''rss_news''>Publish via RSS</input><input disabled="disabled" type=''button'' value=''Preview metadata''><input disabled="disabled" type=''submit'' value=''Save metadata''></span>' WHERE fkey_gui_id = 'admin_wms_metadata' and e_id = 'mb_md_submit';
 
-
-



More information about the Mapbender_commits mailing list