Menu

iPopupMenu not working

Martin
2017-09-06
2017-09-06
  • Martin

    Martin - 2017-09-06

    Hi,

    My installation:
    iTop version 2.3.4-3302 built on 2017-04-14 19:00:51
    Data model: 2.3.0
    MySQL: 5.5.52-MariaDB
    PHP: 5.4.16

    I tried to implement a PopupMeu item as described in the documentation: https://wiki.openitop.org/doku.php?id=2_3_0:customization:extensions_api

    I created an extension module which extends a few CMDB classes and this it's working. I installed it and I'm also able to update it via the toolkit.

    I then added a main.my-module.php file with the example code for the popup menu but it's not working. It seems it's not called, because when I insert a die() statement in the code it has no effect.

    Any idea what's missing? Thanks in advance!

    greetings
    Martin

    main.my-module.php

    class MyPopupExtension implements iPopupMenuExtension
    {
       public static function EnumItems($iMenuId, $param)
       {
          if ($iMenuId == self::MENU_OBJDETAILS_ACTIONS)
          {
             $oObject = $param;
             if ($oObject instanceof Server)
             {
                 $sUID = 'MyPopupExtension-Monitoring'; // Make sure that each menu item has a unique "ID"
                 $sLabel = 'Monthly report';
                 $sURL = 'http://myapp/show_report?server_fqdn='.$oObject->Get('name');
                 $sTarget = '_blank';
                 $oMenuItem = new URLPopupMenuItem($sUID, $sLabel, $sURL, $sTarget);
                 return array($oMenuItem);
             }
          }
          return array();
       }
    }
    
     
  • Martin

    Martin - 2017-09-07

    Update: Solution found by Rafael: https://sourceforge.net/p/itop/discussion/922360/thread/088879eb/#2947

    You have to add it to module.my...php

    'datamodel' => array(
        'main.my-extension.php',
        'model.my-extension.php'
    ),
    
     

Log in to post a comment.

MongoDB Logo MongoDB