source: products/qPloneComments/tags/1.6/skins/qplonecomments/prefs_comments_setup.cpy @ 1591

Last change on this file since 1591 was 1, checked in by myroslav, 19 years ago

Building directory structure

File size: 1.2 KB
Line 
1## Script (Python) "prefs_comments_setup"
2##bind container=container
3##bind context=context
4##bind namespace=
5##bind script=script
6##bind subpath=traverse_subpath
7##parameters=
8##title=
9##
10from Products.qPloneComments.config import PROPERTY_SHEET
11from Products.qPloneComments.utils import setAnonymCommenting
12
13form = context.REQUEST.form
14pp = context.portal_properties
15props_sheet = getattr(pp, PROPERTY_SHEET)
16property_maps=[(m['id'], m['type']) for m in props_sheet.propertyMap() if not m['id']=='title']
17request_ids = form.keys()
18
19kw={}
20for id,type in property_maps:
21    if type == 'boolean':
22        # For boolean type in REQUEST present ONLY CHECKED fields
23        # PECULIARITY: when field uncheck - it disappear from the REQUEST
24        if id in request_ids:
25            kw[id] = True
26        else:
27            kw[id] = False
28
29        # Switch anonymouse commenting
30        if id == 'Enable_Anonymous_Commenting':
31            allow = False
32            if id in request_ids:
33                allow = True
34            setAnonymCommenting(context, allow)
35    else:
36        if id in request_ids:
37            kw[id] = form[id]
38
39props_sheet.manage_changeProperties(kw)
40
41return state.set(portal_status_message='Document changes saved.')
Note: See TracBrowser for help on using the repository browser.