Did not find a how-to for your problem?

Ask me to write the how-to post by writing to the mailing-list at cps-devel [@] lists [.] nuxeo [.] com or writing to me to joseluisdelarosa+cpshowto [@] gmail [.] com. Note: I'll keep all conversations on the official mailing list.
Showing posts with label skins. Show all posts
Showing posts with label skins. Show all posts

Friday, May 9, 2008

How to get Themes code

Usually, you build portal layouts using CPSSkins. When you finally have the layout, you could need to get the XML code to complete your product.

You can do it by exporting the Portlet and Theme Tools on ZMI Setup Tool. So, you can get the XML files needed to complete your product profile.

Other way to save our work is to export the theme within CPSSKins, following these steps: Themes manager -> Select your theme -> Export this theme -> Export on zexp format.
With this format you can import then directly within CPSSkins.

Best the first way. ;)

Monday, August 6, 2007

How to change the colour of the portal status message

An interesting feature of CPS, from the point of view of a developer, is how dynamic generation CSS is implemented.

One of the main reasons to face rendering of CSS is when you need to change the background colour of the portal status message, as its colour can't be changed from themes manager style definitions. To change the styles of the portal status message do this:

  1. Go to the ZMI
  2. Go to the tab Find of portal_skins.
  3. Search for the identifier stylesheet_properties
  4. Click the one file listed that has a red asterisk (this means that's the one that is being used by Zope).
  5. Click the button "Customize".
  6. Search for the property messageBackground and change its default value (#ffca31) for the new one that suits your design.
Look around for other properties that may be changed this object has some other CSS properties that may not be changed from themes management screen.

If you want to know a little more about how CPS uses these properties, do again a search for the file default.css and you will see that the code is in fact DTML which uses stylesheet_properties as variables inside CSS definitions.

And that's all for now, I hope it helps ;-)

Thursday, June 14, 2007

How to import skins folders

This post will put the tool portal_skins of CMF to work for the product CPSMessages.

In CMF the folders called skins are folders that have python scripts and Zope's page templates that can be called from whichever URL of the server.

To add the skins tool feature to the product CPSMessages the process is this:

  1. Add a file called skins.xml to the folder CPSMessages/profiles/default. The text of the file should look like this:



    <?xml version="1.0"?>
    <object name="portal_skins" meta_type="CMF Skins Tool">
    <object name="messages_default" meta_type="Filesystem Directory View"
    directory="CPSMessages/skins/messages_default"/>
    <skin-path name="CPSSkins">
    <layer name="messages_default" insert-after="custom"/>
    </skin-path>
    <skin-path name="CPSSkins-macroless">
    <layer name="messages_default" insert-after="custom"/>
    </skin-path>
    </object>



  2. Add a new step to the file CPSMessages/profiles/default/import_steps.xml with this content:



    <import-step id="skins" version="20040630-01"
    handler="Products.CMFCore.exportimport.skins.importSkinsTool"
    title="Skins Tool">
    <dependency step="toolset"/>
    Import skins tool's filesystem directory views and skin path definitions.
    </import-step>



  3. Create a folder in the path CPSMessages/skins/messages_default.

  4. In the folder created in step 3, add a file called hello_skins.zpt with these words in it:



    <p i18n:translate="hello_skins_imported">
    Hello, skins were imported sucessfully!
    </p>



  5. Register the skins directory so that Zope can access to its content. The way to do it is to add these two lines to the file CPSMessages/__init__.py.



    from Products.CMFCore.DirectoryView import registerDirectory
    registerDirectory('skins', globals())



  6. Restart Zope. The restart is needed because __init__.py file changed.

  7. Go to the tab Import of the tool portal_setup and check the step called Skins tool. Make sure that CPSMessages is the chosen profile in the combo box titled Profile and click the button “Import selected steps”.

  8. In the tool portal_skins you should see a folder called messages_default and after clicking on it, an object called hello_skins should be in there (notice that the extension is ommited). Click on the object hello_skins and use the tab “Test” to see it in action.
And that's all for today... As you may guess, the folder messages_default will be used to store python scripts, Zope's page templates, images and whatever resource that may be needed in the server. Notice the code in python scripts and ZPT in skins is restricted due to security reasons. If you need to write a file to filesystem or want to make system calls use methods in classes, e.g. tools (CPSMessages/MessagesTool.py).

Questions? Please, leave a comment ;-)