[evolvis-commits] r15552: make the <div> block with the errors collapsable↵

mirabilos at evolvis.org mirabilos at evolvis.org
Tue Mar 1 00:14:28 CET 2011


Author: mirabilos
Date: 2011-03-01 00:14:28 +0100 (Tue, 01 Mar 2011)
New Revision: 15552

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/include/extras-debug.php
Log:
make the <div> block with the errors collapsable


Modified: trunk/gforge_base/evolvisforge-5.1/src/common/include/extras-debug.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/include/extras-debug.php	2011-02-28 23:14:25 UTC (rev 15551)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/include/extras-debug.php	2011-02-28 23:14:28 UTC (rev 15552)
@@ -64,6 +64,18 @@
 	if (!isset($ffErrors))
 		$ffErrors = array();
 
+	$divstring = "\n\n" . '<script type="text/javascript"><!-- <![CDATA[
+		function toggle_ffErrors() {
+			var errorsblock = document.getElementById("ffErrorsBlock");
+			if (errorsblock.style.display == "none") {
+				errorsblock.style.display = "block";
+			} else {
+				errorsblock.style.display = "none";
+			}
+		}' . "\n//]]> --></script>\n<div id=\"ffErrors\">\n" .
+	    '<a href="javascript:toggle_ffErrors();">Click to toggle</a>' .
+	    "\n<div id=\"ffErrorsBlock\">";
+
 	/* cut off </body></html> (hopefully only) at the end */
 	$buffer = rtrim($buffer);	/* spaces, newlines, etc. */
 	if (substr($buffer, -strlen("</html>")) != "</html>") {
@@ -85,7 +97,7 @@
 	$has_div = false;
 	foreach ($ffErrors as $msg) {
 		if (!$has_div) {
-			$buffer .= "\n\n<div id=\"ffErrors\">\n";
+			$buffer .= $divstring;
 			$has_div = true;
 		}
 		$buffer .= "\n	<div class=\"" . $msg['type'] . '">' .
@@ -94,7 +106,7 @@
 
 	/* return final buffer */
 	if ($has_div)
-		$buffer .= "\n</div>";
+		$buffer .= "\n</div></div>";
 	return ($buffer . "\n</body></html>\n");
 }
 



More information about the evolvis-commits mailing list