3 * headermenu : viewGlobalConfiguration page
5 * Copyright 2012 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 tableTbodyLink: jQuery('#sortable tbody')
47 $linksArray = $headermenu->getAvailableLinks('headermenu');
48 if (sizeof($linksArray)) {
49 echo $HTML->boxTop(_('Manage available links in headermenu'));
50 $tabletop = array( _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
51 $classth = array('','','','','unsortable');
52 echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
53 foreach ($linksArray as $link) {
55 if (strlen($link['url']) > 0) {
56 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
58 echo '<td>'._('static html code').'</td>';
60 echo '<td>'.htmlspecialchars($link['name']).'</td>';
61 echo '<td>'.htmlspecialchars($link['description']).'</td>';
62 if ($link['is_enable']) {
63 echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
64 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>';
66 echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
67 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>';
69 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>';
70 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>';
74 echo $HTML->listTableBottom();
75 echo $HTML->boxBottom();
79 $linksArray = $headermenu->getAvailableLinks('outermenu');
80 if (sizeof($linksArray)) {
81 echo $HTML->boxTop(_('Manage available links in outermenu'));
82 $tabletop = array(_('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
83 $classth = array('','','','','unsortable');
84 echo $HTML->listTableTop($tabletop, false, 'sortable_outermenu_listlinks', 'sortable', $classth);
85 foreach ($linksArray as $link) {
87 if (strlen($link['url']) > 0) {
88 echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
90 echo '<td>'._('static html code').'</td>';
92 echo '<td>'.htmlspecialchars($link['name']).'</td>';
93 echo '<td>'.htmlspecialchars($link['description']).'</td>';
94 if ($link['is_enable']) {
95 echo '<td>'.html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'class'=>'tabtitle', 'title'=>_('link is on'))).'</td>';
96 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>';
98 echo '<td>'.html_image('docman/delete-directory.png', 22, 22, array('alt'=>_('link is off'), 'class'=>'tabtitle', 'title'=>_('link is off'))).'</td>';
99 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>';
101 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>';
102 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>';
106 echo $HTML->listTableBottom();
107 echo $HTML->boxBottom();
111 echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
113 echo $HTML->boxTop(_('Add a new link'));
114 echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" /></td>';
116 echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" /></td>';
118 echo '<td>'._('Menu Location').'</td><td>';
119 $vals = array('headermenu', 'outermenu');
120 $texts = array('headermenu', 'outermenu');
121 $select_name = 'linkmenu';
122 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'headermenu', false);
125 echo '<td>'._('Menu Type').'</td><td>';
126 $texts = array('URL', 'New Page');
127 $vals = array('url', 'htmlcode');
128 $select_name = 'typemenu';
129 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'url', false);
131 echo '</tr><tr id="htmlcode" style="display:none">';
132 echo '<td>'._('Your HTML Code.').'</td><td>';
133 $GLOBALS['editor_was_set_up'] = false;
134 $body = _('Just paste your code here...');
135 $params['name'] = 'htmlcode';
136 $params['body'] = $body;
137 $params['width'] = "800";
138 $params['height'] = "500";
139 $params['user_id'] = user_getid();
140 plugin_hook("text_editor", $params);
141 if (!$GLOBALS['editor_was_set_up']) {
142 echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
144 unset($GLOBALS['editor_was_set_up']);
145 echo '</td></tr><tr id="urlcode" >';
146 echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" /></td>';
149 echo '<input type="submit" value="'. _('Add') .'" />';
151 echo $HTML->boxBottom();
152 echo '</tr></table>';