Package Products :: Package ZenWidgets :: Module interfaces
[hide private]
[frames] | no frames]

Source Code for Module Products.ZenWidgets.interfaces

 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 zope.interface import Interface, Attribute 
15  from zope.container.interfaces import IContained, IContainer 
16   
17   
18 -class IMessage(IContained):
19 """ 20 A single message. Messages are stored in user-specific MessageQueue objects 21 and in the session object. 22 """ 23 title = Attribute("Title of the message") 24 body = Attribute("Body of the message") 25 image = Attribute("Optional path to image to be displayed") 26 priority = Attribute("Priority of the message") 27 timestamp = Attribute("Time the message was sent") 28 sticky = Attribute("Explicitly designate stickiness") 29
30 - def delete():
31 """ 32 Delete this message from any queues in which it exists. 33 """
34 - def mark_as_read():
35 """ 36 Mark this message as read. 37 """
38 39
40 -class IMessageSender(Interface):
41 """ 42 Something able to send messages. 43 """
44 - def sendToBrowser(title, body, priority, image=None, sticky=None):
45 """ 46 Create a message and store it on the request object. 47 """
48 - def sendToUser(title, body, priority, image=None, user=None):
49 """ 50 Create a message and store it in the L{IMessageQueue} of the user 51 specified. If no user is specified, use the queue of the current user. 52 """
53 - def sendToAll(title, body, priority, image=None):
54 """ 55 For eash user in the system, create an identical message and store it 56 in the user's L{IMessageQueue}. 57 """
58 59
60 -class IMessageQueue(IContainer):
61 """ 62 Marker interface for a message container. 63 """
64 65
66 -class IMessageBox(Interface):
67 """ 68 Something that can provide messages. 69 """ 70 messagebox = Attribute("The source of IMessage objects.")
71 - def get_messages():
72 """ 73 Return all messages. 74 """
75 - def get_unread():
76 """ 77 Return all messages that have not been marked as read. 78 """
79 80
81 -class IUserMessages(IMessageBox):
82 """ 83 Object that is able to provide IMessage objects from a user queue. 84 """
85 86
87 -class IBrowserMessages(IMessageBox):
88 """ 89 Object that is able to provide IMessage objects from the request. 90 """
91