Back to index

plone3  3.1.7
interfaces.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2003-2005 Kupu Contributors. All rights reserved.
00004 #
00005 # This software is distributed under the terms of the Kupu
00006 # License. See LICENSE.txt for license text. For a list of Kupu
00007 # Contributors see CREDITS.txt.
00008 #
00009 ##############################################################################
00010 """Kupu Plone interfaces
00011 
00012 $Id: interfaces.py 54981 2008-05-20 02:40:08Z ldr $
00013 """
00014 from zope.interface import Interface
00015 
00016 class ILibraryManager(Interface):
00017     """Provide an interface for managing and retrieving libraries for
00018     the Kupu editor.
00019     """
00020 
00021     def getLibraries(context):
00022         """Return an ordered sequence of libraries.
00023 
00024         Since libraries might be defined placefully, we look them up
00025         using a context. The return value is provided as a sequence of
00026         dictionaries with the following keys:
00027 
00028           id    - the computed id
00029           title - the computed title of the library
00030           uri   - the computed URI of the library
00031           src   - the computed source URI
00032           icon  - the computed icon URI
00033         """
00034 
00035     def addLibrary(id, title, uri, src, icon):
00036         """Add a library.
00037         """
00038 
00039     def deleteLibraries(indices):
00040         """Delete libraries
00041         """
00042 
00043     def updateLibraries(libraries):
00044         """Update libraries.
00045 
00046         Update libraries using the sequence of mapping objects
00047         provided in the 'libraries' parameter. Each mapping object
00048         needs to provide an 'index' key to indicate which library it
00049         is updating.
00050         """
00051 
00052     def moveUp(indices):
00053         """Reorder libraries by moving specified libraries up.
00054         """
00055 
00056     def moveDown(indices):
00057         """Reorder libraries by moving specified libraries down.
00058         """
00059 
00060 class IResourceTypeMapper(Interface):
00061     """Map portal types to resource types"""
00062 
00063     def getPortalTypesForResourceType(resource_type):
00064         """Return a sequence of portal types for a specific resource type.
00065 
00066         Raises KeyError if resource_type is not found.
00067         """
00068 
00069     def queryPortalTypesForResourceType(resource_type, default=None):
00070         """Return a sequence of portal types for a specific resource type.
00071 
00072         Returns 'default' if resource_type is not found.
00073         """
00074 
00075     def addResourceType(resource_type, portal_types, mode='whitelist'):
00076         """Add a resource type pointing to a sequence of portal_types."""
00077 
00078     def updateResourceTypes(type_mapping):
00079         """Update resource types using the type mapping passed as argument."""
00080 
00081     def deleteResourceTypes(resource_types):
00082         """Delete the type mapping for the specififed resource types
00083 
00084         Raises KeyError if one of the resource_types is not found.
00085         """
00086 
00087 class IKupuLibraryTool(ILibraryManager, IResourceTypeMapper):
00088     """Interface for the Kupu library tool"""