Integrating with kupu

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

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.

 

z

Posted by David Bourgeois at Sep 07, 2005 08:34 PM
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 Sep 07, 2005 09:55 PM
Didn't think of that. Thank you :)