Commit ab764aac authored by Jean-Paul Smets's avatar Jean-Paul Smets

Added support for templates


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@5209 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b03d750a
......@@ -183,18 +183,18 @@ class PreferenceTool(BaseTool):
if len(enabled_prefs) > 0 :
return enabled_prefs[0]
security.declareProtected(Permissions.View, 'getDocumentTemplate')
def getDocumentTemplate(self, folder) :
security.declareProtected(Permissions.View, 'getDocumentTemplateList')
def getDocumentTemplateList(self, folder) :
""" returns all document templates that are in acceptable Preferences
based on different criteria such as folder, portal_type, etc.
XXX This spec still needs to be refined before implementation
"""
acceptable_templates = []
allowed_content_types = map(lambda pti: pti.id, folder.allowedContentTypes())
for pref in self._getSortedPreferenceList() :
for doc in pref.objectValues() :
if hasattr(doc, 'getTemplateDestinationUidList') and \
folder.getUid() in doc.getTemplateDestinationUidList() :
if doc.getPortalTypes() in allowed_content_types:
acceptable_templates.append (doc)
return acceptable_templates
......
......@@ -727,5 +727,13 @@ be a problem)."""
security.declareProtected( Permissions.AccessContentsInformation, 'manage_copyObjects' ) # XXX Why this one doesn't work in CopySupport ?
security.declareProtected( Permissions.AddPortalContent, 'manage_pasteObjects' ) # XXX Why this one doesn't work in CopySupport ?
security.declareProtected(Permissions.View, 'getDocumentTemplateList')
def getDocumentTemplateList(self) :
"""
Returns the list of allowed templates for this folder
by calling the preference tool
"""
return self.getPortalObject().portal_preferences_getDocumentTemplateList(self)
# Overwrite Zope setTitle()
Folder.setTitle = Base.setTitle
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment