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

Source Code for Module 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 as published by 
 8  # 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.app.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
29 - def delete():
30 """ 31 Delete this message from any queues in which it exists. 32 """
33 - def mark_as_read():
34 """ 35 Mark this message as read. 36 """
37 38
39 -class IMessageSender(Interface):
40 """ 41 Something able to send messages. 42 """
43 - def sendToBrowser(title, body, priority, image):
44 """ 45 Create a message and store it on the request object. 46 """
47 - def sendToUser(title, body, priority, image, user):
48 """ 49 Create a message and store it in the L{IMessageQueue} of the user 50 specified. If no user is specified, use the queue of the current user. 51 """
52 - def sendToAll(title, body, priority, image):
53 """ 54 For eash user in the system, create an identical message and store it 55 in the user's L{IMessageQueue}. 56 """
57 58
59 -class IMessageQueue(IContainer):
60 """ 61 Marker interface for a message container. 62 """
63 64
65 -class IMessageBox(Interface):
66 """ 67 Something that can provide messages. 68 """ 69 messagebox = Attribute("The source of IMessage objects.")
70 - def get_messages():
71 """ 72 Return all messages. 73 """
74 - def get_unread():
75 """ 76 Return all messages that have not been marked as read. 77 """
78 79
80 -class IUserMessages(IMessageBox):
81 """ 82 Object that is able to provide IMessage objects from a user queue. 83 """
84 85
86 -class IBrowserMessages(IMessageBox):
87 """ 88 Object that is able to provide IMessage objects from the request. 89 """
90