/**
* headermenu : viewGlobalConfiguration page
*
- * Copyright 2012 Franck Villaume - TrivialDev
+ * Copyright 2012-2013, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
inputOuter: jQuery('#linkmenu_outermenu'),
trHtmlCode: jQuery('#htmlcode'),
trUrlCode: jQuery('#urlcode'),
- tableTbodyLink: jQuery('#sortable tbody')
+ tableOutTbLink: jQuery('.sortable_outermenu_listlinks tbody'),
+ tableHeaTbLink: jQuery('.sortable_headermenu_listlinks tbody'),
+ validOutButton: jQuery('#linkorderoutervalidatebutton'),
+ validHeaButton: jQuery('#linkorderheadervalidatebutton'),
});
});
//]]></script>
<?php
-$linksArray = $headermenu->getAvailableLinks('headermenu');
-if (sizeof($linksArray)) {
+$linksHeaderMenuArray = $headermenu->getAvailableLinks('headermenu');
+$linksOuterMenuArray = $headermenu->getAvailableLinks('outermenu');
+
+if (sizeof($linksHeaderMenuArray) || sizeof($linksOuterMenuArray)) {
+ echo '<p class="information">'. _('You can reorder links, 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.').'</p>';
+}
+if (sizeof($linksHeaderMenuArray)) {
echo $HTML->boxTop(_('Manage available links in headermenu'));
- $tabletop = array( _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
- $classth = array('','','','','unsortable');
+ $tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
+ $classth = array('', '', '', '', '', 'unsortable');
echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
- foreach ($linksArray as $link) {
- echo '<tr>';
+ foreach ($linksHeaderMenuArray as $link) {
+ echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
if (strlen($link['url']) > 0) {
echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
} else {
}
echo $HTML->listTableBottom();
echo $HTML->boxBottom();
+ echo '<input type="button" id="linkorderheadervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
echo '</br>';
+} else {
+ echo '<p class="information">'._('No links available for headermenu').'</p>';
}
-$linksArray = $headermenu->getAvailableLinks('outermenu');
-if (sizeof($linksArray)) {
+
+if (sizeof($linksOuterMenuArray)) {
echo $HTML->boxTop(_('Manage available links in outermenu'));
- $tabletop = array(_('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
- $classth = array('','','','','unsortable');
+ $tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
+ $classth = array('', '', '', '', '', 'unsortable');
echo $HTML->listTableTop($tabletop, false, 'sortable_outermenu_listlinks', 'sortable', $classth);
- foreach ($linksArray as $link) {
- echo '<tr>';
+ foreach ($linksOuterMenuArray as $link) {
+ echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
if (strlen($link['url']) > 0) {
echo '<td>'._('URL').' ('.htmlspecialchars($link['url']).')</td>';
} else {
}
echo $HTML->listTableBottom();
echo $HTML->boxBottom();
+ echo '<input type="button" id="linkorderoutervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
echo '</br>';
+} else {
+ echo '<p class="information">'._('No links available for outermenu').'</p>';
}
+echo '<p class="information">'._('You can add specific tabs in outermenu (main tab) or headermenu (next to the login) with the form below.').'</p>';
echo '<form method="POST" name="addLink" action="index.php?type=globaladmin&action=addLink">';
echo '<table><tr>';
echo $HTML->boxTop(_('Add a new link'));
echo '<p class="information">'. _('You can reorder links, 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.').'</p>';
echo $HTML->boxTop(_('Manage available links'));
$tabletop = array(_('Order'), _('Menu Type'), _('Displayed Name'), _('Description'), _('Status'), _('Actions'));
- $classth = array('', '','','','','unsortable');
+ $classth = array('', '', '', '', '', 'unsortable');
echo $HTML->listTableTop($tabletop, false, 'sortable_headermenu_listlinks', 'sortable', $classth);
foreach ($linksArray as $link) {
echo '<tr id="'.$link['id_headermenu'].'" ><td>'.$link['ordering'].'</td>';
}
echo $HTML->listTableBottom();
echo $HTML->boxBottom();
- echo '<input type="button" id="linkordervalidatebutton" value="'._('Validate Order').'" style="display:none;" />';
+ echo '<input type="button" id="linkordervalidatebutton" value="'._('Save Order').'" style="display:none;" />';
echo '</br>';
}
case 'addLink':
case 'updateLinkValue':
case 'deleteLink':
- case 'updateLinkStatus': {
+ case 'updateLinkStatus':
+ case 'validateOrder': {
global $gfplugins;
include($gfplugins.$headermenu->name.'/action/'.$action.'.php');
break;
this.params.inputURL.click(jQuery.proxy(this, "htmlUrlView"));
this.params.inputOuter.click(jQuery.proxy(this, "inputHtmlCodeView"));
this.params.inputHeader.click(jQuery.proxy(this, "initializeView"));
+ this.params.validOutButton.click(jQuery.proxy(this, "validateOutLinkOrder"));
+ this.params.validHeaButton.click(jQuery.proxy(this, "validateHeaLinkOrder"));
},
initializeView: function() {
this.params.trHtmlCode.hide();
this.params.trUrlCode.show();
this.params.inputURL.attr('checked', 'checked');
- if (typeof(this.params.tableTbodyLink) != 'undefined') {
- this.params.tableTbodyLink.sortable({
+ if (typeof(this.params.tableOutTbLink) != 'undefined') {
+ this.params.tableOutTbLink.sortable({
update: function(event, ui) {
- jQuery(ui.item).attr("id", jQuery(ui.item).index());
- }
+ jQuery(".sortable_outermenu_listlinks tbody").children().each(function() {
+ if (jQuery(this).index() % 2 === 0) {
+ jQuery(this).attr("class", "even");
+ } else {
+ jQuery(this).attr("class", "odd");
+ }
+ jQuery(this).children(":first").text(jQuery(this).index());
+ });
+ jQuery("#linkorderoutervalidatebutton").show();
+ }
+ });
+ }
+ if (typeof(this.params.tableHeaTbLink) != 'undefined') {
+ this.params.tableHeaTbLink.sortable({
+ update: function(event, ui) {
+ jQuery(".sortable_headermenu_listlinks tbody").children().each(function() {
+ if (jQuery(this).index() % 2 === 0) {
+ jQuery(this).attr("class", "even");
+ } else {
+ jQuery(this).attr("class", "odd");
+ }
+ jQuery(this).children(":first").text(jQuery(this).index());
+ });
+ jQuery("#linkorderheadervalidatebutton").show();
+ }
});
}
},
inputHtmlCodeView: function() {
this.params.inputHtmlCode.prop('disabled', false);
- }
+ },
+
+ validateOutLinkOrder: function() {
+ var linkOrder = jQuery(".sortable_outermenu_listlinks tbody").sortable('toArray').toString();
+ jQuery.get(this.params.headerMenuUrl, {
+ action: 'validateOrder',
+ linkorder: linkOrder,
+ type: 'globaladmin'
+ });
+ jQuery('#validateLinkFeedback').remove();
+ jQuery('#maindiv').prepend('<p id="validateLinkFeedback" class="feedback">Outermenu Link Order successfully validated</p>');
+ this.params.validOutButton.hide();
+ },
+
+ validateHeaLinkOrder: function() {
+ var linkOrder = jQuery(".sortable_headermenu_listlinks tbody").sortable('toArray').toString();
+ jQuery.get(this.params.headerMenuUrl, {
+ action: 'validateOrder',
+ linkorder: linkOrder,
+ type: 'globaladmin'
+ });
+ jQuery('#validateLinkFeedback').remove();
+ jQuery('#maindiv').prepend('<p id="validateLinkFeedback" class="feedback">Headermenu Link Order successfully validated</p>');
+ this.params.validHeaButton.hide();
+ },
};
GroupMenuController.prototype =
bindControls: function() {
this.params.inputHtmlCode.click(jQuery.proxy(this, "htmlCodeView"));
this.params.inputURL.click(jQuery.proxy(this, "htmlUrlView"));
- this.params.validateButton.click(jQuery.proxy(this, "validateLinkOrder"));
+ this.params.validateButton.click(jQuery.proxy(this, "validateProjectLinkOrder"));
},
initializeView: function() {
this.params.inputHtmlCode.prop('disabled', false);
},
- validateLinkOrder: function() {
+ validateProjectLinkOrder: function() {
var linkOrder = jQuery("#sortable tbody").sortable('toArray').toString();
jQuery.get(this.params.headerMenuUrl, {
group_id: this.params.groupId,