3 * headermenu : viewProjectConfiguration page
5 * Copyright 2012-2014,2016, 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.
28 echo html_ao('script', array('type' => 'text/javascript'));
31 var controllerGroupMenu;
33 jQuery(document).ready(function() {
34 controllerGroupMenu = new GroupMenuController({
35 inputHtmlCode: jQuery('#typemenu_htmlcode'),
36 inputURL: jQuery('#typemenu_url'),
37 trHtmlCode: jQuery('#trhtmlcode'),
38 trUrlCode: jQuery('#urlcode'),
39 trIframeView: jQuery('#iframe'),
40 tableTbodyLink: jQuery('#sortable').find('tbody'),
41 validateButton: jQuery('#linkordervalidatebutton'),
42 groupId: '<?php echo $group_id ?>',
43 headerMenuUrl: '<?php echo util_make_uri('/plugins/'.$headermenu->name) ?>'
49 echo html_ac(html_ap() - 1);
50 $linksArray = $headermenu->getAvailableLinks('groupmenu', $group_id);
51 if (sizeof($linksArray)) {
52 echo html_e('h2', array(), _('Manage available tabs'));
53 echo $HTML->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.'));
54 $tabletop = array(_('Order'), _('Tab Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
55 $classth = array('', '', '', '', '', 'unsortable');
56 echo $HTML->listTableTop($tabletop, array(), 'sortable_headermenu_listlinks', 'sortable', $classth);
57 foreach ($linksArray as $link) {
59 $cells[] = array($link['ordering'], 'class' => 'align-center');
60 if (strlen($link['url']) > 0) {
62 if ($link['linktype'] == 'iframe') {
63 $content .= ' '._('displayed as iframe');
65 $content .= ' ('.htmlspecialchars($link['url']).')';
67 $content = _('HTML Page');
69 $cells[][] = $content;
70 $cells[][] = htmlspecialchars($link['name']);
71 $cells[][] = htmlspecialchars($link['description']);
72 if ($link['is_enable']) {
73 $cells[][] = html_image('docman/validate.png', 22, 22, array('alt'=>_('link is on'), 'title'=>_('link is on')));
74 $actionsLinks = util_make_link('/plugins/'.$headermenu->name.'?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'))), array('title' => _('Desactivate this link')));
76 $cells[][] = $HTML->getRemovePic('', '', array('alt'=>_('link is off'), 'title'=>_('link is off')));
77 $actionsLinks = util_make_link('/plugins/'.$headermenu->name.'?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'))), array('title' => _('Activate this link')));
79 $actionsLinks .= util_make_link('/plugins/'.$headermenu->name.'?type=projectadmin&group_id='.$group_id.'&view=updateLinkValue&linkid='.$link['id_headermenu'], $HTML->getEditFilePic(_('Edit this link'), 'editdocument'), array('title' => _('Edit this link')));
80 $actionsLinks .= util_make_link('/plugins/'.$headermenu->name.'?type=projectadmin&group_id='.$group_id.'&action=deleteLink&linkid='.$link['id_headermenu'], $HTML->getDeletePic(_('Delete this link'), 'trashdir'), array('title' => _('Delete this link')));
81 $cells[][] = $actionsLinks;
82 echo $HTML->multiTableRow(array('id' => $link['id_headermenu']), $cells);
84 echo $HTML->listTableBottom();
85 echo html_e('input', array('type' => 'button', 'id' => 'linkordervalidatebutton', 'value' => _('Save Order'), 'class' => 'hide'));
89 echo html_e('h2', array(), _('Add new tab'));
90 echo $HTML->information(_('You can add your own tabs in the menu bar with the form below.'));
91 echo $HTML->openForm(array('method' => 'POST', 'name' => 'addLink', 'action' => '/plugins/'.$headermenu->name.'/?type=projectadmin&group_id='.$group_id.'&action=addLink'));
92 echo $HTML->listTableTop();
94 $cells[] = array(_('Displayed Name').utils_requiredField()._(':'), 'style' => 'text-align:right');
95 $cells[][] = html_e('input', array('required' => 'required', 'name' => 'name', 'type' => 'text', 'maxlength' => 255));
96 echo $HTML->multiTableRow(array(), $cells);
98 $cells[] = array(_('Description')._(':'), 'style' => 'text-align:right');
99 $cells[][] = html_e('input', array('name' => 'description', 'type' => 'text', 'maxlength' => 255));
100 echo $HTML->multiTableRow(array(), $cells);
102 $cells[] = array(_('Tab Type')._(':'), 'style' => 'text-align:right');
103 $texts = array('URL', 'HTML Page');
104 $vals = array('url', 'htmlcode');
105 $select_name = 'typemenu';
106 $cells[][] = html_build_radio_buttons_from_arrays($vals, $texts, $select_name, 'url', false);
107 echo $HTML->multiTableRow(array(), $cells);
109 $cells[] = array(_('HTML Page').utils_requiredField()._(':'), 'style' => 'text-align:right');
110 $params['name'] = 'htmlcode';
111 $params['body'] = _('Just paste your code here...');
112 $params['width'] = "800";
113 $params['height'] = "500";
114 $params['content'] = '<textarea name="htmlcode" rows="5" cols="80">'.$params['body'].'</textarea>';
115 plugin_hook_by_reference("text_editor", $params);
116 $cells[][] = $params['content'];
117 echo $HTML->multiTableRow(array('id' => 'trhtmlcode', 'class' => 'hide'), $cells);
119 $cells[] = array(_('URL').utils_requiredField()._(':'), 'style' => 'text-align:right');
120 $cells[][] = html_e('input', array('name' => 'link', 'type' => 'url', 'maxlength' => 255));
121 echo $HTML->multiTableRow(array('id' => 'urlcode'), $cells);
123 $cells[] = array(_('Display URL as iframe')._(':'), 'style' => 'text-align:right');
124 $cells[][] = html_e('input', array('name' => 'iframeview', 'type' => 'checkbox', 'value' => 1));
125 echo $HTML->multiTableRow(array('id' => 'iframe'), $cells);
127 $cells[] = array(html_e('input', array('type' => 'hidden', 'name' => 'linkmenu', 'value' => 'groupmenu')).html_e('input', array('type' => 'submit', 'value' => _('Add'))), 'colspan' => 2);
128 echo $HTML->multiTableRow(array(), $cells);
129 echo $HTML->listTableBottom();
130 echo $HTML->closeForm();
131 echo $HTML->addRequiredFieldsInfoBox();