3 * headermenu plugin : updateLinkValue view
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 $linkId = getIntFromRequest('linkid');
30 $redirect_url = '/plugins/'.$headermenu->name.'/?type='.$type;
31 $action_url = 'index.php?type='.$type.'&action=updateLinkValue';
32 if (isset($group_id) && $group_id) {
33 $redirect_url .= '&group_id='.$group_id;
34 $action_url .= '&group_id='.$group_id;
38 <script language="Javascript" type="text/javascript">//<![CDATA[
39 var controllerHeaderMenu;
41 jQuery(document).ready(function() {
42 controllerHeaderMenu = new EditHeaderMenuController({
43 inputHtmlCode: jQuery('#typemenu_htmlcode'),
44 inputURL: jQuery('#typemenu_url'),
45 inputURLIframe: jQuery('#typemenu_iframe'),
46 inputHeader: jQuery('#linkmenu_headermenu'),
47 inputOuter: jQuery('#linkmenu_outermenu'),
48 trHtmlCode: jQuery('#htmlcode'),
49 trUrlCode: jQuery('#urlcode')
56 $linkValues = $headermenu->getLink($linkId);
57 if (is_array($linkValues)) {
58 echo '<form method="POST" name="updateLink" action="'.$action_url.'">';
60 echo $HTML->boxTop(_('Update this link'));
61 echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" value="'.$linkValues['name'].'" /></td>';
63 echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" value="'.$linkValues['description'].'" /></td>';
65 if ($type == 'globaladmin') {
66 echo '<td>'._('Menu Location').'</td><td>';
67 $vals = array('headermenu', 'outermenu');
68 $texts = array('headermenu', 'outermenu');
69 $select_name = 'linkmenu';
70 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linkmenu'], false);
73 $texts = array('URL', 'New Page');
74 $vals = array('url', 'htmlcode');
76 echo '<td>'._('Menu Type').'</td><td>';
77 if ($type == 'projectadmin') {
78 $texts = array('URL', 'URL as iframe', 'New Page');
79 $vals = array('url', 'iframe', 'htmlcode');
80 echo '<input type="hidden" name="linkmenu" value="groupmenu" />';
82 $select_name = 'typemenu';
83 echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linktype'], false);
85 echo '</tr><tr id="htmlcode" style="display:none">';
86 echo '<td>'._('Your HTML Code.').'</td><td>';
87 $GLOBALS['editor_was_set_up'] = false;
88 $body = $linkValues['htmlcode'];
89 $params['name'] = 'htmlcode';
90 $params['body'] = $body;
91 $params['width'] = "800";
92 $params['height'] = "500";
93 $params['user_id'] = user_getid();
94 plugin_hook("text_editor", $params);
95 if (!$GLOBALS['editor_was_set_up']) {
96 echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
98 unset($GLOBALS['editor_was_set_up']);
99 echo '</td></tr><tr id="urlcode" style="display:none" >';
100 echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" value="'.$linkValues['url'].'" /></td>';
103 echo '<input type="hidden" name="linkid" value="'.$linkId.'" />';
104 echo '<input type="submit" value="'. _('Update') .'" />';
105 echo '<a href="'.$redirect_url.'"><input type="button" value="'. _('Cancel') .'" /></a>';
107 echo $HTML->boxBottom();
108 echo '</tr></table>';
111 $error_msg = _('Cannot retrieve value for this link:').' '.$linkId;
112 session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));