[horde] IMP 5 target in menu

Gerard Breiner gerard.breiner at ias.u-psud.fr
Thu Feb 2 10:03:59 UTC 2012


Le 01/02/2012 21:10, Michael M Slusarz a écrit :
> Quoting Gerard Breiner <gerard.breiner at ias.u-psud.fr>:
>
>> Hello,
>>
>> I want to use "target" In imp/config/menu.php so that to open a new 
>> window (or tab) when the link define by 'url' is clicked.
>> Here is what I've done but unsuccessfull...
>>
>> 'glop' => array(
>>            'url' => 'external link',
>>            'target' => '_blank',
>>            'text' => 'GLOP',
>>            'icon' => ' ')
>
> Are you sure a window with the target '_blank' doesn't already exist?  
> You might want to select a more unique target name.
>
> michael
>
> ___________________________________
> Michael Slusarz [slusarz at horde.org]
>
Hello Michael,

It seems that "$target" variable defined in the Horde_Menu class is not  
used in IMP_Menu_Dimp class (imp/lib/Menu/Dimp.php)... So I added it ....
I also customized by putting a "if" condition so that horde (Accueil) 
don't show up in the menu....
In this way I only enable the Dimp menu. Maybe this hack is not the good 
way to do ?  However this menu seems to work on my expectations.

imp/lib/Menu/Dimp.php
<CODE>
44         foreach ($this->_menu as $k => $m) {
  45             switch ($type) {
  46             case 'sidebar':
  47                 // FIXME: solve the ajax view detection properly.
  48                 if (empty($GLOBALS['conf']['menu']['apps_iframe']) ||
  49                     
$GLOBALS['registry']->hasAjaxView($m['icon']->app)) {
  50                     $href = ' href="' . htmlspecialchars($m['url']) 
. '"';
  51 //hack G.Breiner
  52                     $target = 'target="'. 
htmlspecialchars($m['target']) .'"';
  53 //End of hack
  54                 } else {
  55                     $href = '';
  56                 }
  57 //Hack G.Breiner  $target is added after $href. We also check 
'text' so that to avoid duplicate sidebar if 'Accueil' is clicked.
  58 if (htmlspecialchars($m['text']) != 'Accueil') {
  59                 $out .= '<li class="custom">' .
  60                     Horde::img($m['icon'], 
Horde::stripAccessKey($m['text']), '', $m['icon_path'])
  61                     . '<a id="sidebarapp_' . htmlspecialchars($k) . 
'"'
  62                     . $href . $target . '>' . 
htmlspecialchars($m['text']) . '</a></li>';
  63  }

</CODE>

Best regards.

Gerard Breiner




More information about the horde mailing list