[Fusionforge-commits] FusionForge branch master updated. 2b7f3e3479910fe1789925b1dec8be77d2761829

Alain Peyrat aljeux at fusionforge.org
Wed Apr 24 19:08:18 CEST 2013


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  2b7f3e3479910fe1789925b1dec8be77d2761829 (commit)
      from  f33da7edb940f159d0961b0864e3d06bf5c82710 (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 2b7f3e3479910fe1789925b1dec8be77d2761829
Author: Alain Peyrat <alain.peyrat at alcatel-lucent.com>
Date:   Wed Apr 24 16:09:03 2013 +0200

    Misc fixes in headermenu

diff --git a/src/plugins/headermenu/action/addLink.php b/src/plugins/headermenu/action/addLink.php
index f55b26f..061a7af 100644
--- a/src/plugins/headermenu/action/addLink.php
+++ b/src/plugins/headermenu/action/addLink.php
@@ -28,7 +28,7 @@ $link = getStringFromRequest('link');
 $description = strip_tags(getStringFromRequest('description'));
 $name = strip_tags(getStringFromRequest('name'));
 $linkmenu = getStringFromRequest('linkmenu');
-$htmlcode = getStringFromRequest('htmlcode');
+$htmlcode = TextSanitizer::purify(getStringFromRequest('htmlcode'));
 $type = getStringFromRequest('type');
 $iframed = getIntFromRequest('iframeview');
 
@@ -86,7 +86,7 @@ if (!empty($name) && !empty($linkmenu)) {
 				$error_msg = _('Task failed');
 				session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
 			}
-			$warning_msg = _('Missing Link URL or Html Code.');
+			$warning_msg = _('Missing Link URL or HTML Page.');
 			session_redirect($redirect_url.'&warning_msg='.urlencode($warning_msg));
 		}
 	}
diff --git a/src/plugins/headermenu/action/updateLinkValue.php b/src/plugins/headermenu/action/updateLinkValue.php
index 70cbcb5..f216236 100644
--- a/src/plugins/headermenu/action/updateLinkValue.php
+++ b/src/plugins/headermenu/action/updateLinkValue.php
@@ -30,7 +30,7 @@ $name = strip_tags(getStringFromRequest('name'));
 $description = strip_tags(getStringFromRequest('description'));
 $typemenu = getStringFromRequest('typemenu');
 $linkmenu = getStringFromRequest('linkmenu');
-$htmlcode = getStringFromRequest('htmlcode');
+$htmlcode = TextSanitizer::purify(getStringFromRequest('htmlcode'));
 $type = getStringFromRequest('type');
 
 $redirect_url = '/plugins/'.$headermenu->name.'/?type='.$type;
@@ -81,7 +81,7 @@ if (!empty($idLink) && !empty($name)) {
 				$error_msg = _('Task failed');
 				session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
 			}
-			$warning_msg = _('Missing Link URL or Html Code.');
+			$warning_msg = _('Missing Link URL or HTML Page.');
 			session_redirect($redirect_url.'&warning_msg='.urlencode($warning_msg));
 		}
 	}
diff --git a/src/plugins/headermenu/common/headermenuPlugin.class.php b/src/plugins/headermenu/common/headermenuPlugin.class.php
index 85e9240..7788df1 100644
--- a/src/plugins/headermenu/common/headermenuPlugin.class.php
+++ b/src/plugins/headermenu/common/headermenuPlugin.class.php
@@ -29,7 +29,7 @@ class headermenuPlugin extends Plugin {
 	function __construct() {
 		$this->Plugin();
 		$this->name = 'headermenu';
-		$this->text = 'headermenu';
+		$this->text = 'Menu Tabs Manager';
 		$this->_addHook('headermenu');
 		$this->_addHook('site_admin_option_hook');
 		$this->_addHook('outermenu');
@@ -43,10 +43,6 @@ class headermenuPlugin extends Plugin {
 
 	function CallHook($hookname, &$params) {
 		switch ($hookname) {
-			case 'headermenu': {
-				$this->getHeaderLink();
-				break;
-			}
 			case 'outermenu': {
 				$this->getOuterLink($params);
 				break;
@@ -67,8 +63,8 @@ class headermenuPlugin extends Plugin {
 				$group_id = $params['group_id'];
 				$project = group_get_object($group_id);
 				if ($project->usesPlugin($this->name)) {
-					echo '<p>'.util_make_link('/plugins/'.$this->name.'/?type=projectadmin&group_id='.$group_id,
-					     _('Project GroupMenu Admin'), array('class' => 'tabtitle', 'title' => _('Add/Remove/Activate/Desactivate tabs'))) . '</p>';
+					echo '<p>'.util_make_link('/plugins/'.$this->name.'/?type=projectadmin&group_id='.$group_id,
+					     _('Menu Tabs Manager Admin'), array('class' => 'tabtitle', 'title' => _('Add/Remove/Activate/Desactivate tabs'))) . '</p>';
 				}
 				break;
 			}
@@ -118,11 +114,12 @@ class headermenuPlugin extends Plugin {
 	}
 
 	/**
-	 * getHeaderLink - generate the links following the template
+	 * headermenu - Display the links following the template
 	 *
+	 * @param $params
 	 * @return	bool	true...
 	 */
-	function getHeaderLink() {
+	function headermenu($params) {
 		$availableLinks = $this->getAvailableLinks('headermenu');
 		foreach ($availableLinks as $link) {
 			if ($link['is_enable']) {
@@ -152,7 +149,7 @@ class headermenuPlugin extends Plugin {
 						break;
 					}
 					case 'htmlcode': {
-						$params['DIRS'][] = '/plugins/'.$this->name.'/?type=pageview&pageid='.$link['id_headermenu'];
+						$params['DIRS'][] = '/plugins/'.$this->name.'/?type=pageview&pageid='.$link['id_headermenu'];
 						$params['TITLES'][] = $link['name'];
 						$params['TOOLTIPS'][] = $link['description'];
 						break;
@@ -181,19 +178,19 @@ class headermenuPlugin extends Plugin {
 						break;
 					}
 					case 'htmlcode': {
-						$params['DIRS'][] = '/plugins/'.$this->name.'/?type=pageview&group_id='.$params['group'].'&pageid='.$link['id_headermenu'];
+						$params['DIRS'][] = '/plugins/'.$this->name.'/?type=pageview&group_id='.$params['group'].'&pageid='.$link['id_headermenu'];
 						$params['TITLES'][] = $link['name'];
 						$params['TOOLTIPS'][] = $link['description'];
-						if ($params['toptab'] == '/plugins/'.$this->name.'/?type=pageview&group_id='.$params['group'].'&pageid='.$link['id_headermenu']) {
+						if (isset($params['toptab']) && ($params['toptab'] == '/plugins/'.$this->name.'/?type=pageview&group_id='.$params['group'].'&pageid='.$link['id_headermenu'])) {
 							$params['selected'] = (count($params['DIRS'])-1);
 						}
 						break;
 					}
 					case 'iframe': {
-						$params['DIRS'][] = '/plugins/'.$this->name.'/?type=iframeview&group_id='.$params['group'].'&pageid='.$link['id_headermenu'];
+						$params['DIRS'][] = '/plugins/'.$this->name.'/?type=iframeview&group_id='.$params['group'].'&pageid='.$link['id_headermenu'];
 						$params['TITLES'][] = $link['name'];
 						$params['TOOLTIPS'][] = $link['description'];
-						if ($params['toptab'] == '/plugins/'.$this->name.'/?type=iframeview&group_id='.$params['group'].'&pageid='.$link['id_headermenu']) {
+						if (isset($params['toptab']) && ($params['toptab'] == '/plugins/'.$this->name.'/?type=iframeview&group_id='.$params['group'].'&pageid='.$link['id_headermenu'])) {
 							$params['selected'] = (count($params['DIRS'])-1);
 						}
 						break;
@@ -256,9 +253,20 @@ class headermenuPlugin extends Plugin {
 	 * @param	string	$linktype
 	 * @param	int	$project the group_id or 0 meaning forge level
 	 * @param	string	$htmlcode
+	 * @param	integer	$ordering
 	 * @return	bool	success or not
 	 */
-	function addLink($url, $name, $description, $linkmenu, $linktype = 'url', $project = 0, $htmlcode = '', $ordering = 0) {
+	function addLink($url, $name, $description, $linkmenu, $linktype = 'url', $project = 0, $htmlcode = '', $ordering = NULL) {
+		if ($ordering == NULL) {
+			$res = db_query_params('SELECT MAX(ordering) as ordering FROM plugin_headermenu WHERE project=$1 AND linkmenu=$2',
+				array($project, $linkmenu));
+			if ($res) {
+				$ordering = db_result($res, 0, 'ordering')+1;
+			} else {
+				$ordering = 0;
+			}
+		}
+
 		$res = db_query_params('insert into plugin_headermenu (url, name, description, is_enable, linkmenu, linktype, project, htmlcode, ordering)
 					values ($1, $2, $3, $4, $5, $6, $7, $8, $9)',
 					array(
@@ -344,7 +352,7 @@ class headermenuPlugin extends Plugin {
 	}
 
 	/**
-	 * pageView - display a static html code
+	 * pageView - display an HTML Page
 	 *
 	 * @param	int	the page id
 	 * @return	string	the html code
@@ -399,12 +407,12 @@ class headermenuPlugin extends Plugin {
 				$link = $this->getLink($this->pageid);
 				$group_id = getIntFromRequest('group_id');
 				if ($group_id) {
-					$params['toptab'] = '/plugins/'.$this->name.'/?type='.$type.'&group_id='.$group_id.'&pageid='.$this->pageid;
+					$params['toptab'] = '/plugins/'.$this->name.'/?type='.$type.'&group_id='.$group_id.'&pageid='.$this->pageid;
 					$params['group'] = $group_id;
 					$params['title'] = $link['name'];
 					site_project_header($params);
 				} else {
-					site_header(array('title'=> $link['name'], 'toptab' => '/plugins/'.$this->name.'/?type='.$type.'&pageid='.$this->pageid));
+					site_header(array('title'=> $link['name'], 'toptab' => '/plugins/'.$this->name.'/?type='.$type.'&pageid='.$this->pageid));
 				}
 				$returned = true;
 				break;
@@ -417,7 +425,7 @@ class headermenuPlugin extends Plugin {
 				$group_id = getIntFromRequest('group_id');
 				$params['toptab'] = 'admin';
 				$params['group'] = $group_id;
-				$params['title'] = _('Project groupmenu Admin');
+				$params['title'] = _('Menu Tabs Manager Admin');
 				site_project_header($params);
 				$returned = true;
 				break;
diff --git a/src/plugins/headermenu/view/admin/updateLinkValue.php b/src/plugins/headermenu/view/admin/updateLinkValue.php
index 15e1db0..45a9a0e 100644
--- a/src/plugins/headermenu/view/admin/updateLinkValue.php
+++ b/src/plugins/headermenu/view/admin/updateLinkValue.php
@@ -28,14 +28,14 @@ global $group_id;
 
 $linkId = getIntFromRequest('linkid');
 $redirect_url = '/plugins/'.$headermenu->name.'/?type='.$type;
-$action_url = 'index.php?type='.$type.'&action=updateLinkValue';
+$action_url = 'index.php?type='.$type.'&action=updateLinkValue';
 if (isset($group_id) && $group_id) {
-	$redirect_url .= '&group_id='.$group_id;
-	$action_url .= '&group_id='.$group_id;
+	$redirect_url .= '&group_id='.$group_id;
+	$action_url .= '&group_id='.$group_id;
 }
 ?>
 
-<script language="Javascript" type="text/javascript">//<![CDATA[
+<script type="text/javascript">//<![CDATA[
 var controllerHeaderMenu;
 
 jQuery(document).ready(function() {
@@ -45,7 +45,7 @@ jQuery(document).ready(function() {
 		inputURLIframe:	jQuery('#typemenu_iframe'),
 		inputHeader:	jQuery('#linkmenu_headermenu'),
 		inputOuter:	jQuery('#linkmenu_outermenu'),
-		trHtmlCode:	jQuery('#htmlcode'),
+		trHtmlCode:	jQuery('#trhtmlcode'),
 		trUrlCode:	jQuery('#urlcode')
     });
 });
@@ -55,58 +55,55 @@ jQuery(document).ready(function() {
 <?php
 $linkValues = $headermenu->getLink($linkId);
 if (is_array($linkValues)) {
+	echo '<h2>'._('Update this link')."</h2>\n";
 	echo '<form method="POST" name="updateLink" action="'.$action_url.'">';
-	echo '<table><tr>';
-	echo $HTML->boxTop(_('Update this link'));
-	echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" value="'.$linkValues['name'].'" /></td>';
-	echo '</tr><tr>';
-	echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" value="'.$linkValues['description'].'" /></td>';
-	echo '</tr><tr>';
+	echo '<table class="infotable">'."\n".'<tr>';
+	echo '<td>'._('Displayed Name').utils_requiredField()._(':').'</td><td><input required="required" name="name" type="text" maxlength="255" value="'.$linkValues['name'].'" /></td>';
+	echo '</tr>'."\n".'<tr>';
+	echo '<td>'._('Description')._(':').'</td><td><input name="description" type="text" maxlength="255" value="'.$linkValues['description'].'" /></td>';
+	echo '</tr>'."\n".'<tr>';
 	if ($type == 'globaladmin') {
-		echo '<td>'._('Menu Location').'</td><td>';
+		echo '<td>'._('Menu Location')._(':').'</td><td>';
 		$vals = array('headermenu', 'outermenu');
 		$texts = array('headermenu', 'outermenu');
 		$select_name = 'linkmenu';
 		echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linkmenu'], false);
 		echo '</td>';
 		echo '</tr><tr>';
-		$texts = array('URL', 'New Page');
+		$texts = array('URL', 'HTML Page');
 		$vals = array('url', 'htmlcode');
 	}
-	echo '<td>'._('Menu Type').'</td><td>';
+	echo '<td>'._('Tab Type')._(':').'</td><td>';
 	if ($type == 'projectadmin') {
-		$texts = array('URL', 'URL as iframe', 'New Page');
+		$texts = array('URL', 'URL as iframe', 'HTML Page');
 		$vals = array('url', 'iframe', 'htmlcode');
 		echo '<input type="hidden" name="linkmenu" value="groupmenu" />';
 	}
 	$select_name = 'typemenu';
 	echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linktype'], false);
 	echo '</td>';
-	echo '</tr><tr id="htmlcode" style="display:none">';
-	echo '<td>'._('Your HTML Code.').'</td><td>';
-	$GLOBALS['editor_was_set_up'] = false;
-	$body = $linkValues['htmlcode'];
+	echo '</tr>'."\n".'<tr id="trhtmlcode" style="display:none">';
+	echo '<td>'._('HTML Page').utils_requiredField()._(':').'</td><td>';
+
 	$params['name'] = 'htmlcode';
-	$params['body'] = $body;
+	$params['body'] = $linkValues['htmlcode'];
 	$params['width'] = "800";
 	$params['height'] = "500";
-	$params['user_id'] = user_getid();
-	plugin_hook("text_editor", $params);
-	if (!$GLOBALS['editor_was_set_up']) {
-		echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
-	}
-	unset($GLOBALS['editor_was_set_up']);
-	echo '</td></tr><tr id="urlcode"  style="display:none" >';
-	echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" value="'.$linkValues['url'].'" /></td>';
-	echo '</tr><tr>';
-	echo '<td>';
+	$params['content'] = '<textarea name="htmlcode" rows="5" cols="80">'.$params['body'].'</textarea>';
+	plugin_hook_by_reference("text_editor", $params);
+	echo $params['content'];
+
+	echo '</td></tr>'."\n".'<tr id="urlcode" style="display:none" >';
+	echo '<td>'._('URL').utils_requiredField()._(':').'</td><td><input name="link" type="text" maxlength="255" value="'.$linkValues['url'].'" /></td>';
+	echo '</tr>'."\n";
+	echo '</table>';
+	echo '<p>';
 	echo '<input type="hidden" name="linkid" value="'.$linkId.'" />';
 	echo '<input type="submit" value="'. _('Update') .'" />';
-	echo '<a href="'.$redirect_url.'"><input type="button" value="'. _('Cancel') .'" /></a>';
-	echo '</td>';
-	echo $HTML->boxBottom();
-	echo '</tr></table>';
+    echo '<input type="submit" name="submit" value="'. _('Cancel') .'" formnovalidate="formnovalidate" />';
+	echo '</p>';
 	echo '</form>';
+	echo utils_requiredField().' '._('Indicates required fields.');
 } else {
 	$error_msg = _('Cannot retrieve value for this link:').' '.$linkId;
 	session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
diff --git a/src/plugins/headermenu/view/admin/viewGlobalConfiguration.php b/src/plugins/headermenu/view/admin/viewGlobalConfiguration.php
index a7dde3b..aa151a7 100644
--- a/src/plugins/headermenu/view/admin/viewGlobalConfiguration.php
+++ b/src/plugins/headermenu/view/admin/viewGlobalConfiguration.php
@@ -26,7 +26,7 @@ global $headermenu;
 
 ?>
 
-<script language="Javascript" type="text/javascript">//<![CDATA[
+<script type="text/javascript">//<![CDATA[
 var controllerHeaderMenu;
 
 jQuery(document).ready(function() {
@@ -35,7 +35,7 @@ jQuery(document).ready(function() {
 		inputURL:	jQuery('#typemenu_url'),
 		inputHeader:	jQuery('#linkmenu_headermenu'),
 		inputOuter:	jQuery('#linkmenu_outermenu'),
-		trHtmlCode:	jQuery('#htmlcode'),
+		trHtmlCode:	jQuery('#trhtmlcode'),
 		trUrlCode:	jQuery('#urlcode'),
 		tableOutTbLink:	jQuery('.sortable_outermenu_listlinks tbody'),
 		tableHeaTbLink: jQuery('.sortable_headermenu_listlinks tbody'),
@@ -44,7 +44,7 @@ jQuery(document).ready(function() {
 		validMessOut:	'<?php echo _('Outermenu Link Order successfully validated') ?>',
 		validMessHea:	'<?php echo _('Headermenu Link Order successfully validated') ?>',
 		errMessOut:	'<?php echo _('Error in Outermenu Link Order validation') ?>',
-		errMessHea:	'<?php echo _('Error in Headermenu Link Order validation') ?>',
+		errMessHea:	'<?php echo _('Error in Headermenu Link Order validation') ?>'
 	});
 });
 
@@ -55,11 +55,11 @@ $linksHeaderMenuArray = $headermenu->getAvailableLinks('headermenu');
 $linksOuterMenuArray = $headermenu->getAvailableLinks('outermenu');
 
 if (sizeof($linksHeaderMenuArray) || sizeof($linksOuterMenuArray)) {
-	echo '<p class="information">'. _('You can reorder links, just drag & drop rows in the table below and save order. Please note that those extra tabs can only appear after the standard tabs. And you can only move them inside the set of extra tabs.').'</p>';
+	echo '<p class="information">'. _('You can reorder tabs, just drag & drop rows in the table below and save order. Please note that those extra tabs can only appear after the standard tabs. And you can only move them inside the set of extra tabs.').'</p>';
 }
 if (sizeof($linksHeaderMenuArray)) {
-	echo $HTML->boxTop(_('Manage available links in headermenu'));
-	$tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
+	echo '<h2>'._('Manage available tabs in headermenu').'</h2>';
+	$tabletop = array(_('Order'), _('Tab Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
 	$classth = array('', '', '', '', '', 'unsortable');
 	echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
 	foreach ($linksHeaderMenuArray as $link) {
@@ -67,34 +67,32 @@ if (sizeof($linksHeaderMenuArray)) {
 		if (strlen($link['url']) > 0) {
 			echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
 		} else {
-			echo '<td>'._('static html code').'</td>';
+			echo '<td>'._('HTML Page').'</td>';
 		}
 		echo '<td>'.htmlspecialchars($link['name']).'</td>';
 		echo '<td>'.htmlspecialchars($link['description']).'</td>';
 		if ($link['is_enable']) {
 			echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
-			echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
+			echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
 		} else {
 			echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
-			echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
+			echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
 		}
-		echo '<a class="tabtitle-ne" title="'._('Edit this link').'" href="index.php?type=globaladmin&view=updateLinkValue&linkid='.$link['id_headermenu'].'">'.html_image('docman/edit-file.png',22,22, array('alt'=>_('Edit this link'))). '</a>';
-		echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=globaladmin&action=deleteLink&linkid='.$link['id_headermenu'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
+		echo '<a class="tabtitle-ne" title="'._('Edit this link').'" href="index.php?type=globaladmin&view=updateLinkValue&linkid='.$link['id_headermenu'].'">'.html_image('docman/edit-file.png',22,22, array('alt'=>_('Edit this link'))). '</a>';
+		echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=globaladmin&action=deleteLink&linkid='.$link['id_headermenu'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
 		echo '</td>';
 		echo '</tr>';
 	}
 	echo $HTML->listTableBottom();
-	echo $HTML->boxBottom();
 	echo '<input type="button" id="linkorderheadervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
-	echo '</br>';
+	echo '<br/>';
 } else {
-	echo '<p class="information">'._('No links available for headermenu').'</p>';
+	echo '<p class="information">'._('No tabs available for headermenu').'</p>';
 }
 
-
 if (sizeof($linksOuterMenuArray)) {
-	echo $HTML->boxTop(_('Manage available links in outermenu'));
-	$tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
+	echo '<h2>'._('Manage available tabs in outermenu').'</h2>';
+	$tabletop = array(_('Order'), _('Tab Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
 	$classth = array('', '', '', '', '', 'unsortable');
 	echo $HTML->listTableTop($tabletop, false, 'sortable_outermenu_listlinks', 'sortable', $classth);
 	foreach ($linksOuterMenuArray as $link) {
@@ -102,53 +100,52 @@ if (sizeof($linksOuterMenuArray)) {
 		if (strlen($link['url']) > 0) {
 			echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
 		} else {
-			echo '<td>'._('static html code').'</td>';
+			echo '<td>'._('HTML Page').'</td>';
 		}
 		echo '<td>'.htmlspecialchars($link['name']).'</td>';
 		echo '<td>'.htmlspecialchars($link['description']).'</td>';
 		if ($link['is_enable']) {
 			echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
-			echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
+			echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
 		} else {
 			echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
-			echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
+			echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=globaladmin&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
 		}
-		echo '<a class="tabtitle-ne" title="'._('Edit this link').'" href="index.php?type=globaladmin&view=updateLinkValue&linkid='.$link['id_headermenu'].'">'.html_image('docman/edit-file.png',22,22, array('alt'=>_('Edit this link'))). '</a>';
-		echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=globaladmin&action=deleteLink&linkid='.$link['id_headermenu'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
+		echo '<a class="tabtitle-ne" title="'._('Edit this link').'" href="index.php?type=globaladmin&view=updateLinkValue&linkid='.$link['id_headermenu'].'">'.html_image('docman/edit-file.png',22,22, array('alt'=>_('Edit this link'))). '</a>';
+		echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=globaladmin&action=deleteLink&linkid='.$link['id_headermenu'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
 		echo '</td>';
 		echo '</tr>';
 	}
 	echo $HTML->listTableBottom();
-	echo $HTML->boxBottom();
 	echo '<input type="button" id="linkorderoutervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
-	echo '</br>';
+	echo '<br/>';
 } else {
-	echo '<p class="information">'._('No links available for outermenu').'</p>';
+	echo '<p class="information">'._('No tabs available for outermenu').'</p>';
 }
 
+echo '<h2>'._('Add new tab').'</h2>';
 echo '<p class="information">'._('You can add specific tabs in outermenu (main tab) or headermenu (next to the login) with the form below.').'</p>';
-echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
-echo '<table><tr>';
-echo $HTML->boxTop(_('Add a new link'));
-echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
+echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
+echo '<table class="infotable"><tr>';
+echo '<td>'._('Displayed Name')._(':').'</td><td><input required="required" name="name" type="text" maxlength="255" /></td>';
 echo '</tr><tr>';
-echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" /></td>';
+echo '<td>'._('Description')._(':').'</td><td><input name="description" type="text" maxlength="255" /></td>';
 echo '</tr><tr>';
-echo '<td>'._('Menu Location').'</td><td>';
+echo '<td>'._('Menu Location')._(':').'</td><td>';
 $vals = array('headermenu', 'outermenu');
 $texts = array('headermenu', 'outermenu');
 $select_name = 'linkmenu';
 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'headermenu', false);
 echo '</td>';
 echo '</tr><tr>';
-echo '<td>'._('Menu Type').'</td><td>';
-$texts = array('URL', 'New Page');
+echo '<td>'._('Tab Type')._(':').'</td><td>';
+$texts = array('URL', 'HTML Page');
 $vals = array('url', 'htmlcode');
 $select_name = 'typemenu';
 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'url', false);
 echo '</td>';
-echo '</tr><tr id="htmlcode" style="display:none">';
-echo '<td>'._('Your HTML Code.').'</td><td>';
+echo '</tr><tr id="trhtmlcode" style="display:none">';
+echo '<td>'._('HTML Page')._(':').'</td><td>';
 $GLOBALS['editor_was_set_up'] = false;
 $body = _('Just paste your code here...');
 $params['name'] = 'htmlcode';
@@ -162,11 +159,10 @@ if (!$GLOBALS['editor_was_set_up']) {
 }
 unset($GLOBALS['editor_was_set_up']);
 echo '</td></tr><tr id="urlcode" >';
-echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" /></td>';
+echo '<td>'._('URL')._(':').'</td><td><input name="link" type="text" maxlength="255" /></td>';
 echo '</tr><tr>';
-echo '<td>';
+echo '<td colspan="2">';
 echo '<input type="submit" value="'. _('Add') .'" />';
 echo '</td>';
-echo $HTML->boxBottom();
 echo '</tr></table>';
 echo '</form>';
diff --git a/src/plugins/headermenu/view/admin/viewProjectConfiguration.php b/src/plugins/headermenu/view/admin/viewProjectConfiguration.php
index f9682c3..4b73db9 100644
--- a/src/plugins/headermenu/view/admin/viewProjectConfiguration.php
+++ b/src/plugins/headermenu/view/admin/viewProjectConfiguration.php
@@ -27,22 +27,22 @@ global $group_id;
 
 ?>
 
-<script language="Javascript" type="text/javascript">//<![CDATA[
+<script type="text/javascript">//<![CDATA[
 var controllerGroupMenu;
 
 jQuery(document).ready(function() {
 	controllerGroupMenu = new GroupMenuController({
 		inputHtmlCode:	jQuery('#typemenu_htmlcode'),
 		inputURL:	jQuery('#typemenu_url'),
-		trHtmlCode:	jQuery('#htmlcode'),
+		trHtmlCode:	jQuery('#trhtmlcode'),
 		trUrlCode:	jQuery('#urlcode'),
 		trIframeView:	jQuery('#iframe'),
-		tableTbodyLink:	jQuery('#sortable tbody'),
+		tableTbodyLink:	jQuery('#sortable').find('tbody'),
 		validateButton:	jQuery('#linkordervalidatebutton'),
 		groupId:	'<?php echo $group_id ?>',
 		headerMenuUrl:	'<?php util_make_uri("/plugins/headermenu") ?>',
 		validMessage:	'<?php echo _('Link Order successfully validated') ?>',
-		errorMessage:	'<?php echo _('Error in Link Order validation') ?>',
+		errorMessage:	'<?php echo _('Error in Link Order validation') ?>'
 	});
 });
 
@@ -51,79 +51,77 @@ jQuery(document).ready(function() {
 <?php
 $linksArray = $headermenu->getAvailableLinks('groupmenu', $group_id);
 if (sizeof($linksArray)) {
-	echo '<p class="information">'. _('You can reorder links, just drag & drop rows in the table below and save order. Please note that those extra tabs can only appear after the standard tabs. And you can only move them inside the set of extra tabs.').'</p>';
-	echo $HTML->boxTop(_('Manage available links'));
-	$tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
+	echo '<h2>'._('Manage available tabs')."</h2>\n";
+	echo '<p class="information">'. _('You can reorder tabs, just drag & drop rows in the table below and save order. Please note that those extra tabs can only appear after the standard tabs. And you can only move them inside the set of extra tabs.').'</p>';
+	$tabletop = array(_('Order'), _('Tab Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
 	$classth = array('', '', '', '', '', 'unsortable');
 	echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
 	foreach ($linksArray as $link) {
-		echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
+		echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering']."</td>\n";
 		if (strlen($link['url']) > 0) {
 			echo '<td>'._('URL');
 			if ($link['linktype'] == 'iframe') {
 				echo ' '._('displayed as iframe');
 			}
-			echo ' ('.htmlspecialchars($link['url']).')</td>';
+			echo ' ('.htmlspecialchars($link['url']).")</td>\n";
 		} else {
-			echo '<td>'._('static html code').'</td>';
+			echo '<td>'._('HTML Page')."</td>\n";
 		}
-		echo '<td>'.htmlspecialchars($link['name']).'</td>';
-		echo '<td>'.htmlspecialchars($link['description']).'</td>';
+		echo '<td>'.htmlspecialchars($link['name'])."</td>\n";
+		echo '<td>'.htmlspecialchars($link['description'])."</td>\n";
 		if ($link['is_enable']) {
-			echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
-			echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
+			echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on')))."</td>\n";
+			echo '<td><a class="tabtitle-ne" title="'._('Desactivate this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=0">'.html_image('docman/release-document.png', 22, 22, array('alt'=>_('Desactivate this link'))). '</a>';
 		} else {
-			echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
-			echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
+			echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off')))."</td>\n";
+			echo '<td><a class="tabtitle-ne" title="'._('Activate this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&action=updateLinkStatus&linkid='.$link['id_headermenu'].'&linkstatus=1">'.html_image('docman/reserve-document.png', 22, 22, array('alt'=>_('Activate this link'))). '</a>';
 		}
-		echo '<a class="tabtitle-ne" title="'._('Edit this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&view=updateLinkValue&linkid='.$link['id_headermenu'].'">'.html_image('docman/edit-file.png',22,22, array('alt'=>_('Edit this link'))). '</a>';
-		echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&action=deleteLink&linkid='.$link['id_headermenu'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
-		echo '</td>';
-		echo '</tr>';
+		echo '<a class="tabtitle-ne" title="'._('Edit this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&view=updateLinkValue&linkid='.$link['id_headermenu'].'">'.html_image('docman/edit-file.png',22,22, array('alt'=>_('Edit this link'))). '</a>';
+		echo '<a class="tabtitle-ne" title="'._('Delete this link').'" href="index.php?type=projectadmin&group_id='.$group_id.'&action=deleteLink&linkid='.$link['id_headermenu'].'">'.html_image('docman/trash-empty.png',22,22, array('alt'=>_('Delete this link'))). '</a>';
+		echo "</td>\n";
+		echo "</tr>\n";
 	}
 	echo $HTML->listTableBottom();
-	echo $HTML->boxBottom();
 	echo '<input type="button" id="linkordervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
-	echo '</br>';
+	echo '<br/>';
 }
 
+echo '<h2>'._('Add new tab')."</h2>\n";
 echo '<p class="information">'._('You can add your own tabs in the menu bar with the form below.').'</p>';
-echo '<form method="POST" name="addLink" action="index.php?type=projectadmin&group_id='.$group_id.'&action=addLink">';
-echo '<table><tr>';
-echo $HTML->boxTop(_('Add a new link'));
-echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
+echo '<form method="POST" name="addLink" action="index.php?type=projectadmin&group_id='.$group_id.'&action=addLink">';
+echo '<table class="infotable">'."\n";
+echo '<tr>';
+echo '<td>'._('Displayed Name').utils_requiredField()._(':')."</td>\n";
+echo '<td><input required="required" name="name" type="text" maxlength="255" /></td>';
 echo '</tr><tr>';
-echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" /></td>';
+echo '<td>'._('Description')._(':').'</td><td><input name="description" type="text" maxlength="255" /></td>';
 echo '</tr><tr>';
-echo '<td>'._('Menu Type').'</td><td>';
-$texts = array('URL', 'New Page');
+echo '<td>'._('Tab Type')._(':').'</td><td>';
+$texts = array('URL', 'HTML Page');
 $vals = array('url', 'htmlcode');
 $select_name = 'typemenu';
 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'url', false);
 echo '</td>';
-echo '</tr><tr id="htmlcode" style="display:none">';
-echo '<td>'._('Your HTML Code.').'</td><td>';
-$GLOBALS['editor_was_set_up'] = false;
-$body = _('Just paste your code here...');
+echo '</tr>'."\n".'<tr id="trhtmlcode" style="display:none">';
+echo '<td>'._('HTML Page').utils_requiredField()._(':').'</td><td>';
+
 $params['name'] = 'htmlcode';
-$params['body'] = $body;
+$params['body'] = _('Just paste your code here...');
 $params['width'] = "800";
 $params['height'] = "500";
-$params['user_id'] = user_getid();
-plugin_hook("text_editor", $params);
-if (!$GLOBALS['editor_was_set_up']) {
-	echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
-}
-unset($GLOBALS['editor_was_set_up']);
+$params['content'] = '<textarea name="htmlcode" rows="5" cols="80">'.$params['body'].'</textarea>';
+plugin_hook_by_reference("text_editor", $params);
+echo $params['content'];
+
 echo '</td></tr><tr id="urlcode" >';
-echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" /></td>';
-echo '</td></tr><tr id="iframe" >';
-echo '<td colspan="2" ><input name="iframeview" type="checkbox" value="1" />Display URL as iframe.</td>';
+echo '<td>'._('URL').utils_requiredField()._(':').'</td><td><input name="link" type="text" maxlength="255" /></td>';
+echo '</tr><tr id="iframe" >';
+echo '<td colspan="2"><input name="iframeview" type="checkbox" value="1" />Display URL as iframe</td>';
 echo '</tr><tr>';
-echo '<td>';
+echo '<td colspan="2">';
 echo '<input type="hidden" name="linkmenu" value="groupmenu" />';
 echo '<input type="submit" value="'. _('Add') .'" />';
-echo '</td>';
-echo $HTML->boxBottom();
-echo '</tr></table>';
+echo '</td></tr></table>';
 echo '</form>';
+
+echo utils_requiredField().' '._('Indicates required fields.');
diff --git a/src/plugins/headermenu/www/scripts/HeaderMenuController.js b/src/plugins/headermenu/www/scripts/HeaderMenuController.js
index 4504783..246455d 100644
--- a/src/plugins/headermenu/www/scripts/HeaderMenuController.js
+++ b/src/plugins/headermenu/www/scripts/HeaderMenuController.js
@@ -112,11 +112,11 @@ HeaderMenuController.prototype =
 						jQuery('.feedback').remove();
 						jQuery('.error').remove();
 						if (data == 0) {
-							jQuery('#maindiv').prepend('<p id="validateLinkMessage" class="feedback">'+this.params.validMessOut+'</p>');
+							jQuery('#maindiv').prepend('<div class="actionresult"><p id="validateLinkMessage" class="feedback">'+this.params.validMessOut+'</p></div>');
 						} else {
 							jQuery('#maindiv').prepend('<p id="validateLinkMessage" class="error">'+this.params.errMessOut+'</p>');
 						}
-						this.params.validateButton.hide();
+                        jQuery("#linkorderoutervalidatebutton").hide();
 					}, this)
 			);
 	},
@@ -133,11 +133,11 @@ HeaderMenuController.prototype =
 						jQuery('.feedback').remove();
 						jQuery('.error').remove();
 						if (data == 0) {
-							jQuery('#maindiv').prepend('<p id="validateLinkMessage" class="feedback">'+this.params.validMessHea+'</p>');
+							jQuery('#maindiv').prepend('<div class="actionresult"><p id="validateLinkMessage" class="feedback">'+this.params.validMessHea+'</p></div>');
 						} else {
 							jQuery('#maindiv').prepend('<p id="validateLinkMessage" class="error">'+this.params.errMessHea+'</p>');
 						}
-						this.params.validateButton.hide();
+                        jQuery("#linkorderheadervalidatebutton").hide();
 					}, this)
 			);
 	}
@@ -158,7 +158,7 @@ GroupMenuController.prototype =
 		if (typeof(this.params.tableTbodyLink) != 'undefined') {
 			this.params.tableTbodyLink.sortable({
 				update: function(event, ui) {
-					jQuery("#sortable tbody").children().each(function() {
+					jQuery("#sortable").find("tbody").children().each(function() {
 						if (jQuery(this).index() % 2 === 0) {
 							jQuery(this).attr("class", "even");
 						} else {
@@ -189,7 +189,7 @@ GroupMenuController.prototype =
 	},
 
 	validateProjectLinkOrder: function() {
-		var linkOrder = jQuery("#sortable tbody").sortable('toArray').toString();
+		var linkOrder = jQuery("#sortable").find("tbody").sortable('toArray').toString();
 		jQuery.get(this.params.headerMenuUrl,
 				{
 					group_id:	this.params.groupId,
@@ -201,7 +201,7 @@ GroupMenuController.prototype =
 						jQuery('.feedback').remove();
 						jQuery('.error').remove();
 						if (data == 0) {
-							jQuery('#maindiv').prepend('<p id="validateLinkMessage" class="feedback">'+this.params.validMessage+'</p>');
+							jQuery('#maindiv').prepend('<div class="actionresult"><p id="validateLinkMessage" class="feedback">'+this.params.validMessage+'</p></div>');
 						} else {
 							jQuery('#maindiv').prepend('<p id="validateLinkMessage" class="error">'+this.params.errorMessage+'</p>');
 						}

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

Summary of changes:
 src/plugins/headermenu/action/addLink.php          |    4 +-
 src/plugins/headermenu/action/updateLinkValue.php  |    4 +-
 .../headermenu/common/headermenuPlugin.class.php   |   46 ++++++----
 .../headermenu/view/admin/updateLinkValue.php      |   65 +++++++-------
 .../view/admin/viewGlobalConfiguration.php         |   72 ++++++++-------
 .../view/admin/viewProjectConfiguration.php        |   92 ++++++++++----------
 .../headermenu/www/scripts/HeaderMenuController.js |   14 +--
 7 files changed, 148 insertions(+), 149 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list