[Mapbender-commits] r7065 - in trunk/mapbender/http: classes javascripts php plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Oct 26 14:23:41 EDT 2010


Author: armin11
Date: 2010-10-26 11:23:41 -0700 (Tue, 26 Oct 2010)
New Revision: 7065

Modified:
   trunk/mapbender/http/classes/class_metadata_new.php
   trunk/mapbender/http/javascripts/initWmcObj.php
   trunk/mapbender/http/php/mod_getServiceDisclaimer.php
   trunk/mapbender/http/php/mod_showMetadata.php
   trunk/mapbender/http/plugins/mb_sessionWmc.js
Log:
Some enhancement - major for wmc handling. Adds possibility to admin disclaimer for ows and stores the acception of the disclaimer in the session. The disclaimer are also available for wms which are integrated in mapbenders wmc documents - needs some more work.

Modified: trunk/mapbender/http/classes/class_metadata_new.php
===================================================================
--- trunk/mapbender/http/classes/class_metadata_new.php	2010-10-26 15:10:46 UTC (rev 7064)
+++ trunk/mapbender/http/classes/class_metadata_new.php	2010-10-26 18:23:41 UTC (rev 7065)
@@ -707,8 +707,8 @@
 		}
 		$usedTime2 = $this->microtime_float() - $starttime;
 		//echo "<br>used time: ".$usedTime."<br>";
-		$e = new mb_exception("Time to generate WMS-Metadata: ".$usedTime2);
-		$e = new mb_exception("Wrote the MD_WMS-File");
+		$e = new mb_notice("Time to generate WMS-Metadata: ".$usedTime2);
+		$e = new mb_notice("Wrote the MD_WMS-File");
 	}
 
 
@@ -752,8 +752,8 @@
 			}
 		}
 		
-		$e = new mb_exception("Time to generate WFS-Metadata: ".$usedTime);
-		$e = new mb_exception("Wrote the MD_WFS-File");
+		$e = new mb_notice("Time to generate WFS-Metadata: ".$usedTime);
+		$e = new mb_notice("Wrote the MD_WFS-File");
 	}
 	private function generateWMCMetadata($xmlDoc) {
 		$starttime = $this->microtime_float();
@@ -779,8 +779,8 @@
 		}
 		$usedTime2 = $this->microtime_float() - $starttime;
 		//echo "<br>used time: ".$usedTime."<br>";
-		$e = new mb_exception("Time to generate WMC-Metadata: ".$usedTime2);
-		$e = new mb_exception("Wrote the MD_WMC-File");
+		$e = new mb_notice("Time to generate WMC-Metadata: ".$usedTime2);
+		$e = new mb_notice("Wrote the MD_WMC-File");
 	}
 
 
@@ -1173,7 +1173,7 @@
 
 						//call sql for count of category
 						$res = db_prep_query($sqlCategory, $v, $t);
-						$e = new mb_exception("class_metadata: countCatsql: ".$sqlCategory);
+						$e = new mb_notice("class_metadata: countCatsql: ".$sqlCategory);
 						$categoryCounts = db_fetch_all($res);
 						//if none found: $categoryCounts=false
 						#echo "<br>count sub categories :".$categoryCounts."<br>";

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2010-10-26 15:10:46 UTC (rev 7064)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2010-10-26 18:23:41 UTC (rev 7065)
@@ -47,6 +47,10 @@
 			"überprüft werden, ob die Links verwaist sind oder ob " .
 			"die Dienste überhaupt Daten liefern.",
 		"wms" => array()
+	),
+	"wmcTou" => array(
+		"message" => "Die zu ladende Konfiguration enthält verschiedene Dienste " .
+			"mit folgenden Nutzungsbedigungen:<br>"
 	)
 );
 
@@ -109,6 +113,7 @@
 // WMC
 //
 $inputWmcArray = $getApi->getWmc();
+
 if ($inputWmcArray) {
 	foreach ($inputWmcArray as $input) {
 	// just make it work for a single Wmc
@@ -391,6 +396,24 @@
 	$unavailableIdsTitles
 );
 
+//get terms of use from wms objects which are in the remaining wmc and are not already accepted for this session
+
+$validWMS = $wmcGetApi->getValidWms();
+$translation['wms'] = "Kartendienst";
+$resourceSymbol = "<img src='../img/osgeo_graphics/geosilk/server_map.png' alt='".$translation['wms']." - picture' title='".$translation['wms']."'>";
+$languageCode = 'de';
+$hostName = $_SERVER['HTTP_HOST'];
+$tou = "";
+foreach($validWMS as $WMS) {
+	$tou .= $resourceSymbol." <a href='http://".$hostName."/mapbender/php/mod_showMetadata.php?resource=wms&layout=tabs&id=".$WMS['id']."&languageCode=".$languageCode."'>".$WMS['title']."</a><br>";
+	$tou .= file_get_contents("http://localhost/mapbender/php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true")."<br>";
+}
+
+$resultObj["wmcTou"]["message"] .= $tou;
+
+
+#$resultObj["wmcTou"]["message"] = "Terms of Use";
+
 //
 // Output
 //
@@ -456,4 +479,4 @@
 Mapbender::session()->delete("addwms_zoomToExtent");
 unset($output);
 unset($wmc);
-?>
\ No newline at end of file
+?>

Modified: trunk/mapbender/http/php/mod_getServiceDisclaimer.php
===================================================================
--- trunk/mapbender/http/php/mod_getServiceDisclaimer.php	2010-10-26 15:10:46 UTC (rev 7064)
+++ trunk/mapbender/http/php/mod_getServiceDisclaimer.php	2010-10-26 18:23:41 UTC (rev 7065)
@@ -123,7 +123,7 @@
 			$htmlHeader['priceInformation'][1] = ' (euro)cent per megapixel</b> ';
 			$htmlHeader['priceInformation'][2] = ' for retrieved picture data. The retrieving of a typical map with a standardized resolution of 600x400 px will cost <b>';
 			$htmlHeader['priceInformation'][3] = ' euro</b>. For information about possible discounts please contact ';
-			$htmlHeader['noInformation'] = 'No informations about use constraints are available!';
+			$htmlHeader['noInformation'] = 'No informations about terms of use are available!';
 
 
            
@@ -142,7 +142,7 @@
 			$htmlHeader['priceInformation'][1] = ' Cent pro Megapixel</b> ';
 			$htmlHeader['priceInformation'][2] = ' für abgerufene Bildinformationen angegeben. Das Abrufen eines Kartenbildes in einer Standardauflösung von 600x400 Pixeln kostet dementsprechend <b>';
 			$htmlHeader['priceInformation'][3] = ' Euro</b>. Angaben zu eventuell möglichen Rabatten erhalten Sie über ';
-			$htmlHeader['noInformation'] = 'No informations about use constraints are available!';
+			$htmlHeader['noInformation'] = 'No informations about terms of use are available!';
 
 
        			break;
@@ -160,7 +160,7 @@
 			$htmlHeader['priceInformation'][1] = ' Cent pro Megapixel</b> ';
 			$htmlHeader['priceInformation'][2] = ' für abgerufene Bildinformationen angegeben. Das Abrufen eines Kartenbildes in einer Standardauflösung von 600x400 Pixeln kostet dementsprechend <b>';
 			$htmlHeader['priceInformation'][3] = ' Euro</b>. Angaben zu eventuell möglichen Rabatten erhalten Sie über ';
-			$htmlHeader['noInformation'] = 'No informations about use constraints are available!';
+			$htmlHeader['noInformation'] = 'No informations about terms of use are available!';
 
 		}	
 
@@ -309,7 +309,13 @@
 	}
 } else {
 	//if nothing about restrictions is defined
-	echo $htmlHeader['noInformation'] ;
+	if ($asTable){
+		echo $tableBegin;
+		echo $t_a.$htmlHeader['noInformation'].$t_b.$t_c."<br>";
+		echo $tableEnd;
+	} else {
+		echo $htmlHeader['noInformation']."<br>" ;
+	}
 }
 
 ?>

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2010-10-26 15:10:46 UTC (rev 7064)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2010-10-26 18:23:41 UTC (rev 7065)
@@ -577,7 +577,7 @@
 #$html .= "<br>".$resourceMetadata['contentpos']."<br>";
 #$html .= "<br>".$resource."<br>";
 if ($resource == 'layer' & $resourceMetadata['contentpos'] == 0) {
-	$resourceSymbol = "<img src='../img/osgeo_graphics/geosilk/server_map.png' alt='".$translation['wms']." - Bild' title='".$translation['wms']."'> - ".$translation['wms'];
+	$resourceSymbol = "<img src='../img/osgeo_graphics/geosilk/server_map.png' alt='".$translation['wms']." - picture' title='".$translation['wms']."'> - ".$translation['wms'];
 }
 
 $html .= $t_a.$translation['kindOfResource'].$t_b.$resourceSymbol.$t_c;
@@ -759,7 +759,8 @@
 	$tou = file_get_contents("http://localhost/mapbender/php/mod_getServiceDisclaimer.php?type=".$serviceType."&id=".$serviceId."&languageCode=".$languageCode."&asTable=true");
 }
 if ($resource == 'wmc' ) {
-	$tou = file_get_contents("http://localhost/mapbender/php/mod_getWmcDisclaimer.php?&id=".$serviceId."&languageCode=".$languageCode);
+	$e = new mb_exception("mod_showMetadata: wmcid for disclaimer: ".$resourceMetadata['contentid']);
+	$tou = file_get_contents("http://localhost/mapbender/php/mod_getWmcDisclaimer.php?&id=".$resourceMetadata['contentid']."&languageCode=".$languageCode."&hostName=".$_SERVER['HTTP_HOST']);
 }
 
 $html .= $tou;

Modified: trunk/mapbender/http/plugins/mb_sessionWmc.js
===================================================================
--- trunk/mapbender/http/plugins/mb_sessionWmc.js	2010-10-26 15:10:46 UTC (rev 7064)
+++ trunk/mapbender/http/plugins/mb_sessionWmc.js	2010-10-26 18:23:41 UTC (rev 7065)
@@ -87,7 +87,11 @@
 		var constraintTypeArray = [];
 		for (var constraintType in obj) {
 			var caseObj = obj[constraintType];
-
+			//check if terms of use has been set
+			if (constraintType === "wmcTou" && caseObj.message != "") {
+				html += "<fieldset>"+caseObj.message+"</fieldset>";
+				continue;
+			}
 			if (caseObj.wms.length === 0) {
 				continue;
 			}
@@ -105,6 +109,9 @@
 			html += "</fieldset><br>";
 			constraintTypeArray.push(constraintType);
 		}
+
+
+		
 		if (html === "") {
 			return;
 		}
@@ -151,4 +158,4 @@
 	Mapbender.events.beforeInit.register(checkConstraints);
 };
 
-$sessionWmc.mapbender(new SessionWmcApi(options));
\ No newline at end of file
+$sessionWmc.mapbender(new SessionWmcApi(options));



More information about the Mapbender_commits mailing list