def changePreferences(self, sn, givenname, organisation, tel, postaladdress, attending, role='Attendee',REQUEST=None): """ change preferences for an attendee""" if not sn: return self.AttendeeChangePreferences(setFormError(REQUEST, 'sn', 'Please enter your surname!')) if not givenname: return self.AttendeeChangePreferences(setFormError(REQUEST, 'givenname', 'Please enter your givenname!')) #if not mail: # return self.AttendeeChangePreferences(setFormError(REQUEST, 'mail', 'Please enter your email address!')) #if mail and not isEmailValid(mail): # return self.AttendeeChangePreferences(setFormError(REQUEST, 'mail', 'Your email address is invalid!')) try: do = self.superValues('Default Attendee Properties')[0] self._properties = do.propertyMap() except: self._properties = () self.title = givenname + ' ' + sn self.sn = sn self.givenname = givenname self.organisation = organisation #self.mail = mail self.tel = tel self.postaladdress = postaladdress if attending!=self.attending: self.subscription=DateTime() self.attending = attending self.role = role self._p_changed = 1 self.manage_editProperties(REQUEST) # Update properties if REQUEST is not None: return MessageDialog(title = 'Changed', message = "Your preferences have been changed", action = 'index_html',)
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')
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', )
def manage_addAttendeeAction(self, sn, givenname, organisation, mail, tel, postaladdress, attending, passwd, role, ldap_id, REQUEST=None): "Create an attendee, by calling the constructor" id = self.parseEmail(mail) passwd = genRandomId() if self.checkID(id): return self.authenticatedsignup(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, '', role, 1, 1, ldap_id, REQUEST) if REQUEST is not None: return REQUEST.RESPONSE.redirect('registration')
def manage_addMeeting(self, id, title, event_type, location, txtlocation, description, startdate, enddate, organiser, organiser_email, max_attendees, agenda_url='',minutes_url='', allow_registrations=0, allow_anonymous=0, status='', REQUEST=None): """Add a new Meeting object""" if DateTime(str(startdate)) > DateTime(str(enddate)): return self.manage_addMeetingForm(setFormError(REQUEST, 'invalid_date', 'End date is earlier than start date')) ob=Meeting() ob.id=id ob.title = title ob.event_type = event_type ob.location = location if location: ob.txtlocation = '' else: ob.txtlocation=txtlocation ob.description = description ob.startdate = startdate ob.enddate = enddate ob.agenda_url = agenda_url ob.minutes_url = minutes_url ob.organiser = organiser ob.organiser_email = organiser_email ob.max_attendees = max_attendees if allow_registrations: ob.allow_registrations = 1 else: ob.allow_registrations = 0 ob.allow_anonymous = allow_anonymous ob.status = status ob.generation = 0 self._setObject(id, ob) ob=self._getOb(id) dtmlfile = open(join(package_home(globals()), 'www', 'MeetingIndex.dtml')) content = dtmlfile.read() dtmlfile.close() ob.manage_addDTMLMethod('index_html', title='Default View', file=content) # dtmlfile = open(join(package_home(globals()), 'www','chooseBar.dtml')) # content = dtmlfile.read() # dtmlfile.close() # ob.manage_addDTMLMethod('choose_bar', title='', file=content) dtmlfile = open(join(package_home(globals()), 'www', 'AttendeesList.dtml')) content = dtmlfile.read() dtmlfile.close() ob.manage_addDTMLMethod('list_of_attendees', title='Example of attendee list', file=content) if MBinstalled: mailhost = MessageBoard.getMailHostList(self) ob.manage_addProduct['MessageBoard'].manage_addMessageBoard(id='MaillingList', \ title='Mailing list', description='Note: Everything that was emailed to all attendees is automatically posted here also', mailhost=mailhost[0]) if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1)