/**
* headermenuPlugin Class
*
- * Copyright 2012 Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
global $HTML;
global $headermenu;
+global $type;
-session_require_global_perm('forge_admin');
$linkId = getIntFromRequest('linkid');
?>
controllerHeaderMenu = new EditHeaderMenuController({
inputHtmlCode: jQuery('#typemenu_htmlcode'),
inputURL: jQuery('#typemenu_url'),
+ inputURLIframe: jQuery('#typemenu_iframe'),
inputHeader: jQuery('#linkmenu_headermenu'),
inputOuter: jQuery('#linkmenu_outermenu'),
trHtmlCode: jQuery('#htmlcode'),
<?php
$linkValues = $headermenu->getLink($linkId);
if (is_array($linkValues)) {
- echo '<form method="POST" name="updateLink" action="index.php?type=globaladmin&action=updateLinkValue">';
+ echo '<form method="POST" name="updateLink" action="index.php?type='.$type.'&action=updateLinkValue">';
echo '<table><tr>';
echo $HTML->boxTop(_('Update this link'));
echo '<td>'._('Displayed Name').'</td><td><input name="name" type="text" maxsize="255" value="'.$linkValues['name'].'" /></td>';
echo '</tr><tr>';
echo '<td>'._('Description').'</td><td><input name="description" type="text" maxsize="255" value="'.$linkValues['description'].'" /></td>';
echo '</tr><tr>';
- echo '<td>'._('Menu Location').'</td><td>';
- $vals = array('headermenu', 'outermenu');
- $texts = array('headermenu', 'outermenu');
- $select_name = 'linkmenu';
- echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linkmenu'], false);
- echo '</td>';
- echo '</tr><tr>';
+ if ($type == 'globaladmin') {
+ echo '<td>'._('Menu Location').'</td><td>';
+ $vals = array('headermenu', 'outermenu');
+ $texts = array('headermenu', 'outermenu');
+ $select_name = 'linkmenu';
+ echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linkmenu'], false);
+ echo '</td>';
+ echo '</tr><tr>';
+ }
echo '<td>'._('Menu Type').'</td><td>';
- $texts = array('URL', 'New Page');
- $vals = array('url', 'htmlcode');
+ if ($type == 'projectadmin') {
+ $texts = array('URL', 'URL as iframe', 'New Page');
+ $vals = array('url', 'iframe', 'htmlcode');
+ }
+ if ($type == 'globaladmin') {
+ $texts = array('URL', 'New Page');
+ $vals = array('url', 'htmlcode');
+ }
$select_name = 'typemenu';
echo html_build_radio_buttons_from_arrays($vals, $texts, $select_name, $linkValues['linktype'], false);
echo '</td>';
echo '<textarea name="htmlcode" rows="5" cols="80">'.$body.'</textarea>';
}
unset($GLOBALS['editor_was_set_up']);
- echo '</td></tr><tr id="urlcode" >';
- echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" /></td>';
- echo '</tr><tr id="urlcode" style="display:none" >';
+ echo '</td></tr><tr id="urlcode" style="display:none" >';
echo '<td>'._('URL').'</td><td><input name="link" type="text" maxsize="255" value="'.$linkValues['url'].'" /></td>';
echo '</tr><tr>';
echo '<td>';
echo '<input type="hidden" name="linkid" value="'.$linkId.'" />';
echo '<input type="submit" value="'. _('Update') .'" />';
- echo '<a href="/plugins/'.$headermenu->name.'/?type=globaladmin"><input type="button" value="'. _('Cancel') .'" /></a>';
+ echo '<a href="/plugins/'.$headermenu->name.'/?type='.$type.'"><input type="button" value="'. _('Cancel') .'" /></a>';
echo '</td>';
echo $HTML->boxBottom();
echo '</tr></table>';
echo '</form>';
} else {
$error_msg = _('Cannot retrieve value for this link:').' '.$linkId;
- session_redirect('plugins/'.$headermenu->name.'/?type=globaladmin&error_msg='.urlencode($error_msg));
+ session_redirect('plugins/'.$headermenu->name.'/?type='.$type.'&error_msg='.urlencode($error_msg));
}
/**
* headerMenu Plugin Js Controller
*
- * Copyright 2012, Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
bindControls: function() {
this.params.inputHtmlCode.click(jQuery.proxy(this, "htmlCodeView"));
this.params.inputURL.click(jQuery.proxy(this, "htmlUrlView"));
- this.params.inputOuter.click(jQuery.proxy(this, "inputHtmlCodeView"));
- this.params.inputHeader.click(jQuery.proxy(this, "headerView"));
+ if (typeof(this.params.inputOuter) != 'undefined') {
+ this.params.inputOuter.click(jQuery.proxy(this, "inputHtmlCodeView"));
+ }
+ if (typeof(this.params.inputHeader) != 'undefined') {
+ this.params.inputHeader.click(jQuery.proxy(this, "headerView"));
+ }
+ if (typeof(this.params.inputURLIframe) != 'undefined') {
+ this.params.inputURLIframe.click(jQuery.proxy(this, "htmlUrlView"));
+ }
},
initializeView: function() {
this.params.trHtmlCode.hide();
this.params.trUrlCode.show();
}
+ if (typeof(this.params.inputURLIframe) != 'undefined') {
+ if (this.params.inputURLIframe.attr("checked")) {
+ this.params.trHtmlCode.hide();
+ this.params.trUrlCode.show();
+ }
+ }
},
htmlUrlView: function() {