class WatchingActionAddForm(AddForm): form_fields = form.FormFields(IWatchingAction) label = _(u'Add watching action') description = _(u'An action which can add or remove a user ' u'from the watchers list') form_name = _p(u'Configure element') def create(self, data): a = WatchingAction() form.applyChanges(a, self.form_fields, data) return a
class IWatchingAction(interface.Interface): """Definition of the configuration available for a watching action.""" watching = schema.Choice(title=_(u"Change watching"), vocabulary=watchingChoice) name = schema.ASCIILine(title=_(u"Name of your adapter"), description=_(u"Leave that empty if you don't" u" know what you're doing."), missing_value='', required=False)
class WatchingAction(SimpleItem): interface.implements(IWatchingAction, IRuleElementData) watching = 'watch' name = '' element = 'collective.watcherlist.actions.Watching' summary = _(u'Change if the user is in the watchers list or not.')
from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm from collective.watcherlist.i18n import _ watchingChoice = SimpleVocabulary([ SimpleTerm('watch', 'watch', _(u'Add to watchers list')), SimpleTerm('unwatch', 'unwatch', _(u'Remove from watchers list')), ])
class WatchingActionEditForm(EditForm): form_fields = form.FormFields(IWatchingAction) label = _(u'Edit watching action') description = _(u'An action which can add or remove a user ' u'from the watchers list') form_name = _p(u'Configure element')