Last change
on this file since 696 was
696,
checked in by mylan, 17 years ago
|
Up version
|
-
Property svn:eol-style set to
native
|
File size:
945 bytes
|
Rev | Line | |
---|
[689] | 1 | from urlparse import urlsplit |
---|
| 2 | |
---|
[693] | 3 | from Products.CMFCore.utils import getToolByName |
---|
[689] | 4 | |
---|
| 5 | from config import * |
---|
| 6 | |
---|
| 7 | def setSkin(site, event): |
---|
[693] | 8 | ps = getToolByName(site,'portal_skins') |
---|
[689] | 9 | |
---|
| 10 | if USE_FS_CONFIG: |
---|
[696] | 11 | do_switch = DO_SWITCH |
---|
[689] | 12 | pref = SKIN_SWITCH_PREFIX |
---|
| 13 | switch_theme = SWITCH_THEME |
---|
| 14 | else: |
---|
[693] | 15 | pp = getToolByName(site,'portal_properties') |
---|
[689] | 16 | ss = getattr(pp,'skin_switcher',None) |
---|
| 17 | if not ss: |
---|
| 18 | return |
---|
| 19 | pref = ss.getProperty('theme_switch_prefix', SKIN_SWITCH_PREFIX) |
---|
| 20 | switch_theme = ss.getProperty('switch_theme', SWITCH_THEME) |
---|
[696] | 21 | do_switch = ss.getProperty('do_switch', DO_SWITCH) |
---|
| 22 | |
---|
| 23 | if not do_switch: |
---|
| 24 | return |
---|
| 25 | |
---|
[689] | 26 | avail_skins = ps.getSkinSelections() |
---|
| 27 | if not (pref and switch_theme and switch_theme in avail_skins): |
---|
| 28 | return |
---|
| 29 | |
---|
| 30 | scheme, netloc, path, query, fragm = urlsplit(event.request.URL) |
---|
| 31 | if netloc.startswith(pref): |
---|
| 32 | site.changeSkin(switch_theme) |
---|
Note: See
TracBrowser
for help on using the repository browser.