Menu Customizations

Menu Customizations

The menus displayed in the client, reseller, and administration areas are dynamically generated depending on the permissions of the logged-in user, and thus are not found in any of Centova Cast's template files.

The menus can still be customized, however, by directly editing the menu definition file. This file is located in:

/usr/local/centovacast/web/menu.php

The format of this file is a series of definitions of multidimensional PHP arrays. Accordingly, some PHP experience may be necessary to effectively customize this file without damaging it.

Menu Definitions

The general format of the menu definitions is:

$menu_admin = array(
    // menu sections for the administration area
);

$menu_reseller = array(
    // menu sections for the reseller area
);

$menu_client = array(
    // menu section for the client area
);

Menu Sections

Each menu section within the $menu_xxx arrays above is defined as:

array(
    'name'=>__('Title'),        // the section title to display in the menu
    'url'=>'index.php?foo=bar', // the URL to launch when the section heading is clicked
    'icon'=>'name',             // the icon to display next to the section title; 
                                // corresponds to /theme/images/nav/<icon>.png
    'condition'=>'...',         // conditions required to display this section (see below)
    'djpermission'=>'...',      // DJ permissions required for this section (see below)

    'items'=>array(
    // menu items for this section
    )
),

Menu Items

Each menu item within the 'items' arrays in the menu section definition is defined as:

array(
    'name'=>__('Item name'),      // the name to display for the menu item
    'title'=>__('Tip text'),      // a tip to display on mouse hover
    'url'=>'index.php?page=foo',  // the URL to launch when the item is clicked
    'confirm'=>__('Prompt text'), // an optional confirmation message to display when clicked
    'target'=>'...',              // the HTML target="xxx" attribute for the link
                                  // eg: use '_blank' to open in a new window
    'condition'=>'...',           // conditions required to display this item (see below)
    'djpermission'=>'...'         // DJ permissions required for this item (see below)
),

Conditions

Some menu items are only relevant if the stream is in a particular state; for example, the "start server" link would only be relevant when the server is not currently running.

Conditions allow each menu item to be dynamically displayed or hidden based on various conditions and states. Each menu section and item supports a condition option which specifies a list of condition(s) that must be met for the section or item to be displayed.

The format of the condition list is one or more conditions separated by commas, eg:

'condition'=>'foo'          // condition "foo" must be true
'condition'=>'foo,bar,baz'  // conditions "foo", "bar", and "baz" must be true
'condition'=>'foo,!bar,baz' // conditions "foo" and "baz" must be true, but "bar" must NOT
'condition'=>''             // no conditions; always display the item

If the condition option is empty or omitted entirely, the menu section or item is always displayed. If one of the conditions in the condition option is preceded by an exclamation mark (!) it is negated; the item will only be displayed if that condition is NOT true.

The following conditions are available:

Client Area

  • usesource - true if the account is configured to support an autoDJ
  • autodjup - true if the autoDJ is up
  • autodjdown - true if the autoDJ is down
  • serverup - true if the streaming server is up
  • canstartautodj - true if all other conditions allow the autoDJ to be started
  • privileged - true if the client is logged in from a reseller or admin account
  • serverreload - true if the streaming server supports reloading its configuration without a full restart

Reseller Area

  • No conditions are currently supported.

Administrator Area

  • No conditions are currently supported.

DJ Permissions

When a DJ account logs in to Centova Cast, the standard client menu definition is used to generate the navigation menu for the DJ. Most DJ accounts will have permissions restrictions, however, which prevent the DJ from using many of the features displayed in the menu.

To avoid displaying menu sections or items that the DJ cannot actually use, each menu section and item supports a djpermission option which specifies a list of permission(s) that the DJ must possess in order to see the menu item or section.

The format of the djpermission list is zero or more permissions separated by plus (+) character (indicating "AND") or pipe (|) character (indicating "OR"), eg:

'djpermission'=>'foo'             // require the "foo" permission
'djpermission'=>'foo+bar+baz'     // require the "foo", "bar", and "baz" permissions
'djpermission'=>'foo|bar|baz'     // require any ONE of the "foo" OR "bar" OR "baz" permissions
'djpermission'=>''                // no permissions required; always display the item

If the djpermission option is empty or is omitted entirely, the DJ is always permitted to see the menu section or item. Note that pipe and plus characters cannot be combined within a single djpermission list.

The following DJ permissions are available:

  • controlserver - DJ must have the Start/stop the stream permission
  • controlautodj - DJ must have the Start/stop the autoDJ permission
  • manageplaylists - DJ must have the Manage playlist settings permission
  • medialibrary - DJ must have the Access media library permission
  • managefiles - DJ must have the Manage media files permission
  • viewstatistics - DJ must have the View statistics permission
  • viewlisteners - DJ must have the View listeners permission
  • viewlogs - DJ must have the View logs permission
  • denied - a special permission which indicates that the DJ should never see this menu item/section

It is important to note that this is not an access control mechanism in itself; this only controls which menu items are displayed to the DJ. If a menu item includes an incorrect djpermission setting which allows the DJ to see a menu item to which he does not have access, the DJ will still receive a permission denied error when he clicks the link. Similarly, the djpermission setting cannot be used to deny access to a page to which the DJ has been given access; while it may be used to hide the link, the DJ will still have access to the page if he happens to know the URL and enters it manually.