3 * headermenu : viewGlobalConfiguration page
5 * Copyright 2012-2013, Franck Villaume - TrivialDev
6 * http://fusionforge.org
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 <script type="text/javascript">//<![CDATA[
30 var controllerHeaderMenu;
32 jQuery(document).ready(function() {
33 controllerHeaderMenu = new HeaderMenuController({
34 inputHtmlCode: jQuery('#typemenu_htmlcode'),
35 inputURL: jQuery('#typemenu_url'),
36 inputHeader: jQuery('#linkmenu_headermenu'),
37 inputOuter: jQuery('#linkmenu_outermenu'),
38 trHtmlCode: jQuery('#trhtmlcode'),
39 trUrlCode: jQuery('#urlcode'),
40 tableOutTbLink: jQuery('.sortable_outermenu_listlinks tbody'),
41 tableHeaTbLink: jQuery('.sortable_headermenu_listlinks tbody'),
42 validOutButton: jQuery('#linkorderoutervalidatebutton'),
43 validHeaButton: jQuery('#linkorderheadervalidatebutton'),
44 validMessOut: '<?php echo _('Outermenu Link Order successfully validated') ?>',
45 validMessHea: '<?php echo _('Headermenu Link Order successfully validated') ?>',
46 errMessOut: '<?php echo _('Error in Outermenu Link Order validation') ?>',
47 errMessHea: '<?php echo _('Error in Headermenu Link Order validation') ?>'
54 $linksHeaderMenuArray = $headermenu->getAvailableLinks('headermenu');
55 $linksOuterMenuArray = $headermenu->getAvailableLinks('outermenu');
57 if (sizeof($linksHeaderMenuArray) || sizeof($linksOuterMenuArray)) {
58 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>';
60 if (sizeof($linksHeaderMenuArray)) {
61 echo '<h2>'._('Manage available tabs in headermenu').'</h2>';
62 $tabletop = array(_('Order'), _('Tab Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
63 $classth = array('', '', '', '', '', 'unsortable');
64 echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
65 foreach ($linksHeaderMenuArray as $link) {
66 echo '<tr id="'.$link['id_headermenu'].'" ><td class="align-center">'.$link['ordering'].'</td>';
67 if (strlen($link['url']) > 0) {
68 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
70 echo '<td>'._('HTML Page').'</td>';
72 echo '<td>'.htmlspecialchars($link['name']).'</td>';
73 echo '<td>'.htmlspecialchars($link['description']).'</td>';
74 if ($link['is_enable']) {
75 echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
76 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>';
78 echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
79 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>';
81 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>';
82 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>';
86 echo $HTML->listTableBottom();
87 echo '<input type="button" id="linkorderheadervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
90 echo '<p class="information">'._('No tabs available for headermenu').'</p>';
93 if (sizeof($linksOuterMenuArray)) {
94 echo '<h2>'._('Manage available tabs in outermenu').'</h2>';
95 $tabletop = array(_('Order'), _('Tab Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
96 $classth = array('', '', '', '', '', 'unsortable');
97 echo $HTML->listTableTop($tabletop, false, 'sortable_outermenu_listlinks', 'sortable', $classth);
98 foreach ($linksOuterMenuArray as $link) {
99 echo '<tr id="'.$link['id_headermenu'].'" ><td class="align-center">'.$link['ordering'].'</td>';
100 if (strlen($link['url']) > 0) {
101 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
103 echo '<td>'._('HTML Page').'</td>';
105 echo '<td>'.htmlspecialchars($link['name']).'</td>';
106 echo '<td>'.htmlspecialchars($link['description']).'</td>';
107 if ($link['is_enable']) {
108 echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
109 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>';
111 echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
112 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>';
114 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>';
115 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>';
119 echo $HTML->listTableBottom();
120 echo '<input type="button" id="linkorderoutervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
123 echo '<p class="information">'._('No tabs available for outermenu').'</p>';
126 echo '<h2>'._('Add new tab').'</h2>';
127 echo '<p class="information">'._('You can add specific tabs in outermenu (main tab) or headermenu (next to the login) with the form below.').'</p>';
128 echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
129 echo '<table class="infotable"><tr>';
130 echo '<td>'._('Displayed Name')._(':').'</td><td><input required="required" name="name" type="text" maxlength="255" /></td>';
132 echo '<td>'._('Description')._(':').'</td><td><input name="description" type="text" maxlength="255" /></td>';
134 echo '<td>'._('Menu Location')._(':').'</td><td>';
135 $vals = array('headermenu', 'outermenu');
136 $texts = array('headermenu', 'outermenu');
137 $select_name = 'linkmenu';
138 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'headermenu', false);
141 echo '<td>'._('Tab Type')._(':').'</td><td>';
142 $texts = array('URL', 'HTML Page');
143 $vals = array('url', 'htmlcode');
144 $select_name = 'typemenu';
145 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'url', false);
147 echo '</tr><tr id="trhtmlcode" style="display:none">';
148 echo '<td>'._('HTML Page')._(':').'</td><td>';
149 $GLOBALS['editor_was_set_up'] = false;
150 $body = _('Just paste your code here...');
151 $params['name'] = 'htmlcode';
152 $params['body'] = $body;
153 $params['width'] = "800";
154 $params['height'] = "500";
155 $params['user_id'] = user_getid();
156 plugin_hook("text_editor", $params);
157 if (!$GLOBALS['editor_was_set_up']) {
158 echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
160 unset($GLOBALS['editor_was_set_up']);
161 echo '</td></tr><tr id="urlcode" >';
162 echo '<td>'._('URL')._(':').'</td><td><input name="link" type="text" maxlength="255" /></td>';
164 echo '<td colspan="2">';
165 echo '<input type="submit" value="'. _('Add') .'" />';
167 echo '</tr></table>';