[horde] IMP 5 target in menu

Gerard Breiner gerard.breiner at ias.u-psud.fr
Wed Feb 8 14:33:22 UTC 2012


Le 08/02/2012 06:48, Michael M Slusarz a écrit :
> Quoting Gerard Breiner <gerard.breiner at ias.u-psud.fr>:
>
>> 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 ....
>
> The dynamic view does not support the target element (since menu links 
> are handled by javascript code that is hard-wired).
>
> michael
>
> ___________________________________
> Michael Slusarz [slusarz at horde.org]
>

  Yet it does.... It works for me since I modified 
.imp/lib/Menu/Dimp.php as follow :

[CODE]
foreach ($this->_menu as $k => $m) {
             switch ($type) {
             case 'sidebar':
                 // FIXME: solve the ajax view detection properly.
                 if (empty($GLOBALS['conf']['menu']['apps_iframe']) ||
                     $GLOBALS['registry']->hasAjaxView($m['icon']->app)) {
                     $href = ' href="' . htmlspecialchars($m['url']) . '"';
                     //hack G.Breiner
                         $target = 'target="'. 
htmlspecialchars($m['target']) .'"';
                    //End of hack
                 } else {
                     $href = '';
                 }
                //Hack G.Breiner  $target added after $href. We also 
check 'text' so that to prevent horde sidebar if 'Accueil' is clicked.
               if (htmlspecialchars($m['text']) != 'Accueil') {
                       $out .= '<li class="custom">' .
                                   Horde::img($m['icon'], 
Horde::stripAccessKey($m['text']), '', $m['icon_path'])
                                 . '<a id="sidebarapp_' . 
htmlspecialchars($k) . '"'
                                 . $href . $target . '>' . 
htmlspecialchars($m['text']) . '</a></li>';
              }
[/CODE]

Best regards.

Gerard Breiner



More information about the horde mailing list