[Mapbender-commits] r7075 - in trunk/mapbender/http: javascripts plugins

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Thu Oct 28 12:23:32 EDT 2010


Author: armin11
Date: 2010-10-28 09:23:32 -0700 (Thu, 28 Oct 2010)
New Revision: 7075

Modified:
   trunk/mapbender/http/javascripts/initWmcObj.php
   trunk/mapbender/http/plugins/mb_sessionWmc.js
Log:
Set tou to accepted into session when disclaimer was shown.

Modified: trunk/mapbender/http/javascripts/initWmcObj.php
===================================================================
--- trunk/mapbender/http/javascripts/initWmcObj.php	2010-10-28 14:29:49 UTC (rev 7074)
+++ trunk/mapbender/http/javascripts/initWmcObj.php	2010-10-28 16:23:32 UTC (rev 7075)
@@ -8,6 +8,7 @@
 require_once dirname(__FILE__)."/../classes/class_administration.php";
 require_once dirname(__FILE__)."/../../lib/class_GetApi.php";
 require_once dirname(__FILE__)."/../classes/class_elementVar.php";
+require_once(dirname(__FILE__) . "/../classes/class_tou.php");
 
 function getConfiguration ($key) {
 //check if key param can be found in SESSION,
@@ -49,8 +50,7 @@
 		"wms" => array()
 	),
 	"wmcTou" => array(
-		"message" => "Die zu ladende Konfiguration enthält verschiedene Dienste " .
-			"mit folgenden Nutzungsbedigungen:<br>"
+		"message" => ""
 	)
 );
 
@@ -404,14 +404,24 @@
 $languageCode = 'de';
 $hostName = $_SERVER['HTTP_HOST'];
 $tou = "";
+$classTou = new 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>";
+	//check if tou has already been read - if not show them in the message
+	$resultOfCheck = $classTou->check('wms',$WMS['id']);
+	if ($resultOfCheck['accepted'] == 0) {
+		$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>";
+		//set the tou to be accepted - TODO maybe do this after the button which deletes the message window - from a ajax request.
+		$classTou->set('wms',$WMS['id']);
+	}
 }
+if ($tou != "") {
+	$tou = "Die zu ladende Konfiguration enthält verschiedene Dienste " .
+			"mit folgenden Nutzungsbedigungen:<br>".$tou;
+}
+$resultObj["wmcTou"]["message"] = $tou;
 
-$resultObj["wmcTou"]["message"] .= $tou;
 
-
 #$resultObj["wmcTou"]["message"] = "Terms of Use";
 
 //

Modified: trunk/mapbender/http/plugins/mb_sessionWmc.js
===================================================================
--- trunk/mapbender/http/plugins/mb_sessionWmc.js	2010-10-28 14:29:49 UTC (rev 7074)
+++ trunk/mapbender/http/plugins/mb_sessionWmc.js	2010-10-28 16:23:32 UTC (rev 7075)
@@ -9,7 +9,7 @@
  *
  * Files:
  *  - http/plugins/mb_sessionWmc.js
- *  - http/php/mb_sessionWmc_server.php
+ *  - http/php/mod_sessionWmc_server.php
  *
  * SQL:
  * > INSERT INTO gui_element(fkey_gui_id, e_id, e_pos, e_public, e_comment, e_title, e_element, e_src, e_attributes, e_left, e_top, e_width, e_height, e_z_index, e_more_styles, e_content, e_closetag, e_js_file, e_mb_mod, e_target, e_requires, e_url) VALUES('gui1','sessionWmc',1,1,'','Please confirm','div','','',NULL ,NULL ,NULL ,NULL ,NULL ,'','','div','../plugins/mb_sessionWmc.js','','','mapframe1','');
@@ -87,7 +87,7 @@
 		var constraintTypeArray = [];
 		for (var constraintType in obj) {
 			var caseObj = obj[constraintType];
-			//check if terms of use has been set
+			//check if terms of use has been set - then there are tou given in the message!
 			if (constraintType === "wmcTou" && caseObj.message != "") {
 				html += "<fieldset>"+caseObj.message+"</fieldset>";
 				continue;



More information about the Mapbender_commits mailing list