# -*- coding: utf-8 # Copyright 2007 by Vahur Rebas from Products.Archetypes.public import BaseSchema, Schema from Products.Archetypes.public import StringField, LinesField, FileField, TextField from Products.Archetypes.public import LinesWidget, TextAreaWidget, RichWidget, StringWidget, FileWidget from Products.Archetypes.public import BaseContent, registerType from Globals import InitializeClass from Common import CommonMix as Common from Widgets import TagsWidget, TagsField from AccessControl import ClassSecurityInfo, Unauthorized from config import PROJECT_NAME schema = BaseSchema + Schema(( TextField('body', accessor='getDescription', default_content_type = 'text/html', default_output_type = 'text/html', allowable_content_types = ('text/html',), widget = TextAreaWidget( label = 'Description', label_msgid='label_description', i18n_domain="eportfolio" ), ), StringField('Url', accessor='getUrl', required=1, widget=TagsWidget( label='Url', label_msgid='label_url', description='Insert url or copy embed video url here', description_msgid='desc_url', visible={'view':'invisible','edit':'visible'}, i18n_domain="eportfolio" ), ), )) class Link(BaseContent, Common): """ """ meta_type = "Link" archetype_name = "Link" global_allow = 1 security = ClassSecurityInfo() schema = schema actions = ( { 'id':'view', 'name':'View', 'action':'string:${object_url}/link_view', 'permissions': ('View',), }, { 'id':'edit', 'name':'Edit', 'action':'string:${object_url}/base_edit', 'permissions': ('Modify portal content',), }, { 'id':'metadata', 'name':'Properties', 'action':'string:${object_url}/base_metadata', 'permissions': ('Manage Portal',), }, { 'id':'delete', 'name':'Delete', 'action':'string:${object_url}/delete_confirmation', 'permissions': ('Modify portal content',), }, { 'id':'competencies', 'name':'Associate with competency', 'action':'string:${object_url}/add_reference_to_competency?uid=${object/UID}', 'permissions': ('Modify portal content',), }, ) def isVideo(self): url = self.getUrl() if url.startswith('