[Fusionforge-commits] FusionForge branch master updated. 9c8a1e52d045ca33ee07254d26b33ee171a286c9

Franck VILLAUME nerville at fusionforge.org
Wed Feb 19 18:57:57 CET 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  9c8a1e52d045ca33ee07254d26b33ee171a286c9 (commit)
       via  2304ea2c59e6b37b7e9443d30f943f945bdf4e21 (commit)
       via  610b5702a0ab914634ed4be225087f65dc93e1cb (commit)
       via  c2762ac5c190b0dada0c1746f4b6332aaa4f8856 (commit)
       via  f411f435faea94c1d29f5988814d74ca45593b16 (commit)
      from  5fc3a832ee0b7795ea5e04656a0d8bf07e0233d6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 9c8a1e52d045ca33ee07254d26b33ee171a286c9
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Feb 19 18:55:50 2014 +0100

    a little bit of html_e

diff --git a/src/www/themes/funky/Theme.class.php b/src/www/themes/funky/Theme.class.php
index e655121..3bf27aa 100644
--- a/src/www/themes/funky/Theme.class.php
+++ b/src/www/themes/funky/Theme.class.php
@@ -73,8 +73,7 @@ class Theme extends Layout {
 		echo '<table id="header" class="fullwidth">' . "\n";
 		echo '<tr>' . "\n";
 		echo '<td id="header-col1">' . "\n";
-		echo util_make_link('/', html_image('/header/top-logo.png', null, null, array('alt'=>'FusionForge Home'))) . "\n";
-
+		echo util_make_link('/', html_image('/header/top-logo.png', null, null, array('alt'=>'FusionForge Home')));
 		echo '</td>' . "\n";
 		echo '<td id="header-col2">' . "\n";
 
@@ -134,7 +133,7 @@ class Theme extends Layout {
 
 	function footer($params = array()) {
 		$this->bodyFooter($params);
-		echo '<div class="footer">' . "\n";
+		echo html_e('div', array('class' => 'footer'));
 		echo $this->navigation->getPoweredBy();
 		echo $this->navigation->getShowSource();
 		echo '<div style="clear:both"></div></div>';

commit 2304ea2c59e6b37b7e9443d30f943f945bdf4e21
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Feb 19 18:55:17 2014 +0100

    funky-wOw: adapt boxGetAltRowStyle function

diff --git a/src/www/themes/funky-wOw/Theme.class.php b/src/www/themes/funky-wOw/Theme.class.php
index b9b2276..880e3b5 100644
--- a/src/www/themes/funky-wOw/Theme.class.php
+++ b/src/www/themes/funky-wOw/Theme.class.php
@@ -210,11 +210,15 @@ class Theme extends Layout {
 	 * @param	int	$i	Row number
 	 * @return	string
 	 */
-	function boxGetAltRowStyle($i) 	{
+	function boxGetAltRowStyle($i, $classonly = false) {
 		if ($i % 2 == 0)
-			return 'class="bgcolor-white"';
+			$ret = 'bgcolor-white';
 		else
-			return 'class="bgcolor-grey"';
+			$ret = 'bgcolor-grey';
+		if ($classonly)
+			return $ret;
+		else
+			return 'class="'.$ret.'"';
 	}
 
 	function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS, $nested=false,  $selected=false, $sel_tab_bgcolor='WHITE',  $total_width='100%') {

commit 610b5702a0ab914634ed4be225087f65dc93e1cb
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Wed Feb 19 18:54:18 2014 +0100

    cleanup using html_e(o) generic functions

diff --git a/src/common/include/Navigation.class.php b/src/common/include/Navigation.class.php
index dce99d7..241cb2d 100644
--- a/src/common/include/Navigation.class.php
+++ b/src/common/include/Navigation.class.php
@@ -69,7 +69,7 @@ class Navigation extends Error {
 			}
 		} else {
 			// return HTML code otherwise
-			return '<title>' . $this->getTitle($params, false) . '</title>';
+			return html_e('title', array(), $this->getTitle($params, false), true);
 		}
 	}
 
@@ -84,10 +84,8 @@ class Navigation extends Error {
 		if (!$asHTML) {
 			return util_make_url('/images/icon.png');
 		} else {
-			return '<link rel="icon" type="image/png" href="'
-				. $this->getFavIcon(false) .'" />'
-				. '<link rel="shortcut icon" type="image/png" href="'
-				. $this->getFavIcon(false) .'" />';
+			return html_e('link', array('rel' => 'icon', 'type' => 'image/png', 'href' => $this->getFavIcon(false))).
+				html_e('link', array('rel' => 'shortcut icon', 'type' => 'image/png', 'href' => $this->getFavIcon(false)));
 		}
 	}
 
@@ -121,11 +119,8 @@ class Navigation extends Error {
 		} else {
 			$feeds = $this->getRSS(false);
 			for ($j = 0; $j < count($feeds['urls']); $j++) {
-				echo '
-				<link rel="alternate" title="' .
-				    util_html_secure($feeds['titles'][$j]) .
-				    '" href="' . $feeds['urls'][$j] .
-				    '" type="application/rss+xml"/>';
+				echo html_e('link', array('rel' => 'alternate', 'title' => util_html_secure($feeds['titles'][$j]),
+							'href' => $feeds['urls'][$j], 'type' => 'application/rss+xml'));
 			}
 		}
 	}
@@ -150,8 +145,8 @@ class Navigation extends Error {
 			$exact = 1;
 		}
 
-		$res .= '<form id="searchBox" action="'.util_make_uri('/search/').'" method="get">
-			<div>';
+		$res .= html_eo('form', array('id' => 'searchBox', 'action' => util_make_uri('/search/'), 'method' => 'get'));
+		$res .= html_eo('div', array());
 		$parameters = array(
 			SEARCH__PARAMETER_GROUP_ID => $group_id,
 			SEARCH__PARAMETER_ARTIFACT_ID => $atid,
@@ -163,7 +158,7 @@ class Navigation extends Error {
 		$searchManager->setParametersValues($parameters);
 		$searchEngines =& $searchManager->getAvailableSearchEngines();
 
-		$res .= '<select name="type_of_search">';
+		$res .= html_eo('select', array('name' => 'type_of_search'));
 		for($i = 0, $max = count($searchEngines); $i < $max; $i++) {
 			$searchEngine =& $searchEngines[$i];
 			$res .= '<option value="' . $searchEngine->getType() . '"'
diff --git a/src/common/include/utils.php b/src/common/include/utils.php
index 7f1b17c..9ea9074 100644
--- a/src/common/include/utils.php
+++ b/src/common/include/utils.php
@@ -1156,22 +1156,23 @@ function util_make_uri($path) {
  */
 function util_make_link($path, $text, $extra_params = false, $absolute = false) {
 	global $use_tooltips;
-	$ep = '';
+	$attrs = array();
 	if (is_array($extra_params)) {
 		foreach ($extra_params as $key => $value) {
 			if ($key != 'title') {
-				$ep .= "$key=\"$value\" ";
+				$attrs[$key] = $value;
 			}
 			if ($key == 'title' && $use_tooltips) {
-				$ep .= "$key=\"$value\" ";
+				$attrs[$key] = $value;
 			}
 		}
 	}
 	if ($absolute) {
-		return '<a '.$ep.'href="'.$path.'">'.$text.'</a>';
+		$attrs['href'] = $path;
 	} else {
-		return '<a '.$ep.'href="'.util_make_uri($path).'">'.$text.'</a>';
+		$attrs['href'] = util_make_uri($path);
 	}
+	return html_e('a', $attrs, $text, true);
 }
 
 /**
@@ -1183,7 +1184,7 @@ function util_make_link($path, $text, $extra_params = false, $absolute = false)
  * @return	string
  */
 function util_make_link_u($username, $user_id, $text) {
-	return '<a href="'.util_make_url_u($username, $user_id).'">'.$text.'</a>';
+	return util_make_link(util_make_url_u($username, $user_id), $text, false, true);
 }
 
 /**
@@ -1210,7 +1211,7 @@ function util_display_user($username, $user_id, $text, $size = 'xs') {
 	$params = array('user_id' => $user_id, 'size' => $size, 'content' => '');
 	plugin_hook_by_reference('user_logo', $params);
 
-	$url = '<a href="'.util_make_url_u($username, $user_id).'">'.$text.'</a>';
+	$url = util_make_link_u($username, $user_id, $text);
 	if ($params['content']) {
 		return $params['content'].$url.'<div class="new_line"></div>';
 	}
@@ -1252,7 +1253,7 @@ function util_make_link_g($group_name, $group_id, $text) {
 		return $hook_params['group_link'];
 	}
 
-	return '<a href="'.util_make_url_g($group_name, $group_id).'">'.$text.'</a>';
+	return html_e('a', array('href' => util_make_url_g($group_name, $group_id)), $text, true);
 }
 
 /**
diff --git a/src/www/include/Layout.class.php b/src/www/include/Layout.class.php
index bbd453a..2ac720b 100644
--- a/src/www/include/Layout.class.php
+++ b/src/www/include/Layout.class.php
@@ -327,10 +327,9 @@ class Layout extends Error {
 	 *
 	 */
 	function headerSearch() {
-		echo '<link rel="search" title="'
-			. forge_get_config ('forge_name').'" href="'
-			. util_make_url ('/export/search_plugin.php')
-			. '" type="application/opensearchdescription+xml"/>'."\n";
+		echo html_e('link', array('rel' => "search", 'title' => forge_get_config('forge_name'),
+					'href' => util_make_url('/export/search_plugin.php'),
+					'type' => 'application/opensearchdescription+xml'));
 	}
 
 	/**
@@ -704,20 +703,11 @@ if (isset($params['group']) && $params['group']) {
 				foreach ($groups as $g) {
 					$group_id = $g->getID();
 					$menu = $this->navigation->getProjectMenu($group_id);
-
-					echo '
-						<option value="' . $menu['starturl'] . '">'
-						. $menu['name'] .'</option>';
-
+					echo html_e('option', array('value' => $menu['starturl']), $menu['name'], true);
 					for ($j = 0; $j < count($menu['urls']); $j++) {
-						echo '
-							<option value="' . $menu['urls'][$j] .'">        '
-							. $menu['titles'][$j] . '</option>';
+						echo html_e('option', array('value' => $menu['urls'][$j]), '        '.$menu['titles'][$j], true);
 						if (@$menu['adminurls'][$j]) {
-							echo  '
-								<option value="' . $menu['adminurls'][$j]
-								. '">                '
-								. _('Admin') . '</option>';
+							echo  html_e('option', array('value' => $menu['adminurls'][$j]), '                '._('Admin'), true);
 						}
 					}
 				}
@@ -968,8 +958,7 @@ if (isset($params['group']) && $params['group']) {
 		if (!$feedback) {
 			return '';
 		} else {
-			return '
-			<p class="feedback">'.strip_tags($feedback, '<br>').'</p>';
+			return html_e('p', array('class' => 'feedback'), strip_tags($feedback, '<br>'), true);
 		}
 	}
 	/**
@@ -982,8 +971,7 @@ if (isset($params['group']) && $params['group']) {
 		if (!$msg) {
 			return '';
 		} else {
-			return '
-			<p class="warning_msg">'.strip_tags($msg, '<br>').'</p>';
+			return html_e('p', array('class' => 'warning_msg'), strip_tags($msg, '<br>'), true);
 		}
 	}
 
@@ -997,8 +985,7 @@ if (isset($params['group']) && $params['group']) {
 		if (!$msg) {
 			return '';
 		} else {
-			return '
-			<p class="error">'.strip_tags($msg, '<br>')."</p>\n";
+			return html_e('p', array('class' => 'error'), strip_tags($msg, '<br>'), true);
 		}
 	}
 
@@ -1012,8 +999,7 @@ if (isset($params['group']) && $params['group']) {
 		if (!$msg) {
 			return '';
 		} else {
-			return '
-			<p class="information">'.strip_tags($msg, '<br>').'</p>';
+			return html_e('p', array('class' => 'information'), strip_tags($msg, '<br>'), true);
 		}
 	}
 
@@ -1093,31 +1079,29 @@ if (isset($params['group']) && $params['group']) {
 		return $return;
 	}
 
-	function html_checkbox($name, $value, $id = '', $label = '', $checked = '', $extra_params = '') {
+	function html_checkbox($name, $value, $id = '', $label = '', $checked = '', $extra_params = array()) {
 		if (!$id) {
 			$id = $name;
 		}
-		$return = '<div class="field-holder">
-			';
-		$return .= '<input name="' . $name . '" id="' . $id . '" type="checkbox" value="' . $value . '" ';
+		$return = html_e('div', array('class' => 'field-holder'));
+		$attrs = array('name' => $name, 'id' => $id, 'type' => 'checkbox', 'value' => $value);
 		if ($checked) {
-			$return .= 'checked="checked" ';
+			$attrs['checked'] = 'checked';
 		}
 		if (is_array($extra_params)) {
 			foreach ($extra_params as $key => $extra_params_value) {
-				$return .= $key . '="' . $extra_params_value . '" ';
+				$attrs[$key] = $extra_params_value;
 			}
 		}
-		$return .= '/>';
+		$return .= html_e('input', $attrs);
 		if ($label) {
-			$return .= '<label for="' . $id . '">' . $label . '</label>
-				';
+			$return .= html_e('label', array('for' => $id), $label, true);
 		}
 		$return .= '</div>';
 		return $return;
 	}
 
-	function html_text_input_img_submit($name, $img_src, $id = '', $label = '', $value = '', $img_title = '', $img_alt = '', $extra_params = '', $img_extra_params = '') {
+	function html_text_input_img_submit($name, $img_src, $id = '', $label = '', $value = '', $img_title = '', $img_alt = '', $extra_params = array(), $img_extra_params = '') {
 		if (!$id) {
 			$id = $name;
 		}
diff --git a/src/www/include/html.php b/src/www/include/html.php
index b125363..d86d37e 100644
--- a/src/www/include/html.php
+++ b/src/www/include/html.php
@@ -51,7 +51,7 @@ function html_generic_fileheader($title) {
 	    false) . ";\n" .
 	    "//]]></script>\n";
 	$HTML->headerForgepluckerMeta();
-	echo html_e('title', array(), util_html_secure($title)) . "\n";
+	echo html_e('title', array(), util_html_secure($title));
 }
 
 /**

commit c2762ac5c190b0dada0c1746f4b6332aaa4f8856
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Feb 18 17:56:24 2014 +0100

    funky theme: start to use html_e in functions, adapt odd/even helper

diff --git a/src/www/themes/funky/Theme.class.php b/src/www/themes/funky/Theme.class.php
index adcc959..e655121 100644
--- a/src/www/themes/funky/Theme.class.php
+++ b/src/www/themes/funky/Theme.class.php
@@ -152,9 +152,9 @@ class Theme extends Layout {
 	function boxTop($title, $id = '') {
 		if ($id) {
 			$id = $this->toSlug($id);
-			$idid = ' id="' . $id . '"';
-			$idtitle = ' id="' . $id . '-title"';
-			$idtcont = ' id="' . $id . '-title-content"';
+			$idid = $id;
+			$idtitle = $id.'-title"';
+			$idtcont = $id.'-title-content"';
 		} else {
 			$idid = "";
 			$idtitle = "";
@@ -162,9 +162,9 @@ class Theme extends Layout {
 		}
 
 		$t_result = '';
-		$t_result .= '<div' . $idid . ' class="box-surround">';
-		$t_result .= '<div' . $idtitle . ' class="box-title">';
-		$t_result .= '<div' . $idtcont . ' class="box-title-content">'. $title .'</div>';
+		$t_result .= html_e('div', array('id' => $idid, 'class' => 'box-surround'));
+		$t_result .= html_e('div', array('id' => $idtitle, 'class' => 'box-title'));
+		$t_result .= html_e('div', array('id' => $idtcont, 'class' => 'box-title-content'), $title, false);
 		$t_result .= '</div> <!-- class="box-title" -->';
 
 		return $t_result;
@@ -180,14 +180,12 @@ class Theme extends Layout {
 	function boxMiddle($title, $id = '') {
 		if ($id) {
 			$id = $this->toSlug($id);
-			$idtitle = ' id="' . $id . '-title"';
+			$idtitle = $id.'-title"';
 		} else {
 			$idtitle = "";
 		}
 
-		$t_result ='<div' . $idtitle . ' class="box-middle">'.$title.'</div>';
-
-		return $t_result;
+		return html_e('div', array('id' => $idtitle, 'class' => 'box-middle'), $title, false);
 	}
 
 	/**
@@ -200,13 +198,12 @@ class Theme extends Layout {
 	function boxContent($content, $id = '') {
 		if ($id) {
 			$id = $this->toSlug($id);
-			$idcont = ' id="' . $id . '-content"';
+			$idcont = $id.'-content"';
 		} else {
 			$idcont = "";
 		}
 
-		$t_result ='<div' . $idcont . ' class="box-content">'.$content.'</div>';
-		return $t_result;
+		return html_e('div', array('id' => $idcont, 'class' => 'box-content'), $content, false);
 	}
 
 	/**
@@ -226,11 +223,15 @@ class Theme extends Layout {
 	 * @param	int	$i	Row number
 	 * @return	string
 	 */
-	function boxGetAltRowStyle($i) 	{
+	function boxGetAltRowStyle($i, $classonly = false) {
 		if ($i % 2 == 0)
-			return 'class="bgcolor-white"';
+			$ret = 'bgcolor-white';
+		else
+			$ret = 'bgcolor-grey';
+		if ($classonly)
+			return $ret;
 		else
-			return 'class="bgcolor-grey"';
+			return 'class="'.$ret.'"';
 	}
 
 	function tabGenerator($TABS_DIRS, $TABS_TITLES, $TABS_TOOLTIPS, $nested=false,  $selected=false, $sel_tab_bgcolor='WHITE',  $total_width='100%') {

commit f411f435faea94c1d29f5988814d74ca45593b16
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Tue Feb 18 17:54:44 2014 +0100

    html.php functions: implement use_tooltips in html_e, html_eo, add newline in these functions too, use html_build_checkbox in html_buildcheckboxarray, use html_e in html_build_checkbox

diff --git a/src/www/include/html.php b/src/www/include/html.php
index 35c8049..b125363 100644
--- a/src/www/include/html.php
+++ b/src/www/include/html.php
@@ -801,9 +801,14 @@ function html_build_multiple_select_box_from_arrays($ids, $texts, $name, $checke
  * @return	html code for checkbox control
  */
 function html_build_checkbox($name, $value, $checked) {
-	return '<input type="checkbox" id="'.$name.'" name="'.$name.'"'
-		.' value="'.$value.'"'
-		.($checked ? 'checked="checked"' : '').'>';
+	$attrs = array();
+	$attrs['id'] = $name;
+	$attrs['name'] = $name;
+	$attrs['value'] = $value;
+	if ($checked) {
+		$attrs['checked'] = 'checked';
+	}
+	return html_e('input', $attrs);
 }
 
 /**
@@ -852,14 +857,14 @@ function html_buildcheckboxarray($options, $name, $checked_array) {
 	$checked_count = count($checked_array);
 
 	for ($i = 1; $i <= $option_count; $i++) {
-		echo '
-			<br /><input type="checkbox" name="'.$name.'" value="'.$i.'"';
+		$checked = 0;
+
 		for ($j = 0; $j < $checked_count; $j++) {
 			if ($i == $checked_array[$j]) {
-				echo ' checked="checked"';
+				$checked = 1;
 			}
 		}
-		echo ' /> '.$options[$i];
+		echo '<br />'.html_build_checkbox($name, $value, $checked).$options[$i];
 	}
 }
 
@@ -1098,6 +1103,10 @@ function relative_date($date) {
  *		XHTML string suitable for echo'ing
  */
 function html_eo($name, $attrs = array()) {
+	global $use_tooltips;
+	if (!$use_tooltips && isset($attrs['title']) && isset($attrs['class']) && preg_match('/tabtitle/', $attrs['class'])) {
+		$attrs['title'] = '';
+	}
 	$rv = '<'.$name;
 	foreach ($attrs as $key => $value) {
 		if (is_array($value)) {
@@ -1108,7 +1117,7 @@ function html_eo($name, $attrs = array()) {
 		}
 		$rv .= ' '.$key.'="'.htmlspecialchars($value).'"';
 	}
-	$rv .= '>';
+	$rv .= '>'."\n";
 	return $rv;
 }
 
@@ -1130,6 +1139,10 @@ function html_eo($name, $attrs = array()) {
  *		XHTML string suitable for echo'ing
  */
 function html_e($name, $attrs = array(), $content = "", $shortform = true) {
+	global $use_tooltips;
+	if (!$use_tooltips && isset($attrs['title']) && isset($attrs['class']) && preg_match('/tabtitle/', $attrs['class'])) {
+		$attrs['title'] = '';
+	}
 	$rv = '<'.$name;
 	foreach ($attrs as $key => $value) {
 		if (is_array($value)) {
@@ -1141,9 +1154,9 @@ function html_e($name, $attrs = array(), $content = "", $shortform = true) {
 		$rv .= ' '.$key.'="'.htmlspecialchars($value).'"';
 	}
 	if ($content === "" && $shortform) {
-		$rv .= ' />';
+		$rv .= ' />'."\n";
 	} else {
-		$rv .= '>'.$content.'</'.$name.'>';
+		$rv .= '>'.$content.'</'.$name.'>'."\n";
 	}
 	return $rv;
 }
@@ -1233,7 +1246,7 @@ function html_ac($spos) {
 	$rv = "";
 	while ($html_autoclose_pos > $spos) {
 		--$html_autoclose_pos;
-		$rv .= '</'.$html_autoclose_stack[$html_autoclose_pos]['name'].'>';
+		$rv .= '</'.$html_autoclose_stack[$html_autoclose_pos]['name'].'>'."\n";
 		unset($html_autoclose_stack[$html_autoclose_pos]);
 	}
 	return $rv;

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/Navigation.class.php  |   21 +++++-------
 src/common/include/utils.php             |   17 +++++-----
 src/www/include/Layout.class.php         |   52 +++++++++++-------------------
 src/www/include/html.php                 |   37 ++++++++++++++-------
 src/www/themes/funky-wOw/Theme.class.php |   10 ++++--
 src/www/themes/funky/Theme.class.php     |   38 +++++++++++-----------
 6 files changed, 86 insertions(+), 89 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list