1
2
3
4
5
6
7
8
9
10
11
12
13
14 import cgi
15 import urllib
16
17 from Globals import InitializeClass
18 from AccessControl import ClassSecurityInfo
19
20 from Event import Event
21
23 """
24 Event that lives in the zope context has zope security mechanisms and
25 url back to event manager
26 """
27 security = ClassSecurityInfo()
28 security.setDefaultAccess("allow")
29
30 - def __init__(self, manager, fields, data):
35
40
42 """return a list of data elements that map to the fields parameter.
43 """
44 data = []
45 for field in fields:
46 value = getattr(self, field)
47 _shortvalue = str(value) or ''
48
49
50 if field == "device":
51 value = urllib.quote('<a class="%s"' % (cssClass) +
52 ' href="/zport/dmd/deviceSearchResults'
53 '?query=%s">%s</a>' % (value, _shortvalue))
54 elif field == 'eventClass':
55 _shortvalue = _shortvalue.replace('/','/­')
56 value = urllib.quote('<a class="%s" ' % (cssClass) +
57 'href="/zport/dmd/Events%s">%s</a>' % (value,_shortvalue))
58 else:
59 value = _shortvalue
60 data.append(value)
61 return data
62
63
65 """build an href to call the detail of this event"""
66 return "%s/viewEventFields?evid=%s" % (self._baseurl, self.evid)
67
68
70 """return the css class name to be used for this event.
71 """
72 value = self.severity < 0 and "unknown" or self.severity
73 acked = self.eventState > 0 and "acked" or "noack"
74 return "zenevents_%s_%s %s" % (value, acked, acked)
75
77 """return the id of our manager.
78 """
79 return self._zem
80
81 InitializeClass(ZEvent)
82