Changeset 128

Show
Ignore:
Timestamp:
12/28/05 05:02:42
Author:
mylan
Message:

Realized moderating switching on/off, corrected some thing places of code, connected with this.
Corrected configlet template.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • qPloneComments/trunk/Extensions/utils.py

    r127 r128  
    66    result = marker 
    77    pp = getToolByName(self, 'portal_properties') 
    8     config_ps = getattr(pp, PROPERTY_SHEET
     8    config_ps = getattr(pp, PROPERTY_SHEET, None
    99    if config_ps: 
    1010        result =  getattr(config_ps, prop_name, marker) 
     
    1414# Checking is discussion item published 
    1515def isPublished(self): 
    16  
     16    from zLOG import LOG 
     17    LOG('qPloneComments.utils',777,'isPublished','isPublished was called on %s context' % str(self.getId()) ) 
     18     
    1719    roles = self.permission_settings() 
    1820    roles = [r for r in roles if r['name']=='View']     
     
    6466        mh.send(body)   
    6567     
     68def publishDiscussion(self): 
     69    roles = ['Anonymous'] 
     70    self.manage_permission('View', roles, acquire=1) 
     71     
     72     
  • qPloneComments/trunk/__init__.py

    r127 r128  
    77 
    88from config import * 
     9from Extensions.utils import * 
    910 
    1011registerDirectory('skins', SKIN_GLOBALS) 
     
    3940    self._container[ id ] = item 
    4041 
    41     roles = ['Manager', 'Owner', 'Reviewer'] 
    42     item.manage_permission('View', roles, acquire=0) 
    43  
    44     ################################################# 
    45     from zLOG import LOG 
    46     roles = item.permission_settings() 
    47     roles = [r for r in roles if r['name']=='View'][0] 
    48     roles_view = roles['roles'] 
    49     acquire = roles['acquire'] 
    50     LOG('qPloneComments',777,'createReply','roles = %s' % str(roles) ) 
    51     LOG('qPloneComments',777,'createReply','view_roles=%s' % (str(roles_view)) ) 
    52     LOG('qPloneComments',777,'createReply','acquire=%s' % (str(acquire)) ) 
    53  
    54     ################################################# 
    55     #item.manage_permission('Access contents information', roles, acquire=0) 
     42    # Control of performing moderation 
     43    ifModerate = getProp(self, "Turning_on/off_Moderation", marker=False) 
     44    if ifModerate: 
     45        from zLOG import LOG 
     46        LOG('qPloneComments',777,'createReply','ifModerate=%s \t that''s why Moderation was called' % str(ifModerate) ) 
     47        roles = ['Manager', 'Owner', 'Reviewer'] 
     48        item.manage_permission('View', roles, acquire=0) 
    5649 
    5750    return id 
  • qPloneComments/trunk/skins/qplonecomments/discussion_publish_comment.py

    r127 r128  
    99## 
    1010from Products.CMFPlone import transaction_note 
     11from Products.qPloneComments.Extensions.utils import publishDiscussion 
    1112 
    12 req = context.REQUEST 
    13  
    14 roles = ['Anonymous'] 
    15 context.manage_permission('View', roles, acquire=1) 
     13# Publish discussion item 
     14publishDiscussion(context) 
    1615 
    1716transaction_note('Published discussion item') 
    1817target = '%s/%s' % (context.absolute_url(), context.getTypeInfo().getActionById('view') ) 
    1918 
    20 return req.RESPONSE.redirect(target) 
     19return context.REQUEST.RESPONSE.redirect(target) 
  • qPloneComments/trunk/skins/qplonecomments/discussionitem_view.pt

    r127 r128  
    2121             tal:define="userHasReviewPermission python:checkPermission('Review portal content', here); 
    2222                         isPublished here/isDIPublished; 
    23                          "> 
     23                         ifModerate here/ifModerate;"> 
    2424 
    2525            <h2> 
     
    2929 
    3030            <div class="documentByLine"> 
    31                 <span tal:content="python:test(isPublished, 'Published', 'Not Published')"> Pablish state </span> 
     31                <span tal:content="python:test(isPublished, 'Published', 'Not Published')" 
     32                      tal:condition="ifModerate"> Publish state </span> 
    3233                <span i18n:translate="posted_by">Posted by</span> 
    3334                <span tal:content="here/Creator">Poster Name</span> 
     
    7172            </form> 
    7273 
     74            <div class="documentByLine" 
     75                 tal:condition="not:isPublished">Until publishing this comment adding reply impossible.</div> 
     76 
    7377        </div> 
    7478 
  • qPloneComments/trunk/skins/qplonecomments/qPloneComments_config.cpt

    r127 r128  
    1111    <div metal:define-macro="main" i18n:domain="plone"> 
    1212 
    13         <h1 class="documentFirstHeading"> 
    14             <img tal:replace="structure here/product_icon.gif" /> 
    15             <span tal:replace="here/title_or_id">Title or id</span> 
    16         </h1> 
    17  
    18         <div metal:use-macro="here/document_actions/macros/document_actions"> 
    19             Document actions (print, sendto etc) 
    20         </div> 
     13        <h1 i18n:translate="qplonecomments_configuration">qPloneComments Configuration</h1> 
    2114 
    2215        <a href="" 
    2316           class="link-parent" 
    24            i18n:translate="label_up_to_product_page" 
    25            tal:define="parent_url python:here.navigationParent(here, template.getId())" 
    26            tal:condition="parent_url" 
    27            tal:attributes="href parent_url"> 
    28             Up to Product page 
     17           tal:attributes="href string: $portal_url/plone_control_panel" 
     18           i18n:translate="label_up_to_plone_setup"> 
     19           Up to Plone Setup 
    2920        </a> 
    30  
    31         <div class="documentDescription" 
    32              tal:content="here/Description"> 
    33             description 
    34         </div> 
    35  
    36         <h2 i18n:translate="heading_qplonecomments"> 
    37             qPloneComments configuration 
    38         </h2> 
    3921 
    4022        <form name="edit_form" 
     
    4830 
    4931            <fieldset> 
     32                <legend i18n:translate="legend_mailhost_details">qPloneComments configuration Details</legend> 
    5033                <table cellspacing="4" cellpadding="4" border="0" 
    5134                       tal:define ="props_map python:props_sheet.propertyMap();" 
  • qPloneComments/trunk/skins/qplonecomments/qPloneComments_config_script.cpy

    r127 r128  
    1919for id,type in property_maps: 
    2020    if type == 'boolean': 
     21        # For boolean type in REQUEST present ONLY CHECKED fields 
     22        # PECULIARITY: when field uncheck - it disappear from the REQUEST 
    2123        if id in request_ids: 
    2224            kw[id] = True 
  • qPloneComments/trunk/skins/qplonecomments/viewThreadsAtBottom.pt

    r127 r128  
    5050 
    5151                <div class="comment" 
    52                      tal:define="isPublished reply/isDIPublished"> 
    53  
     52                     tal:define="isPublished reply/isDIPublished; 
     53                                 ifModerate here/ifModerate"> 
    5454                    <h3> 
    5555                        <tal:block replace="structure portal/discussionitem_icon.gif"/> 
     
    5959                    <div class="documentByLine" 
    6060                         tal:define="anonymous_creator python:reply.Creator()=='Anonymous User'"> 
    61                         <span tal:content="python:test(isPublished, 'Published', 'Not Published')"> Pablish state </span> 
     61                        <span tal:content="python:test(isPublished, 'Published', 'Not Published')" 
     62                              tal:condition="ifModerate"> Publish state </span> 
    6263                        <span i18n:translate="label_comment_by">Posted by</span> 
    6364                        <span tal:content="reply/Creator" 
     
    8081                         style="display: inline;" 
    8182                         tal:attributes="action string:${reply/absolute_url}/discussion_reply_form" 
    82                          tal:condition="python:checkPermission('Reply to item', reply)"> 
     83                         tal:condition="python:checkPermission('Reply to item', reply) and isPublished"> 
    8384 
    8485                        <input class="standalone" 
     
    116117                               /> 
    117118                    </form> 
     119 
     120                    <div class="documentByLine" 
     121                         tal:condition="not:isPublished">Until publishing this comment adding reply impossible.</div> 
    118122 
    119123                    <div tal:define="replies python:here.getReplyReplies(reply)"