<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> <head> <meta name="generator" content= "HTML Tidy for Linux/x86 (vers 7 December 2008), see www.w3.org" /> <title>Lemonldap::NG documentation: 4.2-Configure-portal-menu.html</title> <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" /> <style type="text/css"> /*<![CDATA[*/ body{ background: #ddd; font-family: sans-serif; font-size: 11pt; padding: 0 50px; } div.main-content{ padding: 10px; background: #fff; border: 2px #ccc solid; } a{ text-decoration: none; } p.footer{ text-align: center; margin: 5px 0 0 0; } .heading-1{ text-align: center; color: orange; font-variant: small-caps; font-size: 20pt; } .heading-1-1{ color: orange; font-size: 14pt; border-bottom: 2px #ccc solid; } pre{ background: #eee; border: 2px #ccc solid; padding: 5px; border-left: 10px #ccc solid; } ul.star li{ list-style-type: square; } /*]]>*/ </style> </head> <body> <div class="main-content"> <h2 class="heading-1"><span id="HEnhancedmenu">Enhanced menu</span></h2> <p class="paragraph"></p> <ul> <li><a href="#HPresentation">Presentation</a></li> <li><a href="#HActivatethemenuintheportal">Activate the menu in the portal</a></li> <li><a href="#HSetthevisibilityofeachmodules">Set the visibility of each modules</a></li> <li> <a href="#HConfigureapplicationslist">Configure applications list</a> <ul> <li><a href="#HDTD">DTD</a></li> <li><a href="#HParametersdefinition">Parameters definition</a></li> <li><a href="#HSampleXMLfile">Sample XML file</a></li> </ul> </li> </ul><strong class="strong">Documentation applicable for LemonLDAP::NG >= 0.9.3</strong> <h3 class="heading-1-1"><span id="HPresentation">Presentation</span></h3> <p class="paragraph"></p>Menu is a new Portal module providing these functionalities: <ul class="star"> <li>Display an application list to the connected user, with possibility to hide applications he did not have access to.</li> <li>Provide a simple "change password" form that respect Password Policy LDAP draft.</li> <li>Logout with confirmation.</li> </ul> <h3 class="heading-1-1"><span id="HActivatethemenuintheportal">Activate the menu in the portal</span></h3> <p class="paragraph"></p>With a 0.9.3 fresh installation, the default portal/index.pl enables the menu. For the others, add this to the perl code: <p class="paragraph"></p> <div class="code"> <pre> <span class= "java-keyword">if</span> ( $portal->process() ) {<br /><br /> # HTML::Template object creation my $template = HTML::Template-><span class="java-keyword">new</span>( filename => <span class= "java-quote">"$skin_dir/$skin/menu.tpl"</span>, die_on_bad_params => 0, cache => 0, filter => sub { $portal->translate_template(@_) } );<br /><br /> # Menu creation use Lemonldap::NG::Portal::Menu; my $menu = Lemonldap::NG::Portal::Menu-><span class= "java-keyword">new</span>( { portalObject => $portal, apps => { xmlfile => <span class="java-quote">"$appsxmlfile"</span>, imgpath => <span class="java-quote">"$appsimgpath"</span>, }, modules => { appslist => 1, password => USER_CAN_CHANGE_PASSWORD, logout => DISPLAY_LOGOUT, }, # CUSTOM FUNCTION : <span class= "java-keyword">if</span> you want to create customFunctions in rules, declare them here #customFunctions => 'function1 function2', } );<br /><br /> $template->param( AUTH_USER => $portal->{sessionInfo}->{$user_attr} ); $template->param( AUTOCOMPLETE => AUTOCOMPLETE ); $template->param( SKIN => $skin ) $template->param( AUTH_ERROR => $menu->error ); $template->param( AUTH_ERROR_TYPE => $menu->error_type ); $template->param( DISPLAY_APPSLIST => $menu->displayModule(<span class="java-quote">"appslist"</span>) ); $template->param( DISPLAY_PASSWORD => $menu->displayModule(<span class="java-quote">"password"</span>) ); $template->param( DISPLAY_LOGOUT => $menu->displayModule(<span class="java-quote">"logout"</span>) ); $template->param( DISPLAY_TAB => $menu->displayTab ); $template->param( LOGOUT_URL => <span class= "java-quote">"$ENV{SCRIPT_NAME}?logout=1"</span> ); $template->param( REQUIRE_OLDPASSWORD => REQUIRE_OLDPASSWORD ); <span class= "java-keyword">if</span> ( $menu->displayModule(<span class="java-quote">"appslist"</span>) ) { $template->param( APPSLIST_MENU => $menu->appslistMenu ); $template->param( APPSLIST_DESC => $menu->appslistDescription ); }<br /><br /> print $portal->header('text/html; charset=utf8'); print $template->output; } </pre> </div> <h3 class="heading-1-1"><span id="HSetthevisibilityofeachmodules">Set the visibility of each modules</span></h3> <p class="paragraph"></p>In the source code of the portal, you have : <p class="paragraph"></p> <div class="code"> <pre> modules => { appslist => 1, password => USER_CAN_CHANGE_PASSWORD, logout => DISPLAY_LOGOUT, }, </pre> </div> <p class="paragraph"></p>"1" means the module is always displayed, and "0" means never. But you can adapt it to the user profile, for example display the password modification form only to user with employeeType equal to "internal" : <p class="paragraph"></p> <div class="code"> <pre> modules => { appslist => 1, password => '$employeeType =~ /binternalb/', logout => DISPLAY_LOGOUT, }, </pre> </div> <h3 class="heading-1-1"><span id="HConfigureapplicationslist">Configure applications list</span></h3> <h4 class="heading-1-1-1"><span id="HDTD">DTD</span></h4> <p class="paragraph"></p>The XML applications list must respect this DTD: <p class="paragraph"></p> <div class="code"> <pre> <!ELEMENT menu (category*) ><br /><br /><!ELEMENT category (application*, category*) > <!ATTLIST category name CDATA #REQUIRED ><br /><br /><!ELEMENT application (name, uri?, description?, logo?, screenshot?, display?) > <!ATTLIST application id ID #REQUIRED ><br /><br /><!ELEMENT name ( #PCDATA ) > <!ELEMENT uri ( #PCDATA ) > <!ELEMENT description ( #PCDATA ) > <!ELEMENT logo ( #PCDATA ) > <!ELEMENT screenshot ( #PCDATA ) > <!ELEMENT display ( #PCDATA ) > </pre> </div> <h4 class="heading-1-1-1"><span id="HParametersdefinition">Parameters definition</span></h4> <ul class="star"> <li>Category: <ul class="star"> <li>Name of the category (required)</li> </ul> </li> <li>Application: <ul class="star"> <li>ID: unique id of the application inside XML file (required).</li> <li>Name: friendly name of the applications (required).</li> <li>URI: full URI of the application, with http(s)://, and path, page, etc.</li> <li>Description: description of the application.</li> <li>Logo: file name of the logo.</li> <li>Screenshot: file name of the screenshot.</li> <li>Display: <ul class="star"> <li>"auto": display application only if the user has access to it.</li> <li>"on": always display.</li> <li>"off": never display.</li> </ul> </li> </ul> </li> </ul>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. <h4 class="heading-1-1-1"><span id="HSampleXMLfile">Sample XML file</span></h4> <p class="paragraph"></p>Now you can configure your applications list, in /etc/lemonldap-ng/apps-list.xml. For example: <p class="paragraph"></p> <div class="code"> <pre> <?xml version=<span class="java-quote">"1.0"</span> encoding=<span class= "java-quote">"utf-8"</span> standalone=<span class= "java-quote">"no"</span>?> <!DOCTYPE menu SYSTEM <span class="java-quote">"apps-list.dtd"</span>> <menu> <category name=<span class="java-quote">"Business"</span>> <application id=<span class="java-quote">"aaa"</span>> <name>AAA</name> <uri><span class="nobr"><a href= "http://test.ow2.org/aaa&#60;/uri&#62;">http://test.ow2.org/aaa</uri></a></span> <description>AAA description</description> <logo>aaa-logo.gif</logo> <display>auto</display> </application> <application id=<span class="java-quote">"bbb"</span>> <name>BBB</name> <uri><span class="nobr"><a href= "http://test.ow2.org/bbb/login.">http://test.ow2.org/bbb/login.</a></span><span class="java-keyword">do</span></uri> <description>BBB description</description> <logo>bbb-logo.gif</logo> <display>on</display> </application> </category> <category name=<span class="java-quote">"Technical"</span>> <category name=<span class="java-quote">"Directories"</span>> <application id=<span class="java-quote">"pla"</span>> <name>phpLDAPAdmin</name> <uri><span class="nobr"><a href= "http://phpldapadmin.ow2.org&#60;/uri&#62;">http://phpldapadmin.ow2.org</uri></a></span> <description>LDAP directory administration</description> <logo>pla-logo.gif</logo> <display>auto</display> </application> </category> <category name=<span class= "java-quote">"Application servers"</span>> <application id=<span class="java-quote">"probe"</span>> <name>Probe</name> <uri><span class="nobr"><a href= "http://probe.ow2.org&#60;/uri&#62;">http://probe.ow2.org</uri></a></span> <description>Tomcat stats</description> <logo>probe-logo.gif</logo> <display>auto</display> </application> </category> </category> </menu> </pre> </div> </div> <p class="footer"><a href="index.html">Index</a></p> </body> </html>