Enhanced menu

Documentation applicable for LemonLDAP::NG >= 0.9.3

Presentation

Menu is a new Portal module providing these functionalities:

Activate the menu in the portal

With a 0.9.3 fresh installation, the default portal/index.pl enables the menu. For the others, add this to the perl code:

if ( $portal->process() ) {

# HTML::Template object creation my $template = HTML::Template->new( filename => "$skin_dir/$skin/menu.tpl", die_on_bad_params => 0, cache => 0, filter => sub { $portal->translate_template(@_) } );

# Menu creation use Lemonldap::NG::Portal::Menu; my $menu = Lemonldap::NG::Portal::Menu->new( { portalObject => $portal, apps => { xmlfile => "$appsxmlfile", imgpath => "$appsimgpath", }, modules => { appslist => 1, password => 1, logout => 1, }, # CUSTOM FUNCTION : if you want to create customFunctions in rules, declare them here #customFunctions => 'function1 function2', } );

$template->param( AUTH_ERROR => $menu->error ); $template->param( AUTH_ERROR_TYPE => $menu->error_type ); $template->param( DISPLAY_APPSLIST => $menu->displayModule("appslist") ); $template->param( DISPLAY_PASSWORD => $menu->displayModule("password") ); $template->param( DISPLAY_LOGOUT => $menu->displayModule("logout") ); $template->param( DISPLAY_TAB => $menu->displayTab ); $template->param( LOGOUT_URL => "$ENV{SCRIPT_NAME}?logout=1" ); if ( $menu->displayModule("appslist") ) { $template->param( APPSLIST_MENU => $menu->appslistMenu ); $template->param( APPSLIST_DESC => $menu->appslistDescription ); }

print $portal->header('text/html; charset=utf8'); print $template->output; }

XML applications list

DTD

The XML applications list must respect this DTD:

<!ELEMENT menu (category*) >

<!ELEMENT category (application*, category*) > <!ATTLIST category name CDATA #REQUIRED >

<!ELEMENT application (name, uri?, description?, logo?, screenshot?, display?) > <!ATTLIST application id ID #REQUIRED >

<!ELEMENT name ( #PCDATA ) > <!ELEMENT uri ( #PCDATA ) > <!ELEMENT description ( #PCDATA ) > <!ELEMENT logo ( #PCDATA ) > <!ELEMENT screenshot ( #PCDATA ) > <!ELEMENT display ( #PCDATA ) >

Parameters definition

The menu must contains at least one category. Each category can contain applications and categories. An application cannot contain a category. An application must be inside a category.

Sample XML file

Now you can configure your applications list, in /etc/lemonldap-ng/apps-list.xml. For example:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE menu SYSTEM "apps-list.dtd">
<menu>
    <category name="Business">
        <application id="aaa">
                <name>AAA</name>
                <uri>http://test.ow2.org/aaa</uri>
                <description>AAA description</description>
                <logo>aaa-logo.gif</logo>
                <display>auto</display>
        </application>
        <application id="bbb">
                <name>BBB</name>
                <uri>http://test.ow2.org/bbb/login.do</uri>
                <description>BBB description</description>
                <logo>bbb-logo.gif</logo>
                <display>on</display>
        </application>
   </category>
   <category name="Technical">
     <category name="Directories">
        <application id="pla">
                <name>phpLDAPAdmin</name>
                <uri>http://phpldapadmin.ow2.org</uri>
                <description>LDAP directory administration</description>
                <logo>pla-logo.gif</logo>
                <display>auto</display>
        </application>
     </category>
     <category name="Application servers">
        <application id="probe">
                <name>Probe</name>
                <uri>http://probe.ow2.org</uri>
                <description>Tomcat stats</description>
                <logo>probe-logo.gif</logo>
                <display>auto</display>
        </application>
     </category>
   </category>
</menu>