Wir sind Silver-Sponsor der ersten
deutschsprachigen Plone Konferenz

Plone Konferenz München 2012

 

Edit Theme Switcher for plone.app.theming

erstellt von Jens W. Klein — 01.07.2011 13:00

How to switch off plone.app.theming for editing.

Mirror TrackNow with plone.app.theming we are in the lucky situation to deliver really any design with Plone.

But there are also designers out in the wild creating designs not compatible with Plones edit-mode.

So its sometimes easier to edit in the classic Plone UI (Sunburst Theme) using a different web address for editing.

And here is how to do it:

  1. Consider to configure two adresses http://edit.domain.tld and http://www.domain.tld 
  2. Add a subscriber to zope.app.publication.interfaces.IBeforeTraverseEvent to configure.zcml
    <configure ...
    ...
      <subscriber
        for="* zope.app.publication.interfaces.IBeforeTraverseEvent"
        handler=".subscriber.surpress_theme"
      />
    </configure>
  3. Add a file subscriber.py with code to conditionally set the header X-Theme-Disabled: True  in case of edit domain (you may want to improve the condition).
    def surpress_theme(obj, event):
        if event.request['ACTUAL_URL'].startswith('http://edit.'):
            event.request.response.setHeader('X-Theme-Disabled', 'True')
  4. Restart your instance

To test this on localhost just add something like edit.localhost to your /etc/hosts file for 127.0.0.1 and enter http://edit.localhost/Plone in your browser.

Image by karlbirrane at flickr under a CC-BY-SA license

 

Artikelaktionen

best and funny

Kommentar von http://funnyrajj.myopenid.com/ am 09.05.2012 20:19
this theme switcher is one of my best from bluedynamics
http://www.thefunnyquotessayings.com/[…]/ funny quotes