The following is a proposed patch that would allow you re-arrange the Left Navigation menu. It would allow for Categories to be changed (creating new Categories if desired), placement in either the setup or tool tab, and the name to be changed that appears.
The structure in this patch is controlled by an ini file (/etc/asterisk/freepbx_menu.conf) of the format:
[display_name]
type=[setup|tool]
category=[Favorites|Existing Different Category|New Category]
name=New Name
remove=[yes|no] ;if set to yes, the entry will be removed, default no
each of these are optional and the effect will be that the listed item will have its type, category, sort order and/or name changed based on these settings. You can remove an item from the menu with the remove=yes option. (Changing the type can have odd side effects when navigating to that page because some of the modules have their type hardcoded which can result in the left navigation bar changing tabs on you when you go to that page).
There is a Favorites category which is a special case category and will be sorted to be located just below the Admin Category if used. There can be one on both setup and tools tab, with different content.
It's not possible to duplicate an item in two different places.
An example of what something like this might look like is:
[extensions]
type=setup
category=Favorites
[findmefollow]
type=setup
category=Favorites
name=Find-Me Follow
[fax]
type=setup
category=Media
[recordings]
type=setup
category=Media
[music]
type=setup
category=Media
sort=-9
[wiki]
remove=yes
Here is the patch:
Index: freepbx_admin.php
===================================================================
--- freepbx_admin.php (revision 9788)
+++ freepbx_admin.php (working copy)
@@ -5,6 +5,40 @@
?>
<!-- begin menu -->
<?php
+global $amp_conf;
+$fd = $amp_conf['ASTETCDIR'].'/freepbx_menu.conf';
+if ($fpbx_usecategories && file_exists($fd)) {
+ $favorites = parse_ini_file($fd,true);
+ if ($favorites !== false) foreach ($favorites as $menuitem => $setting) {
+ if (isset($fpbx_menu[$menuitem])) {
+ foreach($setting as $key => $value) {
+ switch ($key) {
+ case 'category':
+ case 'name':
+ $fpbx_menu[$menuitem][$key] = htmlspecialchars($value);
+ break;
+ case 'type':
+ if (strtolower($value)=='setup' || strtolower($value)=='tool') {
+ $fpbx_menu[$menuitem][$key] = strtolower($value);
+ }
+ break;
+ case 'sort':
+ if (is_numeric($value) && $value > -10 && $value < 10) {
+ $fpbx_menu[$menuitem][$key] = $value;
+ }
+ break;
+ case 'remove':
+ // parse_ini_file sets all forms of yes/true to 1 and no/false to nothing
+ if ($value == '1') {
+ unset($fpbx_menu[$menuitem]);
+ }
+ break;
+ }
+ }
+ }
+ }
+}
+
$prev_category = '';
if (is_array($fpbx_menu)) {
@@ -15,7 +49,8 @@
$framework_text_domain = Array();
// Sorting menu by category and name
foreach ($fpbx_menu as $key => $row) {
- $category[$key] = $row['category'];
+ // Fake name to have it follow after Admin in the sort order
+ $category[$key] = $row['category'] == 'Favorites'?'Admin Favorites':$row['category'];
$sort[$key] = $row['sort'];
$sort_name[$key] = $row['name'];
$sort_type[$key] = $row['type'];
For those adventuress who want to try this out and provide feedback, let us know. Maybe we can put this into 2.8 as experimental. No GUI, but maybe a future module or addition to core can be added to create a GUI to control this.