Personal tools
You are here: Home Documentation Tutorials RichDocument: Creating content types the Plone 2.1 way Integrating with kupu
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

Integrating with kupu

How to ensure smooth co-operation with kupu, Plone's new default visual editor

Martin Aspeli

This tutorial will teach you how to create content types the Plone 2.1 way, using the ATContentTypes library, by following the example of RichDocument, an extension of Plone's standard Page/Document type.
Page 11 of 17.

Plone 2.1 ships with kupu as the standard visual content editor. Kupu uses the concept of "drawers" that manage "resource types" for letting the user insert links, images, etc. In order for RichDocument users to be able to link to FileAttachment and ImageAttachment objects created inside the document, kupu must know that these are linkable types.

This is set in the kupu_library_tool, under the resource types tab. Specifically, we add ImageAttachment and FileAttachment as linkable resources, whilst ImageAttachment is a mediaobject alongside ATImage. This is all configured in 'Install.py':

    kupuTool = getToolByName(self, 'kupu_library_tool')
    linkable = list(kupuTool.getPortalTypesForResourceType('linkable'))
    mediaobject = list(kupuTool.getPortalTypesForResourceType('mediaobject'))
    if 'FileAttachment' not in linkable:
        linkable.append('FileAttachment')
    if 'ImageAttachment' not in linkable:
        linkable.append('ImageAttachment')
    if 'ImageAttachment' not in mediaobject:
        mediaobject.append('ImageAttachment')
    # kupu_library_tool has an idiotic interface, basically written purely to
    # work with its configuration page. :-(
    kupuTool.updateResourceTypes(({'resource_type' : 'linkable',
                                   'old_type'      : 'linkable',
                                   'portal_types'  :  linkable},
                                  {'resource_type' : 'mediaobject',
                                   'old_type'      : 'mediaobject',
                                   'portal_types'  :  mediaobject},))

The last standard resource type is collection. These items which kupu will treat as folders when navigating through drawers. We do not register RichDocument as a folder, obviously.

 
by Martin Aspeli last modified September 5, 2005 - 10:59 All content is copyright Plone Foundation and the individual contributors.

z

Posted by David Bourgeois at September 7, 2005 - 20:34

Shouldn't you also add RichDocument in the linkable list so we can link this type from other documents?

Good point

Posted by Martin Aspeli at September 7, 2005 - 21:55

Didn't think of that. Thank you :)


For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by