Implement a new option for sidebox menu, called sendToBottom, in order to be able to sort a specific item at the bottom of the sidebox menu

This commit is contained in:
Hadi Nategh 2017-04-04 16:51:41 +02:00
parent 4f9e14fcc6
commit 786ad5b71b
2 changed files with 13 additions and 3 deletions

View File

@ -599,6 +599,7 @@ abstract class Ajax extends Api\Framework
}
$data = array();
$sendToBottom = array();
foreach($this->sideboxes[$appname] as $menu_name => &$file)
{
$current_menu = array(
@ -609,7 +610,7 @@ abstract class Ajax extends Api\Framework
);
foreach($file as $item_text => $item_link)
{
if ($item_text === 'menuOpened' || // flag, not menu entry
if ($item_text === 'menuOpened' || $item_text === 'sendToBottom' ||// flag, not menu entry
$item_text === '_NewLine_' || $item_link === '_NewLine_')
{
continue;
@ -648,9 +649,17 @@ abstract class Ajax extends Api\Framework
}
$current_menu['entries'][] = $var;
}
$data[] = $current_menu;
if ($file['sendToBottom'])
{
$sendToBottom[] = $current_menu;
}
else
{
$data[] = $current_menu;
}
}
return $data;
return array_merge($data, $sendToBottom);
}
/**

View File

@ -280,6 +280,7 @@ class Hooks
// PGP Encryption (Mailvelope plugin) restore/backup menu
$file = Array(
'Backup/Restore ...' => 'javascript:app.'.$appname.'.mailvelopeCreateBackupRestoreDialog();',
'sendToBottom' => true
);
display_sidebox($appname, lang('PGP Encryption'), $file);
}