class CollectionSchemaExtender(PDFSchemaExtender): """ Schema extender """ implements(ISchemaExtender, IBrowserLayerAwareExtender) layer = ILayer fields = ( ExtendedIntegerField( name='pdfMaxDepth', schemata='settings', write_permission="Can customize PDF", widget=public.IntegerWidget( label=_(u"PDF Maximum depth"), description=_( u"Maximum depth to recursively include children items " u"while generating PDF. Leave it empty to use the portal " u"global defined value." ) ) ), ExtendedIntegerField( name='pdfMaxBreadth', schemata='settings', write_permission="Can customize PDF", widget=public.IntegerWidget( label=_(u"PDF Maximum breadth"), description=_( u"Maximum children items to include " u"while generating PDF for collection " u"or folderish content-types where object is collection or " u"folderish. Leave it empty to use the portal " u"global defined value." ) ) ), ExtendedIntegerField( name='pdfMaxItems', schemata='settings', write_permission="Can customize PDF", widget=public.IntegerWidget( label=_(u"PDF Maximum items"), description=_( u"Total maximum children items to be included" u"while generating PDF. Leave it empty to use the portal " u"global defined value." ) ) ), ExtendedImageField( name='coverImage', schemata='settings', write_permission="Can customize PDF", widget=ImageWidget( label=_(u"PDF cover main image"), description=_( u"Main cover image that will show up on the pdf cover page" ) ) ), )
class IssueExtender(object): component.adapts(poifaces.IIssue) implements(extenderfaces.ISchemaExtender, extenderfaces.IBrowserLayerAwareExtender) layer = interfaces.IMakinaMaintenanceLayer fields = [MaintenanceCredit("credits", accessor="getCredits", languageIndependent = True, schemata="default", widget = atapi.IntegerWidget( label=i18n.issue_credits_label, description=i18n.issue_credits_desc, ), ) ] def __init__(self, context): self.context = context def getFields(self): """ @return: List of new fields we contribute to content. """ return self.fields
class TrackerExtender(object): """Include available maintenance unit on tracker""" component.adapts(poifaces.ITracker) implements(extenderfaces.ISchemaExtender, extenderfaces.IBrowserLayerAwareExtender) layer = interfaces.IMakinaMaintenanceLayer fields = [MaintenanceCredit("credits", accessor="getCredits", languageIndependent = True, schemata="default", widget = atapi.IntegerWidget( label=i18n.tracker_credits_label, description=i18n.tracker_credits_desc, ), ) ] def __init__(self, context): self.context = context # if you want to manange order, use IOrderableSchemaExtender with # 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. # """ # schematas["properties"] = ['effectiveDate', 'revisitDate', 'expirationDate', 'creation_date', 'modification_date'] # # return schematas def getFields(self): """ @return: List of new fields we contribute to content. """ return self.fields
widget=atpublic.StringWidget(label=_(u"Volume"), )), atpublic.StringField("lieu", required=False, accessor="getLieu", searchable=False, widget=atpublic.StringWidget(label=_(u"Lieu"), )), atpublic.StringField("editeur", required=False, accessor="getEditeur", searchable=False, widget=atpublic.StringWidget(label=_(u"Editeur"), )), atpublic.IntegerField("annee", required=False, accessor="getAnnee", searchable=False, widget=atpublic.IntegerWidget(label=_(u"Année"), )), atpublic.StringField("pagination", required=False, accessor="getPagination", searchable=False, widget=atpublic.StringWidget( label=_(u"Pagination"), )), atpublic.StringField("collection", required=False, accessor="getCollection", searchable=False, widget=atpublic.StringWidget( label=_(u"Collection"), )), atpublic.StringField("isbn", required=False, accessor="getISBN",
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:]
required=True, accessor="getEditeur", searchable=False, widget=atpublic.StringWidget( label=_(u"label_editeur", default=u"Editeur"), description=_( u"desc_editeur", default=u"Description de l'editeur"), )), atpublic.IntegerField("annee", required=True, accessor="getAnnee", searchable=False, widget=atpublic.IntegerWidget( label=_(u"label_annee", default=u"Annee"), description=_(u"desc_annee", default=u"Description de l'annee"), )), atpublic.StringField( "pagination", required=False, accessor="getPagination", searchable=False, widget=atpublic.StringWidget( label=_(u"label_pagination", default=u"Pagination"), description=_(u"desc_pagination", default=u"Description de la pagination"), )), atpublic.StringField( "collection", required=False,