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 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('#trhtmlcode'),
49 trUrlCode: jQuery('#urlcode')
56 $linkValues = $headermenu->getLink($linkId);
57 if (is_array($linkValues)) {
58 echo '<h2>'._('Update this link')."</h2>\n";
59 echo '<form method="POST" name="updateLink" action="'.$action_url.'">';
60 echo '<table class="infotable">'."\n".'<tr>';
61 echo '<td>'._('Displayed Name').utils_requiredField()._(':').'</td><td><input required="required" name="name" type="text" maxlength="255" value="'.$linkValues['name'].'" /></td>';
62 echo '</tr>'."\n".'<tr>';
63 echo '<td>'._('Description')._(':').'</td><td><input name="description" type="text" maxlength="255" value="'.$linkValues['description'].'" /></td>';
64 echo '</tr>'."\n".'<tr>';
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', 'HTML Page');
74 $vals = array('url', 'htmlcode');
76 echo '<td>'._('Tab Type')._(':').'</td><td>';
77 if ($type == 'projectadmin') {
78 $texts = array('URL', 'URL as iframe', 'HTML 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>'."\n".'<tr id="trhtmlcode" style="display:none">';
86 echo '<td>'._('HTML Page').utils_requiredField()._(':').'</td><td>';
88 $params['name'] = 'htmlcode';
89 $params['body'] = $linkValues['htmlcode'];
90 $params['width'] = "800";
91 $params['height'] = "500";
92 $params['content'] = '<textarea name="htmlcode" rows="5" cols="80">'.$params['body'].'</textarea>';
93 plugin_hook_by_reference("text_editor", $params);
94 echo $params['content'];
96 echo '</td></tr>'."\n".'<tr id="urlcode" style="display:none" >';
97 echo '<td>'._('URL').utils_requiredField()._(':').'</td><td><input name="link" type="text" maxlength="255" value="'.$linkValues['url'].'" /></td>';
101 echo '<input type="hidden" name="linkid" value="'.$linkId.'" />';
102 echo '<input type="submit" value="'. _('Update') .'" />';
103 echo '<input type="submit" name="submit" value="'. _('Cancel') .'" formnovalidate="formnovalidate" />';
106 echo utils_requiredField().' '._('Indicates required fields.');
108 $error_msg = _('Cannot retrieve value for this link:').' '.$linkId;
109 session_redirect($redirect_url.'&error_msg='.urlencode($error_msg));