* Docman: add report view as in FRS (TrivialDev)
Plugins:
-* headermenu: new plugin to handle links in headermenu or outermenu (TrivialDev)
+* headermenu: new plugin to handle links in headermenu, outermenu & groupmenu
+ replace the old extratabs plugin (TrivialDev)
* scmgit: add browsing capability for user personal repository (TrivialDev)
* scmgit: basic activity support (TrivialDev).
* scmgit: multiple repositories per project (developed for/sponsored by AdaCore)
<?php
/**
- * headermenu plugin
+ * headermenu plugin : addLink action
*
- * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
*/
global $headermenu;
+global $group_id;
-session_require_global_perm('forge_admin');
$link = getStringFromRequest('link');
$description = strip_tags(getStringFromRequest('description'));
$name = strip_tags(getStringFromRequest('name'));
$linkmenu = getStringFromRequest('linkmenu');
$htmlcode = getStringFromRequest('htmlcode');
+$type = getStringFromRequest('type');
+$iframed = getIntFromRequest('iframeview');
+
+$redirect_url = 'plugins/'.$headermenu->name.'/?type='.$type;
+if (isset($group_id) && $group_id) {
+ $redirect_url .= '&group_id='.$group_id;
+}
if (!empty($name) && !empty($linkmenu)) {
switch ($linkmenu) {
- case "headermenu": {
+ case 'headermenu': {
if (!empty($link)) {
if (util_check_url($link)) {
if ($headermenu->addLink($link, $name, $description, $linkmenu)) {
$feedback = _('Task succeeded.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect($redirect_url.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
} else {
$error_msg = _('Provided Link is not a valid URL.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
}
}
$warning_msg = _('Missing Link URL.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+ session_redirect($redirect_url.'&warning_msg='.urlencode($warning_msg));
break;
}
- case "outermenu": {
+ case 'outermenu':
+ case 'groupmenu': {
if (!empty($link)) {
if (util_check_url($link)) {
- if ($headermenu->addLink($link, $name, $description, $linkmenu)) {
+ $linktype = 'url';
+ if ($iframed) {
+ $linktype = 'iframe';
+ }
+ if ($headermenu->addLink($link, $name, $description, $linkmenu, $linktype)) {
$feedback = _('Task succeeded.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect($redirect_url.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
} else {
$error_msg = _('Provided Link is not a valid URL.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
}
}
if (!empty($htmlcode)) {
if ($headermenu->addLink('', $name, $description, $linkmenu, 'htmlcode', $htmlcode)) {
$feedback = _('Task succeeded.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect($redirect_url.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
}
$warning_msg = _('Missing Link URL or Html Code.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+ session_redirect($redirect_url.'&warning_msg='.urlencode($warning_msg));
}
}
}
$warning_msg = _('No link to create or name missing.');
-session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+session_redirect($redirect_url.'&warning_msg='.urlencode($warning_msg));
<?php
/**
- * headermenu plugin
+ * headermenu plugin: deleteLink action
*
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*/
global $headermenu;
+global $type;
+global $group_id;
-session_require_global_perm('forge_admin');
$idLink = getIntFromRequest('linkid');
+$redirect_url = 'plugins/'.$headermenu->name.'/?type='.$type;
+if (isset($group_id) && $group_id) {
+ $redirect_url .= '&group_id='.$group_id;
+}
if (!empty($idLink)) {
if ($headermenu->deleteLink($idLink)) {
$feedback = _('Link deleted');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect($redirect_url.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
}
$warning_msg = _('Missing Link to be deleted.');
-session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+session_redirect($redirect_url.'&warning_msg='.urlencode($warning_msg));
<?php
/**
- * headermenu plugin
+ * headermenu plugin: updateLinkStatus action
*
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*/
global $headermenu;
+global $type;
+global $group_id;
-session_require_global_perm('forge_admin');
$idLink = getIntFromRequest('linkid');
$linkStatus = getIntFromRequest('linkstatus');
+$redirect_url = 'plugins/'.$headermenu->name.'/?type='.$type;
+if (isset($group_id) && $group_id) {
+ $redirect_url .= '&group_id='.$group_id;
+}
if (!empty($idLink)) {
if ($headermenu->updateLinkStatus($idLink, $linkStatus)) {
$feedback = _('Link Status updated');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect($redirect_url.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));
}
$warning_msg = _('Missing Link or status to be updated.');
-session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+session_redirect($redirect_url.'&warning_msg='.urlencode($warning_msg));
<?php
/**
- * headermenu plugin
+ * headermenu plugin : updateLinkValue action
*
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
global $headermenu;
-session_require_global_perm('forge_admin');
$idLink = getIntFromRequest('linkid');
$link = getStringFromRequest('link');
$name = strip_tags(getStringFromRequest('name'));
$typemenu = getStringFromRequest('typemenu');
$linkmenu = getStringFromRequest('linkmenu');
$htmlcode = getStringFromRequest('htmlcode');
+$type = getStringFromRequest('type');
if (!empty($idLink) && !empty($name)) {
switch ($linkmenu) {
- case "headermenu": {
+ case 'headermenu': {
if (!empty($link)) {
if (util_check_url($link)) {
if ($headermenu->updateLink($idLink, $link, $name, $description, $linkmenu)) {
$feedback = _('Task succeeded.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));
} else {
$error_msg = _('Provided Link is not a valid URL.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));
}
}
$warning_msg = _('Missing Link URL.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&warning_msg='.urlencode($warning_msg));
break;
}
- case "outermenu": {
- if (!empty($link) && $typemenu == 'url') {
+ case 'outermenu':
+ case 'groupmenu': {
+ if (!empty($link) && ($typemenu == 'url' || $typemenu == 'iframe')) {
if (util_check_url($link)) {
- if ($headermenu->updateLink($idLink, $link, $name, $description, $linkmenu)) {
+ if ($headermenu->updateLink($idLink, $link, $name, $description, $linkmenu, $typemenu)) {
$feedback = _('Task succeeded.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));
} else {
$error_msg = _('Provided Link is not a valid URL.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));
}
}
if (!empty($htmlcode) && $typemenu == 'htmlcode') {
if ($headermenu->updateLink($idLink, '', $name, $description, $linkmenu, 'htmlcode', $htmlcode)) {
$feedback = _('Task succeeded.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&feedback='.urlencode($feedback));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&feedback='.urlencode($feedback));
}
$error_msg = _('Task failed');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));
}
$warning_msg = _('Missing Link URL or Html Code.');
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&warning_msg='.urlencode($warning_msg));
}
}
}
$warning_msg = _('No link to update or name missing.');
-session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&warning_msg='.urlencode($warning_msg));
+session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&warning_msg='.urlencode($warning_msg));
--- /dev/null
+<?php
+/**
+ * headermenu plugin : validateOrder action
+ *
+ * Copyright 2013, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $headermenu;
+
+$sysdebug_enable = false;
+
+$linksOrder = getStringFromRequest('linkorder');
+$returnValue = 1;
+
+if ($linksOrder && strlen($linksOrder)) {
+ $linksOrderArr = explode(',', $linksOrder);
+ if ($headermenu->setLinksOrder($linksOrderArr))
+ $returnValue = 0;
+}
+echo $returnValue;
+exit;
\ No newline at end of file
/**
* headermenuPlugin Class
*
- * Copyright 2012 Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
var $pageid;
function __construct() {
- $this->Plugin() ;
- $this->name = 'headermenu' ;
- $this->text = 'headermenu' ;
+ $this->Plugin();
+ $this->name = 'headermenu';
+ $this->text = 'headermenu';
$this->_addHook('headermenu');
$this->_addHook('site_admin_option_hook');
$this->_addHook('outermenu');
+ $this->_addHook('groupisactivecheckbox'); // The "use ..." checkbox in editgroupinfo
+ $this->_addHook('groupisactivecheckboxpost');
+ $this->_addHook('groupmenu');
+ $this->_addHook('project_admin_plugins');
}
- function CallHook ($hookname, &$params) {
+ function CallHook($hookname, &$params) {
switch ($hookname) {
case 'headermenu': {
$this->getHeaderLink();
echo '<li>'.$this->getAdminOptionLink().'</li>';
break;
}
+ case 'groupmenu': {
+ $this->getGroupLink($params);
+ break;
+ }
+ case 'project_admin_plugins': {
+ $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>';
+ }
+ break;
+ }
}
}
}
/**
+ * getGroupLink - update the links before generate the tab.
+ *
+ * @param array hook params array
+ * @return bool true...
+ */
+ function getGroupLink($params) {
+ $availableLinks = $this->getAvailableLinks('groupmenu');
+ foreach ($availableLinks as $link) {
+ if ($link['is_enable']) {
+ switch ($link['linktype']) {
+ case 'url': {
+ $params['DIRS'][] = $link['url'];
+ $params['TITLES'][] = $link['name'];
+ $params['TOOLTIPS'][] = $link['description'];
+ break;
+ }
+ case 'htmlcode': {
+ $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']) {
+ $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['TITLES'][] = $link['name'];
+ $params['TOOLTIPS'][] = $link['description'];
+ if ($params['toptab'] == '/plugins/'.$this->name.'/?type=iframeview&group_id='.$params['group'].'&pageid='.$link['id_headermenu']) {
+ $params['selected'] = (count($params['DIRS'])-1);
+ }
+ break;
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
* getAvailableLinks - get all the links from the db of certain kind
*
* @param string the type of menu links search in db
* @return array the available links
*/
function getAvailableLinks($linkmenu) {
- $links = db_query_params('select * FROM plugin_headermenu where linkmenu = $1', array($linkmenu));
+ $links = db_query_params('select * FROM plugin_headermenu where linkmenu = $1 order by ordering asc', array($linkmenu));
$availableLinks = array();
while ($arr = db_fetch_array($links)) {
$availableLinks[] = $arr;
}
/**
+ * setLinksOrder - set the linkOrder for a set of links id
+ *
+ * @param array $linksOrder array of ordered links id
+ * @return bool success or not
+ */
+ function setLinksOrder($linksOrder) {
+ for ($i =0; $i < count($linksOrder); $i++) {
+ $res = db_query_params('update plugin_headermenu set ordering = $1 where id_headermenu = $2', array($i, $linksOrder[$i]));
+ if (!$res)
+ return false;
+ }
+ return true;
+ }
+
+ /**
* addLink - add a new valid link
*
* @param string $url the url
return false;
}
+ /**
+ * updateLinkStatus - update the link status
+ *
+ * @param int $idLink the link id
+ * @param int $linkStatus the new status of the link id
+ * @return bool success or not
+ */
function updateLinkStatus($idLink, $linkStatus) {
$res = db_query_params('update plugin_headermenu set is_enable = $1 where id_headermenu = $2', array($linkStatus, $idLink));
if ($res) {
return false;
}
+ /**
+ * getLink - get all informations about a link
+ *
+ * @param int $idLink the link id
+ * @return array the link informations
+ */
function getLink($idLink) {
$res = db_query_params('select * from plugin_headermenu where id_headermenu = $1', array($idLink));
if (db_numrows($res) == 1) {
*/
function pageView($pageid) {
$link = $this->getLink($pageid);
- return $link['htmlcode'];
+ if ($link) {
+ return $link['htmlcode'];
+ } else {
+ return '<p class="error" >'._('Cannot retrieve the page').'</p>';
+ }
}
/**
+ * iframeView - display the iframe
+ *
+ * @param int the iframe id
+ * @return string the html code
+ */
+ function iframeView($pageid) {
+ $link = $this->getLink($pageid);
+ if ($link) {
+ return '<iframe src="'.rtrim($link['url'],'/').'" frameborder="0" height="600px" width="100%"></iframe>';
+ } else {
+ return '<p class="error" >'._('Cannot retrieve the page').'</p>';
+ }
+ }
+
+ /**
* getHeader - initialize header and js
*
* @param string type : user, project, globaladmin (aka group)
global $gfwww;
require_once($gfwww.'admin/admin_utils.php');
html_use_jquery();
+ html_use_jqueryui();
use_javascript('scripts/HeaderMenuController.js');
use_javascript('/js/sortable.js');
site_admin_header(array('title'=>_('Site Global Menu Admin'), 'toptab' => ''));
$returned = true;
break;
}
- case 'pageview': {
+ case 'pageview':
+ case 'iframeview': {
$link = $this->getLink($this->pageid);
- site_header(array('title'=> $link['name'], 'toptab' => '/plugins/headermenu/?pageview&pageid='.$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['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));
+ }
+ $returned = true;
+ break;
+ }
+ case 'projectadmin': {
+ html_use_jquery();
+ html_use_jqueryui();
+ use_javascript('scripts/HeaderMenuController.js');
+ use_javascript('/js/sortable.js');
+ $group_id = getIntFromRequest('group_id');
+ $params['toptab'] = 'admin';
+ $params['group'] = $group_id;
+ $params['title'] = _('Project groupmenu Admin');
+ site_project_header($params);
$returned = true;
break;
}
}
/**
+ * getProjectAdminView - display the Project Admin View
+ *
+ * @return bool true
+ */
+ function getProjectAdminView() {
+ global $gfplugins;
+ $user = session_get_user();
+ include $gfplugins.$this->name.'/view/admin/viewProjectConfiguration.php';
+ return true;
+ }
+
+ /**
* getPluginDescription - display the description of this plugin in pluginman admin page
*
* @return string the description
*/
function getPluginDescription() {
- return _('Get the ability to set new links next to the login menu (headermenu) or in the main menu (outermenu).');
+ return _('Get the ability to set new links next to the login menu (headermenu), in the main menu (outermenu) or in the project menu (groupmenu).');
}
}
--- /dev/null
+UPDATE plugin_headermenu SET linktype = 'url' where linktype = 'URL';
+ALTER TABLE plugin_headermenu ADD COLUMN ordering integer DEFAULT 0 NOT NULL;
/**
* headermenuPlugin Class
*
- * Copyright 2012 Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
global $HTML;
global $headermenu;
+global $type;
-session_require_global_perm('forge_admin');
$linkId = getIntFromRequest('linkid');
?>
controllerHeaderMenu = new EditHeaderMenuController({
inputHtmlCode: jQuery('#typemenu_htmlcode'),
inputURL: jQuery('#typemenu_url'),
+ inputURLIframe: jQuery('#typemenu_iframe'),
inputHeader: jQuery('#linkmenu_headermenu'),
inputOuter: jQuery('#linkmenu_outermenu'),
trHtmlCode: jQuery('#htmlcode'),
<?php
$linkValues = $headermenu->getLink($linkId);
if (is_array($linkValues)) {
- echo '<form method="POST" name="updateLink" action="index.php?type=globaladmin&action=updateLinkValue">';
+ echo '<form method="POST" name="updateLink" action="index.php?type='.$type.'&action=updateLinkValue">';
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 '<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>';
+ if ($type == 'globaladmin') {
+ 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');
+ $vals = array('url', 'htmlcode');
+ }
echo '<td>'._('Menu Type').'</td><td>';
- $texts = array('URL', 'New Page');
- $vals = array('url', 'htmlcode');
+ if ($type == 'projectadmin') {
+ $texts = array('URL', 'URL as iframe', 'New 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 '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
}
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 '</tr><tr id="urlcode" style="display:none" >';
+ 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>';
echo '<input type="hidden" name="linkid" value="'.$linkId.'" />';
echo '<input type="submit" value="'. _('Update') .'" />';
- echo '<a href="/plugins/'.$headermenu->name.'/?type=globaladmin"><input type="button" value="'. _('Cancel') .'" /></a>';
+ echo '<a href="/plugins/'.$headermenu->name.'/?type='.$type.'"><input type="button" value="'. _('Cancel') .'" /></a>';
echo '</td>';
echo $HTML->boxBottom();
echo '</tr></table>';
echo '</form>';
} else {
$error_msg = _('Cannot retrieve value for this link:').' '.$linkId;
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));
}
<?php
/**
- * headermenuPlugin Class
+ * headermenu : viewGlobalConfiguration page
*
- * Copyright 2012 Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
global $HTML;
global $headermenu;
-session_require_global_perm('forge_admin');
?>
<script language="Javascript" type="text/javascript">//<![CDATA[
inputHeader: jQuery('#linkmenu_headermenu'),
inputOuter: jQuery('#linkmenu_outermenu'),
trHtmlCode: jQuery('#htmlcode'),
- trUrlCode: jQuery('#urlcode')
- });
+ trUrlCode: jQuery('#urlcode'),
+ tableOutTbLink: jQuery('.sortable_outermenu_listlinks tbody'),
+ tableHeaTbLink: jQuery('.sortable_headermenu_listlinks tbody'),
+ validOutButton: jQuery('#linkorderoutervalidatebutton'),
+ validHeaButton: jQuery('#linkorderheadervalidatebutton'),
+ });
});
//]]></script>
<?php
-$linksArray = $headermenu->getAllAvailableLinks();
-if (sizeof($linksArray)) {
- echo $HTML->boxTop(_('Manage available links'));
- $tabletop = array(_('Menu Location'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
- $classth = array('', '','','','','unsortable');
+$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>';
+}
+if (sizeof($linksHeaderMenuArray)) {
+ echo $HTML->boxTop(_('Manage available links in headermenu'));
+ $tabletop = array(_('Order'), _('Menu 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>';
- echo '<td>'.htmlspecialchars($link['linkmenu']).'</td>';
+ foreach ($linksHeaderMenuArray as $link) {
+ echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
+ if (strlen($link['url']) > 0) {
+ echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
+ } else {
+ echo '<td>'._('static html code').'</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>';
+ } 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 '<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>';
+} else {
+ echo '<p class="information">'._('No links 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'));
+ $classth = array('', '', '', '', '', 'unsortable');
+ echo $HTML->listTableTop($tabletop, false, 'sortable_outermenu_listlinks', 'sortable', $classth);
+ foreach ($linksOuterMenuArray as $link) {
+ echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
if (strlen($link['url']) > 0) {
echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
} else {
}
echo $HTML->listTableBottom();
echo $HTML->boxBottom();
+ echo '<input type="button" id="linkorderoutervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
echo '</br>';
+} else {
+ echo '<p class="information">'._('No links available for outermenu').'</p>';
}
+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'));
--- /dev/null
+<?php
+/**
+ * headermenu : viewProjectConfiguration page
+ *
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $HTML;
+global $headermenu;
+global $group_id;
+
+?>
+
+<script language="Javascript" type="text/javascript">//<![CDATA[
+var controllerGroupMenu;
+
+jQuery(document).ready(function() {
+ controllerGroupMenu = new GroupMenuController({
+ inputHtmlCode: jQuery('#typemenu_htmlcode'),
+ inputURL: jQuery('#typemenu_url'),
+ trHtmlCode: jQuery('#htmlcode'),
+ trUrlCode: jQuery('#urlcode'),
+ trIframeView: jQuery('#iframe'),
+ tableTbodyLink: jQuery('#sortable tbody'),
+ validateButton: jQuery('#linkordervalidatebutton'),
+ groupId: '<?php echo $group_id ?>',
+ headerMenuUrl: '<?php util_make_uri("/plugins/headermenu") ?>'
+ });
+});
+
+//]]></script>
+
+<?php
+$linksArray = $headermenu->getAvailableLinks('groupmenu');
+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'));
+ $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>';
+ if (strlen($link['url']) > 0) {
+ echo '<td>'._('URL');
+ if ($link['linktype'] == 'iframe') {
+ echo ' '._('displayed as iframe');
+ }
+ echo ' ('.htmlspecialchars($link['url']).')</td>';
+ } else {
+ echo '<td>'._('static html code').'</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=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 '<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 $HTML->listTableBottom();
+ echo $HTML->boxBottom();
+ echo '<input type="button" id="linkordervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
+ echo '</br>';
+}
+
+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 '</tr><tr>';
+echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" /></td>';
+echo '</tr><tr>';
+echo '<td>'._('Menu Type').'</td><td>';
+$texts = array('URL', 'New 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...');
+$params['name'] = 'htmlcode';
+$params['body'] = $body;
+$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" >';
+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 '</tr><tr>';
+echo '<td>';
+echo '<input type="hidden" name="linkmenu" value="groupmenu" />';
+echo '<input type="submit" value="'. _('Add') .'" />';
+echo '</td>';
+echo $HTML->boxBottom();
+echo '</tr></table>';
+echo '</form>';
<?php
/**
- * headermenu plugin
+ * headermenu plugin : index page
*
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
case 'addLink':
case 'updateLinkValue':
case 'deleteLink':
- case 'updateLinkStatus': {
+ case 'updateLinkStatus':
+ case 'validateOrder': {
global $gfplugins;
include($gfplugins.$headermenu->name.'/action/'.$action.'.php');
break;
echo $headermenu->pageView($pageid);
break;
}
+ case 'iframeview': {
+ $pageid = getIntFromRequest('pageid');
+ $headermenu->pageid = $pageid;
+ $headermenu->getHeader($type);
+ echo $headermenu->iframeView($pageid);
+ break;
+ }
+ case 'projectadmin': {
+ if (!session_loggedin()) {
+ exit_not_logged_in();
+ }
+ $group_id = getIntFromRequest('group_id');
+ session_require_perm('project_admin', $group_id);
+ $action = getStringFromRequest('action');
+ $view = getStringFromRequest('view');
+
+ switch ($action) {
+ case 'addLink':
+ case 'updateLinkValue':
+ case 'deleteLink':
+ case 'updateLinkStatus':
+ case 'validateOrder': {
+ global $gfplugins;
+ include($gfplugins.$headermenu->name.'/action/'.$action.'.php');
+ break;
+ }
+ }
+ $headermenu->getHeader($type);
+ switch ($view) {
+ case 'updateLinkValue':
+ global $gfplugins;
+ include($gfplugins.$headermenu->name.'/view/admin/'.$view.'.php');
+ break;
+ default:
+ $headermenu->getProjectAdminView();
+ break;
+ }
+ break;
+ }
}
site_project_footer(array());
/**
* headerMenu Plugin Js Controller
*
- * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
this.initializeView();
};
+GroupMenuController = function(params) {
+ this.params = params;
+ this.bindControls();
+ this.initializeView();
+};
+
HeaderMenuController.prototype =
{
bindControls: function() {
this.params.inputURL.click(jQuery.proxy(this, "htmlUrlView"));
this.params.inputOuter.click(jQuery.proxy(this, "inputHtmlCodeView"));
this.params.inputHeader.click(jQuery.proxy(this, "initializeView"));
+ this.params.validOutButton.click(jQuery.proxy(this, "validateOutLinkOrder"));
+ this.params.validHeaButton.click(jQuery.proxy(this, "validateHeaLinkOrder"));
},
initializeView: function() {
this.params.trHtmlCode.hide();
this.params.trUrlCode.show();
this.params.inputURL.attr('checked', 'checked');
+ if (typeof(this.params.tableOutTbLink) != 'undefined') {
+ this.params.tableOutTbLink.sortable({
+ update: function(event, ui) {
+ jQuery(".sortable_outermenu_listlinks tbody").children().each(function() {
+ if (jQuery(this).index() % 2 === 0) {
+ jQuery(this).attr("class", "even");
+ } else {
+ jQuery(this).attr("class", "odd");
+ }
+ jQuery(this).children(":first").text(jQuery(this).index());
+ });
+ jQuery("#linkorderoutervalidatebutton").show();
+ }
+ });
+ }
+ if (typeof(this.params.tableHeaTbLink) != 'undefined') {
+ this.params.tableHeaTbLink.sortable({
+ update: function(event, ui) {
+ jQuery(".sortable_headermenu_listlinks tbody").children().each(function() {
+ if (jQuery(this).index() % 2 === 0) {
+ jQuery(this).attr("class", "even");
+ } else {
+ jQuery(this).attr("class", "odd");
+ }
+ jQuery(this).children(":first").text(jQuery(this).index());
+ });
+ jQuery("#linkorderheadervalidatebutton").show();
+ }
+ });
+ }
},
htmlCodeView: function() {
inputHtmlCodeView: function() {
this.params.inputHtmlCode.prop('disabled', false);
- }
+ },
+
+ validateOutLinkOrder: function() {
+ var linkOrder = jQuery(".sortable_outermenu_listlinks tbody").sortable('toArray').toString();
+ jQuery.get(this.params.headerMenuUrl, {
+ action: 'validateOrder',
+ linkorder: linkOrder,
+ type: 'globaladmin'
+ });
+ jQuery('#validateLinkFeedback').remove();
+ jQuery('#maindiv').prepend('<p id="validateLinkFeedback" class="feedback">Outermenu Link Order successfully validated</p>');
+ this.params.validOutButton.hide();
+ },
+
+ validateHeaLinkOrder: function() {
+ var linkOrder = jQuery(".sortable_headermenu_listlinks tbody").sortable('toArray').toString();
+ jQuery.get(this.params.headerMenuUrl, {
+ action: 'validateOrder',
+ linkorder: linkOrder,
+ type: 'globaladmin'
+ });
+ jQuery('#validateLinkFeedback').remove();
+ jQuery('#maindiv').prepend('<p id="validateLinkFeedback" class="feedback">Headermenu Link Order successfully validated</p>');
+ this.params.validHeaButton.hide();
+ },
+};
+
+GroupMenuController.prototype =
+{
+ bindControls: function() {
+ this.params.inputHtmlCode.click(jQuery.proxy(this, "htmlCodeView"));
+ this.params.inputURL.click(jQuery.proxy(this, "htmlUrlView"));
+ this.params.validateButton.click(jQuery.proxy(this, "validateProjectLinkOrder"));
+ },
+
+ initializeView: function() {
+ this.params.trHtmlCode.hide();
+ this.params.trUrlCode.show();
+ this.params.inputURL.attr('checked', 'checked');
+ if (typeof(this.params.tableTbodyLink) != 'undefined') {
+ this.params.tableTbodyLink.sortable({
+ update: function(event, ui) {
+ jQuery("#sortable tbody").children().each(function() {
+ if (jQuery(this).index() % 2 === 0) {
+ jQuery(this).attr("class", "even");
+ } else {
+ jQuery(this).attr("class", "odd");
+ }
+ jQuery(this).children(":first").text(jQuery(this).index());
+ });
+ jQuery("#linkordervalidatebutton").show();
+ }
+ });
+ }
+ },
+
+ htmlCodeView: function() {
+ this.params.trHtmlCode.show();
+ this.params.trUrlCode.hide();
+ this.params.trIframeView.hide();
+ },
+
+ htmlUrlView: function() {
+ this.params.trHtmlCode.hide();
+ this.params.trUrlCode.show();
+ this.params.trIframeView.show();
+ },
+
+ inputHtmlCodeView: function() {
+ this.params.inputHtmlCode.prop('disabled', false);
+ },
+
+ validateProjectLinkOrder: function() {
+ var linkOrder = jQuery("#sortable tbody").sortable('toArray').toString();
+ jQuery.get(this.params.headerMenuUrl, {
+ group_id: this.params.groupId,
+ action: 'validateOrder',
+ linkorder: linkOrder,
+ type: 'projectadmin'
+ });
+ jQuery('#validateLinkFeedback').remove();
+ jQuery('#maindiv').prepend('<p id="validateLinkFeedback" class="feedback">Link Order successfully validated</p>');
+ this.params.validateButton.hide();
+ },
};
EditHeaderMenuController.prototype =
bindControls: function() {
this.params.inputHtmlCode.click(jQuery.proxy(this, "htmlCodeView"));
this.params.inputURL.click(jQuery.proxy(this, "htmlUrlView"));
- this.params.inputOuter.click(jQuery.proxy(this, "inputHtmlCodeView"));
- this.params.inputHeader.click(jQuery.proxy(this, "headerView"));
+ if (typeof(this.params.inputOuter) != 'undefined') {
+ this.params.inputOuter.click(jQuery.proxy(this, "inputHtmlCodeView"));
+ }
+ if (typeof(this.params.inputHeader) != 'undefined') {
+ this.params.inputHeader.click(jQuery.proxy(this, "headerView"));
+ }
+ if (typeof(this.params.inputURLIframe) != 'undefined') {
+ this.params.inputURLIframe.click(jQuery.proxy(this, "htmlUrlView"));
+ }
},
initializeView: function() {
this.params.trHtmlCode.hide();
this.params.trUrlCode.show();
}
+ if (typeof(this.params.inputURLIframe) != 'undefined') {
+ if (this.params.inputURLIframe.attr("checked")) {
+ this.params.trHtmlCode.hide();
+ this.params.trUrlCode.show();
+ }
+ }
},
htmlUrlView: function() {
* Copyright 2010, Antoine Mercadal - Capgemini
* Copyright 2010, Marc-Etienne Vargenau, Alcatel-Lucent
* Copyright 2011, Franck Villaume - Capgemini
- * Copyright 2011 - 2012, Franck Villaume - TrivialDev
+ * Copyright 2011-2013, Franck Villaume - TrivialDev
* Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge. FusionForge is free software;
jQuery.noConflict();
jQuery(window).load(function(){
jQuery(".quicknews").hide();
+ setTimeout("jQuery('.feedback').hide('slow')", 5000);
+ setInterval(function() {
setTimeout("jQuery('.feedback').hide('slow')", 5000);
+ }, 5000);
});
//]]></script>
<?php