Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes
plone.app.layout.viewlets.comments.CommentsViewlet Class Reference
Inheritance diagram for plone.app.layout.viewlets.comments.CommentsViewlet:
Inheritance graph
[legend]
Collaboration diagram for plone.app.layout.viewlets.comments.CommentsViewlet:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def update
def can_reply
def is_discussion_allowed
def get_replies
def is_anonymous
def login_action
def can_manage
def member_info
def format_time
def portal_url
def render
def index

Public Attributes

 portal_discussion
 portal_membership
 context
 request
 view
 manager
 portal_state
 site_url

Static Public Attributes

tuple index = ViewPageTemplateFile('comments.pt')

Detailed Description

Definition at line 12 of file comments.py.


Member Function Documentation

Definition at line 58 of file comments.py.

00058 
00059     def can_manage(self):
00060         return getSecurityManager().checkPermission('Manage portal', aq_inner(self.context))

Definition at line 20 of file comments.py.

00020 
00021     def can_reply(self):
00022         return getSecurityManager().checkPermission('Reply to item', aq_inner(self.context))

Definition at line 67 of file comments.py.

00067 
00068     def format_time(self, time):
00069         context = aq_inner(self.context)
00070         util = getToolByName(context, 'translation_service')
00071         return util.ulocalized_time(time, 1, context, domain='plonelocales')

Here is the call graph for this function:

Definition at line 29 of file comments.py.

00029 
00030     def get_replies(self):
00031         replies = []
00032 
00033         context = aq_inner(self.context)
00034         container = aq_parent(context)
00035         pd = self.portal_discussion
00036 
00037         def getRs(obj, replies, counter):
00038             rs = pd.getDiscussionFor(obj).getReplies()
00039             if len(rs) > 0:
00040                 rs.sort(lambda x, y: cmp(x.modified(), y.modified()))
00041                 for r in rs:
00042                     replies.append({'depth':counter, 'object':r})
00043                     getRs(r, replies, counter=counter + 1)
00044 
00045         try:
00046             getRs(context, replies, 0)
00047         except DiscussionNotAllowed:
00048             # We tried to get discussions for an object that has not only
00049             # discussions turned off but also no discussion container.
00050             return []
00051         return replies

Here is the call graph for this function:

Reimplemented in plone.app.layout.viewlets.common.TitleViewlet.

Definition at line 46 of file common.py.

00046 
00047     def index(self):
00048         raise NotImplementedError(
00049             '`index` method must be implemented by subclass.')
00050 

Here is the caller graph for this function:

Definition at line 52 of file comments.py.

00052 
00053     def is_anonymous(self):
00054         return self.portal_state.anonymous()

Definition at line 23 of file comments.py.

00023 
00024     def is_discussion_allowed(self):
00025         if self.portal_discussion is None:
00026             return False
00027         else:
00028             return self.portal_discussion.isDiscussionAllowedFor(aq_inner(self.context))

Definition at line 55 of file comments.py.

00055 
00056     def login_action(self):
00057         return '%s/login_form?came_from=%s' % (self.site_url, url_quote(self.request.get('URL', '')),)

Definition at line 61 of file comments.py.

00061 
00062     def member_info(self, creator):
00063         if self.portal_membership is None:
00064             return None
00065         else:
00066             return self.portal_membership.getMemberInfo(creator)

Definition at line 33 of file common.py.

00033 
00034     def portal_url(self):
00035         return self.site_url
00036 

Reimplemented in plone.app.layout.presentation.presentation.PresentationViewlet.

Definition at line 42 of file common.py.

00042 
00043     def render(self):
00044         # defer to index method, because that's what gets overridden by the template ZCML attribute
00045         return self.index()
        

Here is the call graph for this function:

Reimplemented from plone.app.layout.viewlets.common.ViewletBase.

Definition at line 15 of file comments.py.

00015 
00016     def update(self):
00017         super(CommentsViewlet, self).update()
00018         self.portal_discussion = getToolByName(self.context, 'portal_discussion', None)
00019         self.portal_membership = getToolByName(self.context, 'portal_membership', None)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 26 of file common.py.

tuple plone.app.layout.viewlets.comments.CommentsViewlet.index = ViewPageTemplateFile('comments.pt') [static]

Definition at line 13 of file comments.py.

Definition at line 29 of file common.py.

Definition at line 17 of file comments.py.

Definition at line 18 of file comments.py.

Reimplemented in plone.app.layout.viewlets.common.TitleViewlet.

Definition at line 38 of file common.py.

Definition at line 27 of file common.py.

Definition at line 40 of file common.py.

Definition at line 28 of file common.py.


The documentation for this class was generated from the following file: