Пример #1
0
from StringIO import StringIO

from email import Encoders
from email.Header import Header
from email.MIMEAudio import MIMEAudio
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText

from cs.pfg.xmlmailer.config import *
from cs.pfg.xmlmailer import XMLMailerFactory as _

from DateTime import DateTime

xmladapterSchema = formMailerAdapterSchema.copy() + Schema((
    StringField('filesystempath',
                searchable=False,
                required=False,
                widget=StringWidget(
                    label=u'The path in the filesystem where an XML file representing the form data will be written',
                    label_msgid=_(u'The path in the filesystem where an XML file representing the form data will be written'),
                    description=u"Be careful! The path must exists in the filesystem and Plone process must have write permissions in that path. If you don't know what this means, ask your system administrator. If you leave it empty, no file will be written to the filesystem.",
                    description_msgid=_(u"Be careful! The path must exists in the filesystem and Plone process must have write permissions in that path. If you don't know what this means, ask your system administrator"),
                    i18n_domain='cs.pfg.xmlmailer',
                    ),
                ),
    ),)
                    

class FormXMLMailerAdapter(FormMailerAdapter):
Пример #2
0
from Products.Archetypes import atapi
from Products.ATContentTypes.content import schemata

from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter
from Products.PloneFormGen.content.formMailerAdapter import formMailerAdapterSchema
from Products.PloneFormGen import dollarReplace

# -*- Message Factory Imported Here -*-
from redomino.tokenrole.utils import make_uuid
from redomino.tokenrole.interfaces import ITokenInfoSchema

from redomino.tokenroleform import tokenroleformMessageFactory as _
from redomino.tokenroleform.interfaces import ITokenRoleMailerAdapter
from redomino.tokenroleform.config import PROJECTNAME

TokenRoleMailerAdapterSchema = formMailerAdapterSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.ReferenceField(
        'private_doc',
        storage=atapi.AnnotationStorage(),
        widget=ReferenceBrowserWidget(
            label=_(u"Private doc"),
            description=_(u"Choose the private item you are going to share"),
            startup_directory_method='startupDirectoryMethod',
        ),
        required=True,
        relationship='tokenrolemaileradapter_private_doc',
        allowed_types=(),  # specify portal type names here ('Example Type',)
        multiValued=False,
    ),
Пример #3
0
        'expiration_time',
        required=False,
        default=7,
        widget=atapi.IntegerWidget(
            label=_(u'label_expiration_time',
                    default=u'Expiration time'),
            description=_(
                u'label_help_expiration_time',
                default=(
                    u'Maximum number of days allowed to confirm the form.')),
        ),
        schemata='confirmation'
    ),

))
confirmedFormMailerAdapterSchema = formMailerAdapterSchema.copy() + \
    confirmedSchema


class ConfirmedFormMailerAdapter(FormMailerAdapter):
    schema = confirmedFormMailerAdapterSchema
    security = ClassSecurityInfo()

    security.declareProtected(permissions.View, 'post_validate')

    def post_validate(self, REQUEST=None, errors=None):
        # Perform a check after validation.  We do not want to make
        # plain_mail and html_mail required, but we do need at least
        # one of them filled.
        if (not REQUEST.form.get('plain_mail').strip() and
                not REQUEST.form.get('html_mail').strip()):
from Products.PloneFormGen.content.fieldsBase import BaseFormField
from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter
from Products.PloneFormGen.content.formMailerAdapter import formMailerAdapterSchema
from email import Encoders
from email.MIMEAudio import MIMEAudio
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from zope.interface import implements


_marker = []


PFGExtendedMailAdapterSchema = ATFolderSchema.copy() + formMailerAdapterSchema.copy() + Schema((

    LinesField(
        name='msg_attachments',
        schemata='message',
        required=False,
        searchable=False,
        languageIndependent=True,
        storage=AnnotationStorage(),
        widget=MultiSelectionWidget(
            label=_(u'E-mail Attachments'),
            description=_(u'Please select the attachments to be sent with email.'),
            format='checkbox'),
        vocabulary='attachments',
        enforceVocabulary=True)))
Пример #5
0
# Available parameters:
#  fields  = HTTP request form fields as a dict. Example:
#            fields['fieldname1'] has the value the user
#            entered/selected in the form
#
#  request = The current HTTP request.
#            Access fields by request.form["myfieldname"]
#
#  ploneformgen = PloneFormGen object
#
# Return the amount to be payed by the end user as a float number

assert False, "Please complete your script"
"""

MiPagoAdapterSchema = formMailerAdapterSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-
    atapi.StringField('mipago_cpr_code',
                      languageIndependent=True,
                      vocabulary=atapi.DisplayList([
                          ('9050299', _(u'9050299: Notebook 60, modality 1')),
                          ('9052180', _(u'9052180: Notebook 60, modality 2')),
                          ('9050794', _(u'9050794: Notebook 57')),
                      ]),
                      required=True,
                      storage=atapi.AnnotationStorage(),
                      searchable=False,
                      widget=atapi.SelectionWidget(
                          description='',
                          label=_('Enter the CPR code of this payment'),
from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter, formMailerAdapterSchema

from getpaid.formgen.config import PROJECTNAME

from email.Header import Header

# Get Paid events
import zope
from getpaid.core.interfaces import workflow_states, IShoppingCartUtility, IShippableOrder, IShippingRateService, IShippableLineItem
from zope.annotation.interfaces import IAnnotations

from Acquisition import aq_base

logger = logging.getLogger("GetPaidFormMailer")

getPaidFormMailerAdapterSchema = formMailerAdapterSchema.copy()


class GetPaidFormMailerAdapter(FormMailerAdapter):
    """ A form action adapter that will e-mail form input. """

    schema = getPaidFormMailerAdapterSchema
    portal_type = meta_type = 'GetPaidFormMailerAdapter'
    archetype_name = 'GetPaid Mailer Adapter'
    content_icon = 'mailaction.gif'

    security       = ClassSecurityInfo()

    security.declarePrivate('onSuccess')
    def onSuccess(self, fields, REQUEST=None):
        """
"""Sub-class of PloneFormGen's FormMailerAdapter
"""
from zope.interface import implements
from Products.CMFCore.permissions import View
from AccessControl import ClassSecurityInfo

from Products.Archetypes import atapi

from Products.PloneFormGen.content.formMailerAdapter import formMailerAdapterSchema
from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter

from collective.megaphone.compat import getSite
from collective.megaphone.config import PROJECTNAME
from collective.megaphone.recipient_multiplexer import IMultiplexedActionAdapter

schema = formMailerAdapterSchema.copy()

# we're removing the single recip name field to be replaced by a property that gets the name
# built from the individual fields listed above
del schema["recipient_name"]

# hide some fields
for h in (
    "to_field",  # allows you to extract the recip's value from the form
    "cc_recipients",
    "bcc_recipients",
    "subject_field",  # ditto the subject line
    "showAll",
    "showFields",
    "includeEmpties",  # fields for auto-generated email bodies
    "senderOverride",
Пример #8
0
from Products.PloneFormGen.content.fieldsBase import BaseFormField
from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter
from Products.PloneFormGen.content.formMailerAdapter import formMailerAdapterSchema
from email import Encoders
from email.MIMEAudio import MIMEAudio
from email.MIMEBase import MIMEBase
from email.MIMEImage import MIMEImage
from email.MIMEMultipart import MIMEMultipart
from email.MIMEText import MIMEText
from zope.interface import implements


_marker = []


PFGExtendedMailAdapterSchema = ATFolderSchema.copy() + formMailerAdapterSchema.copy() + Schema((

    LinesField(
        name='msg_attachments',
        schemata='message',
        required=False,
        searchable=False,
        languageIndependent=True,
        storage=AnnotationStorage(),
        widget=MultiSelectionWidget(
            label=_('E-mail Attachments'),
            description=_('Please select the attachments to be sent with email.'),
            format='checkbox'),
        vocabulary='attachments',
        enforceVocabulary=True)))
            description=_(
                u'help_recipient_override_text',
                default=u"""
                    A TALES expression that will be evaluated to override any value
                    otherwise entered for the confirmation recipient e-mail address. You are strongly
                    cautioned against using unvalidated data from the request for this purpose.
                    Leave empty if unneeded. Your expression should evaluate as a string.
                    PLEASE NOTE: errors in the evaluation of this expression will cause
                    an error on form display.
                """,
            ),
            size=70,
        ),
    ),
))
confirmedFormMailerAdapterSchema = formMailerAdapterSchema.copy(
) + confirmedSchema


@implementer(IConfirmedFormMailerAdapter)
class ConfirmedFormMailerAdapter(FormMailerAdapter):
    schema = confirmedFormMailerAdapterSchema
    security = ClassSecurityInfo()

    security.declareProtected(permissions.View, 'post_validate')

    def post_validate(self, REQUEST=None, errors=None):
        # Perform a check after validation.  We do not want to make
        # plain_mail and html_mail required, but we do need at least
        # one of them filled.
        if (not REQUEST.form.get('plain_mail').strip()
                and not REQUEST.form.get('html_mail').strip()):
from Products.Archetypes import atapi
from Products.ATContentTypes.content import schemata

from Products.PloneFormGen.content.formMailerAdapter import FormMailerAdapter
from Products.PloneFormGen.content.formMailerAdapter import formMailerAdapterSchema
from Products.PloneFormGen import dollarReplace

# -*- Message Factory Imported Here -*-
from redomino.tokenrole.utils import make_uuid
from redomino.tokenrole.interfaces import ITokenInfoSchema

from redomino.tokenroleform import tokenroleformMessageFactory as _
from redomino.tokenroleform.interfaces import ITokenRoleMailerAdapter
from redomino.tokenroleform.config import PROJECTNAME

TokenRoleMailerAdapterSchema = formMailerAdapterSchema.copy() + atapi.Schema((

    # -*- Your Archetypes field definitions here ... -*-

    atapi.ReferenceField(
        'private_doc',
        storage=atapi.AnnotationStorage(),
        widget=ReferenceBrowserWidget(
            label=_(u"Private doc"),
            description=_(u"Choose the private item you are going to share"),
            startup_directory_method='startupDirectoryMethod',
        ),
        required=True,
        relationship='tokenrolemaileradapter_private_doc',
        allowed_types=(), # specify portal type names here ('Example Type',)
        multiValued=False,