[Fusionforge-commits] r16224 - in branches/Branch_5_2/src/www: include widgets

Thorsten Glaser mirabilos at fusionforge.org
Fri Sep 14 16:02:30 CEST 2012


Author: mirabilos
Date: 2012-09-14 16:02:30 +0200 (Fri, 14 Sep 2012)
New Revision: 16224

Modified:
   branches/Branch_5_2/src/www/include/Layout.class.php
   branches/Branch_5_2/src/www/include/html.php
   branches/Branch_5_2/src/www/widgets/widget.php
Log:
I like this one better: provide (and use) displayStylesheetElements

displayStylesheetElements is empty for now; it might call stuff
like headerFavIcon, headerCSS, etc. if needed

also, make the widget IFRAME valid XHTML: <head> *must* contain <title>


Modified: branches/Branch_5_2/src/www/include/Layout.class.php
===================================================================
--- branches/Branch_5_2/src/www/include/Layout.class.php	2012-09-14 11:09:13 UTC (rev 16223)
+++ branches/Branch_5_2/src/www/include/Layout.class.php	2012-09-14 14:02:30 UTC (rev 16224)
@@ -273,7 +273,7 @@
 	function headerHTMLDeclaration() {
 		global $sysDTDs, $sysXMLNSs;
 
-		print '<?xml version="1.0" encoding="utf-8"?>'."\n";
+		print '<' . '?xml version="1.0" encoding="utf-8"?>'."\n";
 		if (!util_ifsetor($this->doctype) || !util_ifsetor($sysDTDs[$this->doctype])) {
 			$this->doctype = 'transitional';
 		}
@@ -1366,6 +1366,10 @@
 
 		echo $this->subMenu($subMenuTitle, $subMenuUrl, $subMenuAttr);
 	}
+
+	function displayStylesheetElements() {
+		/* Codendi/Tuleap compatibility */
+	}
 }
 
 // Local Variables:

Modified: branches/Branch_5_2/src/www/include/html.php
===================================================================
--- branches/Branch_5_2/src/www/include/html.php	2012-09-14 11:09:13 UTC (rev 16223)
+++ branches/Branch_5_2/src/www/include/html.php	2012-09-14 14:02:30 UTC (rev 16224)
@@ -7,6 +7,8 @@
  * Copyright (C) 2010 Alain Peyrat - Alcatel-Lucent
  * Copyright 2011, Franck Villaume - Capgemini
  * Copyright 2011-2012, Franck Villaume - TrivialDev
+ * Copyright © 2011, 2012
+ *	Thorsten “mirabilos” Glaser <t.glaser at tarent.de>
  *
  * This file is part of FusionForge. FusionForge is free software;
  * you can redistribute it and/or modify it under the terms of the
@@ -24,7 +26,35 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+require_once $gfcommon.'include/minijson.php';
+
 /**
+ * html_generic_fileheader() - Output <html><head> and <meta/> inside.
+ *
+ * @param	string	$title
+ *			Mandatory content of <title> attribute,
+ *			will be HTML-secured
+ */
+function html_generic_fileheader($title) {
+	global $HTML, $sysDTDs, $sysXMLNSs;
+
+	if (!$title) {
+		throw new Exception('A title is mandatory in XHTML!');
+	}
+
+	$HTML->headerHTMLDeclaration();
+	echo "<head>\n";
+	echo '<meta http-equiv="Content-Type" ' .
+	    'content="text/html; charset=utf-8" />' . "\n";
+	echo '<script language="JavaScript" type="text/javascript">//<![CDATA[' .
+	    "\n\tvar sys_url_base = " . minijson_encode(util_make_url("/"),
+	    false) . ";\n" .
+	    "//]]></script>\n";
+	$HTML->headerForgepluckerMeta();
+	echo html_e('title', array(), util_html_secure($title)) . "\n";
+}
+
+/**
  * html_feedback_top() - Show the feedback output at the top of the page.
  *
  * @param	string	The feedback.

Modified: branches/Branch_5_2/src/www/widgets/widget.php
===================================================================
--- branches/Branch_5_2/src/www/widgets/widget.php	2012-09-14 11:09:13 UTC (rev 16223)
+++ branches/Branch_5_2/src/www/widgets/widget.php	2012-09-14 14:02:30 UTC (rev 16224)
@@ -90,8 +90,8 @@
                             }
                             break;
                         case 'iframe':
-                            echo '<html><head>';
-                            //$GLOBALS['HTML']->displayStylesheetElements();
+			    html_generic_fileheader($name . " widget");
+                            $GLOBALS['HTML']->displayStylesheetElements();
                             echo '</head><body class="main_body_row contenttable">';
                             $widget->loadContent($instance_id);
                             echo $widget->getContent();




More information about the Fusionforge-commits mailing list