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 language="Javascript" 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('#htmlcode'),
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 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>';
60 if (sizeof($linksHeaderMenuArray)) {
61 echo $HTML->boxTop(_('Manage available links in headermenu'));
62 $tabletop = array(_('Order'), _('Menu 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>'.$link['ordering'].'</td>';
67 if (strlen($link['url']) > 0) {
68 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
70 echo '<td>'._('static html code').'</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 $HTML->boxBottom();
88 echo '<input type="button" id="linkorderheadervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
91 echo '<p class="information">'._('No links available for headermenu').'</p>';
95 if (sizeof($linksOuterMenuArray)) {
96 echo $HTML->boxTop(_('Manage available links in outermenu'));
97 $tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
98 $classth = array('', '', '', '', '', 'unsortable');
99 echo $HTML->listTableTop($tabletop, false, 'sortable_outermenu_listlinks', 'sortable', $classth);
100 foreach ($linksOuterMenuArray as $link) {
101 echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
102 if (strlen($link['url']) > 0) {
103 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
105 echo '<td>'._('static html code').'</td>';
107 echo '<td>'.htmlspecialchars($link['name']).'</td>';
108 echo '<td>'.htmlspecialchars($link['description']).'</td>';
109 if ($link['is_enable']) {
110 echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
111 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>';
113 echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
114 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>';
116 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>';
117 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>';
121 echo $HTML->listTableBottom();
122 echo $HTML->boxBottom();
123 echo '<input type="button" id="linkorderoutervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
126 echo '<p class="information">'._('No links available for outermenu').'</p>';
129 echo '<p class="information">'._('You can add specific tabs in outermenu (main tab) or headermenu (next to the login) with the form below.').'</p>';
130 echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
132 echo $HTML->boxTop(_('Add a new link'));
133 echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
135 echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" /></td>';
137 echo '<td>'._('Menu Location').'</td><td>';
138 $vals = array('headermenu', 'outermenu');
139 $texts = array('headermenu', 'outermenu');
140 $select_name = 'linkmenu';
141 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'headermenu', false);
144 echo '<td>'._('Menu Type').'</td><td>';
145 $texts = array('URL', 'New Page');
146 $vals = array('url', 'htmlcode');
147 $select_name = 'typemenu';
148 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'url', false);
150 echo '</tr><tr id="htmlcode" style="display:none">';
151 echo '<td>'._('Your HTML Code.').'</td><td>';
152 $GLOBALS['editor_was_set_up'] = false;
153 $body = _('Just paste your code here...');
154 $params['name'] = 'htmlcode';
155 $params['body'] = $body;
156 $params['width'] = "800";
157 $params['height'] = "500";
158 $params['user_id'] = user_getid();
159 plugin_hook("text_editor", $params);
160 if (!$GLOBALS['editor_was_set_up']) {
161 echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
163 unset($GLOBALS['editor_was_set_up']);
164 echo '</td></tr><tr id="urlcode" >';
165 echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" /></td>';
168 echo '<input type="submit" value="'. _('Add') .'" />';
170 echo $HTML->boxBottom();
171 echo '</tr></table>';