3 * headermenuPlugin Class
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.
28 $linkId = getIntFromRequest('linkid');
31 <script language="Javascript" type="text/javascript">//<![CDATA[
32 var controllerHeaderMenu;
34 jQuery(document).ready(function() {
35 controllerHeaderMenu = new EditHeaderMenuController({
36 inputHtmlCode: jQuery('#typemenu_htmlcode'),
37 inputURL: jQuery('#typemenu_url'),
38 inputURLIframe: jQuery('#typemenu_iframe'),
39 inputHeader: jQuery('#linkmenu_headermenu'),
40 inputOuter: jQuery('#linkmenu_outermenu'),
41 trHtmlCode: jQuery('#htmlcode'),
42 trUrlCode: jQuery('#urlcode')
49 $linkValues = $headermenu->getLink($linkId);
50 if (is_array($linkValues)) {
51 echo '<form method="POST" name="updateLink" action="index.php?type='.$type.'&action=updateLinkValue">';
53 echo $HTML->boxTop(_('Update this link'));
54 echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" value="'.$linkValues['name'].'" /></td>';
56 echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" value="'.$linkValues['description'].'" /></td>';
58 if ($type == 'globaladmin') {
59 echo '<td>'._('Menu Location').'</td><td>';
60 $vals = array('headermenu', 'outermenu');
61 $texts = array('headermenu', 'outermenu');
62 $select_name = 'linkmenu';
63 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linkmenu'], false);
66 $texts = array('URL', 'New Page');
67 $vals = array('url', 'htmlcode');
69 echo '<td>'._('Menu Type').'</td><td>';
70 if ($type == 'projectadmin') {
71 $texts = array('URL', 'URL as iframe', 'New Page');
72 $vals = array('url', 'iframe', 'htmlcode');
73 echo '<input type="hidden" name="linkmenu" value="groupmenu" />';
75 $select_name = 'typemenu';
76 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linktype'], false);
78 echo '</tr><tr id="htmlcode" style="display:none">';
79 echo '<td>'._('Your HTML Code.').'</td><td>';
80 $GLOBALS['editor_was_set_up'] = false;
81 $body = $linkValues['htmlcode'];
82 $params['name'] = 'htmlcode';
83 $params['body'] = $body;
84 $params['width'] = "800";
85 $params['height'] = "500";
86 $params['user_id'] = user_getid();
87 plugin_hook("text_editor", $params);
88 if (!$GLOBALS['editor_was_set_up']) {
89 echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
91 unset($GLOBALS['editor_was_set_up']);
92 echo '</td></tr><tr id="urlcode" style="display:none" >';
93 echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" value="'.$linkValues['url'].'" /></td>';
96 echo '<input type="hidden" name="linkid" value="'.$linkId.'" />';
97 echo '<input type="submit" value="'. _('Update') .'" />';
98 echo '<a href="/plugins/'.$headermenu->name.'/?type='.$type.'"><input type="button" value="'. _('Cancel') .'" /></a>';
100 echo $HTML->boxBottom();
101 echo '</tr></table>';
104 $error_msg = _('Cannot retrieve value for this link:').' '.$linkId;
105 session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));