def send_email(self, userid):
     """ Send email to nominated address """
     registry = getUtility(IRegistry)
     mail_settings = registry.forInterface(IMailSchema, prefix='plone')
     mTo = self.getSurveyNotificationEmail()
     mFrom = mail_settings.email_from_address
     mSubj = translate(_(
         '[${survey_title}] New survey submitted',
         mapping={'survey_title': self.Title()}),
         context=self.REQUEST)
     message = []
     message.append(translate(_(
         'Survey ${survey_title}',
         mapping={'survey_title': self.Title()}),
         context=self.REQUEST))
     message.append(translate(_(
         'has been completed by user: ${userid}',
         mapping={'userid': userid}),
         context=self.REQUEST))
     message.append(self.absolute_url() +
                    '/@@Products.PloneSurvey.survey_view_results')
     mMsg = '\n\n'.join(message)
     try:
         self.MailHost.send(mMsg.encode('utf-8'), mTo, mFrom, mSubj)
     except ConflictError:
         raise
     except:
         # XXX too many things can go wrong
         pass
 def send_email(self, userid):
     """ Send email to nominated address """
     properties = self.portal_properties.site_properties
     mTo = self.getSurveyNotificationEmail()
     mFrom = properties.email_from_address
     mSubj = translate(_('[${survey_title}] New survey submitted',
                         mapping={'survey_title': self.Title()}),
                       context=self.REQUEST)
     message = []
     message.append(
         translate(_('Survey ${survey_title}',
                     mapping={'survey_title': self.Title()}),
                   context=self.REQUEST))
     message.append(
         translate(_('has been completed by user: ${userid}',
                     mapping={'userid': userid}),
                   context=self.REQUEST))
     message.append(self.absolute_url() +
                    '/@@Products.PloneSurvey.survey_view_results')
     mMsg = '\n\n'.join(message)
     try:
         self.MailHost.send(mMsg.encode('utf-8'), mTo, mFrom, mSubj)
     except ConflictError:
         raise
     except:
         # XXX too many things can go wrong
         pass
 def _get_yes_no_default(self):
     foo = (_(u'Yes'), _(u'No'))
     translation_service = getToolByName(self,'translation_service')
     return (translation_service.utranslate(domain='plonesurvey',
                                          msgid=u'Yes',
                                          context=self),
             translation_service.utranslate(domain='plonesurvey',
                                          msgid=u'No',
                                          context=self),
             )
 def _get_yes_no_default(self):
     foo = (_(u'Yes'), _(u'No'))
     translation_service = getToolByName(self, 'translation_service')
     return (
         translation_service.utranslate(domain='plonesurvey',
                                        msgid=u'Yes',
                                        context=self),
         translation_service.utranslate(domain='plonesurvey',
                                        msgid=u'No',
                                        context=self),
     )
 def _get_commentLabel_default(self):
     foo = _(u'commentLabelDefault', default=u"Comment - mandatory if \"no\"")
     translation_service = getToolByName(self,'translation_service')
     return translation_service.utranslate(domain='plonesurvey',
                                           msgid=u'commentLabelDefault',
                                           default=u'Comment - mandatory if "no"',
                                           context=self)
 def _get_emailInvite_default(self):
     foo = _('emailInviteDefault', default=DEFAULT_SURVEY_INVITE)
     translation_service = getToolByName(self, 'translation_service')
     return translation_service.utranslate(domain='plonesurvey',
                                           msgid='emailInviteDefault',
                                           default=DEFAULT_SURVEY_INVITE,
                                           context=self)
 def _get_emailInvite_default(self):
     foo = _('emailInviteDefault', default=DEFAULT_SURVEY_INVITE)
     translation_service = getToolByName(self,'translation_service')
     return translation_service.utranslate(domain='plonesurvey',
                                           msgid='emailInviteDefault',
                                           default=DEFAULT_SURVEY_INVITE,
                                           context=self)
 def _get_commentLabel_default(self):
     foo = _(u'commentLabelDefault',
             default=u"Comment - mandatory if \"no\"")
     translation_service = getToolByName(self, 'translation_service')
     return translation_service.utranslate(
         domain='plonesurvey',
         msgid=u'commentLabelDefault',
         default=u'Comment - mandatory if "no"',
         context=self)
 def pre_validate(self, REQUEST, errors):
     """ checks captcha """
     product_installed = self.portal_quickinstaller.isProductInstalled('quintagroup.plonecaptchas')
     if not product_installed and not self.collective_recaptcha_enabled() and REQUEST.get('showCaptcha', 0):
         if int(REQUEST.get('showCaptcha')):
             errors['showCaptcha'] = _('showCaptcha',
                 default='Product quintagroup.plonecaptchas not installed. '
                         'If you prefer to use the product collective.recaptcha instead of quintagroup.plonecaptchas '
                         'then verifies that recaptcha private and public keys are configured. '
                         'Go to path/to/site/@@recaptcha-settings to configure.')
Beispiel #10
0
    def __call__(self):
        self.message = ""
        source = self.request.form.get("frm_csv", None)

        if not source:
            self.message = _("No source file given")
            return self.index()

        oExcel = excel()
        oExcel.delimiter = ","
        result = [x for x in reader(source, dialect=oExcel)]

        for x in result:
            fullname = x[0]
            email = x[1]
            self.context.addAuthenticatedRespondent(email, fullname=fullname)

        self.message = _("Done importing respondents")

        return self.index()
    def __call__(self):
        self.message = ""
        source = self.request.form.get('frm_csv', None)

        if not source:
            self.message = _("No source file given")
            return self.index()

        oExcel = excel()
        oExcel.delimiter = ','
        result = [x for x in reader(source, dialect=oExcel)]

        for x in result:
            if len(x) != 2:
                continue
            fullname = x[0]
            email = x[1]
            self.context.addAuthenticatedRespondent(email, fullname=fullname)

        self.message = _("Done importing respondents")

        return self.index()
Beispiel #12
0
 def pre_validate(self, REQUEST, errors):
     """ checks captcha """
     product_installed = self.portal_quickinstaller.isProductInstalled(
         'quintagroup.plonecaptchas')
     if not product_installed and not self.collective_recaptcha_enabled(
     ) and REQUEST.get('showCaptcha', 0):
         if int(REQUEST.get('showCaptcha')):
             errors['showCaptcha'] = _(
                 'showCaptcha',
                 default='Product quintagroup.plonecaptchas not installed. '
                 'If you prefer to use the product collective.recaptcha instead of quintagroup.plonecaptchas '
                 'then verifies that recaptcha private and public keys are configured. '
                 'Go to path/to/site/@@recaptcha-settings to configure.')
Beispiel #13
0
 def send_email(self, userid):
     """ Send email to nominated address """
     properties = self.portal_properties.site_properties
     mTo = self.getSurveyNotificationEmail()
     mFrom = properties.email_from_address
     mSubj = translate(
         _("[${survey_title}] New survey submitted", mapping={"survey_title": self.Title()}), context=self.REQUEST
     )
     message = []
     message.append(
         translate(_("Survey ${survey_title}", mapping={"survey_title": self.Title()}), context=self.REQUEST)
     )
     message.append(
         translate(_("has been completed by user: ${userid}", mapping={"userid": userid}), context=self.REQUEST)
     )
     message.append(self.absolute_url() + "/@@Products.PloneSurvey.survey_view_results")
     mMsg = "\n\n".join(message)
     try:
         self.MailHost.send(mMsg.encode("utf-8"), mTo, mFrom, mSubj)
     except ConflictError:
         raise
     except:
         # XXX too many things can go wrong
         pass
from Products.validation import validation
from zope.i18nmessageid import MessageFactory

from Products.PloneSurvey import PloneSurveyMessageFactory as _

SKINS_DIR = 'skins'

GLOBALS = globals()

DEFAULT_SURVEY_INVITE = u'''
<p>Dear **Name**,</p>
<p>Please complete the **Survey**</p>
<p>Thank you</p>'''

SURVEY_STATUS = DisplayList((
    ('open', _(u'label_survey_open', default=u'Open')),
    ('closed', _(u'label_survey_closed', default=u'Closed')),
    ))

NOTIFICATION_METHOD = DisplayList((
    ('', _(u'label_no_emails', default=u'No emails')),
    ('each_submission', _(u'label_all_emails', default=u'Email on each submission')),
    ))

TEXT_INPUT_TYPE = DisplayList((
    ('text', _(u'label_text_field', default=u'Text Field')),
    ('area', _(u'label_text_area', default=u'Text Area')),
    ))

SELECT_INPUT_TYPE = DisplayList((
    ('radio', _(u'label_radio_buttons', default=u'Radio Buttons')),
from Products.PloneSurvey.config import LIKERT_OPTIONS

SurveySchema = ATContentTypeSchema.copy() + ConstrainTypesMixinSchema + Schema((

    TextField(
        'body',
        searchable=1,
        required=0,
        schemata="Introduction",
        default_content_type='text/html',
        default_output_type='text/html',
        allowable_content_types=('text/plain',
                                 'text/structured',
                                 'text/html', ),
        widget=RichWidget(
            label=_('label_introduction',
                    default=u"Introduction"),
            description=_(
                'help_introduction',
                default=u"Enter an introduction for the survey."),
            rows=5,
        ),
    ),

    TextField(
        'thankYouMessage',
        required=0,
        searchable=0,
        default_method="translateThankYouMessage",
        widget=TextAreaWidget(
            label=_("label_thank",
                    default="'Thank you' message text"),
Beispiel #16
0
from Products.Archetypes.utils import IntDisplayList
from Products.validation import validation

from Products.PloneSurvey import PloneSurveyMessageFactory as _

SKINS_DIR = 'skins'

GLOBALS = globals()

DEFAULT_SURVEY_INVITE = u'''
<p>Dear **Name**,</p>
<p>Please complete the **Survey**</p>
<p>Thank you</p>'''

NOTIFICATION_METHOD = DisplayList((
    ('', _(u'label_no_emails', default=u'No emails')),
    ('each_submission',
     _(u'label_all_emails', default=u'Email on each submission')),
))

TEXT_INPUT_TYPE = DisplayList((
    ('text', _(u'label_text_field', default=u'Text Field')),
    ('area', _(u'label_text_area', default=u'Text Area')),
))

SELECT_INPUT_TYPE = DisplayList((
    ('radio', _(u'label_radio_buttons', default=u'Radio Buttons')),
    ('selectionBox', _(u'label_selection_box', default=u'Selection Box')),
    ('multipleSelect',
     _(u'label_multiple_selection_box', default=u'Multiple Selection Box')),
    ('checkbox', _(u'label_check_boxes', default=u'Check Boxes')),
Beispiel #17
0
SurveySchema = ATContentTypeSchema.copy(
) + ConstrainTypesMixinSchema + Schema((
    TextField(
        'body',
        searchable=1,
        required=0,
        schemata="Introduction",
        default_content_type='text/html',
        default_output_type='text/html',
        allowable_content_types=(
            'text/plain',
            'text/structured',
            'text/html',
        ),
        widget=RichWidget(
            label=_('label_introduction', default=u"Introduction"),
            description=_('help_introduction',
                          default=u"Enter an introduction for the survey."),
            rows=5,
        ),
    ),
    TextField(
        'thankYouMessage',
        required=0,
        searchable=0,
        default_method="translateThankYouMessage",
        widget=TextAreaWidget(
            label=_("label_thank", default="'Thank you' message text"),
            description=_(
                'help_thankyou',
                default=u"This is the message that will be displayed to "
Beispiel #18
0
 def _get_emailInvite_default(self):
     foo = _("emailInviteDefault", default=DEFAULT_SURVEY_INVITE)
     translation_service = getToolByName(self, "translation_service")
     return translation_service.utranslate(
         domain="plonesurvey", msgid="emailInviteDefault", default=DEFAULT_SURVEY_INVITE, context=self
     )