Skip to main content

Skinning for plone made easy

Project description

Introduction

This package provides functionality to ease skinning of plone. It is built around the idea that you shouldn’t have to adapt much plone templates but instead take any layout you want and put it on top of Plone.

That means that all editing is done using Plone skin but for anonymous users (or users not having the correct permission) another skin is shown. This works based on rules described below. No url switching or iframe magic needed.

It resembles collective.skinny but instead of imposing customized templates for each and every content type this package tries to reuse already existing views and templates. You also won’t need a special server configuration to redirect to ++skin++ or such. With some coding it is also possible to use this for community sites because people can log in and either (if permission is set) they see the well-known Plone interface or the public skin. Also there is no need to hack around to prevent plone templates from leaking because you want to display all plone related templates as is.

Full Example provided here: http://pypi.python.org/pypi/anthill.exampletheme

Installation

  • Include anthill.skinner in your buildout.cfg

  • Make sure to also include z3c.autoinclude

  • Rerun buildout

  • Restart your Zope instance

  • Go to portal_quickinstaller and install anthill.skinner

  • ATT: Make sure to restart Zope - this is because of a handler only being evaluated on startup

  • There should be a new link “Show Preview” on the bottom

Creation of a theme (simple way)

  • Create a new folder custom_public in portal_skins

  • Include this folder in portal_skins/manage_propertiesForm in publicview

  • Customize anthill_skinner_templates/main_template to custom_public

  • Put images and CSS also to this folder

  • For a more elaborate example look at anthill.exampletheme

Dependencies

  • z3c.autoinclude

  • anthill.tal.macrorenderer

Tested with

  • Plone 4.x (for Plone 3.x use version <0.7)

Pros

  • No need to understand the complex plone template logic

  • No need to write a new handbook for editors - take any recent plone book because the edit skin stays the same

  • Less work when updating to a new Plone version because you didn’t touch much of the templates

  • Almost no limitations for your theme/design that could be imposed by the fact that you need to include all the edit functionality (tabs, …) into your theme

  • By not having to fiddle with Plone inner logic/templates that much you save much time

Cons

  • Editors have no in-place editing - although you can change to the edit view on every context there’s one more click needed

  • Including plone portlets into your theme is a little more complex

Similar packages

  • collective.skinny

  • collective.editskinswitcher

Rules

Instead of having url based rules this package uses simple rules suitable for most deployments. If you don’t like these rules then you can easily overwrite them.

Rules to show public skin are as follows (order matters):

  • User is anonymous

  • User is authenticated but has not the correct permission (anthill: View CMS)

  • User is authenticated, has the correct permission but activated preview

  • There is a request variable named anthill.skinner.preview

All rules can be found in browser/handling#mustDisplayPublicSkin.

Overwrite rules

You can overwrite these rules by defining an adapter. Please keep in mind that if you overwrite rules then you need to overwrite all rules!

configure.zcml:

<adapter
    for="anthill.skinner.interfaces.ISkinHandler"
    provides="anthill.skinner.interfaces.IRuleOverwrite"
    factory="your.product.publicview.RuleMaker"
/>

publicview.py:

class RuleMaker:
    implements(IRuleOverwrite)

    def __init__(self, context):
        self.context = context

    def mustDisplayPublicView(self, context, request):
        return True

How to create your own skin

In order to create your own skin first take a look at the very simple example included in this package. It shows you how to define your menu and how content will be displayed.

Please be aware of the fact that it is intended to not load any of the css or javascript coming with Plone.

You can then create your own theme based on anthill.skinner by simply using the same skin and layer for your resources. Use anthill.skinner.interfaces.IPublicSkinLayer as the layer and publicview as the skin name you’re putting your stuff into.

Thanks

  • Developers of collective.skinny

  • Plone community

  • banality design & communication for funding this (all anthill.* packages)

This package is part of the anthill.* ecosystem that powers many websites all around the world - all being built on top of this package (originally for Plone 2.x).

Changelog

0.8 (2010-11-30)

  • Added possibility to select language for menu items [spamsch]

  • Plone 4 compatibility [spamsch]

0.6 (2009-11-27)

  • Many more fixes to utility methods [spamsch]

  • Fixed renderer to use context for macro rendering [spamsch]

  • Fixed navtree to always use folderish context [spamsch]

  • Now taking review state into account for display [spamsch]

  • Added method to check if context is portal root [spamsch]

  • Fixed severe bug in user auth where skinner would never switch into cms mode even if user has authenticated [spamsch]

0.5 - 2009-10-28

  • Fixed severe bug in main_template always showing error [spamsch]

0.4 - 2009-08-14

  • Fixed skinner to be only active where installed using portal_quickinstaller [spamsch]

0.3 - 2009-08-09

  • Fixed z3c.autoinclude inclusion in configure.zcml [spamsch]

0.2 - 2009-08-08

  • Added menu generator for public views to ease menu separation and usage [spamsch]

  • Fixed preview activation and deactivation link to use the current context and stick to the folder [spamsch]

0.1 - 2009-06-08

  • Initial release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anthill.skinner-0.8.tar.gz (142.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page