Ejemplo n.º 1
0
    def feedback(self):
        """ Feedback form
        """
        schema = createSchema("FeedbackSchema").bind(context=self.context, request=self.request, api=self.api)
        form = Form(schema, action=self.request.resource_url(self.context, "feedback"), buttons=(button_send,))
        self.api.register_form_resources(form)

        post = self.request.POST
        if self.request.method == "POST":
            controls = post.items()
            try:
                appstruct = form.validate(controls)
            except ValidationFailure, e:
                self.response["form"] = e.render()
                return self.response
            sender = appstruct["email"] and appstruct["email"] or "VoteIT <*****@*****.**>"
            recipients = ("*****@*****.**",)
            response = {
                "api": self.api,
                "meeting": self.api.meeting,
                "name": appstruct["name"],
                "email": appstruct["email"],
                "subject": appstruct["subject"],
                "message": appstruct["message"],
            }
            body_html = render("templates/email/feedback.pt", response, request=self.request)
            subject = "[%s] | %s" % (self.api.translate(_(u"VoteIT Feedback")), appstruct["subject"])
            msg = Message(subject=subject, sender=sender and sender or None, recipients=recipients, html=body_html)
            mailer = get_mailer(self.request)
            mailer.send(msg)
            self.api.flash_messages.add(_(u"Message sent to VoteIT"))
            url = self.request.resource_url(self.context)
            return HTTPFound(location=url)
Ejemplo n.º 2
0
def state_change_notification(meeting, event):
    """ Sends an email to [email protected] when a meeting changes state """

    request = get_current_request()
    url = resource_url(meeting, request)

    sender = "%s <%s>" % (meeting.get_field_value('meeting_mail_name'),
                          meeting.get_field_value('meeting_mail_address'))

    response = {
        'title': meeting.get_field_value('title'),
        'new_state': event.new_state.title().lower(),
        'old_state': event.old_state.title().lower(),
        'url': url,
    }
    body_html = render('views/templates/email/state_change_notification.pt',
                       response,
                       request=request)

    msg = Message(subject=_(u"VoteIT meeting state changed"),
                  sender=sender and sender or None,
                  recipients=("*****@*****.**", ),
                  html=body_html)

    mailer = get_mailer(request)
    mailer.send(msg)
Ejemplo n.º 3
0
    def feedback(self):
        """ Feedback form
        """
        schema = createSchema('FeedbackSchema').bind(context=self.context,
                                                     request=self.request,
                                                     api=self.api)
        form = Form(schema,
                    action=self.request.resource_url(self.context, 'feedback'),
                    buttons=(button_send, ))
        self.api.register_form_resources(form)

        post = self.request.POST
        if self.request.method == 'POST':
            controls = post.items()
            try:
                appstruct = form.validate(controls)
            except ValidationFailure, e:
                self.response['form'] = e.render()
                return self.response
            sender = appstruct['email'] and appstruct[
                'email'] or "VoteIT <*****@*****.**>"
            recipients = ("*****@*****.**", )
            response = {
                'api': self.api,
                'meeting': self.api.meeting,
                'name': appstruct['name'],
                'email': appstruct['email'],
                'subject': appstruct['subject'],
                'message': appstruct['message'],
            }
            body_html = render('templates/email/feedback.pt',
                               response,
                               request=self.request)
            subject = "[%s] | %s" % (self.api.translate(
                _(u"VoteIT Feedback")), appstruct['subject'])
            msg = Message(subject=subject,
                          sender=sender and sender or None,
                          recipients=recipients,
                          html=body_html)
            mailer = get_mailer(self.request)
            mailer.send(msg)
            self.api.flash_messages.add(_(u"Message sent to VoteIT"))
            url = self.request.resource_url(self.context)
            return HTTPFound(location=url)
Ejemplo n.º 4
0
def state_change_notification(meeting, event):
    """ Sends an email to [email protected] when a meeting changes state """
    
    request = get_current_request()
    url = resource_url(meeting, request)
    
    sender = "%s <%s>" % (meeting.get_field_value('meeting_mail_name'), meeting.get_field_value('meeting_mail_address'))
    
    response = {
                'title': meeting.get_field_value('title'),
                'new_state': event.new_state.title().lower(),
                'old_state': event.old_state.title().lower(),
                'url': url,
                }
    body_html = render('views/templates/email/state_change_notification.pt', response, request=request)

    msg = Message(subject=_(u"VoteIT meeting state changed"),
                  sender = sender and sender or None,
                  recipients=("*****@*****.**",),
                  html=body_html)

    mailer = get_mailer(request)
    mailer.send(msg)
Ejemplo n.º 5
0
import colander
from betahaus.pyracont.decorators import schema_factory
from voteit.core.schemas.contact import ContactSchema

from voteit.site import SiteMF as _


@schema_factory(
    'FeedbackSchema',
    title=_("Feedback"),
    description=
    _(u"Contact the VoteIT team with feedback. Please enter your email address if you want to be able to receive a reply!"
      ))
class FeedbackSchema(ContactSchema):
    """ Feedback contact form schema. Same as contact in voteit.core """
Ejemplo n.º 6
0
import colander
from betahaus.pyracont.decorators import schema_factory
from voteit.core.schemas.contact import ContactSchema

from voteit.site import SiteMF as _


@schema_factory('FeedbackSchema', title=_("Feedback"),
                description = _(u"Contact the VoteIT team with feedback. Please enter your email address if you want to be able to receive a reply!"))
class FeedbackSchema(ContactSchema):
    """ Feedback contact form schema. Same as contact in voteit.core """
Ejemplo n.º 7
0
from betahaus.viewcomponent import view_action

from voteit.site import SiteMF as _


@view_action('help_action', 'feedback', title=_(u"Feedback"))
def action_contact(context, request, va, **kw):
    """ Register buttons for help actions. Keep in mind that the name and the link must be the same.
    """
    api = kw['api']
    context = api.meeting and api.meeting or api.root
    return """<li><a href="%s">%s</a></li>""" % (
        request.resource_url(context, va.name),
        api.translate(va.title),
    )
Ejemplo n.º 8
0
from betahaus.viewcomponent import view_action

from voteit.site import SiteMF as _


@view_action('help_action', 'feedback', title = _(u"Feedback"))
def action_contact(context, request, va, **kw):
    """ Register buttons for help actions. Keep in mind that the name and the link must be the same.
    """
    api = kw['api']
    context = api.meeting and api.meeting or api.root
    return """<li><a href="%s">%s</a></li>""" % (request.resource_url(context, va.name),
                                                 api.translate(va.title),)