X-Git-Url: https://scm.cri.ensmp.fr/git/MosaicDocument.git/blobdiff_plain/155c6ba3d7e8e9693d30b3cf70f591f0153610b6..99b3ba92670e19c1f86f5de83b8e6bbe4fdc297f:/Products/MosaicDocument/__init__.py diff --git a/Products/MosaicDocument/__init__.py b/Products/MosaicDocument/__init__.py new file mode 100755 index 0000000..6ccb156 --- /dev/null +++ b/Products/MosaicDocument/__init__.py @@ -0,0 +1,83 @@ +# -*- coding: utf-8 -*- +# (c) 2003 Centre de Recherche en Informatique ENSMP Fontainebleau +# (c) 2003 Benoît PIN + +from Products.CMFCore.DirectoryView import registerDirectory +from Products.CMFCore import utils +from Products.CMFCore.permissions import AddPortalContent, ManagePortal + + +import MosaicDocument +import MosaicBlock +import ImageSlot, StringSlot, FileSlot, SpacerSlot + +import MosaicTool +from MosaicBlockInformation import \ + MosaicBlockInformation, addMosaicBlockInformationForm, addMosaicBlockInformation, \ + SlotInfo, addSlotInfo, \ + RuleInfo, addRuleInfo + +contentClasses = ( + MosaicDocument.MosaicDocument, + MosaicBlock.MosaicBlock, + ImageSlot.ImageSlot, + StringSlot.StringSlot, + FileSlot.FileSlot, + SpacerSlot.SpacerSlot + ) + +contentConstructors = ( + MosaicDocument.addMosaicDocument, + MosaicBlock.addMosaicBlock, + ImageSlot.addImageSlot, + StringSlot.addStringSlot, + FileSlot.addFileSlot, + SpacerSlot.addSpacerSlot + ) + +fti = ( + MosaicDocument.factory_type_information + + ImageSlot.factory_type_information + + StringSlot.factory_type_information + + FileSlot.factory_type_information + + SpacerSlot.factory_type_information + + () + ) + +for path in ('default_blocks', 'default_slots', 'skins') : + registerDirectory(path, globals()) + +def initialize(registrar) : + utils.ContentInit( + 'Mosaic Document', + content_types = contentClasses, + permission = AddPortalContent, + extra_constructors = contentConstructors, + fti = fti, + ).initialize(registrar) + + utils.ToolInit( + 'Mosaic Tool', + tools = (MosaicTool.MosaicTool, ), + icon = 'tool.gif', + ).initialize(registrar) + + registrar.registerClass( + MosaicBlockInformation, + constructors = (addMosaicBlockInformationForm, addMosaicBlockInformation), + icon = 'dtml/block_icon.gif') + + registrar.registerClass( + SlotInfo, + constructors=(addSlotInfo,) + ) + + registrar.registerClass( + RuleInfo, + constructors=(addRuleInfo,) + ) + + +## monkey patching ZPublisher.Converters +from ZPublisher.Converters import type_converters +type_converters.update({'expr' : MosaicDocument.Expression}) \ No newline at end of file