Last change
on this file since 3664 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
1.1 KB
|
Line | |
---|
1 | ## Controller Script (Python) "prefs_captchas_setup" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind state=state |
---|
7 | ##bind subpath=traverse_subpath |
---|
8 | ##parameters= |
---|
9 | ##title=Set necessary skin |
---|
10 | ## |
---|
11 | from Products.CMFCore.utils import getToolByName |
---|
12 | import string |
---|
13 | def exchangeLayers(layer1, layer2): |
---|
14 | skinstool = getToolByName(context, 'portal_skins') |
---|
15 | for skin in skinstool.getSkinSelections(): |
---|
16 | path = skinstool.getSkinPath(skin) |
---|
17 | path = map( string.strip, string.split( path,',' )) |
---|
18 | try: |
---|
19 | i = path.index(layer1) |
---|
20 | path.remove(layer1) |
---|
21 | path.insert(i, layer2) |
---|
22 | except ValueError: |
---|
23 | pass |
---|
24 | path = string.join( path, ', ' ) |
---|
25 | skinstool.addSkinSelection( skin, path ) |
---|
26 | |
---|
27 | form = context.REQUEST.form |
---|
28 | ct = form['static_captchas'] |
---|
29 | |
---|
30 | if ct == 'static': |
---|
31 | exchangeLayers('plone_captchas/dynamic', 'plone_captchas/static') |
---|
32 | layer = 'static' |
---|
33 | else: |
---|
34 | exchangeLayers('plone_captchas/static', 'plone_captchas/dynamic') |
---|
35 | layer = 'dynamic' |
---|
36 | |
---|
37 | return state.set(portal_status_message = 'Captchas changed to %s'%layer) |
---|
Note: See
TracBrowser
for help on using the repository browser.