I want to have different folders to have different themes.
I am trying to make a Project( SkinChooser) with a view where you can choose a
theme and this theme shall be set to the folder.
I don't know if that is possible. I have ( I think so ) all the stuff I need,
but when I choose a theme, nothing happens, no error, no warning, just the ond
theme is displayed.
skinchooser.py file:
class SkinChooserView(BrowserView):
"""This is a View for changing the skin"""
template = ViewPageTemplateFile("templates/skinchooser.pt")
def __call__(self):
self.request.set("disable_border", True)
okbutton = self.request.get("button.submit")
if not okbutton:
return self.template()
text_input = self.request.get("skinname") # is "Hasecke Theme"
path_input = self.request.get("skinpath") # is "plone3_theme.hasecke
path_input = path_input.split(".") #("plone3_theme","hasecke")
print path_input
print text_input
tool = SkinsTool()
tool.addSkinSelection(text_input, path_input)
if text_input:
self.context.changeSkin(text_input) #here the theme shall be set to the
Folder.
print self.context.getCurrentSkinName()
return self.request.response.redirect(self.context.absolute_url())
In the end "print self.context.getCurrentSkinName()" returns the new Theme,
but the theme isn't displayed, the old theme is still displayed.
The page template, if needed:
[...]
<metal:main fill-slot="main">
<h1 class="documentFirstHeading" i18n:translate="header_choose_skin">
Choose another Skin
</h1>
<form method="get"
tal:attributes="action string:${context/absolute_url}/${view/__name__}">
<input type="text" size="20" name="skinname" value="Hasecke Theme" />
<input type="text" size="20" name="skinpath" value="plone3_theme.hasecke" />
<input type="submit" size="5" name="button.submit" value="Change"
class="context"/>
</form>
</metal:main>
[...]
I ran out of Ideas. I hope someone knows how to apply a new theme to one
Folder.
Thanks in advance
Filip Hasecke
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Plone-Users mailing list
Plone...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plone-users
I ran out of Ideas. I hope someone knows how to apply a new theme to one
Folder.
Hi, I've copied the necessary part form the code. Now I have this:
class SkinChooserView(BrowserView):
"""This is a View for changing the skin"""
template = ViewPageTemplateFile("templates/skinchooser.pt")
def __call__(self):
self.request.set("disable_border", True)
okbutton = self.request.get("button.submit")
if not okbutton:
return self.template()
text_input = self.request.get("skinname")
script_body = '''
context.changeSkin('%s', context.REQUEST)
return 1
''' % text_input
if not 'setSkin' in self.context.objectIds():
self.context.manage_addProduct['PythonScripts'].manage_addPythonScript('setSkin')
self.context['setSkin'].write(script_body)
self.context.manage_addProduct['SiteAccess'].manage_addAccessRule('setSkin')
return self.request.response.redirect(self.context.absolute_url())
Ok now the skin changes, BUT the result is not the new skin, but a mixture of
the old and new skin. I think I need to reset all old Themesettings before
setting the new one. But I don't know how to do that :(
>
> I did this using access rule, you can see this here:
> http://dev.plone.org/collective/browser/sc.base.hotsites/trunk/sc/base/hots
>ites/subscribers.py#L49
class SkinChooserView(BrowserView):
"""This is a View for changing the skin"""
template = ViewPageTemplateFile("templates/skinchooser.pt")
def __call__(self):
self.request.set("disable_border", True)
okbutton = self.request.get("button.submit")
if not okbutton:
return self.template()
text_input = self.request.get("skinname")
script_body = '''
context.changeSkin('%s', context.REQUEST)
return 1
''' % text_input
if not 'setSkin' in self.context.objectIds():
self.context.manage_addProduct['PythonScripts'].manage_addPythonScript('setSkin')
self.context['setSkin'].write(script_body)
self.context.manage_addProduct['SiteAccess'].manage_addAccessRule('setSkin')return self.request.response.redirect(self.context.absolute_url())Ok now the skin changes, BUT the result is not the new skin, but a mixture of
the old and new skin. I think I need to reset all old Themesettings before
setting the new one. But I don't know how to do that :(
I use Themes based on the default Plone theme
You can download one ofthe themes here:
http://filip.hasecke.com/stuff/plone3_theme.midnight/view
The problem is viewlets which are displayed in one theme are displayed in
another, the viewlet hides are not updated. And there is a problem with the
CSS cache. Also the whole skins folder is not replaced by the new themes skin
folder :/
>
> Now, the problem is your skin definitions.
> Can be viewlets and browser views registered to all skins.
> Your new skin can be based on the old default skin.
> What skins you are using in your tests ?
I use Themes based on the default Plone theme
You can download one ofthe themes here:
http://filip.hasecke.com/stuff/plone3_theme.midnight/view
The problem is viewlets which are displayed in one theme are displayed in
another, the viewlet hides are not updated. And there is a problem with the
CSS cache. Also the whole skins folder is not replaced by the new themes skin
folder :/
Is it possible to reset all settings to plone default, for just one folder,
before changing the skin?
I need to have all settings like in the default plone theme and I need an
empty style, else all settings of the old theme will be kept, if the new skin
does not change it explicitly.
Is it possible to reset all settings, but just for one folder. Hmm, I don't
think so :/
Does anyone know something about that?
> So... you have reinstalled your theme product ?Yes also with reinstalling there are some complications with the
>
> This behavior (viewlets.xml not working and themes skin folder not
> replaced) seems to be the product isn`t installed correctly.
>
> You could get a look in portal_skins in the tab "*Properties*" and see the
> skin names and skin layers that will be used.
main_template, but when I reinstall the theme for the whole site the CSS and
the viewlets are correct.
Is it possible to reset all settings to plone default, for just one folder,
before changing the skin?
I need to have all settings like in the default plone theme and I need an
empty style, else all settings of the old theme will be kept, if the new skin
does not change it explicitly.
Is it possible to reset all settings, but just for one folder. Hmm, I don't
think so :/
Does anyone know something about that?