Changeset 230
- Timestamp:
- 02/01/06 06:09:55
- Files:
-
- qPloneComments/branches/plone-2.1/Extensions/Install.py (modified) (3 diffs)
- qPloneComments/branches/plone-2.1/config.py (modified) (1 diff)
- qPloneComments/branches/plone-2.1/patch.py (modified) (2 diffs)
- qPloneComments/branches/plone-2.1/skins/qplonecomments/discussion_reply.cpy (modified) (3 diffs)
- qPloneComments/branches/plone-2.1/skins/qplonecomments/discussion_reply_form.cpt (modified) (1 diff)
- qPloneComments/branches/plone-2.1/skins/qplonecomments/prefs_comments_setup.cpy (modified) (2 diffs)
- qPloneComments/branches/plone-2.1/skins/qplonecomments/prefs_comments_setup_form.cpt (modified) (7 diffs)
- qPloneComments/branches/plone-2.1/skins/qplonecomments/validate_setup.vpy (modified) (1 diff)
- qPloneComments/branches/plone-2.1/skins/qplonecomments/validate_talkback.vpy (modified) (2 diffs)
- qPloneComments/branches/plone-2.1/skins/qplonecomments/viewThreadsAtBottom.pt (modified) (1 diff)
- qPloneComments/branches/plone-2.1/tests/testQPloneCommentsCommenting.py (modified) (5 diffs)
- qPloneComments/branches/plone-2.1/tests/testQPloneCommentsConfiglet.py (modified) (6 diffs)
- qPloneComments/branches/plone-2.1/tests/testQPloneCommentsInstall.py (modified) (1 diff)
- qPloneComments/branches/plone-2.1/tests/testQPloneCommentsNotification.py (modified) (6 diffs)
- qPloneComments/branches/plone-2.1/utils.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneComments/branches/plone-2.1/Extensions/Install.py
r229 r230 45 45 # add Property sheet to portal_properies 46 46 pp = getToolByName(self, 'portal_properties') 47 if not PROPERTY_SHEETin pp.objectIds():48 pp.addPropertySheet(id= PROPERTY_SHEET, title= '%s Properties' % PROPERTY_SHEET)49 out.write("Adding %s property sheet to portal_properies\n" % PROPERTY_SHEET)50 props_sheet = pp[ PROPERTY_SHEET]51 updateProperty(props_sheet, id=" Enable_Moderation", value="True", property_type='boolean', out=out)52 updateProperty(props_sheet, id=" Enable_Anonymous_Commenting", value="True", property_type='boolean', out=out)53 updateProperty(props_sheet, id=" Enable_Published_Notification", value="True", property_type='boolean', out=out)54 updateProperty(props_sheet, id=" Enable_Approve_Notification", value="True", property_type='boolean', out=out)55 updateProperty(props_sheet, id=" Email_Discussion_Manager", value="", property_type='string', out=out)56 updateProperty(props_sheet, id=" Email_Subject_Prefix", value="", property_type='string', out=out)47 if not 'qPloneComments' in pp.objectIds(): 48 pp.addPropertySheet(id='qPloneComments', title= '%s Properties' % 'qPloneComments') 49 out.write("Adding %s property sheet to portal_properies\n" % 'qPloneComments' ) 50 props_sheet = pp['qPloneComments'] 51 updateProperty(props_sheet, id="enable_moderation", value="True", property_type='boolean', out=out) 52 updateProperty(props_sheet, id="enable_anonymous_commenting", value="True", property_type='boolean', out=out) 53 updateProperty(props_sheet, id="enable_published_notification", value="True", property_type='boolean', out=out) 54 updateProperty(props_sheet, id="enable_approve_notification", value="True", property_type='boolean', out=out) 55 updateProperty(props_sheet, id="email_discussion_manager", value="", property_type='string', out=out) 56 updateProperty(props_sheet, id="email_subject_prefix", value="", property_type='string', out=out) 57 57 # Tern on Anonymous commenting 58 58 self.manage_permission(ReplyToItem, ['Anonymous','Manager','Member'], 1) 59 59 60 out.write("Updating properties of %s property sheet\n" % PROPERTY_SHEET)60 out.write("Updating properties of %s property sheet\n" % 'qPloneComments' ) 61 61 62 62 # Add Configlet. Delete old version before adding, if exist one. … … 88 88 if not pp_ps.hasProperty(id): 89 89 pp_ps.manage_addProperty(id, value, property_type) 90 out.write("Adding %s property to %s property sheet\n" % (id, PROPERTY_SHEET) )90 out.write("Adding %s property to %s property sheet\n" % (id, 'qPloneComments') ) 91 91 92 92 … … 106 106 # Remove Product's property sheet from portal_properties 107 107 pp = getToolByName(self, 'portal_properties') 108 if PROPERTY_SHEETin pp.objectIds():109 pp.manage_delObjects(ids=[ PROPERTY_SHEET,])108 if 'qPloneComments' in pp.objectIds(): 109 pp.manage_delObjects(ids=['qPloneComments',]) qPloneComments/branches/plone-2.1/config.py
r229 r230 4 4 SKINS_DIR = "skins" 5 5 SKIN_NAME = "qplonecomments" 6 PROPERTY_SHEET = "qPloneComments"7 6 8 7 CONFIGLET_ID = "prefs_comments_setup_form" qPloneComments/branches/plone-2.1/patch.py
r229 r230 4 4 from Products.CMFCore.utils import getToolByName 5 5 6 #from config import *7 6 from utils import * 8 7 … … 34 33 else: 35 34 item.manage_addProperty(id='isAnon', value=value, type='boolean') 35 36 36 item.review_state="private" 37 37 38 item.__of__( self ).indexObject()39 40 38 item.setReplyTo( self._getDiscussable() ) 41 42 39 self._container[ id ] = item 43 40 44 41 # Control of performing moderation 45 ifModerate = getProp(self, " Enable_Moderation", marker=False)42 ifModerate = getProp(self, "enable_moderation", marker=False) 46 43 if ifModerate: 47 44 roles = ['DiscussionManager'] 48 45 item.manage_permission('Delete objects', roles, acquire=1) 49 #item.manage_permission('Review portal content', roles, acquire=0)50 46 item.manage_permission('View', roles, acquire=0) 51 47 else: 52 48 item.review_state = "published" 53 49 item._p_changed = 1 54 50 51 item.__of__( self ).indexObject() 55 52 return id 56 53 qPloneComments/branches/plone-2.1/skins/qplonecomments/discussion_reply.cpy
r229 r230 12 12 from Products.CMFCore.utils import getToolByName 13 13 from Products.qPloneComments.utils import send_email 14 from Products.qPloneComments.config import PROPERTY_SHEET15 14 16 15 mtool = getToolByName(context, 'portal_membership') … … 19 18 pp = getToolByName(context,'portal_properties') 20 19 # Get properties 21 isForAnonymous = pp[ PROPERTY_SHEET].getProperty('Enable_Anonymous_Commenting', None)22 ifModerate = pp[ PROPERTY_SHEET].getProperty('Enable_Moderation', None);20 isForAnonymous = pp['qPloneComments'].getProperty('enable_anonymous_commenting', None) 21 ifModerate = pp['qPloneComments'].getProperty('enable_moderation', None); 23 22 24 23 … … 67 66 reply = tb.getReply(id) 68 67 68 69 69 # TODO THIS NEEDS TO GO AWAY! 70 70 if hasattr(dtool.aq_explicit, 'cookReply'): qPloneComments/branches/plone-2.1/skins/qplonecomments/discussion_reply_form.cpt
r229 r230 62 62 action="talkback" 63 63 tal:attributes="action string:$here_url/$template_id" 64 tal:define="isForAnonymous python:here.portal_properties.qPloneComments.getProperty(' Enable_Anonymous_Commenting', 0)">64 tal:define="isForAnonymous python:here.portal_properties.qPloneComments.getProperty('enable_anonymous_commenting', 0)"> 65 65 66 66 <fieldset> qPloneComments/branches/plone-2.1/skins/qplonecomments/prefs_comments_setup.cpy
r229 r230 8 8 ##title= 9 9 ## 10 from Products. qPloneComments.config import PROPERTY_SHEET10 from Products.CMFCore.utils import getToolByName 11 11 from Products.qPloneComments.utils import setAnonymCommenting 12 from Products.CMFCore.utils import getToolByName13 12 14 13 form = context.REQUEST.form 15 14 pp = getToolByName(context, 'portal_properties') 16 props_sheet = getattr(pp, PROPERTY_SHEET)15 props_sheet = getattr(pp, 'qPloneComments') 17 16 property_maps=[(m['id'], m['type']) for m in props_sheet.propertyMap() if not m['id']=='title'] 18 17 request_ids = form.keys() … … 27 26 28 27 # Switch anonymouse commenting 29 if id == ' Enable_Anonymous_Commenting':28 if id == 'enable_anonymous_commenting': 30 29 allow = False 31 30 if id in request_ids: qPloneComments/branches/plone-2.1/skins/qplonecomments/prefs_comments_setup_form.cpt
r229 r230 64 64 enctype="multipart/form-data" 65 65 tal:define ="pp here/portal_properties; 66 ps_name python:modules['Products.qPloneComments.config'].PROPERTY_SHEET; 67 props_sheet python:getattr(pp, ps_name);" 66 props_sheet python:getattr(pp, 'qPloneComments');" 68 67 tal:attributes="action string:${here/getId}/${template/getId}"> 69 68 … … 72 71 73 72 <div class="field" 74 tal:define="property_id string: Enable_Moderation;73 tal:define="property_id string:enable_moderation; 75 74 isEnabledModeration python:props_sheet.getProperty(property_id, False);" 76 75 tal:condition="python:props_sheet.hasProperty(property_id)"> … … 92 91 93 92 <div class="field" 94 tal:define="property_id string: Enable_Anonymous_Commenting;93 tal:define="property_id string:enable_anonymous_commenting; 95 94 isEnabledAnonymousCommenting python:props_sheet.getProperty(property_id, False);" 96 95 tal:condition="python:props_sheet.hasProperty(property_id)"> … … 112 111 113 112 <div class="field" 114 tal:define="property_id string: Enable_Published_Notification;113 tal:define="property_id string:enable_published_notification; 115 114 isEnabledPublishedNotification python:props_sheet.getProperty(property_id, False);" 116 115 tal:condition="python:props_sheet.hasProperty(property_id)"> … … 131 130 132 131 <div class="field" 133 tal:define="property_id string: Enable_Approve_Notification;132 tal:define="property_id string:enable_approve_notification; 134 133 isEnableApproveNotification python:props_sheet.getProperty(property_id, False);" 135 134 tal:condition="python:props_sheet.hasProperty(property_id)"> … … 153 152 --> 154 153 <div class="field" 155 tal:define="property_id string: Email_Discussion_Manager;154 tal:define="property_id string:email_discussion_manager; 156 155 email python:props_sheet.getProperty(property_id, ''); 157 156 error python:test(errors.has_key(property_id), errors.get(property_id), None);" … … 178 177 179 178 <div class="field" 180 tal:define="property_id string: Email_Subject_Prefix;179 tal:define="property_id string:email_subject_prefix; 181 180 organization_name python:props_sheet.getProperty(property_id, '');" 182 181 tal:condition="python:props_sheet.hasProperty(property_id)"> qPloneComments/branches/plone-2.1/skins/qplonecomments/validate_setup.vpy
r229 r230 8 8 ##parameters= 9 9 ##title=validates qpc setup 10 10 ## 11 11 from Products.CMFCore.utils import getToolByName 12 12 13 13 form = context.REQUEST.form 14 email_key = ' Email_Discussion_Manager'14 email_key = 'email_discussion_manager' 15 15 16 16 if email_key in form: qPloneComments/branches/plone-2.1/skins/qplonecomments/validate_talkback.vpy
r229 r230 8 8 ##parameters=subject='',body_text='' 9 9 ##title=validates a discussion entry 10 10 ## 11 11 from Products.CMFCore.utils import getToolByName 12 from Products.qPloneComments.config import PROPERTY_SHEET13 12 14 13 dtool = context.portal_discussion … … 27 26 28 27 pp = getToolByName(context, 'portal_properties') 29 isForAnonymous = pp[ PROPERTY_SHEET].getProperty('Enable_Anonymous_Commenting', None)28 isForAnonymous = pp['qPloneComments'].getProperty('enable_anonymous_commenting', None) 30 29 if isForAnonymous: 31 30 pm = getToolByName(context, 'portal_membership') qPloneComments/branches/plone-2.1/skins/qplonecomments/viewThreadsAtBottom.pt
r229 r230 39 39 40 40 <tal:getreplies repeat="reply_dict python:here.getReplyReplies(here)" 41 define="ifModerate python:here.portal_properties.qPloneComments.getProperty(' Enable_Moderation', None);">41 define="ifModerate python:here.portal_properties.qPloneComments.getProperty('enable_moderation', None);"> 42 42 <div class="comment" style="" 43 43 tal:define="indent python:reply_dict['depth']*2; qPloneComments/branches/plone-2.1/tests/testQPloneCommentsCommenting.py
r229 r230 166 166 pp = getToolByName(self.portal, 'portal_properties') 167 167 config_ps = getattr(pp, 'qPloneComments', None) 168 EnableAnonymComm = getattr(config_ps, " Enable_Anonymous_Commenting")168 EnableAnonymComm = getattr(config_ps, "enable_anonymous_commenting") 169 169 # Group users depending on Anonymous commenting enabling/disabling 170 170 if EnableAnonymComm: … … 277 277 pp = getToolByName(self.portal, 'portal_properties') 278 278 config_ps = getattr(pp, 'qPloneComments', None) 279 EnableAnonymComm = getattr(config_ps, " Enable_Anonymous_Commenting")279 EnableAnonymComm = getattr(config_ps, "enable_anonymous_commenting") 280 280 # Group users depending on Anonymous commenting enabling/disabling 281 281 if EnableAnonymComm: … … 344 344 # Preparation for functional testing 345 345 # Tern On Moderation and tern on Anonymous commenting 346 self.request.form[' Enable_Anonymous_Commenting'] = 'True'347 self.request.form[' Enable_Moderation'] = 'True'346 self.request.form['enable_anonymous_commenting'] = 'True' 347 self.request.form['enable_moderation'] = 'True' 348 348 self.portal.prefs_comments_setup() 349 349 # Initialize base classes … … 358 358 # Preparation for functional testing 359 359 # Tern On Moderation and tern off Anonymous commenting 360 self.request.form[' Enable_Moderation'] = 'True'360 self.request.form['enable_moderation'] = 'True' 361 361 self.portal.prefs_comments_setup() 362 362 # Initialize base classes … … 372 372 # Preparation for functional testing 373 373 # Tern On Anonymous commenting and tern off Moderation 374 self.request.form[' Enable_Anonymous_Commenting'] = 'True'374 self.request.form['enable_anonymous_commenting'] = 'True' 375 375 self.portal.prefs_comments_setup() 376 376 # Initialize base classes qPloneComments/branches/plone-2.1/tests/testQPloneCommentsConfiglet.py
r229 r230 75 75 self.login('dm') 76 76 # For prepare mail sending - enter an e-mail adress 77 self.prefs._updateProperty(' Email_Discussion_Manager', 'discussion.manager@test.com')77 self.prefs._updateProperty('email_discussion_manager', 'discussion.manager@test.com') 78 78 member = self.portal.portal_membership.getAuthenticatedMember() 79 79 member.setMemberProperties({'email':'creator@test.com'}) … … 91 91 return [r['name'] for r in getPortalReplyPerm(ReplyToItem) if r['selected']=='SELECTED'] 92 92 # Simulate switching ON Anonymous Commenting 93 self.request.form[' Enable_Anonymous_Commenting'] = 'True'93 self.request.form['enable_anonymous_commenting'] = 'True' 94 94 self.portal.prefs_comments_setup() 95 95 actual_reply_permission = getReplyRoles() … … 97 97 "'Reply to Item' permission set for %s. 'Anonymous' role NOT added" % actual_reply_permission) 98 98 # Simulate switching OFF Anonymous Commenting 99 if self.request.form.has_key(' Enable_Anonymous_Commenting'):100 del self.request.form[' Enable_Anonymous_Commenting']99 if self.request.form.has_key('enable_anonymous_commenting'): 100 del self.request.form['enable_anonymous_commenting'] 101 101 self.portal.prefs_comments_setup() 102 102 actual_reply_permission = getReplyRoles() … … 108 108 addUsers(self) 109 109 self.discussion = self.portal.portal_discussion 110 self.request.form[' Enable_Anonymous_Commenting'] = 'True'111 self.request.form[' Enable_Moderation'] = 'True'110 self.request.form['enable_anonymous_commenting'] = 'True' 111 self.request.form['enable_moderation'] = 'True' 112 112 self.portal.prefs_comments_setup() 113 113 # Create talkback for document and Add comment to my_doc … … 132 132 addUsers(self) 133 133 self.discussion = self.portal.portal_discussion 134 self.request.form[' Enable_Anonymous_Commenting'] = 'True'134 self.request.form['enable_anonymous_commenting'] = 'True' 135 135 self.portal.prefs_comments_setup() 136 136 # Create talkback for document and Add comment to my_doc … … 153 153 def testApproveNotification(self): 154 154 # Check ON Notification Anonymous Commenting 155 self.request.form[' Enable_Approve_Notification'] = 'True'155 self.request.form['enable_approve_notification'] = 'True' 156 156 self.portal.prefs_comments_setup() 157 self.assert_(self.prefs.getProperty(' Enable_Approve_Notification')==1,"Approve Notification not terned ON")157 self.assert_(self.prefs.getProperty('enable_approve_notification')==1,"Approve Notification not terned ON") 158 158 159 159 # Check OFF Notification Anonymous Commenting 160 if self.request.form.has_key(' Enable_Approve_Notification'):161 del self.request.form[' Enable_Approve_Notification']160 if self.request.form.has_key('enable_approve_notification'): 161 del self.request.form['enable_approve_notification'] 162 162 self.portal.prefs_comments_setup() 163 self.assert_(self.prefs.getProperty(' Enable_Approve_Notification')==0,"Approve Notification not terned OFF")163 self.assert_(self.prefs.getProperty('enable_approve_notification')==0,"Approve Notification not terned OFF") 164 164 165 165 166 166 def testPublishedNotification(self): 167 167 # Check ON Notification Anonymous Commenting 168 self.request.form[' Enable_Published_Notification'] = 'True'168 self.request.form['enable_published_notification'] = 'True' 169 169 self.portal.prefs_comments_setup() 170 self.assert_(self.prefs.getProperty(' Enable_Published_Notification')==1,"Published Notification not terned ON")170 self.assert_(self.prefs.getProperty('enable_published_notification')==1,"Published Notification not terned ON") 171 171 172 172 # Check OFF Notification Anonymous Commenting 173 if self.request.form.has_key(' Enable_Published_Notification'):174 del self.request.form[' Enable_Published_Notification']173 if self.request.form.has_key('enable_published_notification'): 174 del self.request.form['enable_published_notification'] 175 175 self.portal.prefs_comments_setup() 176 self.assert_(self.prefs.getProperty(' Enable_Published_Notification')==0,"Published Notification not terned OFF")176 self.assert_(self.prefs.getProperty('enable_published_notification')==0,"Published Notification not terned OFF") 177 177 178 178 qPloneComments/branches/plone-2.1/tests/testQPloneCommentsInstall.py
r229 r230 16 16 CONFIGLET_ID = "prefs_comments_setup_form" 17 17 18 EMAIL_PID = " Email_Discussion_Manager"19 APPROVE_NOTIFICATION_PID = " Enable_Approve_Notification"20 PUBLISHED_NOTIFICATION_PID = " Enable_Published_Notification"21 MODERATION_PID = " Enable_Moderation"22 ANONYMOUS_COMMENTING_PID = " Enable_Anonymous_Commenting"18 EMAIL_PID = "email_discussion_manager" 19 APPROVE_NOTIFICATION_PID = "enable_approve_notification" 20 PUBLISHED_NOTIFICATION_PID = "enable_published_notification" 21 MODERATION_PID = "enable_moderation" 22 ANONYMOUS_COMMENTING_PID = "enable_anonymous_commenting" 23 23 24 24 PloneTestCase.installProduct(PRODUCT) qPloneComments/branches/plone-2.1/tests/testQPloneCommentsNotification.py
r229 r230 24 24 25 25 def setApprovePublished(self, swithA=1,swithP=1): 26 self.prefs._updateProperty(' Enable_Approve_Notification', swithA)27 self.prefs._updateProperty(' Enable_Published_Notification', swithP)26 self.prefs._updateProperty('enable_approve_notification', swithA) 27 self.prefs._updateProperty('enable_published_notification', swithP) 28 28 29 29 … … 54 54 self.login('dm') 55 55 # For prepare mail sending - enter an e-mail adress 56 self.prefs._updateProperty(' Email_Discussion_Manager', 'discussion.manager@test.com')56 self.prefs._updateProperty('email_discussion_manager', 'discussion.manager@test.com') 57 57 member = self.portal.portal_membership.getAuthenticatedMember() 58 58 member.setMemberProperties({'email':'creator@test.com'}) … … 108 108 109 109 def testOFFModerationApprovePublished(self): 110 self.prefs._updateProperty(' Enable_Moderation', 0)110 self.prefs._updateProperty('enable_moderation', 0) 111 111 112 112 # Test Enable Approve Notification & Enable Published Notification … … 118 118 119 119 def testOFFModerationApprove(self): 120 self.prefs._updateProperty(' Enable_Moderation', 0)120 self.prefs._updateProperty('enable_moderation', 0) 121 121 122 122 # Test Enable Approve Notification & Disable Published Notification … … 128 128 129 129 def testOFFModerationPublished(self): 130 self.prefs._updateProperty(' Enable_Moderation', 0)130 self.prefs._updateProperty('enable_moderation', 0) 131 131 132 132 # Test Enable Published Notification & Disable Approve Notification … … 138 138 139 139 def testOFFModeration(self): 140 self.prefs._updateProperty(' Enable_Moderation', 0)140 self.prefs._updateProperty('enable_moderation', 0) 141 141 142 142 # Test Disable Published Notification & Disable Approve Notification qPloneComments/branches/plone-2.1/utils.py
r229 r230 1 1 from Products.CMFCore.utils import getToolByName 2 from config import *3 2 4 3 # Get apropriate property from (propery_sheeet) configlet … … 6 5 result = marker 7 6 pp = getToolByName(self, 'portal_properties') 8 config_ps = getattr(pp, PROPERTY_SHEET, None)7 config_ps = getattr(pp, 'qPloneComments', None) 9 8 if config_ps: 10 9 result = getattr(config_ps, prop_name, marker) … … 18 17 notify = False 19 18 if state=="approve": 20 notify = getProp(context, " Enable_Approve_Notification", False)19 notify = getProp(context, "enable_approve_notification", False) 21 20 elif state=="published": 22 notify = getProp(context, " Enable_Published_Notification", False)21 notify = getProp(context, "enable_published_notification", False) 23 22 if not notify: 24 23 return 0 … … 48 47 to_address = creator.getProperty('email', None) 49 48 elif state=="approve": 50 to_address = getProp(context, " Email_Discussion_Manager", None)49 to_address = getProp(context, "email_discussion_manager", None) 51 50 52 51 # Combine and send email … … 57 56 template = getattr(context, 'approve_comment_template') 58 57 59 organization_name = getProp(context, " Email_Subject_Prefix", "")58 organization_name = getProp(context, "email_subject_prefix", "") 60 59 message = template(obj=parent, mto=to_address, 61 60 mfrom=from_address, organization_name=organization_name) … … 73 72 self.manage_permission('View', roles, acquire=1) 74 73 self._p_changed = 1 74 self.reindexObject() 75 75 76 76
