class VignetteExtender(object): """This extender just add a new field to all content types """ # We use both orderable and browser layer aware sensitive properties implements(IOrderableSchemaExtender, IBrowserLayerAwareExtender) # Don't do schema extending unless our add-on product is installed on Plone layer = IThemeSpecific fields = [ ExtensionImageField( "image", storage=atapi.AnnotationStorage(migrate=True), languageIndependent=True, schemata="default", required=True, widget=atapi.ImageWidget( label=_p(u'label_news_image', default=u'Image'), description=_(u"This image should have 765px with"), show_content_type=False), ), ExtensionStringField( "imageCaption", required=False, schemata="default", widget=atapi.StringWidget(label=_p(u'label_image_caption', default=u'Image Caption'), size=40), ) ] def __init__(self, context): self.context = context def getOrder(self, schematas): """ Manipulate the order in which fields appear. @param schematas: Dictonary of schemata name -> field lists @return: Dictionary of reordered field lists per schemata. """ return schematas def getFields(self): """ @return: List of new fields we contribute to content. """ return self.fields
from jalon.content.config import PROJECTNAME from jalon.content.interfaces import IJalonRessourceExterne import jalon_utils import copy ressourceType = [ u"Lien web".encode("utf-8"), u"Lecteur exportable".encode("utf-8") ] JalonRessourceExterneSchema = ATDocumentSchema.copy() + atpublic.Schema(( atpublic.StringField("sousTitre", required=False, accessor="getSousTitre", searchable=False, widget=atpublic.StringWidget( label=_(u"Sous titre"), )), atpublic.StringField("typeRessourceExterne", required=True, accessor="getTypeRessourceExterne", searchable=False, default="", vocabulary=ressourceType, widget=atpublic.SelectionWidget( label=_(u"Type de la Ressource Externe"), format="select", )), atpublic.TextField("auteurs", required=True, accessor="getAuteurs", searchable=False, widget=atpublic.TextAreaWidget(label=_(u"Auteurs"), )),
'fullname', default='', accessor='getFullname', mutator='setFullname', mode='rw', read_permission=permissions.VIEW_PUBLIC_PERMISSION, write_permission=permissions.EDIT_PROPERTIES_PERMISSION, index=('membrane_tool/ZCTextIndex,lexicon_id=member_lexicon,' 'index_type=Cosine Measure|TextIndex:brains', 'ZCTextIndex|TextIndex:brains'), regfield=1, user_property=True, widget=atapi.StringWidget( label='Full name', label_msgid='label_full_name', description="Enter full name, eg. John Smith.", description_msgid='help_full_name_creation', i18n_domain='plone', )), atapi.StringField('telefone', default='', mode='rw', regfield=1, read_permission=permissions.VIEW_PUBLIC_PERMISSION, write_permission=permissions.EDIT_PROPERTIES_PERMISSION, user_property=True, widget=atapi.StringWidget( label='Telefone', label_msgid='label_telefone', description="Forneca seu numero de telefone.", description_msgid='help_telefone_creation',
class ProcurementRequest(afapi.AlphaFlowed, BaseContent): """A procurement request. """ zope.interface.implement(IAlphaFlowed) schema = atapi.BaseSchema.copy() + atapi.Schema(( atapi.StringField( "article", required=True, widget=atapi.StringWidget( label="Article", description="XXX", ), ), atapi.StringField( "account", required=False, vocabulary=config.accounts, widget=atapi.SelectionWidget( label="Account", description="XXX", ), ), atapi.TextField( "reason", required=False, widget=atapi.TextAreaWidget( label="Reason", description="XXX", ), ), atapi.FloatField( "price", required=True, ), atapi.DateTimeField( "due", required=True, ), )) schema["id"].widget.visible = \ schema["title"].widget.visible = { 'edit':'hidden', 'view':'hidden' } schema["title"].required = False content_icon = "file_icon.gif" # XXX global_allow = 0 archetype_name = "Procurement Request" portal_type = meta_type = "ProcurementRequest" include_default_actions = False actions = ( { 'id': 'view', 'name': 'View', 'action': 'string:${object_url}/base_view', }, { 'id': 'edit', 'name': 'Edit', 'action': 'string:${object_url}/base_edit', }, ) def Title(self): """DC title.""" return self.getArticle() def manage_afterAdd(self, item, container): ProcurementRequest.inheritedAttribute('manage_afterAdd')(self, item, container) if len(self.getAllInstances()) > 0: return wftool = getToolByName(self, "workflow_manager") process = wftool.processes['procurement'].current() self.assignProcess(process) self.getInstance().start("Workflow started by request creation.") def getAccountGroup(self): """Return the name of the group responsible for this request's account.""" return utils.getGroupFromAccount(self.getAccount())
from jalon.content import contentMessageFactory as _ from jalon.content.config import PROJECTNAME from jalon.content.interfaces import IJalonConnect import copy import jalon_utils JalonConnectSchema = ATDocumentSchema.copy() + atpublic.Schema(( atpublic.StringField( 'dateAjout', required = False, accessor = 'getDateAjout', searchable = False, widget = atpublic.StringWidget( label = _(u"Date de création sur Adobe Connect") )), atpublic.StringField( "duree", required = False, accessor = "getDuree", searchable = False, widget = atpublic.StringWidget( label = _(u"Durée"), )), atpublic.StringField( "dateUS", required = False, accessor = "getDateUS", searchable = False, widget = atpublic.StringWidget(
class ViewletConfigFieldsExtender(object): adapts(IViewletConfigFieldsExtender) implements(ISchemaExtender) fields = [ ExtensionBooleanField( "inherit_viewlet_settings", schemata="Listing", widget=atapi.BooleanWidget( label=_(u"Inherit viewlet settinngs"), description=_( u"If checked - the settings will be inherited from parent." ), ), ), ExtensionStringField( "viewlet_title", schemata="Listing", widget=atapi.StringWidget(label=_(u"Viewlet title"), ), ), ExtensionStringField( "script_name", vocabulary_factory="python-scripts-viewlet", schemata="Listing", required=False, widget=atapi.SelectionWidget( format='select', label=_(u"Python Script"), description=_( u"Python Script used to generate list of results"), ), ), ExtensionIntField( "limit_results", schemata="Listing", widget=atapi.IntegerWidget( label=_(u"Limit results"), description=_( u"How many results should be displayed (none means all)"), ), ), ExtensionStringField( "template_name", vocabulary_factory="python-scripts-viewlets-templates", schemata="Listing", required=False, widget=atapi.SelectionWidget( format='select', label=_(u"Template"), description=_(u"Template to use to render list of results"), ), ), ] def __init__(self, context): self.context = context def getFields(self): """ The list of fields """ # Return the 'inherit_viewlet_settings' field only if it's possible to inherit if any([i.get(self.context, inherit=True) for i in self.fields]): return self.fields else: return self.fields[1:]
from Products.ATContentTypes import atct from Products.ATContentTypes.content.schemata import finalizeATCTSchema from Products.CMFPlone.utils import getToolByName from zope.interface import implements from cirb.relex.interfaces import IProject from cirb.relex.i18n import _ logger = logging.getLogger('cirb.relex') ProjectSchema = atct.ATContentTypeSchema.copy() + atapi.Schema( ( atapi.StringField( 'code', widget=atapi.StringWidget( label=_(u'Code'), i18n_domain='cirb.relex', ), ), atapi.StringField( 'name_fr', widget=atapi.StringWidget( label=_(u'Name FR'), i18n_domain='cirb.relex', ), ), atapi.StringField( 'name_en', widget=atapi.StringWidget( label=_(u'Name EN'), i18n_domain='cirb.relex', ),
from jalon.content.interfaces import IJalonFile import jalon_utils JalonFileSchema = ATDocumentSchema.copy() + atpublic.Schema(( BlobField('file', widget=atpublic.FileWidget(label='A file', description='Some file'), required=True, ), atpublic.StringField("actif", required=False, accessor="getActif", searchable=False, default="actif", widget=atpublic.StringWidget(label=_(u"Actif"), )), atpublic.TextField("correction", required=True, accessor="getCorrection", searchable=False, widget=atpublic.TextAreaWidget(label=_(u"Correction"), )), atpublic.StringField("note", required=False, accessor="getNote", searchable=False, widget=atpublic.StringWidget(label=_(u"Note ou appréciation"), )), ))
from jalonedit.content import contentMessageFactory as _ from jalonedit.content.config import PROJECTNAME from jalonedit.content.interfaces import IBibliographie from DateTime import DateTime BibliographieSchema = ATDocumentSchema.copy() + atpublic.Schema(( atpublic.StringField( "sous-titre", required=False, accessor="getSousTitre", searchable=False, widget=atpublic.StringWidget( label=_(u"label_sousTitreWebographie", default=u"sous Titre Webographie"), description=_(u"desc_sousTitreWebographie", default=u"Description du sous Titre Webographie"), )), atpublic.StringField( "premier-auteur", required=True, accessor="getPremierAuteur", searchable=False, widget=atpublic.StringWidget( label=_(u"label_premierAuteur", default=u"premier Auteur"), description=_(u"desc_premierAuteur", default=u"Description du premier Auteur"), )), atpublic.TextField( "autres-auteurs", required=False,
from Products.CMFCore.utils import getToolByName from jalon.content import contentMessageFactory as _ from jalon.content.config import PROJECTNAME from jalon.content.interfaces import IJalonForum import jalon_utils JalonForumSchema = ATDocumentSchema.copy() + atpublic.Schema(( atpublic.StringField( "dateAff", required=False, accessor="getDateAff", searchable=False, widget=atpublic.StringWidget( label=_(u"Date d'affichage"), description=_(u"Description de la date d'affichage"), )), atpublic.StringField( "dateMasq", required=False, accessor="getDateMasq", searchable=False, widget=atpublic.StringWidget( label=_(u"Date à laquelle cette activité est masquée"), description=_(u"Date servant à masquer cette activité"), )), )) class JalonForum(ATDocumentBase): """ un forum pour Jalon