# -*- coding: utf-8 # Copyright 2006 by Meelis Mets from Products.Archetypes.public import BaseSchema, Schema from Products.Archetypes.public import FileField, TextField from Products.Archetypes.public import FileWidget, RichWidget from Products.Archetypes.public import BaseFolder, registerType from Globals import InitializeClass from Products.CMFCore.utils import getToolByName from Products.Archetypes.public import RFC822Marshaller from Products.Archetypes.public import AnnotationStorage from AccessControl import ClassSecurityInfo, Unauthorized from config import PROJECT_NAME schema = BaseSchema + Schema(( TextField('text', accessor='getBody', required=True, searchable=True, primary=True, storage = AnnotationStorage(migrate=True), validators = ('isTidyHtmlWithCleanup',), #validators = ('isTidyHtml',), default_content_type = 'Sheet', default_output_type = 'text/x-html-safe', allowable_content_types = (), widget = RichWidget( description = "", description_msgid = "help_body_text", label = "Body Text", label_msgid = "label_body_text", rows = 25, i18n_domain = "plone", allow_file_upload = 0)), ), marshall=RFC822Marshaller() ) class Sheet(BaseFolder): """ E-Portfolio Slide""" meta_type = "Sheet" archetype_name = "Sheet" global_allow = 1 exclude_from_nav = True filter_content_types = True allowed_content_types = () security = ClassSecurityInfo() schema = schema actions = ( { 'id':'view', 'name':'View', 'action':'string:${object_url}/base_view', 'permissions': ('View',), }, { 'id':'edit', 'name':'Edit', 'action':'string:${object_url}/base_edit', 'permissions': ('Access Denied',), }, { 'id':'metadata', 'name':'Properties', 'action':'string:${object_url}/base_metadata', 'permissions': ('Access Denied',), }, ) def __init__(self, id): self.id = id self.largeIcon = "presentation.gif" #def manage_afterAdd(self,item,container): def getAct(self): """ACT""" action = {'action': 'string:${object_url}/drawer_view', 'permissions': ('View',), 'id': 'esimene', 'name': 'Esimene'} act = getattr(self.aq_parent, 'actions') act = act + (action,) setattr(self.aq_parent, 'actions', act) return self.aq_parent.actions registerType(Sheet, PROJECT_NAME)