<?php
/**
- * headermenu plugin
+ * headermenu plugin: deleteLink action
*
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
<?php
/**
- * headermenu plugin
+ * headermenu plugin: updateLinkStatus action
*
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
<?php
/**
- * headermenu plugin
+ * headermenu plugin : updateLinkValue action
*
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
--- /dev/null
+<?php
+/**
+ * headermenu plugin : validateOrder action
+ *
+ * Copyright 2013, Franck Villaume - TrivialDev
+ * http://fusionforge.org
+ *
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
+ *
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+global $headermenu;
+
+$sysdebug_enable = false;
+
+$linksOrder = getStringFromRequest('linkorder');
+$returnValue = 1;
+
+if ($linksOrder && strlen($linksOrder)) {
+ $linksOrderArr = explode(',', $linksOrder);
+ if ($headermenu->setLinksOrder($linksOrderArr))
+ $returnValue = 0;
+}
+echo $returnValue;
+exit;
\ No newline at end of file
* @return array the available links
*/
function getAvailableLinks($linkmenu) {
- $links = db_query_params('select * FROM plugin_headermenu where linkmenu = $1 order by ordering', array($linkmenu));
+ $links = db_query_params('select * FROM plugin_headermenu where linkmenu = $1 order by ordering asc', array($linkmenu));
$availableLinks = array();
while ($arr = db_fetch_array($links)) {
$availableLinks[] = $arr;
}
/**
+ * setLinksOrder - set the linkOrder for a set of links id
+ *
+ * @param array $linksOrder array of ordered links id
+ * @return bool success or not
+ */
+ function setLinksOrder($linksOrder) {
+ for ($i =0; $i < count($linksOrder); $i++) {
+ $res = db_query_params('update plugin_headermenu set ordering = $1 where id_headermenu = $2', array($i, $linksOrder[$i]));
+ if (!$res)
+ return false;
+ }
+ return true;
+ }
+
+ /**
* addLink - add a new valid link
*
* @param string $url the url
html_use_jqueryui();
use_javascript('scripts/HeaderMenuController.js');
use_javascript('/js/sortable.js');
- site_header(array('title'=>_('Project Menu Admin'), 'toptab' => ''));
+ $group_id = getIntFromRequest('group_id');
+ $params['toptab'] = 'admin';
+ $params['group'] = $group_id;
+ $params['title'] = _('Project groupmenu Admin');
+ site_project_header($params);
$returned = true;
break;
}
/**
* headermenu : viewProjectConfiguration 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;
<?php
$linksArray = $headermenu->getAvailableLinks('groupmenu');
if (sizeof($linksArray)) {
- echo '<p class="information">'. _('You can reorder links, just drag & drop rows in the table 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 '<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');
case 'addLink':
case 'updateLinkValue':
case 'deleteLink':
- case 'updateLinkStatus': {
+ case 'updateLinkStatus':
+ case 'validateOrder': {
global $gfplugins;
include($gfplugins.$headermenu->name.'/action/'.$action.'.php');
break;
linkorder: linkOrder,
type: 'projectadmin'
});
- jQuery('#maindiv').prepend('<p class="feedback">Link Order successfully validated</p>');
+ jQuery('#validateLinkFeedback').remove();
+ jQuery('#maindiv').prepend('<p id="validateLinkFeedback" class="feedback">Link Order successfully validated</p>');
this.params.validateButton.hide();
},
};