[Zope-CMF] Skins Questions

Tres Seaver tseaver@palladion.com
Thu, 31 May 2001 08:10:14 -0400


Chris Withers wrote:

>>>Why doesn't it just store the skin selected as an attribute of the
>>>
> member
> 
>>>object?
>>>
>>can't remember - someone else asked this question a week or two ago
>>and got a reply.  one reason is so you can use skins for i18n, i
>>think.
>>
> 
> Hehe, I'd search the archive if I could... but I've got a coupla other
> questions relating to skin selection anyway...
> 
> I've got a coupla CMF apps where I don't want the user to be able to choose
> their skin, I want to specify it and not have them able to change it.
> How would I go about doing that?
> 
> For example: Say if I have a CMF app that contains documentation for a
> modular and customisable product. Each customer organisation will have
> several users, each with their own username. They will each have their skin
> set for them and musn't be able to change it. The skin's name will be the
> name of organisation.
> 
> The skins tool will have layers for each module as well as a layer for each
> customer (to contain the bits of documentaion that are customised for them),
> the 'customer skin' will be made up of the appropriate layers. Does that
> make sense?
> 
> So, my questions are:
> 
> 1. How do I 'set' the skin for each user in this way?


You replace the tool with one which implements its interface according to
your policy.


> 
> 2. Can skin layers (the folder things in the skins tool) contain subfolders?
> eg:
> layer1/part1/doc2
> layer2/part1/doc2
> 
> Skin1: layer1 content Images ..etc..
> Skin2: layer2 layer1 content Images ..etc..
> 
> If I refer to /part1/doc2, will a user with Skin1 set get /layer1/part1/doc2
> and a user with Skin2 set get /layer2/part1/doc2?
> 
> If not, how can I make this work?


I played briefly with this as a way to "unmangle" the type name from the 
names
of skin methods.  It half works, but the longer you interact with it, 
the weirder
the URLs get.  If all you want is to look up "pieces" of pages, rather 
than use
the methods in the sub-layers as full-blown page-rendering methods of 
content
objects, then it might work (caveat utilor).


> 
> cheers,
> 
> Chris
> 
> PS: I wanna make the paths specifed in the skin definition
> RestrictedTraverse to get the specified items rather than just look in the
> skins tool itself (this would let me share skins between CMF instances, it
> was discussed ages ago on the list) Where's the code I need to change? Would
> anyone have any objections to this change being made in the core?

I'd be willing to be corrected (by Shane, anyway :) but my gut says that
your request would be punitively expensive (the skins name lookups get 
called
a *lot*;  Shane once measured 4500 lookups for a single page).  Why not 
move the
skin methods to the filesystem, instead, and just "mount" them multiply from
there?

Tres.
--===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org