[Zope-CMF] Skins Guru´s

James van der Veen james@codenamefuture.nl
Mon, 25 Jun 2001 11:06:31 +0200


Hi karl,

Well you got it right about what I wanted to do but there is one more thing.
I would like people (with no zope knowledge) to be able to add a CMF and
after creating the CMF they should be able to 
change the stylesheet properties (with a form I will create) and a few other
little things. 
If I let them do it with the built in skins they have to create a new Folder
etc etc etc.

So what I realy would want to do is fill the custom (or any other id) skins
folder with some dtml-docs when the CMF is created in a way that it dows not
become a locked Folder.

James



> HI all,
>
> I have a (I think)simple skins question.
>
> I have added a Folder to the CMFDefault/skins dir. called school. I added
> some docs I want to add to the custom skin every time I make a portal.
> Well All is fine till now .. I restart zope create a new portal and my
skin
> is in the skins folder. And here comes the BUT...
> The Docs are still protected (like the generic and contents etc folders).
I
> would like the docs in my school folder to be unlocked sothe portal
mangers
> can change them in the same school dir.
>
> Can someone tell me how to do this?

I'm not sure what you're asking, but I'm creating CMF sites with
custom skins pre-added with the method below.  Basically, create the
skin views, which are DTML Methods, create a skin folder for them, put the
skin views in the skin folder, create a default skin which is the
Basic skin with this skin folder prepended.

If you just want the skins views to be put in Custom, you don't need
to mess with the new folder or creating a new skin - just create the
skin views and stick them in Custom.

    def _customizeSkins(self, portal):
        "copy our custom skins to the new CMF site"
        # we need to create these methods here, not in the module,
        # else we get a foreign db connection exception
        logged_in = DTMLMethod(logged_inStr, __name__ = "logged_in")
        login_form = DTMLMethod(login_formStr, __name__ = "login_form")
        first_logged_in = DTMLMethod(first_logged_inStr,
                                     __name__ = "first_logged_in")

        ps = getToolByName(portal, "portal_skins")
        ps.manage_addProduct['OFSP'].manage_addFolder(id='tour')
        basicSel = ps._getSelections()['Basic']
        tourSel = 'tour, ' + basicSel
        ps.addSkinSelection('Tour', tourSel, make_default = 1)

        skinFolder = getattr(ps, 'tour')
        skinFolder._setObject('login_form', login_form)
        skinFolder._setObject('logged_in', logged_in)
        skinFolder._setObject('first_logged_in', first_logged_in)