[Mapbender-commits] r4767 - in trunk/mapbender: http/classes http/frames http/include http/javascripts resources/db/pgsql/UTF-8/update

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Wed Sep 30 13:27:37 EDT 2009


Author: christoph
Date: 2009-09-30 13:27:36 -0400 (Wed, 30 Sep 2009)
New Revision: 4767

Modified:
   trunk/mapbender/http/classes/class_element.php
   trunk/mapbender/http/classes/class_gui.php
   trunk/mapbender/http/frames/index.php
   trunk/mapbender/http/frames/login.php
   trunk/mapbender/http/include/gui1_splash.php
   trunk/mapbender/http/include/template_splash.php
   trunk/mapbender/http/javascripts/mod_addWMSfromList.php
   trunk/mapbender/http/javascripts/mod_digitize_tab.php
   trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
   trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6_to_2.7rc1_pgsql_UTF-8.sql
Log:
HTML validation

Modified: trunk/mapbender/http/classes/class_element.php
===================================================================
--- trunk/mapbender/http/classes/class_element.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/classes/class_element.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -137,34 +137,64 @@
 			$openTag .= "<" . $this->element . " ";
 			
 			// id and name
-			$openTag .= "id='" . $this->id . "' name='" . $this->id . "' ";
+			$openTag .= "id='" . $this->id . "' ";
 			
+			$validTags = array(
+				"form",
+				"iframe",
+				"img",
+				"applet",
+				"button",
+				"frame",
+				"input",
+				"map",
+				"object",
+				"param",
+				"select",
+				"textarea"
+			);
+			if (in_array($this->element, $validTags)) {
+				$openTag .= "name='" . htmlentities($this->id, ENT_QUOTES, CHARSET) . "' ";
+			}
+			
 			// attributes
 			if ($this->attributes) {
 				$openTag .= stripslashes($this->replaceSessionStringByUrlParameters($this->attributes)) . " ";
 			}
 			
+			if ($this->element === "img" && !preg_match("/alt( )*=/", $this->attributes)) {
+				$openTag .= "alt='" . htmlentities($this->title, ENT_QUOTES, CHARSET) . "' ";
+			}
+			
 			// title
 			if ($this->title) {
-				$openTag .= "title='" . $this->title . "' ";
+				$openTag .= "title='" . htmlentities($this->title, ENT_QUOTES, CHARSET) . "' ";
 			}
+			else {
+				// add a title for iframes
+				if ($this->element === "iframe") {
+					$openTag .= "title='" . $this->id . "' ";
+				}
+			}
 			
 			// src
 			if ($this->src) {
-   				$openTag .= "src = '" . $this->replaceSessionStringByUrlParameters($this->src);
+   				$openTag .= "src = '" . $this->replaceSessionStringByUrlParameters(
+					htmlentities($this->src, ENT_QUOTES, CHARSET)
+				);
 
 				// for iframes which are not "loadData", 
 				// add additional parameters
 				if ($this->closeTag == "iframe" && $this->id != "loadData") {
 					if(mb_strpos($this->src, "?")) {
-						$openTag .= "&";
+						$openTag .= "&amp;";
 					}
 					else {
 	      				$openTag .= "?";
       				}
-	      			$openTag .= "e_id_css=" . $this->id . "&" .
-	      					 "e_id=" . $this->id . "&" .
-	      					 "e_target=" . $this->target . "&" .
+	      			$openTag .= "e_id_css=" . $this->id . "&amp;" .
+	      					 "e_id=" . $this->id . "&amp;" .
+	      					 "e_target=" . $this->target . "&amp;" .
 	      					 $this->getUrlParameters();
 				}
    				$openTag .= "' ";
@@ -207,10 +237,10 @@
 						ob_end_clean();
 					}
 					else {
-						$splashScreen .= "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
-							"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
-							MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
-							"loading application '" . $this->guiId . "'";
+						$splashScreen .= "<img alt='indicator wheel' src='../img/indicator_wheel.gif'>&nbsp;" . 
+	"<strong>Ma<span style='font-color:#0000CE'>p</span><span style='font-color:#C00000'>b</span>ender " . 
+	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</strong>..." .
+	"loading application '" . $this->guiId . "'";
 					}
 				}	
 				$openTag .= "<div id='loading_mapbender' " .
@@ -233,7 +263,7 @@
 	}
 	
 	private function getHtmlCloseTag () {
-		if ($this->element == "body" && $this->isBodyAndUsesSplashScreen) {
+		if ($this->element == "body") {
 			return "</div></body>";
 		}
 		if ($this->closeTag != "") {
@@ -250,7 +280,7 @@
 		if (isset($this->id)) {
 			$urlParameters .= "&elementID=" . $this->id;
 		}
-		return $urlParameters;
+		return htmlentities($urlParameters, ENT_QUOTES, CHARSET);
 	}
 	
 	private function replaceSessionStringByUrlParameters ($string) {

Modified: trunk/mapbender/http/classes/class_gui.php
===================================================================
--- trunk/mapbender/http/classes/class_gui.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/classes/class_gui.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -459,7 +459,7 @@
 			return true;
 		}
 		else {
-	      echo "<script language='javascript'>";
+	      echo "<script type='text/javascript'>";
 	      echo "alert('This gui name " . $newGuiName . " is taken!');";
 	      echo "</script>";
 	      return false;

Modified: trunk/mapbender/http/frames/index.php
===================================================================
--- trunk/mapbender/http/frames/index.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/frames/index.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -49,6 +49,8 @@
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="expires" content="0">
 <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET;?>">
+<META http-equiv="Content-Style-Type" content="text/css">
+<META http-equiv="Content-Script-Type" content="text/javascript">
 <title><?php echo  $gui_id;?> - presented by Mapbender</title>
 <?php
 $sql = "SELECT * FROM gui_element_vars WHERE fkey_e_id = 'body' AND fkey_gui_id = $1 and var_name='favicon'";
@@ -89,8 +91,8 @@
 <?php
 $currentApplication = new gui($gui_id);
 echo $currentApplication->toHtml();
-$mapPhpParameters = $urlParameters."&mb_myBBOX=".$_REQUEST["mb_myBBOX"];
+$mapPhpParameters = htmlentities($urlParameters, ENT_QUOTES, CHARSET)."&amp;mb_myBBOX=".$_REQUEST["mb_myBBOX"];
 echo "<script type='text/javascript' src='../javascripts/map.php?".$mapPhpParameters."'></script>";
 
 ?>
-</html>
+</html>
\ No newline at end of file

Modified: trunk/mapbender/http/frames/login.php
===================================================================
--- trunk/mapbender/http/frames/login.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/frames/login.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -77,6 +77,8 @@
 <meta http-equiv="cache-control" content="no-cache">
 <meta http-equiv="pragma" content="no-cache">
 <meta http-equiv="expires" content="0">
+<META http-equiv="Content-Style-Type" content="text/css">
+<META http-equiv="Content-Script-Type" content="text/javascript">
 <?php
 echo '<meta http-equiv="Content-Type" content="text/html; charset='.CHARSET.'">';	
 ?>

Modified: trunk/mapbender/http/include/gui1_splash.php
===================================================================
--- trunk/mapbender/http/include/gui1_splash.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/include/gui1_splash.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -1,6 +1,6 @@
 <?php
-echo "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
-	"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
-	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
-	"loading application '" . $gui_id . "'";
+echo "<img alt='indicator wheel' src='../img/indicator_wheel.gif'>&nbsp;" . 
+	"<strong>Ma<span style='font-color:#0000CE'>p</span><span style='font-color:#C00000'>b</span>ender " . 
+	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</strong>..." .
+	"loading application '" . $this->guiId . "'";
 ?>

Modified: trunk/mapbender/http/include/template_splash.php
===================================================================
--- trunk/mapbender/http/include/template_splash.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/include/template_splash.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -1,6 +1,6 @@
 <?php
-echo "<img src='../img/indicator_wheel.gif'>&nbsp;" . 
-	"<b>Ma<font color='#0000CE'>p</font><font color='#C00000'>b</font>ender " . 
-	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</b>..." .
-	"loading application '" . $gui_id . "'";
+echo "<img alt='indicator wheel' src='../img/indicator_wheel.gif'>&nbsp;" . 
+	"<strong>Ma<span style='font-color:#0000CE'>p</span><span style='font-color:#C00000'>b</span>ender " . 
+	MB_VERSION_NUMBER . " " . strtolower(MB_VERSION_APPENDIX) . "</strong>..." .
+	"loading application '" . $this->guiId . "'";
 ?>

Modified: trunk/mapbender/http/javascripts/mod_addWMSfromList.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_addWMSfromList.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/javascripts/mod_addWMSfromList.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -93,7 +93,7 @@
 if($cnt_target > 1){
 	echo "alert('addWMS: ID not unique!');";
 }
-echo "<script language='Javascript'>";
+echo "<script type='text/javascript'>";
 echo "var gui_id = '".$logged_gui_id."';";
 echo "var mod_addWMS_data = '".$e_require."';";
 $target = explode(",", $e_target);

Modified: trunk/mapbender/http/javascripts/mod_digitize_tab.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_digitize_tab.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/javascripts/mod_digitize_tab.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -36,7 +36,7 @@
 include '../include/dyn_css.php';
 ?>
 <script type='text/javascript' src='../extensions/jquery-1.3.2.min.js'></script>
-<script language='JavaScript'>
+<script type='text/javascript'>
 //
 // Buttons
 //

Modified: trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php
===================================================================
--- trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/http/javascripts/mod_wfs_SpatialRequest.php	2009-09-30 17:27:36 UTC (rev 4767)
@@ -328,7 +328,7 @@
 		mod_wfs_spatialRequest_win = window.open("","mod_wfs_spatialRequest_win","width=200,height=150,resizable=yes");
 		mod_wfs_spatialRequest_win.document.open("text/html");
 
-		mod_wfs_spatialRequest_win.document.writeln('<script language="JavaScript" type="text/javascript">');
+		mod_wfs_spatialRequest_win.document.writeln('<script type="text/javascript" type="text/javascript">');
 		mod_wfs_spatialRequest_win.document.writeln('function set(obj){');
 		mod_wfs_spatialRequest_win.document.writeln('for(var i=0; i< document.getElementsByName("geom").length; i++){');
 		mod_wfs_spatialRequest_win.document.writeln('if(document.getElementsByName("geom")[i].checked){');

Modified: trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6_to_2.7rc1_pgsql_UTF-8.sql
===================================================================
--- trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6_to_2.7rc1_pgsql_UTF-8.sql	2009-09-30 09:40:48 UTC (rev 4766)
+++ trunk/mapbender/resources/db/pgsql/UTF-8/update/update_2.6_to_2.7rc1_pgsql_UTF-8.sql	2009-09-30 17:27:36 UTC (rev 4767)
@@ -443,3 +443,31 @@
       ON UPDATE CASCADE ON DELETE CASCADE
 );
 
+-- remove obsolete src from treeGDE (no longer a frame)
+UPDATE gui_element SET e_src = '' WHERE e_id = 'treeGDE';
+
+-- remove frameborder = 0 from treeGDE (no longer a frame)
+UPDATE gui_element SET e_attributes = 'onmouseover="this.style.zIndex=300;this.style.width=350;" onmouseout="this.style.zIndex=2;this.style.width=200"' WHERE e_id = 'treeGDE';
+
+-- remove frameborder = 0 from switchLocale_noreload
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'switchLocale_noreload';
+
+-- add title
+UPDATE gui_element SET e_content = '<select style="font-family: Arial, sans-serif; font-size:12" title="Set background" name="mod_setBackground_list" onchange="mod_setBackground_change(this)"><option value="0"></option></select>' WHERE e_id = 'setBackground';
+
+-- remove nobr tag from mapbender
+UPDATE gui_element SET e_content = '<span>Ma</span><span style="color: blue;">P</span><span style="color: red;">b</span><span>ender</span><script type="text/javascript"> mb_registerSubFunctions("mod_mapbender()"); function mod_mapbender(){ document.getElementById("mapbender").style.left = parseInt(document.getElementById("mapframe1").style.left) + parseInt(document.getElementById("mapframe1").style.width) - 90; document.getElementById("mapbender").style.top = parseInt(document.getElementById("mapframe1").style.top) + parseInt(document.getElementById("mapframe1").style.height) -1; } </script>' WHERE e_id = 'mapbender';
+
+-- correct URL encoding
+UPDATE gui_element SET e_attributes = E'onclick="printWindow = window.open(\'../print/mod_printPDF.php?target=mapframe1&amp;sessionID&amp;conf=printPDF_b.conf\',\'printWin\',\'width=260, height=380, resizable=yes\');printWindow.focus();"  onmouseover="this.src = this.src.replace(/_off/,\'_over\');" onmouseout="this.src = this.src.replace(/_over/, \'_off\');"' WHERE e_id = 'printPDF';
+
+-- added mandatory action attribute
+UPDATE gui_element SET e_attributes = 'action="window.location.href"' WHERE e_id = 'setBackground';
+UPDATE gui_element SET e_attributes = 'action="window.location.href" onsubmit="return mod_scaleText()"' WHERE e_id = 'scaleText';
+UPDATE gui_element SET e_content = '<form id="form_switch_locale" action="window.location.href" name="form_switch_locale" target="parent"><select id="language" name="language" onchange="validate_locale()"></select></form>' WHERE e_id = 'switchLocale_noreload';
+
+-- attributes only valid for printPDF button (img)
+UPDATE gui_element SET e_attributes = '' WHERE e_id = 'printPDF' AND e_element = 'iframe';
+
+
+



More information about the Mapbender_commits mailing list