6.0.0-git
2024-04-27

Diff for CustomizeMenu between 9 and 10

+ Customizing menus in Horde 5

There are two main menus in Horde. The topbar contains links to all different horde applications, configuration and administration options available to the user. 
If the application has a search facility, the topbar will also provide a search field.
The sidebar on the left contains module-specific entries.

++ Topbar customisation ++

You can regroup applications into submenus by adding {{heading}} and {{menu_parent}} entries to the {{registry.local.php}} file.

For example, let's group nag and whups into a "chores" menu. 
<code type="php">
$this->applications['chores'] = array('name' => 'chores',
                                      'status' => 'heading'
                                     );
$this->applications['nag']['menu_parent'] = 'chores';
$this->applications['whups']['menu_parent'] = 'chores';
</code>

The chores-menu will only be displayed if either nag or whups are available and active. You can also add an 'url' parameter to a 'heading' to make it clickable. Unfortunately, headings which have no apps below them will not be shown.

To work around this, registerHorde 5.1 adds 'link' items which allow proper external URLs

<code type="php">
<?php
/* Example registry.local.php file*/
$this->applications['mywebsite'] =
array('name' => 'Website', 'status' => 'link', 'url' =>
'http://www.ralf-lang.de', 'menu_parent' => 'others', 'target' => '_new');
</code>


Prior to Horde 5.1 you can use a workaround: Register your links as apps.

<code type="php">
// Custom Menus
  'intranet' => array(
      'name' => _("Intranet Links"),
      'status' => 'heading',


  'xyz' => array(
      'webroot' => 'http://applications.horde.org/',
      'name' => _("Application 1"),
      'status' => 'active',
      'target' => '_blank',
      'menu_parent' => 'intranet',
      'fileroot' => '/tmp',
      'icon' => ''
  ),

</code>
This has a side effect though. The new pseudo app will show a useless entry in the "preferences" menu.




+ Customizing menus in Horde 3 and 4

There are two main menus in Horde. Each module has its own application menu on the top. And then there is what is called the "Sidebar", the menu on the left in a separate browser frame, which is always the same and contains links to the different Horde applications.

++ Application menus

The application menus are aggregated from several places. You can configure menus in three places:

# Horde Setup, where you can configure Help, Options, Problems, and Logout/Login menu items: you need to login as an administrator and then go to {{Administration -> Setup -> Horde -> Menu Settings}}
# Application Setup, where you can configure links to all installed applications and application-specific items: {{Adminstration -> Setup -> Application -> Menu Settings}}
# Arbitrary items: can be configured in {{config/menu.php}}. Copy {{menu.php.dist}} to {{menu.php}}, read the comments in the file header, and create your own menu entries

++ Sidebar

To add new items to the sidebar menu, you need to edit {{config/registry.php}}. Make sure to read the comments at the top of {{registry.php}} carefully. The only required configuration values for a menu entry are {{'name'}} and {{'status'}}, but  {{'webroot'}} and {{'fileroot'}} are useful entries.

Let's say you want to add a link to your intranet:
<code type="php">
// Custom Menus
$this->applications['intranet'] = array(
     'name' => _('Intranet Links'),
     'status' => 'heading',
     'icon' => '',
);
$this->applications['intranet_link_1'] = array(
 'webroot' => 'https://www.example.com',
 'name' => _("Example Link"),
 'status' => 'active',
 'target' => '_parent',
 'menu_parent' => 'intranet',
 'fileroot' => '/tmp',
 'icon' => '',
);
</code>
This adds a top-level menu entry with the link text "Intranet Links" and a sub link to {{https://www.example.com}} to your sidebar. We also set the {{'icon'}} value to an empty string. This is to keep the browser from loading an icon from a default location, creating a lot entries in your web server's error log. If you put an icon with a size of 16x16 pixel somewhere on your web server, you can put the (web) location into the {{'icon'}} value, and it will be displayed in the menu.


Following works in Horde 4.
<code type="php">
// Custom Menus
  'intranet' => array(
      'name' => _("Intranet Links"),
      'status' => 'heading',
  ),

  'xyz' => array(
      'webroot' => 'http://applications.horde.org/',
      'name' => _("Application 1"),
      'status' => 'notoolbar',
      'target' => '_blank',
      'menu_parent' => 'intranet',
      'fileroot' => '/tmp',
      'icon' => ''
  ),

</code>