X-Git-Url: https://scm.cri.ensmp.fr/git/MosaicDocument.git/blobdiff_plain/155c6ba3d7e8e9693d30b3cf70f591f0153610b6..99b3ba92670e19c1f86f5de83b8e6bbe4fdc297f:/BaseSlot.py?ds=sidebyside diff --git a/BaseSlot.py b/BaseSlot.py deleted file mode 100755 index 24c958d..0000000 --- a/BaseSlot.py +++ /dev/null @@ -1,101 +0,0 @@ -# -*- 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, DTMLFile -from Products.CMFCore.utils import getToolByName - -from AccessControl import ClassSecurityInfo -from Products.CMFCore.permissions import View, ModifyPortalContent -from Products.CMFCore.DynamicType import DynamicType -from Products.PageTemplates.Expressions import getEngine -from Products.PageTemplates.Expressions import SecureModuleImporter - -class BaseSlot(DynamicType) : - """Slot""" - - _isMosaicSlot = 1 - _editableFields = [] - _indexableFields = [] - - security = ClassSecurityInfo() - - security.declarePublic('callAction') - def callAction(self, actionId, *args, **kw) : - """call action from action definitions""" - typeTool = getToolByName(self, 'portal_types') - - # !!! id et meta_type doivent etre identiques dans la fti. - typeInfo = typeTool.getTypeInfo(self) - actionInfo = typeInfo.getActionInfo('object/%s' % actionId) - zpt = getattr(self, actionInfo['url']) - return zpt(object=self, block=self.aq_parent, *args, **kw) - - security.declareProtected(ModifyPortalContent, 'edit') - def edit(self, **kw) : - """ Edit Slot""" - for fieldName in self._editableFields : - if kw.has_key(fieldName) : - setattr(self, fieldName, kw[fieldName]) - - security.declareProtected(View, 'getBlock') - def getBlock(self) : - """ Return the block object where the slot is located """ - return self.aq_parent - - security.declareProtected(View, 'getExprContext') - def getExprContext(self, REQUEST=None) : - """Return an expression context customized for expressions properties from slot information""" - block = self.aq_parent - while block.meta_type != 'Mosaic Block' : - block = block.aq_parent - data = { - 'portal' : self.portal_url.getPortalObject(), - 'slot' : self, - 'block' : self.aq_parent, - 'here' : None, - 'request' : REQUEST, - 'modules' : SecureModuleImporter, - 'nothing' : None, - } - return getEngine().getContext(data) - - security.declareProtected(View, 'SearchableText') - def SearchableText(self) : - """ Return full text for indexation """ - text = '' - for fieldName in self._indexableFields : - field = getattr(self, fieldName) - if callable(field) : - text += ' %s' % field() - else : - text += ' %s' % field - - return text - - def _initDefaultValues(self) : - pass - - def indexObject(self): pass - def unindexObject(self): pass - def reindexObject(self, idxs=[]): pass - def reindexObjectSecurity(self): pass - def notifyWorkflowCreated(self): pass - - -InitializeClass(BaseSlot)