###########################################################################
#
# This program is part of Zenoss Core, an open source monitoring platform.
# Copyright (C) 2007, Zenoss Inc.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 as published by
# the Free Software Foundation.
#
# For complete information please visit: http://www.zenoss.com/oss/
#
###########################################################################

__doc__='''

Add menu relations to all device organizers, OsProcesses, Services, etc
Add default menus to dmd and device organizers

$Id:$
'''
import Migrate

from Products.ZenUtils.Utils import zenPath
menuxml = zenPath("Products/ZenModel/data/menus.xml")

ZenPackItems = dict(
    ordering=0.0, 
    id=         'addToZenPack',
    description='Add to ZenPack...',
    action=     'dialog_addToZenPack',
    permissions=('View',),
    isdialog=True,
    )

class MenuRelations(Migrate.Step):
    version = Migrate.Version(2, 0, 0)

    def cutover(self, dmd):
        dmd.buildRelations()
#        for dev in dmd.Devices.getSubDevices():
#            dev.buildRelations()
#        for name in ['Devices', 'Systems', 'Groups', 'Locations',
#                        'Services', 'Processes']:
#            top = getattr(dmd, name)
#            orgs = top.getSubOrganizers()
#            orgs.insert(0, top)
#            for o in orgs:
#                o.buildRelations()
#                if name == 'Devices':
#                    for d in o.devices():
#                        d.buildRelations()
#                        if getattr(d, 'os', None):
#                            for n in ['ipservices', 'winservices', 'processes']:
#                                for p in getattr(d.os, n)():
#                                    p.buildRelations()
#                if name == 'Services':
#                    for sc in o.serviceclasses():
#                        sc.buildRelations()
#                if name == 'Processes':
#                    for pc in o.osProcessClasses():
#                        pc.buildRelations()

        # Add menus.
        
# Get rid of all menus

        hasmenus = lambda x: hasattr(x, 'zenMenus') 
        if hasmenus(dmd): dmd.zenMenus.removeRelation()
        if hasmenus(dmd.Devices): dmd.Devices.zenMenus.removeRelation()
        if hasmenus(dmd.Networks): dmd.Networks.zenMenus.removeRelation()

        dmd.buildMenus({  
'TopLevel': [
         {  'action': 'dialog_addEvent',
            'allowed_classes': ('EventClass',),
            'description': 'Add Event...',
            'id': 'addEvent',
            'isdialog': True,
            'ordering': 80.0,
            'permissions': ('Manage DMD',)},
        {  'action': 'dialog_refreshEventSchema',
           'allowed_classes': ['MySqlEventManager'],
           'description': 'Refresh Event Schema...',
           'id': 'manage_refreshConversions',
           'isdialog': True,
           'ordering': 90.0,
           'permissions': ('Change Device',)},
        {  'action': 'dialog_clearEventCache',
           'allowed_classes': ['MySqlEventManager'],
           'description': 'Clear Event Cache...',
           'id': 'manage_clearCache',
           'isdialog': True,
           'ordering': 80.0,
           'permissions': ('Change Device',)},
        {  'action': 'dialog_clearAllHeartbeats',
           'allowed_classes': ['MySqlEventManager'],
           'description': 'Clear All Heartbeats...',
           'id': 'manage_clearHeartbeats',
           'isdialog': True,
           'ordering': 2.0,
           'permissions': ('Change Device',)}
],
'Add': [   {  'action': 'dialog_addReportClass',
                'allowed_classes': ('ReportClass',),
                'description': 'Add Report Organizer...',
                'id': 'addReportClass',
                'isdialog': True,
                'ordering': 90.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_addReport',
                'allowed_classes': ('ReportClass',),
                'description': 'Add Device Report...',
                'id': 'addDeviceReport',
                'isdialog': True,
                'ordering': 80.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_addIpInterface',
                'allowed_classes': ('OperatingSystem',),
                'description': 'Add IpInterface...',
                'id': 'addIpInterface',
                'isdialog': True,
                'ordering': 70.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_addOSProcess',
                'allowed_classes': ('OperatingSystem',),
                'description': 'Add OSProcess...',
                'id': 'addOSProcess',
                'isdialog': True,
                'ordering': 60.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_addFileSystem',
                'allowed_classes': ('OperatingSystem',),
                'description': 'Add File System...',
                'id': 'addFileSystem',
                'isdialog': True,
                'ordering': 50.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_addIpRouteEntry',
                'allowed_classes': ('OperatingSystem',),
                'description': 'Add Route...',
                'id': 'addIpRouteEntry',
                'isdialog': True,
                'ordering': 40.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_addIpService',
                'allowed_classes': ('OperatingSystem',),
                'description': 'Add IpService...',
                'id': 'addIpService',
                'isdialog': True,
                'ordering': 30.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_addWinService',
                'allowed_classes': ('OperatingSystem',),
                'description': 'Add WinService...',
                'id': 'addWinService',
                'isdialog': True,
                'ordering': 20.0,
                'permissions': ('Change Device',)}],
'DataPoint_list': [  {  'action': 'dialog_addDataPoint',
                       'description': 'Add DataPoint...',
                       'id': 'addDataPoint',
                       'isdialog': True,
                       'ordering': 90.1,
                       'permissions': ('Change Device',)},
                    {  'action': 'dialog_deleteDataPoint',
                       'description': 'Delete DataPoint...',
                       'id': 'deleteDataPoint',
                       'isdialog': True,
                       'ordering': 90.0,
                       'permissions': ('Change Device',)}],
'DataSource_list': [  {  'action': 'dialog_addDataSource',
                        'description': 'Add DataSource...',
                        'id': 'addDataSource',
                        'isdialog': True,
                        'ordering': 90.1,
                        'permissions': ('Change Device',)},
                     {  'action': 'dialog_deleteDataSource',
                        'description': 'Delete DataSource...',
                        'id': 'deleteDataSource',
                        'isdialog': True,
                        'ordering': 90.0,
                        'permissions': ('Change Device',)}],
'Device_list': [  
            {  'action': 'dialog_setProductionState',
               'description': 'Set Production State...',
               'id': 'setProductionState',
               'isdialog': True,
               'ordering': 80.0,
               'permissions': ('Change Device Production State',)},
            {  'action': 'dialog_setPriority',
               'description': 'Set Priority...',
               'id': 'setPriority',
               'isdialog': True,
               'ordering': 70.0,
               'permissions': ('Change Device',)},
            {  'action': 'dialog_moveDevices',
                    'description': 'Move to Class...',
                    'id': 'moveclass',
                    'isdialog': True,
                    'ordering': 50.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_setGroups',
                    'description': 'Set Groups...',
                    'id': 'setGroups',
                    'isdialog': True,
                    'ordering': 40.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_setSystems',
                    'description': 'Set Systems...',
                    'id': 'setSystems',
                    'isdialog': True,
                    'ordering': 30.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_setLocation',
                    'description': 'Set Location...',
                    'id': 'setLocation',
                    'isdialog': True,
                    'ordering': 20.0,
                    'permissions': ('Change Device',)},
                {  'action': 'dialog_setPerformanceMonitor',
                   'description': 'Set Perf Monitor...',
                   'id': 'setPerformanceMonitor',
                   'isdialog': True,
                   'ordering': 15.0,
                   'permissions': ('Change Device',)},
                 {  'action': 'dialog_removeDevices',
                    'description': 'Delete devices...',
                    'id': 'removeDevices',
                    'isdialog': True,
                    'ordering': 10.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_lockDevices',
                    'description': 'Lock devices...',
                    'id': 'lockDevices',
                    'isdialog': True,
                    'ordering': 2.0,
                    'permissions': ('Change Device',)}],
'DeviceGrid_list': [
            {  'action': 'dialog_setProductionState_grid',
               'description': 'Set Production State...',
               'id': 'setProductionState_grid',
               'isdialog': True,
               'ordering': 80.0,
               'permissions': ('Change Device Production State',)},
            {  'action': 'dialog_setPriority_grid',
               'description': 'Set Priority...',
               'id': 'setPriority',
               'isdialog': True,
               'ordering': 70.0,
               'permissions': ('Change Device',)},
            {  'action': 'dialog_moveDevices_grid',
                    'description': 'Move to Class...',
                    'id': 'moveclass_grid',
                    'isdialog': True,
                    'ordering': 50.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_setGroups_grid',
                    'description': 'Set Groups...',
                    'id': 'setGroups_grid',
                    'isdialog': True,
                    'ordering': 40.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_setSystems_grid',
                    'description': 'Set Systems...',
                    'id': 'setSystems_grid',
                    'isdialog': True,
                    'ordering': 30.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_setLocation_grid',
                    'description': 'Set Location...',
                    'id': 'setLocation_grid',
                    'isdialog': True,
                    'ordering': 20.0,
                    'permissions': ('Change Device',)},
                {  'action': 'dialog_setPerformanceMonitor_grid',
                   'description': 'Set Perf Monitor...',
                   'id': 'setPerformanceMonitor_grid',
                   'isdialog': True,
                   'ordering': 15.0,
                   'permissions': ('Change Device',)},
                 {  'action': 'dialog_removeDevices_grid',
                    'description': 'Delete devices...',
                    'id': 'removeDevices_grid',
                    'isdialog': True,
                    'ordering': 10.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_lockDevices_grid',
                    'description': 'Lock devices...',
                    'id': 'lockDevices_grid',
                    'isdialog': True,
                    'ordering': 2.0,
                    'permissions': ('Change Device',)}],
'EventMapping_list': [  {  'action': 'dialog_addToZenPack',
                          'description': 'Add to ZenPack...',
                          'id': 'addToZenPack',
                          'isdialog': True,
                          'ordering': 0.0,
                          'permissions': ('View',)},
                       {  'action': 'dialog_createInstance',
                          'description': 'Add Mapping...',
                          'id': 'addInstance',
                          'isdialog': True,
                          'ordering': 80.0,
                          'permissions': ('Manage DMD',)},
                       {  'action': 'dialog_removeInstances',
                          'description': 'Delete Mappings...',
                          'id': 'removeInstances',
                          'isdialog': True,
                          'ordering': 80.0,
                          'permissions': ('Manage DMD',)},
                       {  'action': 'dialog_moveInstances',
                          'description': 'Move Mappings...',
                          'id': 'moveInstances',
                          'isdialog': True,
                          'ordering': 70.0,
                          'permissions': ('Manage DMD',)}],
'Event_list': [  {  'action': 'javascript:eventZenGrid.acknowledgeBatch()',
                   'description': 'Acknowledge Events',
                   'id': 'acknowledgeEvents',
                   'ordering': 80.0,
                   'permissions': ('Manage DMD',)},
                {  'action': 'dialog_moveEventsToHistory',
                   'description': 'Move to History...',
                   'id': 'historifyEvents',
                   'isdialog': True,
                   'ordering': 70.0,
                   'permissions': ('Manage DMD',)},
                {  'action': 'javascript:goExport()',
                   'description': 'Download as CSV',
                   'id': 'exportAllEvents',
                   'ordering': 10.0,
                   'permissions': ('View',)},
                {  'action': 'dialog_createEventMap',
                   'description': 'Map Events to Class...',
                   'id': 'createEventMap',
                   'isdialog': True,
                   'ordering': 90.0,
                   'permissions': ('Manage DMD',)}],
'FileSystem': [  {  'action': 'dialog_addFileSystem',
                   'description': 'Add File System...',
                   'id': 'addFileSystem',
                   'isdialog': True,
                   'ordering': 90.0,
                   'permissions': ('Change Device',)},
                {  'action': 'dialog_deleteFileSystems',
                   'description': 'Delete FileSystems...',
                   'id': 'deleteFileSystems',
                   'isdialog': True,
                   'ordering': 80.0,
                   'permissions': ('Change Device',)},
                {  'action': 'dialog_lockFileSystems',
                   'description': 'Lock FileSystems...',
                   'id': 'lockFileSystems',
                   'isdialog': True,
                   'ordering': 2.0,
                   'permissions': ('Change Device',)}],
'Graph_list': [  {  'action': 'dialog_addGraph',
                   'description': 'Add Graph...',
                   'id': 'addGraph',
                   'isdialog': True,
                   'ordering': 90.1,
                   'permissions': ('Change Device',)},
                {  'action': 'dialog_deleteGraph',
                   'description': 'Delete Graph...',
                   'id': 'deleteGraph',
                   'isdialog': True,
                   'ordering': 90.0,
                   'permissions': ('Change Device',)},
                {  'action': "javascript:submitFormToMethod('graphList', 'manage_resequenceRRDGraphs')",
                   'description': 'Re-sequence Graphs',
                   'id': 'resequenceGraphs',
                   'ordering': 80.0,
                   'permissions': ('Change Device',)}],
'HistoryEvent_list': [  {  'action': 'dialog_createEventMap',
                          'description': 'Map Events to Class...',
                          'id': 'createEventMap',
                          'isdialog': True,
                          'ordering': 90.0,
                          'permissions': ('Manage DMD',)},
                       {  'action': 'javascript:goExport()',
                          'description': 'Download as CSV',
                          'id': 'exportAllEvents',
                          'ordering': 80.0,
                          'permissions': ('View',)},
                       {  'action': 'dialog_undeleteHistoryEvents',
                          'description': 'Undelete Events...',
                          'id': 'undeleteHistoryEvents',
                          'isdialog': True,
                          'ordering': 70.0,
                          'permissions': ('Manage DMD',)}],
'IpAddresses': [  {  'action': 'dialog_deleteIpAddress',
                    'description': 'Delete IpAddresses...',
                    'id': 'deleteIpAddress',
                    'isdialog': True,
                    'ordering': 90.0,
                    'permissions': ('Change Device',)}],
'IpInterface': [  {  'action': 'dialog_addIpInterface',
                    'description': 'Add IpInterface...',
                    'id': 'addIpInterface',
                    'isdialog': True,
                    'ordering': 90.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_deleteIpInterfaces',
                    'description': 'Delete IpInterfaces...',
                    'id': 'deleteIpInterfaces',
                    'isdialog': True,
                    'ordering': 80.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_lockIpInterfaces',
                    'description': 'Lock IpInterfaces...',
                    'id': 'lockIpInterfaces',
                    'isdialog': True,
                    'ordering': 2.0,
                    'permissions': ('Change Device',)}],
'IpRouteEntry': [  {  'action': 'dialog_addIpRouteEntry',
                     'description': 'Add IpRouteEntry...',
                     'id': 'addIpRouteEntry',
                     'isdialog': True,
                     'ordering': 90.0,
                     'permissions': ('Change Device',)},
                  {  'action': 'dialog_deleteIpRouteEntries',
                     'description': 'Delete Entries...',
                     'id': 'deleteIpRouteEntries',
                     'isdialog': True,
                     'ordering': 80.0,
                     'permissions': ('Change Device',)},
                  {  'action': 'dialog_lockIpRouteEntries',
                     'description': 'Lock IpRouteEntries...',
                     'id': 'lockIpRouteEntries',
                     'isdialog': True,
                     'ordering': 2.0,
                     'permissions': ('Change Device',)}],
'IpService': [  {  'action': 'dialog_addIpService',
                  'description': 'Add IpService...',
                  'id': 'addIpService',
                  'isdialog': True,
                  'ordering': 90.0,
                  'permissions': ('Change Device',)},
               {  'action': 'dialog_deleteIpServices',
                  'description': 'Delete IpServices...',
                  'id': 'deleteIpServices',
                  'isdialog': True,
                  'ordering': 80.0,
                  'permissions': ('Change Device',)},
               {  'action': 'dialog_lockIpServices',
                  'description': 'Lock IpServices...',
                  'id': 'lockIpServices',
                  'isdialog': True,
                  'ordering': 2.0,
                  'permissions': ('Change Device',)}],

'Edit': [  
            {  'action': 'dialog_setProductionState_global',
               'allowed_classes': (  'DeviceClass',
                                     'DeviceGroup',
                                     'Location',
                                     'System'),
               'description': 'Set Production State...',
               'id': 'setProductionState',
               'isdialog': True,
               'ordering': 80.0,
               'permissions': ('Change Device Production State',)},
            {  'action': 'dialog_setPriority_global',
               'allowed_classes': (  'DeviceClass',
                                     'DeviceGroup',
                                     'Location',
                                     'System'),
               'description': 'Set Priority...',
               'id': 'setPriority',
               'isdialog': True,
               'ordering': 70.0,
               'permissions': ('Change Device',)},
             {  'action': 'dialog_setGroups_global',
               'allowed_classes': (  'DeviceClass',
                                     'DeviceGroup',
                                     'Location',
                                     'System'),
                'description': 'Set Groups...',
                'id': 'setGroups',
                'isdialog': True,
                'ordering': 40.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_setSystems_global',
                'allowed_classes': ( 'DeviceClass',
                                     'DeviceGroup',
                                     'Location',
                                     'System'),
                'description': 'Set Systems...',
                'id': 'setSystems',
                'isdialog': True,
                'ordering': 30.0,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_setLocation_global',
                'description': 'Set Location...',
                'allowed_classes': ( 'DeviceClass',
                                     'DeviceGroup',
                                     'Location',
                                     'System'),
                'id': 'setLocation',
                'isdialog': True,
                'ordering': 20.0,
                'permissions': ('Change Device',)},
            {  'action':'dialog_setPerformanceMonitor_global',
               'description': 'Set Perf Monitor...',
               'id': 'setPerformanceMonitor',
               'allowed_classes': ( 'DeviceClass',
                                     'DeviceGroup',
                                     'Location',
                                     'System'),
               'isdialog': True,
               'ordering': 15.0,
               'permissions': ('Change Device',)},
    ],
'Manage': [  
            {  'action': 'dialog_addDevice',
               'allowed_classes': ('DeviceClass',),
               'description': 'Add Device...',
               'id': 'addDevice',
               'isdialog': True,
               'ordering': 90.0,
               'permissions': ('Manage DMD',)},
            {  'action': 'collectDevice', 
                'allowed_classes': (  'Device', 
                'OperatingSystem'), 
                'description': 'Model Device', 
                'id': 'modelDevice', 
                'ordering': 88.0, 
                'permissions': ('Change Device',)},
            {  'action': 'dialog_lockDevices',
                'allowed_classes': (  'DeviceClass',),
                'description': 'Lock Devices...',
                'id': 'lockDevices',
                'isdialog': True,
                'ordering': 86.0,
                'permissions': ('Change Device',)},
            {  'action': 'dialog_changeClass',
               'allowed_classes': ('Device', 'OperatingSystem'),
               'description': 'Change Class...',
               'id': 'changeClass',
               'isdialog': True,
               'ordering': 85.0,
               'permissions': ('Change Device',)},
            {  'action': 'dialog_resetIp',
               'allowed_classes': (  'Device',
                                     'OperatingSystem',
                                     'DeviceClass',
                                  ),
               'description': 'Reset IP...',
               'id': 'resetIp',
               'isdialog': True,
               'ordering': 50.0,
               'permissions': ('Change Device',)},
            {  'action': 'manage_snmpCommunity',
               'allowed_classes': (  'Device',
                                     'OperatingSystem',
                                     'DeviceClass',
                                     ),
               'description': 'Reset Community',
               'id': 'resetCommunity',
               'ordering': 12.0,
               'permissions': ('Change Device',)},
            {  'action': 'dialog_renameDevice',
               'allowed_classes': ('Device', 'OperatingSystem'),
               'description': 'Rename Device...',
               'id': 'renameDevice',
               'isdialog': True,
               'ordering': 30.0,
               'permissions': ('Change Device',)},
            {  'action': 'dialog_deleteDevice',
               'allowed_classes': ('Device', 'OperatingSystem'),
               'description': 'Delete Device...',
               'id': 'deleteDevice',
               'isdialog': True,
               'ordering': 4.0,
               'permissions': ('Change Device',)},
            {  'action': 'dialog_lock',
               'allowed_classes': [  'Device',
                                     'OperatingSystem',
                                     'WinService',
                                     'FileSystem',
                                     'HardDisk',
                                     'IpInterface',
                                     'IpService',
                                     'OSProcess',
                                     'IpRouteEntry'],
               'description': 'Lock...',
               'id': 'lockObject',
               'isdialog': True,
               'ordering': 15.0,
               'permissions': ('Change Device',)},
            {  'action': 'pushConfig',
               'allowed_classes': ['DeviceClass', 'Device'],
               'description': 'Push Changes',
               'id': 'pushConfig',
               'ordering': 10.0,
               'permissions': ('Change Device',)},
            {  'action': '../pushConfig',
               'allowed_classes': ['OperatingSystem'],
               'description': 'Push Changes',
               'id': 'pushConfig_os',
               'ordering': 10.0,
               'permissions': ('Change Device',)},
            {  'action': 'dialog_clearHeartbeats',
               'allowed_classes': ('Device', 'OperatingSystem'),
               'description': 'Clear Heartbeats...',
               'id': 'clearHeartbeats',
               'isdialog': True,
               'ordering': 5.0,
               'permissions': ('Change Device',)}],
'Manufacturer_list': [  {  'action': 'dialog_addToZenPack',
                          'description': 'Add to ZenPack...',
                          'id': 'addToZenPack',
                          'isdialog': True,
                          'ordering': 0.0,
                          'permissions': ('View',)},
                       {  'action': 'dialog_addManufacturer',
                          'description': 'Add Manufacturer...',
                          'id': 'addManufacturer',
                          'isdialog': True,
                          'ordering': 90.0,
                          'permissions': ('Manage DMD',)},
                       {  'action': 'dialog_removeManufacturers',
                          'description': 'Delete Manufacturers...',
                          'id': 'removeManufacturers',
                          'isdialog': True,
                          'ordering': 80.0,
                          'permissions': ('Manage DMD',)}],
'Menus': [  {  'action': 'dialog_addToZenPack',
              'description': 'Add to ZenPack...',
              'id': 'addToZenPack',
              'isdialog': True,
              'ordering': 0.0,
              'permissions': ('View',)},
           {  'action': 'dialog_addMenuItem',
              'allowed_classes': ['DataRoot'],
              'description': 'Add Menu Item...',
              'id': 'addMenuItem',
              'isdialog': True,
              'ordering': 90.0,
              'permissions': ('Manage DMD',)},
           {  'action': 'dialog_deleteMenuItems',
              'allowed_classes': ['DataRoot'],
              'description': 'Delete Menu Items...',
              'id': 'deleteMenuItems',
              'isdialog': True,
              'ordering': 80.0,
              'permissions': ('Manage DMD',)},
           {  'action': 'dialog_saveOrdering',
              'allowed_classes': ['DataRoot'],
              'description': 'Save Ordering...',
              'id': 'saveOrdering',
              'isdialog': True,
              'ordering': 70.0,
              'permissions': ('Manage DMD',)}],
'Mib_list': [  {  'action': 'dialog_addToZenPack',
                 'description': 'Add to ZenPack...',
                 'id': 'addToZenPack',
                 'isdialog': True,
                 'ordering': 0.0,
                 'permissions': ('View',)},
              {  'action': 'dialog_addMibModule',
                 'description': 'Add Mib...',
                 'id': 'addMibModule',
                 'isdialog': True,
                 'ordering': 90.0,
                 'permissions': ('Manage DMD',)},
              {  'action': 'dialog_removeMibModules',
                 'description': 'Delete Mibs...',
                 'id': 'removeMibModules',
                 'isdialog': True,
                 'ordering': 80.0,
                 'permissions': ('Manage DMD',)},
              {  'action': 'dialog_moveMibModules',
                 'description': 'Move Mibs...',
                 'id': 'moveMibModules',
                 'isdialog': True,
                 'ordering': 70.0,
                 'permissions': ('Manage DMD',)}],
'More': [ {  'action': 'viewHistory',
              'allowed_classes': ['Device', 
                 'System', 
                 'DeviceGroup', 
                 'Location', 
                 'DeviceClass'],
              'description': 'Modifications',
              'id': 'viewHistory',
              'ordering': 2.0,
              'permissions': ('Change Device',)},
          {  'action': '../viewHistory',
             'allowed_classes': ['OperatingSystem'],
             'description': 'Modifications',
             'id': 'viewHistory_os',
             'ordering': 2.0,
             'permissions': ('Change Device',)},
          {  'action': 'objTemplates',
             'allowed_classes': [  'Device',
                                   'HardDisk'],
             'description': 'Templates',
             'id': 'objTemplates',
             'ordering': 81.0,
             'permissions': ('Change Device',)},
          {  'action': '../objTemplates',
             'allowed_classes': ['OperatingSystem'],
             'description': 'Templates',
             'id': 'objTemplates_os',
             'ordering': 81.0,
             'permissions': ('Change Device',)},
          {  'action': 'dialog_addOneToZenPack',
             'allowed_classes': ['ZenPackable'],
             'description': 'Add to ZenPack...',
             'id': 'addToZenPack',
             'isdialog': True,
             'ordering': 1.0,
             'permissions': ('View',)},
          {  'action': 'dialog_deleteComponent',
             'allowed_classes': [  'WinService',
                                   'FileSystem',
                                   'HardDisk',
                                   'IpInterface',
                                   'IpService',
                                   'OSProcess',
                                   'IpRouteEntry'],
             'description': 'Delete',
             'id': 'deleteObject',
             'isdialog': True,
             'ordering': 80.0,
             'permissions': ('Change Device',)},
          {  'action': 'editCustSchema',
             'allowed_classes': ['DeviceClass'],
             'description': 'Custom Schema',
             'id': 'editCustSchema',
             'ordering': 60.0,
             'permissions': ('Change Device',)},
          {  'action': 'deviceCustomEdit',
             'allowed_classes': ['Device'],
             'description': 'Custom',
             'id': 'deviceCustomEdit',
             'ordering': 95.0,
             'permissions': ('View',)},
          {  'action': 'zSortableProperty?prop=zCollectorPlugins',
             'allowed_classes': ['Device', 'DeviceClass'],
             'description': 'Collector Plugins',
             'id': 'collectorPlugins',
             'ordering': 20.0,
             'permissions': ('Change Device',)},
          {  'action': '../deviceCustomEdit',
             'allowed_classes': ['OperatingSystem'],
             'description': 'Custom',
             'id': 'deviceCustomEdit_os',
             'ordering': 95.0,
             'permissions': ('View',)},
          {  'action': 'deviceManagement',
             'allowed_classes': ['Device', 'DeviceClass'],
             'description': 'Administration',
             'id': 'deviceManagement',
             'ordering': 50.0,
             'permissions': ('Change Device',)},
          {  'action': '../deviceManagement',
             'allowed_classes': ['OperatingSystem'],
             'description': 'Administration',
             'id': 'deviceManagement_os',
             'ordering': 50.0,
             'permissions': ('Change Device',)},
          {  'action': 'performanceTemplates',
             'allowed_classes': ['DeviceClass'],
             'description': 'All Templates',
             'id': 'performanceTemplates',
             'ordering': 65.0,
             'permissions': ('View Device',)},
          {  'action': 'zPropertyEdit',
             'allowed_classes': [  'Device',],
             'description': 'zProperties',
             'id': 'zPropertyEdit',
             'ordering': 85.0,
             'permissions': ('View',)},
          {  'action': '../zPropertyEdit',
             'allowed_classes': ['OperatingSystem'],
             'description': 'zProperties',
             'id': 'zPropertyEdit_os',
             'ordering': 85.0,
             'permissions': ('View',)}],
'OIDMappings': [  {  'action': 'dialog_addOIDMapping',
                    'description': 'Add OID Mapping...',
                    'id': 'addOIDMapping',
                    'isdialog': True,
                    'ordering': 90.1,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_deleteOIDMapping',
                    'description': 'Delete OID Mapping...',
                    'id': 'deleteOIDMapping',
                    'isdialog': True,
                    'ordering': 90.0,
                    'permissions': ('Change Device',)}],
'OSProcess': [  {  'action': 'dialog_addOSProcess',
                  'description': 'Add OSProcess...',
                  'id': 'addOSProcess',
                  'isdialog': True,
                  'ordering': 90.0,
                  'permissions': ('Change Device',)},
               {  'action': 'dialog_deleteOSProcesses',
                  'description': 'Delete OSProcesses...',
                  'id': 'deleteOSProcesses',
                  'isdialog': True,
                  'ordering': 80.0,
                  'permissions': ('Change Device',)},
               {  'action': 'dialog_lockOSProcesses',
                  'description': 'Lock OSProcesses...',
                  'id': 'lockOSProcesses',
                  'isdialog': True,
                  'ordering': 2.0,
                  'permissions': ('Change Device',)}],
'OSProcessResequence_list': [  {  'action': 'javascript:submitFormToMethod("processList", "manage_resequenceProcesses")',
                                 'description': 'Re-sequence Processes',
                                 'id': 'resequenceOsProcesses',
                                 'ordering': 3.0,
                                 'permissions': ('Manage DMD',)}],
'OSProcess_list': [  {  'action': 'dialog_addToZenPack',
                       'description': 'Add to ZenPack...',
                       'id': 'addToZenPack',
                       'isdialog': True,
                       'ordering': 0.0,
                       'permissions': ('View',)},
                    {  'action': 'dialog_addOSProcessClass',
                       'description': 'Add Process...',
                       'id': 'addOSProcess',
                       'isdialog': True,
                       'ordering': 90.0,
                       'permissions': ('Manage DMD',)},
                    {  'action': 'dialog_removeOSProcesses',
                       'description': 'Delete Processes...',
                       'id': 'removeOSProcesses',
                       'isdialog': True,
                       'ordering': 80.0,
                       'permissions': ('Manage DMD',)},
                    {  'action': 'dialog_moveOSProcesses',
                       'description': 'Move Processes...',
                       'id': 'moveOSProcesses',
                       'isdialog': True,
                       'ordering': 70.0,
                       'permissions': ('Manage DMD',)}],
'Organizer_list': [  {  'action': 'dialog_addToZenPack',
                       'description': 'Add to ZenPack...',
                       'id': 'addToZenPack',
                       'isdialog': True,
                       'ordering': 0.0,
                       'permissions': ('View',)},
                    {  'action': 'dialog_addOrganizer',
                       'description': 'Add New Organizer...',
                       'id': 'addOrganizer',
                       'isdialog': True,
                       'ordering': 90.0,
                       'permissions': ('Manage DMD',)},
                    {  'action': 'dialog_moveOrganizer',
                       'description': 'Move Organizers...',
                       'id': 'moveOrganizer',
                       'isdialog': True,
                       'ordering': 80.0,
                       'permissions': ('Manage DMD',)},
                    {  'action': 'dialog_removeOrganizer',
                       'description': 'Delete Organizers...',
                       'id': 'removeOrganizers',
                       'isdialog': True,
                       'ordering': 70.0,
                       'permissions': ('Manage DMD',)}],
'PerformanceMonitor_list': [  {  'action': 'dialog_addMonitor',
                                'description': 'Add Monitor...',
                                'id': 'addPMonitor',
                                'isdialog': True,
                                'ordering': 90.0,
                                'permissions': ('Manage DMD',)},
                             {  'action': 'dialog_removeMonitors',
                                'description': 'Delete Monitors...',
                                'id': 'removePMonitors',
                                'isdialog': True,
                                'ordering': 80.0,
                                'permissions': ('Manage DMD',)}],
            'Product_list':            [
                ZenPackItems,
                dict(
                    ordering=90.0, 
                    id=         'addHardware',
                    description='Add New Hardware...',
                    action=     'dialog_addHardware',
                    permissions=('Manage DMD',),
                    isdialog=   True
                    ),
                dict(
                    ordering=80.0, 
                    id=         'addSoftware',
                    description='Add New Software...',
                    action=     'dialog_addSoftware',
                    permissions=('Manage DMD',),
                    isdialog=   True
                    ),
                dict(
                    ordering=80.0, 
                    id=         'addOS',
                    description='Add New OS...',
                    action=     'dialog_addOS',
                    permissions=('Manage DMD',),
                    isdialog=   True
                    ),
                dict(
                    ordering=70.0, 
                    id=         'moveToManufacturer',
                    description='Move To Manufacturer...',
                    action=     'dialog_moveToManufacturer',
                    permissions=('Manage DMD',),
                    isdialog=   True
                    ),
                dict(
                    ordering=60.0, 
                    id=         'deleteProducts',
                    description='Delete Products...',
                    action=     'dialog_deleteProducts',
                    permissions=('Manage DMD',),
                    isdialog=   True
                    )
            ],
'ReportClass_list': [  {  'action': 'dialog_addToZenPack',
                         'description': 'Add to ZenPack...',
                         'id': 'addToZenPack',
                         'isdialog': True,
                         'ordering': 0.0,
                         'permissions': ('View',)},
                      {  'action': 'dialog_addReportClass',
                         'allowed_classes': ('ReportClass',),
                         'description': 'Add Report Organizer...',
                         'id': 'addReportClass',
                         'isdialog': True,
                         'ordering': 90.0,
                         'permissions': ('Change Device',)},
                      {  'action': 'dialog_deleteReportClasses',
                         'allowed_classes': ('ReportClass',),
                         'description': 'Delete Report Organizers...',
                         'id': 'deleteReportClasses',
                         'isdialog': True,
                         'ordering': 80.0,
                         'permissions': ('Change Device',)}],
'Report_list': [  {  'action': 'dialog_addToZenPack',
                    'description': 'Add to ZenPack...',
                    'id': 'addToZenPack',
                    'isdialog': True,
                    'ordering': 0.0,
                    'permissions': ('View',)},
                 {  'action': 'dialog_addReport',
                    'allowed_classes': ('ReportClass',),
                    'description': 'Add Device Report...',
                    'id': 'addDeviceReport',
                    'isdialog': True,
                    'ordering': 90.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_deleteReports',
                    'allowed_classes': ('ReportClass',),
                    'description': 'Delete Device Reports...',
                    'id': 'deleteDeviceReports',
                    'isdialog': True,
                    'ordering': 80.0,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_moveReports',
                    'allowed_classes': ('ReportClass',),
                    'description': 'Move Device Reports...',
                    'id': 'moveDeviceReports',
                    'isdialog': True,
                    'ordering': 70.0,
                    'permissions': ('Change Device',)}],
'Service_list': [  {  'action': 'dialog_addToZenPack',
                     'description': 'Add to ZenPack...',
                     'id': 'addToZenPack',
                     'isdialog': True,
                     'ordering': 0.0,
                     'permissions': ('View',)},
                  {  'action': 'dialog_addServiceClass',
                     'description': 'Add Service...',
                     'id': 'addServiceClass',
                     'isdialog': True,
                     'ordering': 90.0,
                     'permissions': ('Manage DMD',)},
                  {  'action': 'dialog_addIpServiceClass',
                     'description': 'Add IP Service...',
                     'id': 'addIpServiceClass',
                     'isdialog': True,
                     'ordering': 85.0,
                     'permissions': ('Manage DMD',)},
                  {  'action': 'dialog_removeServiceClasses',
                     'description': 'Delete Services...',
                     'id': 'removeServiceClasses',
                     'isdialog': True,
                     'ordering': 80.0,
                     'permissions': ('Manage DMD',)},
                  {  'action': 'dialog_moveServiceClasses',
                     'description': 'Move Services...',
                     'id': 'moveServiceClasses',
                     'isdialog': True,
                     'ordering': 70.0,
                     'permissions': ('Manage DMD',)}],
'StatusMonitor_list': [  {  'action': 'dialog_addMonitor',
                           'description': 'Add Monitor...',
                           'id': 'addSMonitor',
                           'isdialog': True,
                           'ordering': 90.0,
                           'permissions': ('Manage DMD',)},
                        {  'action': 'dialog_removeMonitors',
                           'description': 'Delete Monitors...',
                           'id': 'removeSMonitors',
                           'isdialog': True,
                           'ordering': 80.0,
                           'permissions': ('Manage DMD',)}],
'EventView_list': [  {  'action': 'dialog_addEventView',
                          'description': 'Add Event View...',
                          'id': 'addEventView',
                          'isdialog': True,
                          'ordering': 90.0,
                          'permissions': ('Manage DMD',)},
                       {  'action': 'dialog_deleteEventViews',
                          'description': 'Delete Event Views...',
                          'id': 'deleteEventViews',
                          'isdialog': True,
                          'ordering': 80.0,
                          'permissions': ('Manage DMD',)}],
'ActionRule_list': [  {  'action': 'dialog_addActionRule',
                        'description': 'Add Alerting Rule...',
                        'id': 'addActionRule',
                        'isdialog': True,
                        'ordering': 90.0,
                        'permissions': ('Manage DMD',)},
                     {  'action': 'dialog_deleteActionRules',
                        'description': 'Delete Rules...',
                        'id': 'deleteActionRules',
                        'isdialog': True,
                        'ordering': 80.0,
                        'permissions': ('Manage DMD',)}],
'ActionRuleWindow_list': [  {  'action': 'dialog_addActionRuleWindow',
                          'description': 'Add Rule Window...',
                          'id': 'addActionRuleWindow',
                          'isdialog': True,
                          'ordering': 90.0,
                          'permissions': ('Manage DMD',)},
                       {  'action': 'dialog_deleteActionRuleWindows',
                          'description': 'Delete Rule Windows...',
                          'id': 'deleteActionRuleWindows',
                          'isdialog': True,
                          'ordering': 80.0,
                          'permissions': ('Manage DMD',)}],
'Administrator_list': [  {  'action': 'dialog_addAdministrator',
                        'description': 'Add Administrator...',
                        'id': 'addAdministrator',
                        'isdialog': True,
                        'ordering': 90.0,
                        'permissions': ('Manage DMD',)},
                     {  'action': 'dialog_deleteAdministrators',
                        'description': 'Delete Admins...',
                        'id': 'deleteAdministrators',
                        'isdialog': True,
                        'ordering': 80.0,
                        'permissions': ('Manage DMD',)},
                     {  'action': 'dialog_saveAdministrators',
                        'description': 'Save Administrators...',
                        'id': 'saveAdministrators',
                        'isdialog': True,
                        'ordering': 85.0,
                        'permissions': ('Manage DMD',)}],
'UserCommand_list': [  {  'action': 'dialog_addToZenPack',
                     'description': 'Add to ZenPack...',
                     'id': 'addToZenPack',
                     'banned_classes': ('Device', 
                        'Service', 'IPService', 'WinService', 'OSProcess'),
                     'isdialog': True,
                     'ordering': 0.0,
                     'permissions': ('View',)},
                     {  'action': 'dialog_addUserCommand',
                          'description': 'Add User Command...',
                          'id': 'addUserCommand',
                          'isdialog': True,
                          'ordering': 90.0,
                          'permissions': ('Manage DMD',)},
                       {  'action': 'dialog_deleteUserCommands',
                          'description': 'Delete Commands...',
                          'id': 'deleteUserCommands',
                          'isdialog': True,
                          'ordering': 80.0,
                          'permissions': ('Manage DMD',)}],
'MaintenanceWindow_list': [  {  'action': 'dialog_addMaintenanceWindow',
                        'description': 'Add Maint Window...',
                        'id': 'addMaintenanceWindow',
                        'isdialog': True,
                        'ordering': 90.0,
                        'permissions': ('Manage DMD',)},
                     {  'action': 'dialog_deleteMaintenanceWindows',
                        'description': 'Delete Maint Windows...',
                        'id': 'deleteMaintenanceWindows',
                        'isdialog': True,
                        'ordering': 80.0,
                        'permissions': ('Manage DMD',)}],
'Subnetworks': [  {  'action': 'javascript:submitFormToMethod("subnetworkForm", "discoverDevices")',
                    'allowed_classes': ('IpNetwork',),
                    'description': 'Discover Devices',
                    'id': 'discoverDevices',
                    'ordering': 80.0,
                    'permissions': ('Change Device',)},
                {  'action': 'dialog_moveNetworks',
                   'allowed_classes': ('IpNetwork',),
                   'description': 'Move Networks...',
                   'id': 'moveNetworks',
                   'isdialog': True,
                   'ordering': 90.0,
                   'permissions': ('Change Device',)},                    
                 {  'action': 'dialog_deleteNetwork',
                    'allowed_classes': ('IpNetwork',),
                    'description': 'Delete Networks...',
                    'id': 'deleteNetwork',
                    'isdialog': True,
                    'ordering': 90.1,
                    'permissions': ('Change Device',)},
                 {  'action': 'dialog_addNetwork',
                    'allowed_classes': ('IpNetwork',),
                    'description': 'Add Network...',
                    'id': 'addNetwork',
                    'isdialog': True,
                    'ordering': 90.2,
                    'permissions': ('Change Device',)}],
'objTemplates': [  {  'action': 'dialog_addLocalTemplate',
                    'allowed_classes': ('Device',),
                      'description': 'Add Template...',
                      'id': 'addLocalTemplate',
                      'isdialog': True,
                      'ordering': 90.1,
                      'permissions': ('Change Device',)},
                {  'action': 'dialog_bindTemplates',
                    'allowed_classes': ('Device',),
                    'description': 'Bind Templates...',
                    'id': 'bindTemplate',
                    'isdialog': True,
                    'ordering': 80.1,
                    'permissions': ('Change Device',)},
                {  'action': 'dialog_removeZDeviceTemplates',
                    'allowed_classes': ('Device',),
                      'description': 'Reset Bindings',
                      'id': 'removeZDeviceTemplates',
                      'isdialog': True,
                      'ordering': 70.1,
                      'permissions': ('Change Device',)},
                ],
'AllTemplates': [  {  'action': 'dialog_addTemplate',
                'description': 'Add Template...',
                'id': 'addTemplate',
                'isdialog': True,
                'ordering': 90.1,
                'permissions': ('Change Device',)},
             {  'action': 'dialog_deleteTemplates',
                'description': 'Delete Templates...',
                'id': 'deleteTemplates',
                'isdialog': True,
                'ordering': 90.0,
                'permissions': ('Change Device',)}],
'Templates': [  {  'action': 'dialog_addTemplate',
                  'description': 'Add Template...',
                  'id': 'addTemplate',
                  'isdialog': True,
                  'ordering': 90.1,
                  'permissions': ('Change Device',)},
               {  'action': 'dialog_deleteTemplates',
                  'description': 'Delete Templates...',
                  'id': 'deleteTemplates',
                  'isdialog': True,
                  'ordering': 90.0,
                  'permissions': ('Change Device',)},
               {  'action': 'dialog_copyPasteTemplates',
                  'description': 'Copy Templates...',
                  'id': 'copyPasteTemplates',
                  'isdialog': True,
                  'ordering': 18.0,
                  'permissions': ('Change Device',)},
                {  'action': 'dialog_bindTemplates',
                    'description': 'Bind Templates...',
                    'id': 'bindTemplate',
                    'isdialog': True,
                    'ordering': 80.0,
                    'permissions': ('Change Device',)},
                {  'action': 'dialog_removeZDeviceTemplates',
                      'description': 'Reset Bindings',
                      'id': 'removeZDeviceTemplates',
                      'isdialog': True,
                      'ordering': 70.1,
                      'permissions': ('Change Device',)},
               ],
'Threshold_list': [  {  'action': 'dialog_addThreshold',
                       'description': 'Add Threshold...',
                       'id': 'addThreshold',
                       'isdialog': True,
                       'ordering': 90.1,
                       'permissions': ('Change Device',)},
                    {  'action': 'dialog_deleteThreshold',
                       'description': 'Delete Threshold...',
                       'id': 'deleteThreshold',
                       'isdialog': True,
                       'ordering': 90.0,
                       'permissions': ('Change Device',)}],
'Traps': [  {  'action': 'dialog_addTrap',
              'description': 'Add Trap...',
              'id': 'addTrap',
              'isdialog': True,
              'ordering': 90.1,
              'permissions': ('Change Device',)},
           {  'action': 'dialog_deleteTrap',
              'description': 'Delete Trap...',
              'id': 'deleteTrap',
              'isdialog': True,
              'ordering': 90.0,
              'permissions': ('Change Device',)}],
'User_list': [  {  'action': 'dialog_addToZenPack',
                  'description': 'Add to ZenPack...',
                  'id': 'addToZenPack',
                  'isdialog': True,
                  'ordering': 0.0,
                  'permissions': ('View',)},
               {  'action': 'dialog_addUser',
                  'description': 'Add New User...',
                  'id': 'addUser',
                  'isdialog': True,
                  'ordering': 90.0,
                  'permissions': ('Manage DMD',)},
               {  'action': 'dialog_deleteUsers',
                  'description': 'Delete Users...',
                  'id': 'deleteUser',
                  'isdialog': True,
                  'ordering': 70.0,
                  'permissions': ('Manage DMD',)}],
'WinService': [  {  'action': 'dialog_addWinService',
                   'description': 'Add WinService...',
                   'id': 'addWinService',
                   'isdialog': True,
                   'ordering': 90.0,
                   'permissions': ('Change Device',)},
                {  'action': 'dialog_deleteWinServices',
                   'description': 'Delete WinServices...',
                   'id': 'deleteWinServices',
                   'isdialog': True,
                   'ordering': 80.0,
                   'permissions': ('Change Device',)},
                {  'action': 'dialog_lockWinServices',
                   'description': 'Lock WinServices...',
                   'id': 'lockWinServices',
                   'isdialog': True,
                   'ordering': 2.0,
                   'permissions': ('Change Device',)}],
'ZenPack_list': [  
                {   'action': 'dialog_addZenPack',
                    'description': 'Create a ZenPack...',
                     'id': 'addZenPack',
                     'isdialog': True,
                     'ordering': 1.02,
                     'permissions': ('Manage DMD',)},
                {   'action': 'dialog_removeZenPacks', 
                    'description': 'Delete ZenPack...', 
                    'id': 'removeZenPack', 
                    'isdialog': True, 
                    'ordering': 1.01, 
                    'permissions': ('Manage DMD',)}],
            })
            
            
MenuRelations()
