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.

Tuesday, March 4, 2008

How to get show the SharedCalendar's "pretty" title on a Navigation Portlet

When you enable CPSSharedCalendar on a CPS Site, you can create Shared Calendars anywhere in the site. If you have some Navigation Portlet on the site, this shows the identifier of the calendar instead of the pretty Title.

If you can show the Title instead of the Identifier you can do it by patching the getNavigationItems script, including this piece of code


if ptype == 'CPS Calendar':
title = str(context.restrictedTraverse(base_url + rpath).title_or_id())
else:
title = object['title_or_id']


before appending the item to the folder_items dictionary.

Tuesday, January 15, 2008

How to import a local directory

Well... we have just developed a CPS product to import a local directory to a CPS Site.
You can download it using this svn url:

http://svn2.yerbabuena.es/pub/products/cps/CPSFileImporter/trunk

Friday, November 2, 2007

How to create directory entries programatically

However, it also is possible that you need to creat a few entries in a directory programmatically.
I explain a usecase:

- You have to create an entity, like a company, into the portal.
- You need to have a few users associated to that company, like a Manager, a Reviewer, etc.

The way to do it is simple:

0. Import necessary modules.



from Products.CMFCore.utils import getToolByName



1. Take the directory where you need to create the entries.



directories = getToolByName(context, 'portal_directories')
my_dir = directories['my_dir']



2. Create the entry.



my_entry = {'id' : 'my_id',
'name' : 'my_name',
'data' : 'some other data'}



3. Insert the entry.



my_dir.createEntry(my_entry)





It also be useful to create test data.