def afterSetUp(self): from Products.TemplateFields import ZPTField self.field = ZPTField('aField') self.folder.validate_field = lambda *args, **kw: None self.folder.setTitle("My Folder")
it here."), i18n_domain='EasyNewsletter', size=10, ) ), # XXX can be removed in version 4 ZPTField( 'out_template_pt', schemata='settings', required=False, validators=('zptvalidator', ), widget=atapi.TextAreaWidget( label=_( u"label_out_template_pt", default=u"Outgoing Mail Template, NOT USED ANY MORE!"), description=_( u"help_mailtemplate_body_pt", default=u"This is not used anymore and will be removed in \ future, please see docs for output templates."), i18n_domain="EasyNewsletter", rows=40, ), ), atapi.StringField( 'outputTemplate', vocabulary="get_output_templates", required=True, default_method='get_default_output_template', widget=atapi.SelectionWidget(
class ZPTFieldTest(PloneTestCase.PloneTestCase): def afterSetUp(self): from Products.TemplateFields import ZPTField self.field = ZPTField('aField') self.folder.validate_field = lambda *args, **kw: None self.folder.setTitle("My Folder") def validate(self, value): errors = {} res = self.field.validate(value, self.folder, errors) return res, errors def test_defaults(self): self.assertEquals(self.field.get(self.folder), "My Folder\n") def test_getRaw(self): raw = self.field.getRaw(self.folder) self.assertEquals(raw, '<span tal:replace="here/title_or_id" />') def test_set(self): self.assertEquals(self.field.get(self.folder), "My Folder\n") self.field.set(self.folder, '<span tal:replace="here/aq_parent/title_or_id" />') self.assertEquals(self.field.get(self.folder), "Members\n") def test_set_zpt(self): # Just make sure setting PageTemplate works too. default_zpt = self.field.getDefault(self.folder) self.field.set(self.folder, default_zpt) self.assertEquals( self.field.getRaw(self.folder), default_zpt.read())
for fields that received no input. Uncheck to leave fields with no input out of the e-mail. """), ), ), ZPTField( 'body_pt', schemata='template', write_permission=EDIT_TALES_PERMISSION, default_method='getMailBodyDefault', read_permission=ModifyPortalContent, widget=TextAreaWidget( description=_(u'help_formmailer_body_pt', default=u"""This is a Zope Page Template used for rendering of the mail-body. You don\'t need to modify it, but if you know TAL (Zope\'s Template Attribute Language) you have the full power to customize your outgoing mails."""), label=_(u'label_formmailer_body_pt', default=u'Mail-Body Template'), rows=20, visible={ 'edit': 'visible', 'view': 'invisible' }, ), validators=('zptvalidator', ), ), StringField( 'body_type', schemata='template', default_method='getMailBodyTypeDefault', vocabulary=MIME_LIST,
default=u"Some packages provide an external delivery service \ for EasyNewsletter. If one is installed you can choose it here." ), i18n_domain='EasyNewsletter', size=10, )), ZPTField( 'out_template_pt', schemata='settings', required=True, default=config.DEFAULT_OUT_TEMPLATE_PT, validators=('zptvalidator', ), widget=atapi.TextAreaWidget( label=_(u"label_out_template_pt", default=u"Outgoing Mail Template"), description=_( u"help_mailtemplate_body_pt", default= u"This is a Zope Page Template used for rendering of the out going mail. \ You don\'t need to modify it, but if you know TAL (Zope\'s Template \ Attribute Language) you have the full power to customize your outgoing mails." ), i18n_domain="EasyNewsletter", rows=40, ), ), atapi.StringField( 'subscriber_confirmation_mail_subject', schemata="settings", required=True, default=config.DEFAULT_SUBSCRIBER_CONFIRMATION_MAIL_SUBJECT, widget=atapi.StringWidget(
from Products.TemplateFields import ZPTField from Products.CMFCore.utils import getToolByName from zope.interface import implements from Products.EasyNewsletter import config from Products.EasyNewsletter.interfaces import IENLTemplate from Products.EasyNewsletter import EasyNewsletterMessageFactory as _ schema = atapi.BaseSchema + atapi.Schema(( ZPTField( 'body', validators=('zptvalidator', ), widget=atapi.TextAreaWidget( label=_(u'label_body_zpt', default=u'Newsletter Template'), description=_( 'help_body_zpt', default=u'This is a Zope Page Template file that is used for \ rendering the newsletter mail.'), i18n_domain="plone", rows=30, ), ), atapi.TextField( 'description', accessor="Description", widget=atapi.TextAreaWidget( label=_(u"label_description", default=u'Description'), description=_(u"help_description", default=u"Enter a value for description."), i18n_domain="plone", ),
def afterSetUp(self): PloneTestCase.PloneTestCase.afterSetUp(self) self.field = ZPTField("aField") self.folder.validate_field = lambda *args, **kw: None self.folder.setTitle("My Folder")
from abstract.pfg2pdf.interfaces import IFormToPDFAdapter from abstract.pfg2pdf.config import PROJECTNAME from abstract.pfg2pdf import _ FormToPDFAdapterSchema = FormAdapterSchema.copy() + atapi.Schema(( ZPTField( 'pdf_body_pt', # schemata='template', write_permission=EDIT_TALES_PERMISSION, default_method='getPDFBodyDefault', read_permission=ModifyPortalContent, widget=atapi.TextAreaWidget( label=_(_(u'PDF-Body Template')), description=_( _(u"This is a Zope Page Template " u"used for rendering of the PDF for this form. " u"You will find data from the form " u"in the `options` var (es: options/comments)")), rows=20, visible={ 'edit': 'visible', 'view': 'invisible' }, ), validators=('zptvalidator', ), ), atapi.IntegerField( 'download_timeout', storage=atapi.AnnotationStorage(), widget=atapi.IntegerWidget( label=_(u"Download Timeout"),
i18n_domain='EasyNewsletter', size=1, )), # XXX provide a default_method to select template from registry if possible # this could be combined with an email render behavior on the content # source target objects like Collection (Plone >= 5 only). ZPTField( 'body', validators=('zptvalidator', ), widget=atapi.TextAreaWidget( label=_(u'label_body_zpt', default=u'Custom Aggregation Template'), description=_( 'help_body_zpt', # XXX update translations for this string! default=u'This is a custom Zope Page Template that ' + u'is used for rendering the aggregated email content' + u', in case you selected <i>custom</i> for the ' + u'aggregation template above.'), i18n_domain="plone", rows=90, ), ), ), ) # schema['body'].widget.visible = { # 'view': 'invisible', 'edit': 'hidden'} @implementer(IENLTemplate)
'sender_mail', required=False, widget=atapi.StringWidget(label=_( u'label_sender_mail', default=u'From address used to send the confirmation e-mail', )), schemata='confirmation', ), ZPTField( 'plain_mail', required=False, widget=atapi.TextAreaWidget( label=_(u'label_plain_mail', default=u'Content of the confirmation email (plain text)'), description=_( u'label_help_plain_mail', default=(u'The content of the confirmation email. ' 'Use [[confirmation_link]] to display the ' 'confirmation link. You can also use tal language ' 'here for complex data integration.'), ), ), schemata='confirmation', ), ZPTField( 'html_mail', required=False, default_output_type='text/x-html-safe', widget=atapi.TextAreaWidget( label=_(u'label_html_mail', default=u'Content of the confirmation email (HTML)'), description=_(