def summary(self): exclude = self.exclude if exclude: msg = _(u"Exclude content object from navigation.") else: msg = _(u"Show content object in navigation.") return msg
def summary(self): exclude = self.exclude if exclude: msg = _(u"Exclude content from navigation.") else: msg = _(u"Show content object in navigation.") return msg
def summary(self): rights = self.rights only_empty = self.only_empty condition = (only_empty and _(u', only if rights was not set.') or _(u'.')) msg = _(u"Set rights '${rights}'${condition}", mapping=dict(rights=rights, condition=condition)) return msg
def summary(self): language = self.language only_empty = self.only_empty condition = (only_empty and _(u', only if language was not set.') or _(u'.')) msg = _(u"Set language ${language}${condition}", mapping=dict(language=language, condition=condition)) return msg
def summary(self): creators = self.creators only_empty = self.only_empty condition = (only_empty and _(u', only if creators was not set.') or _(u'.')) msg = _(u"Set creators to ${creators}${condition}", mapping=dict(creators=','.join(creators), condition=condition)) return msg
class IExcludeFromNavAction(Interface): '''Interface for the configurable aspects of exclude from navigation action. This is also used to create add and edit forms, below. ''' exclude = Bool(title=_(u"Exclude content from navigation"), description=_(u"If checked the content will not be " u"listed in portal navigation elements."))
def summary(self): same_as_parent = self.same_as_parent subject = self.subject if same_as_parent: msg = _(u"Apply tags from parent object.") else: msg = _(u"Apply tags ${tags}", mapping=dict(tags=", ".join(subject))) return msg
class IRightsAction(Interface): '''Interface for the configurable aspects of a set rights action. This is also used to create add and edit forms, below. ''' rights = Text(title=_(u'Rights'), description=_(u'Inform the copyright statement or other ' u'rights information on this item'), required=True) only_empty = Bool(title=_(u"Only if not set"), description=_(u"Apply this only if no rights was " u"set on the content item."), required=False, default=True)
class IContributorsAction(Interface): '''Interface for the configurable aspects of a set contributors action. This is also used to create add and edit forms, below. ''' contributors = Tuple(title=_(u'Contributors'), description=DESC, value_type=TextLine(), required=False,) only_empty = Bool(title=_(u"Only if not set"), description=_(u"Apply this only if no contributors was " u"set on the content item."), required=False, default=True)
class ILanguageAction(Interface): '''Interface for the configurable aspects of a set language action. This is also used to create add and edit forms, below. ''' language = Choice(title=_(u'Language'), description=_(u'Select here the language to be applied ' u'to the content item.'), required=True, vocabulary=VOCAB) only_empty = Bool(title=_(u"Only if not set"), description=_(u"Apply this only if no language was " u"set on the content item."), required=False, default=True)
class SubjectEditForm(EditForm): """ An edit form for the set Tags contentrules action """ form_fields = form.FormFields(ISubjectAction) label = _(u"Edit the set Tags content rules action") description = FORM_DESC form_name = FORM_NAME
class ContributorsEditForm(EditForm): """ An edit form for the set Contributors contentrules action """ form_fields = form.FormFields(IContributorsAction) label = _(u"Edit the set Contributors content rules action") description = FORM_DESC form_name = FORM_NAME
class ExcludeFromNavEditForm(EditForm): """ An edit form for the exclude from navigation contentrules action """ form_fields = form.FormFields(IExcludeFromNavAction) label = _(u"Edit an exclude from navigation content rules action") description = FORM_DESC form_name = FORM_NAME
class LanguageEditForm(EditForm): """ An edit form for the set Language contentrules action """ form_fields = form.FormFields(ILanguageAction) label = _(u"Edit the set Language content rules action") description = FORM_DESC form_name = FORM_NAME
class ISubjectAction(Interface): '''Interface for the configurable aspects of a set Tag action. This is also used to create add and edit forms, below. ''' same_as_parent = Bool(title=_(u"Use Tags from parent object"), description=_(u"Select this to use Tags as defined " u"in the parent object. If this " u"option is selected this action " u"ignores the following field.")) subject = Set(title=_(u'Tags'), description=_(u'Tags to check for. Leave it blank ' u'to check for contents without any ' u'tag set'), required=False, value_type=Choice(vocabulary=VOCAB))
class ICreatorsAction(Interface): '''Interface for the configurable aspects of a set creators action. This is also used to create add and edit forms, below. ''' creators = Tuple( title=_(u'Creators'), description=_(u'Persons responsible for creating the ' u'content of this item. Please enter a ' u'list of user names, one per line. The ' u'principal creator should come first.'), value_type=TextLine(), required=False, ) only_empty = Bool(title=_(u"Only if not set"), description=_(u"Apply this only if no creators was " u"set on the content item."), required=False, default=True)
class ExcludeFromNavAddForm(AddForm): """ An add form for the exclude from navigation contentrules action """ form_fields = form.FormFields(IExcludeFromNavAction) label = _(u"Add an exclude from navigation content rules action") description = FORM_DESC form_name = FORM_NAME def create(self, data): a = ExcludeFromNavAction() form.applyChanges(a, self.form_fields, data) return a
class ContributorsAddForm(AddForm): """ An add form for the Contributors contentrules action """ form_fields = form.FormFields(IContributorsAction) label = _(u"Add set Contributors content rules action") description = FORM_DESC form_name = FORM_NAME def create(self, data): a = ContributorsAction() form.applyChanges(a, self.form_fields, data) return a
from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool from zope.schema import Choice VOCAB = 'plone.app.vocabularies.AvailableContentLanguages' FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that sets language to a content.') class ILanguageAction(Interface): '''Interface for the configurable aspects of a set language action. This is also used to create add and edit forms, below. ''' language = Choice(title=_(u'Language'), description=_(u'Select here the language to be applied ' u'to the content item.'), required=True, vocabulary=VOCAB)
from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool from zope.schema import Choice from zope.schema import Set VOCAB = 'plone.app.vocabularies.Keywords' FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that applies Tags to a content.') class ISubjectAction(Interface): '''Interface for the configurable aspects of a set Tag action. This is also used to create add and edit forms, below. ''' same_as_parent = Bool(title=_(u"Use Tags from parent object"), description=_(u"Select this to use Tags as defined " u"in the parent object. If this " u"option is selected this action " u"ignores the following field."))
from plone.app.contentrules.browser.formhelper import AddForm from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool from zope.schema import TextLine from zope.schema import Tuple FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that sets contributors to a content.') DESC = _(u'The names of people that have contributed to this item. Each ' u'contributor should be on a separate line.') class IContributorsAction(Interface): '''Interface for the configurable aspects of a set contributors action. This is also used to create add and edit forms, below. ''' contributors = Tuple(title=_(u'Contributors'), description=DESC, value_type=TextLine(),
# -*- coding: utf-8 -*- from OFS.SimpleItem import SimpleItem from plone.app.contentrules.browser.formhelper import AddForm from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that excludes contents from navigation.') class IExcludeFromNavAction(Interface): '''Interface for the configurable aspects of exclude from navigation action. This is also used to create add and edit forms, below. ''' exclude = Bool(title=_(u"Exclude content from navigation"), description=_(u"If checked the content will not be " u"listed in portal navigation elements.")) class ExcludeFromNavAction(SimpleItem):
from plone.app.contentrules.browser.formhelper import AddForm from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool from zope.schema import Choice VOCAB = 'plone.app.vocabularies.AvailableContentLanguages' FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that sets language to a content.') class ILanguageAction(Interface): '''Interface for the configurable aspects of a set language action. This is also used to create add and edit forms, below. ''' language = Choice(title=_(u'Language'), description=_(u'Select here the language to be applied ' u'to the content item.'), required=True, vocabulary=VOCAB)
from plone.app.contentrules.browser.formhelper import AddForm from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool from zope.schema import TextLine from zope.schema import Tuple FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that sets creators to a content.') class ICreatorsAction(Interface): '''Interface for the configurable aspects of a set creators action. This is also used to create add and edit forms, below. ''' creators = Tuple(title=_(u'Creators'), description=_(u'Persons responsible for creating the ' u'content of this item. Please enter a ' u'list of user names, one per line. The ' u'principal creator should come first.'), value_type=TextLine(),
from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool from zope.schema import Choice from zope.schema import Set VOCAB = 'plone.app.vocabularies.Keywords' FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that applies Tags to a content.') class ISubjectAction(Interface): '''Interface for the configurable aspects of a set Tag action. This is also used to create add and edit forms, below. ''' same_as_parent = Bool(title=_(u"Use Tags from parent object"), description=_(u"Select this to use Tags as defined " u"in the parent object. If this " u"option is selected this action " u"ignores the following field."))
# -*- coding: utf-8 -*- from OFS.SimpleItem import SimpleItem from plone.app.contentrules.browser.formhelper import AddForm from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that excludes contents from navigation.') class IExcludeFromNavAction(Interface): '''Interface for the configurable aspects of exclude from navigation action. This is also used to create add and edit forms, below. ''' exclude = Bool(title=_(u"Exclude content from navigation"), description=_(u"If checked the content will not be " u"listed in portal navigation elements."))
from OFS.SimpleItem import SimpleItem from plone.app.contentrules.browser.formhelper import AddForm from plone.app.contentrules.browser.formhelper import EditForm from plone.contentrules.rule.interfaces import IExecutable from plone.contentrules.rule.interfaces import IRuleElementData from sc.contentrules.metadata import MessageFactory as _ from sc.contentrules.metadata import utils from zope.component import adapts from zope.formlib import form from zope.interface import implements from zope.interface import Interface from zope.schema import Bool from zope.schema import Text FORM_NAME = _(u"Configure action") FORM_DESC = _(u'An action that sets rights to a content.') class IRightsAction(Interface): '''Interface for the configurable aspects of a set rights action. This is also used to create add and edit forms, below. ''' rights = Text(title=_(u'Rights'), description=_(u'Inform the copyright statement or other ' u'rights information on this item'), required=True) only_empty = Bool(title=_(u"Only if not set"),