Package Products :: Package ZenEvents :: Module ZEvent |
[hide private]
[frames] | no frames]

# Source Code for Module Products.ZenEvents.ZEvent

     1  ###########################################################################
     2  #
     3  # This program is part of Zenoss Core, an open source monitoring platform.
     4  # Copyright (C) 2007, Zenoss Inc.
     5  #
     6  # This program is free software; you can redistribute it and/or modify it
     7  # under the terms of the GNU General Public License version 2 or (at your
     8  # option) any later version as published by the Free Software Foundation.
     9  #
    10  # For complete information please visit: http://www.zenoss.com/oss/
    11  #
    12  ###########################################################################
    13
    14  from Globals import InitializeClass
    15  from AccessControl import ClassSecurityInfo
    16
    17  from Event import Event
    18
    19 -class ZEvent(Event):
    20      """
    21      Event that lives in the zope context has zope security mechanisms and
    22      url back to event manager
    23      """
    24      security = ClassSecurityInfo()
    25      security.setDefaultAccess("allow")
    26
    27 -    def __init__(self, manager, fields, data, eventPermission=True):
    28          Event.__init__(self)
    29          self.updateFromFields(fields, data)
    30          self._zem = manager.getId()
    31          self._baseurl = manager.absolute_url_path()
    32          self.eventPermission = eventPermission
    33
    34 -    def getEventDetailHref(self):
    35          """build an href to call the detail of this event"""
    36          return "%s/viewEventFields?evid=%s" % (self._baseurl, self.evid)
    37
    38 -    def getCssClass(self):
    39          """return the css class name to be used for this event.
    40          """
    41          __pychecker__='no-constCond'
    42          value = self.severity < 0 and "unknown" or self.severity
    43          acked = self.eventState > 0 and "acked" or "noack"
    44          return "zenevents_%s_%s %s" % (value, acked, acked)
    45
    46 -    def zem(self):
    47          """return the id of our manager.
    48          """
    49          return self._zem
    50
    51  InitializeClass(ZEvent)
    52