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 | ## |
---|
10 | from Products.qPloneComments.config import PROPERTY_SHEET |
---|
11 | from Products.qPloneComments.utils import setAnonymCommenting |
---|
12 | |
---|
13 | form = context.REQUEST.form |
---|
14 | pp = context.portal_properties |
---|
15 | props_sheet = getattr(pp, PROPERTY_SHEET) |
---|
16 | property_maps=[(m['id'], m['type']) for m in props_sheet.propertyMap() if not m['id']=='title'] |
---|
17 | request_ids = form.keys() |
---|
18 | |
---|
19 | kw={} |
---|
20 | for 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 | |
---|
39 | props_sheet.manage_changeProperties(kw) |
---|
40 | |
---|
41 | return state.set(portal_status_message='Document changes saved.') |
---|
Note: See
TracBrowser
for help on using the repository browser.