def fiddle(self, schema): if schema.get('creation_date', None) is None: return for f in self.getFields(): schema.addField(f) # move to AGLS schemata schema['creation_date'].schemata = 'AGLS Overrides' # update description schema['creation_date'].widget.description = _( u'Date this object was created. Used for AGLS Date meta tag.') # unhide it schema['creation_date'].widget.visible = { 'edit': 'visible', 'view': 'invisible'} # set starting year schema['creation_date'].widget.starting_year = 1990 # move after AGLS description field schema.moveField('creation_date', after='agls_desc')
from zope import schema from zope.component import adapts from zope.interface import alsoProvides from zope.interface import implements from plone.dexterity.interfaces import IDexterityContent from plone.directives import form from pretaweb.agls import messageFactory as _ from z3c.form.interfaces import IEditForm from z3c.form.interfaces import IAddForm from pretaweb.agls.content.agls import AGLS_TYPES from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm AGLS_TYPES_VOCAB = SimpleVocabulary( [SimpleTerm(value=x, title=_(x)) for x in AGLS_TYPES] ) AGLS_FIELDS = ( 'agls_title_override', 'agls_title', 'agls_desc_override', 'agls_desc', 'agls_author_override', 'agls_author', 'agls_id_override', 'agls_id', 'agls_publisher_override', 'agls_publisher', 'agls_format_override', 'agls_format' ) class IAGLS(form.Schema): form.fieldset( 'categorization', label=u'Categorization',