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'),
50 $linksHeaderMenuArray = $headermenu->getAvailableLinks('headermenu');
51 $linksOuterMenuArray = $headermenu->getAvailableLinks('outermenu');
53 if (sizeof($linksHeaderMenuArray) || sizeof($linksOuterMenuArray)) {
54 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>';
56 if (sizeof($linksHeaderMenuArray)) {
57 echo $HTML->boxTop(_('Manage available links in headermenu'));
58 $tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
59 $classth = array('', '', '', '', '', 'unsortable');
60 echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
61 foreach ($linksHeaderMenuArray as $link) {
62 echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
63 if (strlen($link['url']) > 0) {
64 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
66 echo '<td>'._('static html code').'</td>';
68 echo '<td>'.htmlspecialchars($link['name']).'</td>';
69 echo '<td>'.htmlspecialchars($link['description']).'</td>';
70 if ($link['is_enable']) {
71 echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
72 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>';
74 echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
75 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>';
77 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>';
78 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>';
82 echo $HTML->listTableBottom();
83 echo $HTML->boxBottom();
84 echo '<input type="button" id="linkorderheadervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
87 echo '<p class="information">'._('No links available for headermenu').'</p>';
91 if (sizeof($linksOuterMenuArray)) {
92 echo $HTML->boxTop(_('Manage available links in outermenu'));
93 $tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
94 $classth = array('', '', '', '', '', 'unsortable');
95 echo $HTML->listTableTop($tabletop, false, 'sortable_outermenu_listlinks', 'sortable', $classth);
96 foreach ($linksOuterMenuArray as $link) {
97 echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
98 if (strlen($link['url']) > 0) {
99 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
101 echo '<td>'._('static html code').'</td>';
103 echo '<td>'.htmlspecialchars($link['name']).'</td>';
104 echo '<td>'.htmlspecialchars($link['description']).'</td>';
105 if ($link['is_enable']) {
106 echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
107 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>';
109 echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
110 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>';
112 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>';
113 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>';
117 echo $HTML->listTableBottom();
118 echo $HTML->boxBottom();
119 echo '<input type="button" id="linkorderoutervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
122 echo '<p class="information">'._('No links available for outermenu').'</p>';
125 echo '<p class="information">'._('You can add specific tabs in outermenu (main tab) or headermenu (next to the login) with the form below.').'</p>';
126 echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
128 echo $HTML->boxTop(_('Add a new link'));
129 echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
131 echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" /></td>';
133 echo '<td>'._('Menu Location').'</td><td>';
134 $vals = array('headermenu', 'outermenu');
135 $texts = array('headermenu', 'outermenu');
136 $select_name = 'linkmenu';
137 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'headermenu', false);
140 echo '<td>'._('Menu Type').'</td><td>';
141 $texts = array('URL', 'New Page');
142 $vals = array('url', 'htmlcode');
143 $select_name = 'typemenu';
144 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'url', false);
146 echo '</tr><tr id="htmlcode" style="display:none">';
147 echo '<td>'._('Your HTML Code.').'</td><td>';
148 $GLOBALS['editor_was_set_up'] = false;
149 $body = _('Just paste your code here...');
150 $params['name'] = 'htmlcode';
151 $params['body'] = $body;
152 $params['width'] = "800";
153 $params['height'] = "500";
154 $params['user_id'] = user_getid();
155 plugin_hook("text_editor", $params);
156 if (!$GLOBALS['editor_was_set_up']) {
157 echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
159 unset($GLOBALS['editor_was_set_up']);
160 echo '</td></tr><tr id="urlcode" >';
161 echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" /></td>';
164 echo '<input type="submit" value="'. _('Add') .'" />';
166 echo $HTML->boxBottom();
167 echo '</tr></table>';