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

# Source Code for Module Products.ZenWidgets.interfaces

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