class ATRefnode(BaseContent): """A simple archetype for testing references. It can point to itself""" schema = BaseSchema.copy() + Schema(( ReferenceField('relatedItems', relationship='relatesTo', multiValued=True, isMetadata=True, languageIndependent=False, index='KeywordIndex', referencesSortable=True, keepReferencesOnCopy=True, write_permission=ModifyPortalContent, widget=ReferenceWidget(label=u'label_related_items', description='', visible={ 'edit': 'visible', 'view': 'invisible' })), # make it a list ))
from AccessControl import ClassSecurityInfo from Products.Archetypes.atapi import (Schema, BaseSchema, BaseContent, registerType) from Products.CMFCore.permissions import ModifyPortalContent from Products.EEAContentTypes.content.Highlight import Highlight from Products.EEAContentTypes.config import PROJECTNAME from eea.themecentre.interfaces import IThemeTagging schema = Schema(( ), ) Speech_schema = BaseSchema.copy() + \ getattr(Highlight, 'schema', Schema(())).copy() + \ schema.copy() class Speech(Highlight, BaseContent): """ Speech """ security = ClassSecurityInfo() # This name appears in the 'add' box archetype_name = 'Speech' meta_type = 'Speech' portal_type = 'Speech' allowed_content_types = [] + list(getattr(
widget=SelectionWidget( label="Change responsible manager", description="Select the responsible manager for this issue", format="flex", label_msgid='Poi_label_newResponsibleManager', description_msgid='Poi_help_newResponsibleManager', i18n_domain='Poi', ), vocabulary='getManagersVocab', default_method='getCurrentResponsibleManager', enforceVocabulary=True, accessor="getNewResponsibleManager", write_permission=permissions.ModifyIssueAssignment), ), ) PoiResponse_schema = BaseSchema.copy() + \ schema.copy() class PoiResponse(BaseContent, BrowserDefaultMixin): """A response to an issue, added by a project manager. When giving a response, the workflow state of the parent issue can be set at the same time. """ security = ClassSecurityInfo() __implements__ = (getattr(BaseContent, '__implements__', ()), ) + \ (getattr(BrowserDefaultMixin, '__implements__', ()), ) + (Response, ) implements(IResponse) # This name appears in the 'add' box archetype_name = 'Response'
class ECQBaseAnswer(BaseContent): """ A basic answer. The actual text has to be supplied by the candidate. """ # This prevents the Questions from showing up as a portal content type global_allow = False schema = BaseSchema.copy() + Schema(( StringField( name='title', required=1, searchable=0, default='Answer', accessor='Title', widget=StringWidget( label_msgid='label_title', visible={ 'view': 'invisible', 'edit': 'invisible' }, i18n_domain='plone', ), ), StringField( name='answerkey', required=1, searchable=0, default='', accessor='Answerkey', mode='r', widget=StringWidget( label_msgid='label_title', visible={'view': 'visible'}, i18n_domain=config.I18N_DOMAIN, ), ), )) # Use a custom page template for viewing. actions = ({ 'id': 'view', 'action': 'string:${object_url}/ecq_baseanswer_view', }, ) meta_type = 'ECQBaseAnswer' # zope type name portal_type = meta_type # plone type name archetype_name = 'Base Answer' # friendly type name content_icon = 'ecq_answer.png' letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' security = ClassSecurityInfo() security.declarePrivate('manage_afterAdd') def manage_afterAdd(self, item, container): retVal = BaseContent.manage_afterAdd(self, item, container) self.syncResults('add') return retVal security.declarePrivate('manage_beforeDelete') def manage_beforeDelete(self, item, container): retVal = BaseContent.manage_beforeDelete(self, item, container) self.syncResults('delete') return retVal def Answerkey(self): return self.letters[self.contentValues(filter={ 'portal_type': self.portal_type }).index(self)] def Title(self): return self.archetype_name
i18n_domain='EEAEnquiry', )), ReferenceField(name='enquiries', widget=ReferenceWidget( label='Enquiries', label_msgid='EEAEnquiry_label_enquiries', i18n_domain='EEAEnquiry', ), allowed_types=('Enquiry', ), multiValued=1, relationship='enquiries'), ), ) schema['enquiries'].widget.visible = {'edit': 'invisible'} EnquiryRequestor_schema = BaseSchema.copy() + \ schema.copy() class EnquiryRequestor(BaseContent): """ Requestor """ security = ClassSecurityInfo() implements(IEnquiryRequestor) archetype_name = 'EnquiryRequestor' meta_type = 'EnquiryRequestor' portal_type = 'EnquiryRequestor' allowed_content_types = [] filter_content_types = 0 global_allow = 0 immediate_view = 'base_view'
from Products.Archetypes.atapi import BaseSchema from Products.Archetypes.atapi import LinesField from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import registerType from Products.Archetypes.examples.SimpleType import SimpleType from plone.formwidget.recurrence.at.widget import RecurrenceWidget schema = BaseSchema.copy() + Schema( ( LinesField( "rec", widget=RecurrenceWidget( label="Recurrence", startField="test_start_field", startYear="test_start_year", startMonth="test_start_month", startDay="test_start_day", first_day=4, ), ), ) ) class RecurrenceType(SimpleType): """A simple archetype""" schema = schema archetype_name = meta_type = "RecurrenceType" portal_type = "RecurrenceType"
from Products.Archetypes.atapi import BaseSchema from Products.Archetypes.atapi import MetadataSchema from Products.Archetypes.atapi import ReferenceField from Products.Archetypes.atapi import BooleanField from Products.Archetypes.atapi import BooleanWidget from Products.ATContentTypes import ATCTMessageFactory as _ from Products.CMFCore.permissions import ModifyPortalContent from archetypes.referencebrowserwidget import ReferenceBrowserWidget # for ATContentTypes we want to have the description in the edit view # just like CMF ATContentTypeSchema = BaseSchema.copy() + MetadataSchema(( BooleanField('excludeFromNav', required = False, languageIndependent = True, schemata = 'metadata', # moved to 'default' for folders widget = BooleanWidget( description=_(u'help_exclude_from_nav', default=u'If selected, this item will not appear in the navigation tree'), label = _(u'label_exclude_from_nav', default=u'Exclude from navigation'), visible={'view' : 'hidden', 'edit' : 'visible'}, ), ), ),) ATContentTypeSchema['id'].searchable = True ATContentTypeSchema['id'].validators = ('isValidId',) # Update the validation layer after change the validator in runtime ATContentTypeSchema['id']._validationLayer()
widget=ReferenceWidget( label='Enquiryrequestor', label_msgid='EEAEnquiry_label_enquiryRequestor', i18n_domain='EEAEnquiry', ), allowed_types=('EnquiryRequestor',), multiValued=0, relationship='enquriyRequestor' ), ), ) schema['enquiryRequestor'].widget.visible = {'edit': 'invisible'} Enquiry_schema = BaseSchema.copy() + \ schema.copy() class Enquiry(BaseContent): """ Enquiry """ security = ClassSecurityInfo() __implements__ = (getattr(BaseContent, '__implements__', ()),) # This name appears in the 'add' box archetype_name = 'Enquiry' meta_type = 'Enquiry' portal_type = 'Enquiry' allowed_content_types = []
""" Speech """ from AccessControl import ClassSecurityInfo from Products.Archetypes.atapi import (Schema, BaseSchema, BaseContent, registerType) from Products.CMFCore.permissions import ModifyPortalContent from Products.EEAContentTypes.content.Highlight import Highlight from Products.EEAContentTypes.config import PROJECTNAME from eea.themecentre.interfaces import IThemeTagging schema = Schema((), ) Speech_schema = BaseSchema.copy() + \ getattr(Highlight, 'schema', Schema(())).copy() + \ schema.copy() class Speech(Highlight, BaseContent): """ Speech """ security = ClassSecurityInfo() # This name appears in the 'add' box archetype_name = 'Speech' meta_type = 'Speech' portal_type = 'Speech' allowed_content_types = [] + list( getattr(Highlight, 'allowed_content_types', [])) filter_content_types = 0
""" Strng """ from AccessControl import ClassSecurityInfo from Products.Archetypes.atapi import (Schema, BaseSchema, BaseContent, registerType) from Products.EEAEnquiry.config import PROJECTNAME schema = Schema((), ) Strng_schema = BaseSchema.copy() + \ schema.copy() class Strng(BaseContent): """ Strng """ security = ClassSecurityInfo() # This name appears in the 'add' box archetype_name = 'Strng' meta_type = 'Strng' portal_type = 'Strng' allowed_content_types = [] filter_content_types = 0 global_allow = 1 #content_icon = 'Strng.gif' immediate_view = 'base_view' default_view = 'base_view' suppl_views = ()
from DateTime import DateTime from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import BaseSchema from Products.Archetypes.atapi import DateTimeField from Products.Archetypes.atapi import registerType from Products.Archetypes.examples.SimpleType import SimpleType from plone.formwidget.datetime.at import DateWidget from plone.formwidget.datetime.at import DatetimeWidget from plone.formwidget.datetime.at import MonthYearWidget schema = BaseSchema.copy() + Schema(( DateTimeField('datefield', default_method=DateTime, widget=DateWidget( label='Date field', description='', )), DateTimeField('datetimefield', default_method=DateTime, widget=DatetimeWidget( label='Datetime field', description='', ampm=1, )), DateTimeField('monthyearfield', default_method=DateTime, widget=MonthYearWidget( label='MonthYear field', description='',
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # """ Base ad to create Ad types with """ from Globals import InitializeClass from Products.CMFCore.utils import getToolByName from Products.Archetypes.atapi import DisplayList from Products.Archetypes.atapi import BaseSchema, Schema, BaseContent from Products.Archetypes.atapi import ReferenceField, StringField from Products.Archetypes.atapi import StringWidget, SelectionWidget from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget \ import ReferenceBrowserWidget from Products.PromoEngine.config import PROJECTNAME BaseAdSchema = BaseSchema.copy() + Schema(( ReferenceField( 'adLocation', multiValued = True, relationship = 'AdLocation', widget = ReferenceBrowserWidget( label = 'Ad Location Step 1', description = """Select where the ad should show up""", startup_directory = '/', ), ), StringField( 'adSlot', vocabulary = '_slotVocab', index = 'ad_catalog/FieldIndex', widget = SelectionWidget(
from Products.Archetypes.atapi import Schema, BaseSchema, BaseContent, DisplayList, registerType #from Products.Archetypes.utils import shasattr from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin from Products.CMFCore.utils import UniqueObject from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION #from zLOG import LOG, INFO, ERROR from Products.ECAssignmentBox.tool.Statistics import Statistics from Products.ECAssignmentBox.tool.interfaces import IECABTool from Products.ECAssignmentBox import config from Products.ECAssignmentBox import LOG schema = Schema((), ) ECABTool_schema = BaseSchema.copy() + schema.copy() class ECABTool(UniqueObject, BaseContent, BrowserDefaultMixin): """ """ security = ClassSecurityInfo() implements(IECABTool) meta_type = 'ECABTool' plone_tool = True _at_rename_after_creation = True schema = ECABTool_schema def __init__(self, id=None): """
from affinitic.caching.memcached import memcachedClient from gites.core.config import PROJECTNAME from gites.core.interfaces import IHebergementFolder from gites.map.browser.interfaces import IMappableContent schema = Schema(( ), ) ##code-section after-local-schema #fill in your manual code here ##/code-section after-local-schema HebergementFolder_schema = BaseSchema.copy() + \ schema.copy() ##code-section after-schema #fill in your manual code here HebergementFolder_schema = ATFolder.schema.copy() + \ schema.copy() ##/code-section after-schema class HebergementFolder(ATFolder): """ """ security = ClassSecurityInfo() __implements__ = (getattr(ATFolder, '__implements__', ())) # This name appears in the 'add' box
from Products.Archetypes.atapi import BaseSchema from Products.Archetypes.atapi import MetadataSchema from Products.Archetypes.atapi import ReferenceField from Products.Archetypes.atapi import BooleanField from Products.Archetypes.atapi import BooleanWidget from Products.ATContentTypes import ATCTMessageFactory as _ from Products.CMFCore.permissions import ModifyPortalContent from Products.Archetypes.Widget import RelatedItemsWidget # for ATContentTypes we want to have the description in the edit view # just like CMF ATContentTypeSchema = BaseSchema.copy() + MetadataSchema( ( BooleanField( 'excludeFromNav', required=False, languageIndependent=True, schemata='metadata', # moved to 'default' for folders widget=BooleanWidget( description=_( u'help_exclude_from_nav', default= u'If selected, this item will not appear in the navigation tree' ), label=_(u'label_exclude_from_nav', default=u'Exclude from navigation'), visible={ 'view': 'hidden', 'edit': 'visible' }, ),
name='groupsInCharge', widget=MultiSelectionWidget( description="GroupsInCharge", description_msgid="groups_in_charge_descr", format="checkbox", label='Groupsincharge', label_msgid='PloneMeeting_label_groupsInCharge', i18n_domain='PloneMeeting', ), multiValued=1, vocabulary='listActiveMeetingGroups', write_permission="PloneMeeting: Write risky config", ), ), ) MeetingGroup_schema = BaseSchema.copy() + \ schema.copy() MeetingGroup_schema['id'].write_permission = "PloneMeeting: Write risky config" MeetingGroup_schema[ 'title'].write_permission = "PloneMeeting: Write risky config" MeetingGroup_schema.changeSchemataForField('description', 'default') MeetingGroup_schema.moveField('description', after='title') MeetingGroup_schema['description'].storage = AttributeStorage() MeetingGroup_schema[ 'description'].write_permission = "PloneMeeting: Write risky config" MeetingGroup_schema['description'].widget.description = " " MeetingGroup_schema[ 'description'].widget.description_msgid = "empty_description" # hide metadata fields and even protect it by the WriteRiskyConfig permission for field in MeetingGroup_schema.getSchemataFields('metadata'):
""" demonstrates the use of archetypes.linguakeywordwidget """ from Products.Archetypes.atapi import LinesField from Products.Archetypes.atapi import BaseSchema from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import BaseContent from Products.Archetypes.atapi import registerType from archetypes.linguakeywordwidget.config import PROJECTNAME from archetypes.linguakeywordwidget.widget import LinguaKeywordWidget schema = BaseSchema.copy() + Schema((LinesField( 'subject', multiValued=1, accessor="Subject", widget=LinguaKeywordWidget()), )) class RefBrowserDemo(BaseContent): """ Demo from archetypes.linguakeywordwidget """ content_icon = "document_icon.gif" schema = schema registerType(RefBrowserDemo, PROJECTNAME)
StringField( name='region', widget=StringWidget( description="Please enter your state or region.", label='Region', label_msgid='EEAEnquiry_label_region', description_msgid='EEAEnquiry_help_region', i18n_domain='EEAEnquiry', ) ), ), ) Requestor_schema = BaseSchema.copy() + \ schema.copy() class Requestor(BaseContent): """ Requestor """ security = ClassSecurityInfo() __implements__ = (getattr(BaseContent, '__implements__', ()),) # This name appears in the 'add' box archetype_name = 'Requestor' meta_type = 'Requestor' portal_type = 'Requestor' allowed_content_types = [] filter_content_types = 0
""" Strng """ from AccessControl import ClassSecurityInfo from Products.Archetypes.atapi import ( Schema, BaseSchema, BaseContent, registerType) from Products.EEAEnquiry.config import PROJECTNAME schema = Schema(( ), ) Strng_schema = BaseSchema.copy() + \ schema.copy() class Strng(BaseContent): """ Strng """ security = ClassSecurityInfo() # This name appears in the 'add' box archetype_name = 'Strng' meta_type = 'Strng' portal_type = 'Strng' allowed_content_types = [] filter_content_types = 0 global_allow = 1 #content_icon = 'Strng.gif' immediate_view = 'base_view' default_view = 'base_view'
description_msgid="mail_meeting_events", condition="python: here.listMeetingEvents()", format="checkbox", label='Mailmeetingevents', label_msgid='PloneMeeting_label_mailMeetingEvents', i18n_domain='PloneMeeting', ), multiValued=1, vocabulary="listMeetingEvents", default_method="getDefaultMeetingEvents", enforceVocabulary=True, write_permission="PloneMeeting: Write risky config", ), ), ) MeetingUser_schema = BaseSchema.copy() + \ schema.copy() MeetingUser_schema['id'].write_permission = "PloneMeeting: Write risky config" MeetingUser_schema[ 'title'].write_permission = "PloneMeeting: Write risky config" # hide metadata fields and even protect it vy the WriteRiskyConfig permission for field in MeetingUser_schema.getSchemataFields('metadata'): field.widget.visible = {'edit': 'invisible', 'view': 'invisible'} field.write_permission = WriteRiskyConfig class MeetingUser(BaseContent, BrowserDefaultMixin): """ """ security = ClassSecurityInfo()
description="Select the responsible manager for this issue", format="flex", label_msgid="Poi_label_newResponsibleManager", description_msgid="Poi_help_newResponsibleManager", i18n_domain="Poi", ), vocabulary="getManagersVocab", default_method="getCurrentResponsibleManager", enforceVocabulary=True, accessor="getNewResponsibleManager", write_permission=permissions.ModifyIssueAssignment, ), ) ) PoiResponse_schema = BaseSchema.copy() + schema.copy() class PoiResponse(BaseContent, BrowserDefaultMixin): """A response to an issue, added by a project manager. When giving a response, the workflow state of the parent issue can be set at the same time. """ security = ClassSecurityInfo() __implements__ = ( (getattr(BaseContent, "__implements__", ()),) + (getattr(BrowserDefaultMixin, "__implements__", ()),) + (Response,) ) implements(IResponse)
from Products.Archetypes.atapi import LinesField from Products.Archetypes.atapi import LinesWidget from Products.Archetypes.atapi import listTypes from Products.Archetypes.atapi import MetadataSchema from Products.Archetypes.atapi import process_types from Products.Archetypes.atapi import registerType from Products.Archetypes.atapi import RichWidget from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import TextAreaWidget from Products.Archetypes.atapi import TextField from Products.CMFCore.utils import ContentInit from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin PROJECTNAME = 'collective.searchandreplace' SampleTypeSchema = BaseSchema.copy() + MetadataSchema(()) + Schema(( TextField('rich', required=False, searchable=True, default_output_type='text/x-html-safe', widget=RichWidget(description='', label=u'Rich Text')), TextField('plain', required=False, searchable=True, widget=TextAreaWidget(description='', label=u'Plain Text')), LinesField('line', required=False, searchable=True, widget=LinesWidget(description='', label=u'Text Line')), TextField('unsearchable', required=False,
from Products.Archetypes.atapi import Schema, BaseSchema, registerType from Products.Archetypes.atapi import BaseContent, DisplayList from Products.Archetypes.debug import log_exc from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin from Products.CMFCore.utils import UniqueObject from Products.CMFCore import permissions from Products.ECAutoAssessmentBox import config from Products.ECAutoAssessmentBox import LOG from Products.ECAutoAssessmentBox import ECMessageFactory as _ ECSpoolerTool_schema = BaseSchema.copy() # ID for the virtual non-backend BACKEND_NONE = 'None' class ConnectionFailedException(Exception): """ """ pass class ECSpoolerTool(UniqueObject, BaseContent, BrowserDefaultMixin): """ """ security = ClassSecurityInfo()
label_msgid='eXtremeManagement_label_phone', description_msgid='eXtremeManagement_help_phone', i18n_domain='eXtremeManagement'), ), StringField( name='email', widget=StringWidget( description="Enter your email address.", label='Email', label_msgid='eXtremeManagement_label_email', description_msgid='eXtremeManagement_help_email', i18n_domain='eXtremeManagement') ), ), ) BaseSchema = BaseSchema.copy() BaseSchema['id'].widget.visible = dict(edit=0, view=0) ProjectMember_schema = BaseSchema + schema class ProjectMember(BaseContent): """ """ security = ClassSecurityInfo() implements(IXMProjectMember) # This name appears in the 'add' box archetype_name = 'Project Member' portal_type = meta_type = 'ProjectMember' typeDescription = "ProjectMember" typeDescMsgId = 'description_edit_projectmember'
required=1, validators=('isEmail', )), ReferenceField(name='enquiryRequestor', widget=ReferenceWidget( label='Enquiryrequestor', label_msgid='EEAEnquiry_label_enquiryRequestor', i18n_domain='EEAEnquiry', ), allowed_types=('EnquiryRequestor', ), multiValued=0, relationship='enquriyRequestor'), ), ) schema['enquiryRequestor'].widget.visible = {'edit': 'invisible'} Enquiry_schema = BaseSchema.copy() + \ schema.copy() class Enquiry(BaseContent): """ Enquiry """ security = ClassSecurityInfo() __implements__ = (getattr(BaseContent, '__implements__', ()), ) # This name appears in the 'add' box archetype_name = 'Enquiry' meta_type = 'Enquiry' portal_type = 'Enquiry' allowed_content_types = []
from Products.Archetypes.atapi import listTypes from Products.Archetypes.atapi import MetadataSchema from Products.Archetypes.atapi import process_types from Products.Archetypes.atapi import registerType from Products.Archetypes.atapi import RichWidget from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import TextAreaWidget from Products.Archetypes.atapi import TextField from Products.CMFCore.utils import ContentInit from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin PROJECTNAME = "collective.searchandreplace" SampleTypeSchema = ( BaseSchema.copy() + MetadataSchema(()) + Schema( ( TextField( "rich", required=False, searchable=True, default_output_type="text/x-html-safe", widget=RichWidget(description="", label=u"Rich Text"), ), TextField( "plain", required=False, searchable=True, widget=TextAreaWidget(description="", label=u"Plain Text"),
from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin from Products.CMFCore.utils import UniqueObject from Products.DCWorkflow.Transitions import TRIGGER_USER_ACTION #from zLOG import LOG, INFO, ERROR from Products.ECAssignmentBox.tool.Statistics import Statistics from Products.ECAssignmentBox.tool.interfaces import IECABTool from Products.ECAssignmentBox import config from Products.ECAssignmentBox import LOG schema = Schema(( ), ) ECABTool_schema = BaseSchema.copy() + schema.copy() class ECABTool(UniqueObject, BaseContent, BrowserDefaultMixin): """ """ security = ClassSecurityInfo() implements(IECABTool) meta_type = 'ECABTool' plone_tool = True _at_rename_after_creation = True schema = ECABTool_schema def __init__(self, id=None): """ Tool-constructors have no id argument, the id is fixed
from Products.Archetypes.atapi import LinesWidget from Products.Archetypes.atapi import listTypes from Products.Archetypes.atapi import MetadataSchema from Products.Archetypes.atapi import process_types from Products.Archetypes.atapi import registerType from Products.Archetypes.atapi import RichWidget from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import TextAreaWidget from Products.Archetypes.atapi import TextField from Products.CMFCore.utils import ContentInit from Products.CMFDynamicViewFTI.browserdefault import BrowserDefaultMixin PROJECTNAME = 'collective.searchandreplace' SampleTypeSchema = BaseSchema.copy() + MetadataSchema(()) + Schema(( TextField( 'rich', required=False, searchable=True, default_output_type='text/x-html-safe', widget=RichWidget( description='', label=u'Rich Text') ), TextField( 'plain', required=False, searchable=True,