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

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Mon Nov 11 13:04:14 PST 2013


Author: armin11
Date: 2013-11-11 13:04:14 -0800 (Mon, 11 Nov 2013)
New Revision: 8739

Modified:
   trunk/mapbender/http/classes/class_owsConstraints.php
   trunk/mapbender/http/javascripts/initWmcObj.php
   trunk/mapbender/http/php/mod_getWmcDisclaimer.php
   trunk/mapbender/http/php/mod_showMetadata.php
Log:
Exchange pulling of constraints via http with calling class.

Modified: trunk/mapbender/http/classes/class_owsConstraints.php
===================================================================
--- trunk/mapbender/http/classes/class_owsConstraints.php	2013-11-11 20:28:20 UTC (rev 8738)
+++ trunk/mapbender/http/classes/class_owsConstraints.php	2013-11-11 21:04:14 UTC (rev 8739)
@@ -14,7 +14,7 @@
 	function __construct() {
 		$this->type = "wms";
 		$this->id = 1;
-		$this->languageCode = "de";
+		$this->languageCode = "en";
 		$this->withHeader = false;
 		$this->asTable = false;
 		$this->outputFormat = "html";
@@ -231,8 +231,12 @@
 					}
 				}
 				$html .= $feesPart.$tableEnd;
-				echo $html;
-				die();
+				if ($this->returnDirect) {
+					echo $html;
+					die();
+				} else {
+					return $html;
+				}
 			} else {
 				$discPrivacy = "";		
 				$fees = "";
@@ -278,8 +282,12 @@
 					$html .= $fees."<br>";
 				}
 				if ($this->outputFormat != "iso19139") {
-					echo $html;
-					die();
+					if ($this->returnDirect) {
+						echo $html;
+						die();
+					} else {
+						return $html;
+					}
 				} else {
 					$constraints = $discPrivacy.$accessConstraints;
 					$this->generateXmlOutput($fees,$constraints);
@@ -289,7 +297,12 @@
 			if ($this->outputFormat == "iso19139") {
 				$this->generateXmlOutput(false,false);
 			} else {
-				echo "free";//since it is not neccessary to give information about nothing ;-)
+				if ($this->returnDirect) {
+					echo "free";
+					die();
+				} else {
+					return "free";
+				}
 			}
 		}
 	}

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2013-11-11 20:28:20 UTC (rev 8738)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2013-11-11 21:04:14 UTC (rev 8739)
@@ -12,6 +12,7 @@
 require_once dirname(__FILE__)."/../classes/class_elementVar.php";
 require_once(dirname(__FILE__) . "/../classes/class_tou.php");
 require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_owsConstraints.php");
 
 function getConfiguration ($key) {
 //check if key param can be found in SESSION,
@@ -423,17 +424,13 @@
 	$resultOfCheck = $classTou->check('wms',$WMS['id']);
 	if ($resultOfCheck['accepted'] == 0) {
 		$touHeader = $resourceSymbol." <a href='../php/mod_showMetadata.php?resource=wms&layout=tabs&id=".$WMS['id']."&languageCode=".$languageCode."' target='_blank'>".$WMS['title']."</a><br>";
-
-		if (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on") {
-			$mapbenderProtocol = "https://";
-			$mapbenderBaseUrl = "https://".$hostName;
-		}
-		else {
-			$mapbenderProtocol = "http://";
-			$mapbenderBaseUrl = "http://".$hostName;
-		}
-		$touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../../php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
-		$touForWMS = $touServiceConnector->file;
+		$constraints = new OwsConstraints();
+		$constraints->languageCode = $languageCode;
+		$constraints->asTable = true;
+		$constraints->id = $WMS['id'];
+		$constraints->type = "wms";
+		$constraints->returnDirect = false;
+		$touForWMS = $constraints->getDisclaimer();
 		//add only those who have no special tou defined - 
 		if ($touForWMS != 'free'){
 			$tou .= $touHeader.$touForWMS;

Modified: trunk/mapbender/http/php/mod_getWmcDisclaimer.php
===================================================================
--- trunk/mapbender/http/php/mod_getWmcDisclaimer.php	2013-11-11 20:28:20 UTC (rev 8738)
+++ trunk/mapbender/http/php/mod_getWmcDisclaimer.php	2013-11-11 21:04:14 UTC (rev 8739)
@@ -3,6 +3,7 @@
 require_once dirname(__FILE__) . "/../classes/class_wmc_factory.php";
 require_once(dirname(__FILE__) . "/../classes/class_user.php");
 require_once(dirname(__FILE__)."/../classes/class_connector.php");
+require_once(dirname(__FILE__)."/../classes/class_owsConstraints.php");
 
 //following is needed cause sometimes the service is invoked as a localhost service and then no userId is known but the userId in the session is needed for class_wmc to read from database!!! TODO: check if needed in this class.
 $userId = Mapbender::session()->get("mb_user_id");
@@ -106,17 +107,18 @@
 for ($i = 0; $i < $countWMS; $i++) {
 	$WMS = $validWMS[$countWMS - ($i+1)];
 	echo $resourceSymbol." <a href='".$mapbenderBaseUrl.$_SERVER['SCRIPT_NAME']."/../mod_showMetadata.php?resource=wms&layout=tabs&id=".$WMS['id']."&languageCode=".$languageCode."'>".$WMS['title']."</a><br>";
-	//all local connections are without ssl
-	$touServiceConnector = new connector("http://localhost".$_SERVER['SCRIPT_NAME']."/../mod_getServiceDisclaimer.php?type=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
-	$touForWMS = $touServiceConnector->file;
-	// 
+	$constraints = new OwsConstraints();
+	$constraints->languageCode = $languageCode;
+	$constraints->asTable = true;
+	$constraints->id = $WMS['id'];
+	$constraints->type = "wms";
+	$constraints->returnDirect = false;
+	$touForWMS = $constraints->getDisclaimer();
 	if ($touForWMS == 'free'){
 		$wmstou = $translation['noTouInformation'];
 	} else {
 		$wmstou = $touForWMS;
 	}
-	//$wmstou = $touServiceConnector->file;
-	#$wmstou = file_get_contents("http://localhost/mapbender/php/mod_getServiceDisclaimer.php?resource=wms&id=".$WMS['id']."&languageCode=".$languageCode."&asTable=true");
 	echo $wmstou."<br>";
 }
 //var_dump($validWMS);

Modified: trunk/mapbender/http/php/mod_showMetadata.php
===================================================================
--- trunk/mapbender/http/php/mod_showMetadata.php	2013-11-11 20:28:20 UTC (rev 8738)
+++ trunk/mapbender/http/php/mod_showMetadata.php	2013-11-11 21:04:14 UTC (rev 8739)
@@ -22,6 +22,7 @@
 require_once dirname(__FILE__) . "/../classes/class_user.php";
 require_once dirname(__FILE__) . "/../classes/class_wms.php";
 require_once dirname(__FILE__) . "/../classes/class_Uuid.php";
+require_once(dirname(__FILE__)."/../classes/class_owsConstraints.php"); 
 require_once dirname(__FILE__) . "/../../tools/wms_extent/extent_service.conf";
 require_once dirname(__FILE__) . "/../extensions/phpqrcode/phpqrcode.php";
 
@@ -1198,8 +1199,16 @@
 $html .= '<p>';
 
 if ($resource == 'wms' or $resource == 'layer') {
-	$touServiceConnector = new connector($mapbenderProtocol."localhost".$_SERVER['SCRIPT_NAME']."/../mod_getServiceDisclaimer.php?resource=wms&id=".$resourceMetadata['serviceid']."&languageCode=".$languageCode."&asTable=true");
-	$tou = $touServiceConnector->file;
+	$constraints = new OwsConstraints();
+	$constraints->languageCode = $languageCode;
+	$constraints->asTable = true;
+	$constraints->id = $resourceMetadata['serviceid'];
+	$constraints->type = "wms";
+	$constraints->returnDirect = false;
+	if (!$result['success']) {
+		echo $result['message'];
+	}
+	$tou = $constraints->getDisclaimer();
 }
 if ($resource == 'wmc' ) {
 	$e = new mb_notice("mod_showMetadata: wmcid for disclaimer: ".$resourceMetadata['contentid']);



More information about the Mapbender_commits mailing list