class ICover(model.Schema): title = schema.TextLine( title=_(u'Title'), required=True, ) feature = RelationList( title=_(u"Related Product"), default=[], value_type=RelationChoice(title=_(u"Related"), source=CatalogSource(portal_type='Product')), required=True, )
def email_invariant(data): com_email = data.email sub_email = data.test if com_email: for email in com_email.split('\r\n'): if not re.match( r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", email): raise Invalid(_(u'Your Email is not valid!')) if sub_email and not re.match( r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", sub_email): raise Invalid(_(u'Subscribe Email is not valid!'))
class IInform(Form.Schema): email = schema.Text( title=_(u'email'), required=False, ) cellphone = schema.Text( title=_(u'cellphone'), required=False, ) address = schema.Text( title=_(u'address'), required=False ) fax = schema.Text( title=_(u'fax'), required=False )
class IInform(Form.Schema): email = schema.Text( title=_(u'Your Email'), description=_(u'Display on Footer and Contact us page'), required=True, ) cellphone = schema.Text( title=_(u'Your Cellphone'), description=_(u'Display on Footer and Contact us page'), required=True, ) address = schema.Text( title=_(u'Your Address'), description=_(u'Display on Footer and Contact us page'), required=True) fax = schema.Text(title=_(u'Your Fax'), description=_(u'Display on Footer and Contact us page'), required=True) test = schema.TextLine( title=_(u'Subscribe Emails'), description=_(u'Used to receiving Email from Contact us page'), required=True) @invariant def email_invariant(data): com_email = data.email sub_email = data.test if com_email: for email in com_email.split('\r\n'): if not re.match( r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", email): raise Invalid(_(u'Your Email is not valid!')) if sub_email and not re.match( r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", sub_email): raise Invalid(_(u'Subscribe Email is not valid!'))
class IProduct(model.Schema): title = schema.TextLine( title=_(u'Name'), required=True, ) modelNo = schema.TextLine( title=_(u'Model No'), required=False, ) beApplicable = schema.TextLine( title=_(u'Be Applicable'), required=False, ) characteristic = schema.TextLine( title=_(u'Characteristic'), required=False, ) body = RichText( title=_(u'Body'), required=False, ) cover = NamedBlobImage( title=_(u"Cover Image"), required=True, ) category = schema.TextLine( title=_(u'Category'), required=True, ) subject = schema.TextLine( title=_(u'Subject'), required=True, )
required=True) test = schema.TextLine( title=_(u'Subscribe Emails'), description=_(u'Used to receiving Email from Contact us page'), required=True) @invariant def email_invariant(data): com_email = data.email sub_email = data.test if com_email: for email in com_email.split('\r\n'): if not re.match( r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", email): raise Invalid(_(u'Your Email is not valid!')) if sub_email and not re.match( r"^[A-Za-z0-9\.\+_-]+@[A-Za-z0-9\._-]+\.[a-zA-Z]*$", sub_email): raise Invalid(_(u'Subscribe Email is not valid!')) class BasicInformControlPanelForm(RegistryEditForm): form.extends(RegistryEditForm) schema = IInform CustomControlPanelView = layout.wrap_form(BasicInformControlPanelForm, ControlPanelFormWrapper) CustomControlPanelView.label = _(u"Basic Inform")
class IProductimg(model.Schema): image = NamedBlobImage( title=_(u"Image"), description=_(u"Add image in 'Product' content"), )
class IProduct(model.Schema): title = schema.TextLine( title=_(u'Name'), required=True, ) modelNo = schema.TextLine( title=_(u'Model No'), required=False, ) beApplicable = schema.TextLine( title=_(u'Be Applicable'), required=False, ) characteristic = schema.TextLine( title=_(u'Characteristic'), required=False, ) description = schema.Text( title=_(u'Description'), required=False, ) body = RichText( title=_(u'Product Description'), required=False, ) cover = NamedBlobImage( title=_(u"Cover Image"), required=True, ) category = schema.TextLine( title=_(u'Category'), required=True, ) subject = schema.TextLine( title=_(u'Subject'), required=True, ) fieldset(_('Slider'), fields=['img1', 'img2', 'img3', 'img4', 'img5']) img1 = NamedBlobImage( title=_(u"Slider Image1"), required=False, ) img2 = NamedBlobImage( title=_(u"Slider Image2"), required=False, ) img3 = NamedBlobImage( title=_(u"Slider Image3"), required=False, ) img4 = NamedBlobImage( title=_(u"Slider Image4"), required=False, ) img5 = NamedBlobImage( title=_(u"Slider Image5"), required=False, )
class IDict(Form.Schema): dict = schema.Text( title=_(u'store category and subject'), required=False, )
# -*- coding: utf-8 -*- from gct.content import _ from plone.app.registry.browser.controlpanel import RegistryEditForm from plone.app.registry.browser.controlpanel import ControlPanelFormWrapper from zope import schema from plone.z3cform import layout from z3c.form import form from plone.directives import form as Form class IDict(Form.Schema): dict = schema.Text( title=_(u'store category and subject'), required=False, ) class CategoriesControlPanelForm(RegistryEditForm): form.extends(RegistryEditForm) schema = IDict CustomControlPanelView = layout.wrap_form(CategoriesControlPanelForm, ControlPanelFormWrapper) CustomControlPanelView.label = _(u"Custom Related Setting")