X-Git-Url: https://scm.cri.minesparis.psl.eu/git/MosaicDocument.git/blobdiff_plain/155c6ba3d7e8e9693d30b3cf70f591f0153610b6..99b3ba92670e19c1f86f5de83b8e6bbe4fdc297f:/Products/MosaicDocument/SpacerSlot.py?ds=inline diff --git a/Products/MosaicDocument/SpacerSlot.py b/Products/MosaicDocument/SpacerSlot.py new file mode 100755 index 0000000..e8daf01 --- /dev/null +++ b/Products/MosaicDocument/SpacerSlot.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# (c) 2003 Centre de Recherche en Informatique ENSMP Fontainebleau +# (c) 2003 Benoît PIN +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as published +# by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +# 02111-1307, USA. +# + + +from Globals import InitializeClass +from Products.CMFCore.permissions import View, ModifyPortalContent +from BaseSlot import BaseSlot +from OFS.SimpleItem import SimpleItem + +factory_type_information = ( {'id' : 'Spacer Slot', + 'meta_type' : 'Spacer Slot', + 'description' : "Spacer Slot for Mosaic Document", + 'icon' : 'mosaic_tool/spacer_icon.gif', + 'product' : 'MosaicDocument', + 'factory' : 'addSpacerSlot', + 'immediate_view' : 'view', + 'actions' : + ({'id' : 'view', + 'name' : 'View', + 'action' : 'slot_spacer_view', + 'permissions' : (View, ) + }, + + {'id' : 'edit', + 'name' : 'Edit', + 'action' : 'slot_spacer_form', + 'permissions' : (ModifyPortalContent, ) + }, + ) + }, + ) + + +class SpacerSlot(BaseSlot, SimpleItem) : + """Spacer Slot""" + meta_type = 'Spacer Slot' + + _editableFields = ('nbOfSpaces',) + _indexableFields = () + + def __init__(self, id, nbOfSpaces = 3) : + self.id = id + self.nbOfSpaces = nbOfSpaces + +InitializeClass(SpacerSlot) + +def addSpacerSlot(dispatcher, id, nbOfSpaces = 3) : + """Add a new SpacerSlot object""" + + o = SpacerSlot(id, nbOfSpaces) + dispatcher.Destination()._setObject(id, o)