Exemplo n.º 1
0
    def manage_addAnonAttendeeAction(self, sn, givenname, organisation, mail,
            tel, postaladdress, attending, REQUEST=None):
        "Create an attendee, by calling the constructor"
        if not sn:
            return self.signup(setFormError(REQUEST, 'sn', 'Please enter your surname!'))
        if not givenname:
            return self.signup(setFormError(REQUEST, 'givenname', 'Please enter your givenname!'))
        if not mail:
            return self.signup(setFormError(REQUEST, 'mail', 'Please enter your email address!'))
        if mail and not isEmailValid(mail):
            return self.signup(setFormError(REQUEST, 'mail', 'Your email address is invalid!'))

        mail = str(mail)
        pat = re.compile(r'([a-zA-Z][\w-]*@[\w-]+(?:\.[\w-]+)*)')
        if pat.search(mail) is None:
            return MessageDialog(
                title = 'Bad email address',
                message = "Your registration couldn't succeed due to invalid email address",
                action = 'signup',
                )
        id = self.parseEmail(mail)
        passwd = genRandomId()

        if self.checkID(id):
           return self.signup(setFormError(REQUEST, 'mail', 'This email account was already used to make a reservation!'))

        self.manage_addProduct['ManagedMeetings'].manage_addAttendee(
                id , sn, givenname, organisation, mail,
                tel, postaladdress, attending, passwd, '', 'Attendee', 0, 1, '', REQUEST)

        if REQUEST is not None:
            return REQUEST.RESPONSE.redirect('registration')
Exemplo n.º 2
0
    def send_email(self, subject, comments='', email='', notify=0, date='', attached=[], REQUEST=None,RESPONSE=None):
        """ Sends an email """

        if not subject:
            return self.SendEmail_form(setFormError(REQUEST, 'subject', 'Please enter a subject!'))
        if not comments:
            return self.SendEmail_form(setFormError(REQUEST, 'comments', 'Empty email is not allowed!'))
        if not email:
            return self.SendEmail_form(setFormError(REQUEST, 'email', 'Please enter your email address!'))
        if email and not isEmailValid(email):
            return self.SendEmail_form(setFormError(REQUEST, 'email', 'Your email address is invalid!'))

        userid = REQUEST.AUTHENTICATED_USER.getUserName()

        if MBinstalled and REQUEST.has_key('saveMessage'):
            self.saveIntoMaillingList(subject, comments, userid, email, notify, date)

        reciplist = []
        for t in self.objectValues('Meeting Attendee'):
            if t.mail != '':
                reciplist.append('<' + t.mail + '>')
        recipients = string.join(reciplist,',\n  ') #Unused

        sendermail = 'MeetingManager@' + REQUEST['SERVER_NAME']
        if hasattr(self, 'organiser_email'):
            if getattr(self, 'organiser_email') != '':
                organiser_email = self.organiser_email
        fromaddr = userid + ' <' + email + '>'

        self._send_email(comments, subject, attached, fromaddr, reciplist, sendermail)

        if REQUEST.has_key('destinationURL'):
            return RESPONSE.redirect(REQUEST['destinationURL'])

        if REQUEST is not None:
            return MessageDialog(
                title = 'Mailed',
                message = "The mail %s has been sent!" % self.id,
                action = './manage_main',
                )