From 14b00ff3612d91a52c14be90273fbcf40d379114 Mon Sep 17 00:00:00 2001 From: Timo Stollenwerk Date: Sun, 28 Jun 2009 18:29:01 +0000 Subject: [PATCH] fix publish comment button. svn path=/plone.app.discussion/trunk/; revision=27702 --- plone/app/discussion/browser/moderation.pt | 94 ++++++++++--------- plone/app/discussion/browser/moderation.py | 51 ++++++---- .../browser/stylesheets/discussion.css | 8 ++ plone/app/discussion/browser/table.pt | 10 +- 4 files changed, 93 insertions(+), 70 deletions(-) diff --git a/plone/app/discussion/browser/moderation.pt b/plone/app/discussion/browser/moderation.pt index a480566..7163bea 100644 --- a/plone/app/discussion/browser/moderation.pt +++ b/plone/app/discussion/browser/moderation.pt @@ -34,51 +34,50 @@ - + -

- Review comments -

+

+ Review comments +

-
    -
  • -
    - -
    -
  • -
  • -
    - - -
    -
  • -
  • -
    - - -
    -
  • - -
+
    +
  • +
    + +
    +
  • +
  • +
    + + +
    +
  • +
  • +
    + + +
    +
  • + +
-
- -
- -
+
+ +
+ +
- Commenter @@ -197,6 +200,7 @@ + --->
diff --git a/plone/app/discussion/browser/moderation.py b/plone/app/discussion/browser/moderation.py index fccd49b..5714d6d 100644 --- a/plone/app/discussion/browser/moderation.py +++ b/plone/app/discussion/browser/moderation.py @@ -35,14 +35,14 @@ class View(BrowserView): template = ViewPageTemplateFile('moderation.pt') - def contents_table(self): - table = ReviewCommentsTable(aq_inner(self.context), self.request) - return table.render() - def __call__(self): context = aq_inner(self.context) + self.state = self.request.get('review_state', 'pending') + self.transition = self.request.get('publish_transition', 'pending') + self.limit = self.request.get('limit', 100) + if self.request.has_key('form.button.FilterPending'): self.comments = self.comments_pending() elif self.request.has_key('form.button.FilterPublished'): @@ -51,11 +51,9 @@ class View(BrowserView): self.comments = self.comments_all() return self.template() - def cook(self, text): - return text - - def comments_workflow_enabled(self): - return True + def comments_table(self): + table = ReviewCommentsTable(aq_inner(self.context), self.request, self.comments, self.transition) + return table.render() def comments_all(self, start=0, size=None): @@ -106,6 +104,12 @@ class View(BrowserView): def comments_spam(self, start=0, size=None): return None + def cook(self, text): + return text + + def comments_workflow_enabled(self): + return True + class ReviewTable(Table): render = VPTF("table.pt") batching = VPTF("batching.pt") @@ -114,10 +118,12 @@ class ReviewCommentsTable(object): """The reviewcomments table renders the table and its actions. """ - def __init__(self, context, request, contentFilter={}): + def __init__(self, context, request, content, transition, contentFilter={}, ): self.context = context self.request = request self.contentFilter = contentFilter + self.content = content + self.transition = transition url = context.absolute_url() view_url = url + '/@@moderate-comments' @@ -132,17 +138,19 @@ class ReviewCommentsTable(object): """ context = aq_inner(self.context) - self.state = self.request.get('review_state', 'pending') - self.transition = self.request.get('publish_transition', 'pending') - self.limit = self.request.get('limit', 100) + #self.state = self.request.get('review_state', 'pending') + #self.transition = self.request.get('publish_transition', 'pending') + #self.limit = self.request.get('limit', 100) - catalog = getToolByName(context, 'portal_catalog') + #catalog = getToolByName(context, 'portal_catalog') - brains = catalog( - portal_type='Discussion Item', - sort_on='created', - sort_limit=self.limit, - ) + #brains = catalog( + # portal_type='Discussion Item', + # sort_on='created', + # sort_limit=self.limit, + # ) + + brains = self.content plone_utils = getToolByName(context, 'plone_utils') plone_view = getMultiAdapter((context, self.request), name=u'plone') @@ -206,6 +214,7 @@ class ReviewCommentsTable(object): icon = icon.html_tag(), type_class = type_class, wf_state = review_state, + transition = self.transition, state_title = portal_workflow.getTitleForStateOnType(review_state, obj_type), state_class = state_class, @@ -238,10 +247,12 @@ class ReviewCommentsTable(object): @property def buttons(self): + buttons = [] context = aq_inner(self.context) portal_actions = getToolByName(context, 'portal_actions') - button_actions = portal_actions.listActionInfos(object=context, categories=('folder_buttons', )) + #button_actions = portal_actions.listActionInfos(object=context, categories=('folder_buttons', )) + button_actions = portal_actions.listActionInfos(object=context) # Do not show buttons if there is no data, unless there is data to be # pasted diff --git a/plone/app/discussion/browser/stylesheets/discussion.css b/plone/app/discussion/browser/stylesheets/discussion.css index 9295127..66ba396 100644 --- a/plone/app/discussion/browser/stylesheets/discussion.css +++ b/plone/app/discussion/browser/stylesheets/discussion.css @@ -68,3 +68,11 @@ ul.filter { #dobulkaction { margin: 0.2em 0; } + +.moderate-publish-comment { + float: left; +} + +.moderate-delete-comment { + float: right; +} diff --git a/plone/app/discussion/browser/table.pt b/plone/app/discussion/browser/table.pt index 34f3f05..4ad1c8a 100644 --- a/plone/app/discussion/browser/table.pt +++ b/plone/app/discussion/browser/table.pt @@ -162,15 +162,15 @@ ▼ - +
+ tal:condition="python:item['wf_state'] == 'pending'"> -