示例#1
0
 def notify(self,registrant,params):
     if params.has_key("conf"):
         GenericMailer.sendAndLog(self.apply(registrant,params),
                                  params["conf"],
                                  log.ModuleNames.REGISTRATION)
     else:
         GenericMailer.send(self.apply(registrant,params))
示例#2
0
    def askForExcuse(self, eventManager, toIdList):
        data = self.prepareAskForExcuse(eventManager,toIdList)
        if data is None :
            return False

        GenericMailer.sendAndLog(GenericNotification(data),self._conference,"participants",eventManager)
        return True
示例#3
0
    def setStatusDeclined(self, responsibleUser=None, sendMail=True):
        if self._status != "pending" :
            return False
        self._status = "declined"
        
        logData = self.getParticipantData()
        logData["subject"] = _("%s : status set to DECLINED")%self.getWholeName()
        self.getConference().getLogHandler().logAction(logData,"participants",responsibleUser)

        if sendMail:
            data = {}
            data["fromAddr"] = info.HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()
            confTitle = self._participation.getConference().getTitle()
            data["subject"] = _("Your application for attendance in %s declined")%confTitle
            toList = []
            toList.append(self._email)
            title = ""
            if self._title == "" or self._title is None :
                title = self._firstName
            else:
                title = self._title        
            data["toList"] = toList
            data["body"] = _("""
            Dear %s %s,
            
            your request to attend the %s has been declined by the event manager.
            
            Your Indico
            """)%(title, self._familyName, confTitle)
                        
            GenericMailer.sendAndLog(GenericNotification(data),self.getConference(),"participants",responsibleUser)
        
        return True
示例#4
0
 def notify(self,registrant,params):
     if params.has_key("conf"):
         GenericMailer.sendAndLog(self.apply(registrant,params),
                                  params["conf"],
                                  'Registration')
     else:
         GenericMailer.send(self.apply(registrant,params))
示例#5
0
    def askForExcuse(self, eventManager, toIdList):
        data = self.prepareAskForExcuse(eventManager, toIdList)
        if data is None:
            return False

        GenericMailer.sendAndLog(GenericNotification(data), self._conference,
                                 "participants", eventManager)
        return True
示例#6
0
    def askForExcuse(self, eventManager, toIdList):
        data = self.prepareAskForExcuse(eventManager, toIdList)
        if data is None:
            return False

        GenericMailer.sendAndLog(GenericNotification(data), self._conference,
                                 log.ModuleNames.PARTICIPANTS)
        return True
示例#7
0
    def askForExcuse(self, eventManager, toIdList):
        data = self.prepareAskForExcuse(eventManager, toIdList)
        if data is None :
            return False

        GenericMailer.sendAndLog(GenericNotification(data), self._conference,
                                 log.ModuleNames.PARTICIPANTS)
        return True
示例#8
0
 def notifyAll(self,params):
     subj=params.get("subject","")
     b=params.get("body","")
     fa=params.get("from","")
     tl=params.get("to",[])
     cc = params.get("cc",[])
     notification =  Notification(subject=subj,body=b,fromAddr=fa,toList=tl,ccList=cc)
     if params.has_key("conf"):
         GenericMailer.sendAndLog(notification, params["conf"])
     else:
         GenericMailer.send(notification)
示例#9
0
 def notifyAll(self,params):
     subj=params.get("subject","")
     b=params.get("body","")
     fa=params.get("from","")
     tl=params.get("to",[])
     cc = params.get("cc",[])
     notification =  Notification(subject=subj,body=b,fromAddr=fa,toList=tl,ccList=cc)
     if params.has_key("conf"):
         GenericMailer.sendAndLog(notification, params["conf"],
                                  log.ModuleNames.REGISTRATION)
     else:
         GenericMailer.send(notification)
示例#10
0
    def addParticipant(self, participant, eventManager=None):
        # check if it's worth to add the participant
        if participant.getConference().getId() != self._conference.getId():
            return False
        self.removePendingParticipant(participant)
        if not participant.setId(self._newParticipantId()):
            return False
        if self.alreadyParticipating(participant) != 0:
            return False
        self._participantList["%d" % self._lastParticipantId()] = participant

        # remove him from the "pending" list
        if participant in self._pendingParticipantList.values():
            for k in self._pendingParticipantList.keys():
                if self._pendingParticipantList[k] == participant:
                    del self._pendingParticipantList[k]
                    break

        logData = participant.getParticipantData()
        logData["subject"] = _(
            "New participant added : %s") % participant.getWholeName()
        self._conference.getLogHandler().logAction(
            logData, log.ModuleNames.PARTICIPANTS)

        participant.setStatusAdded()

        # check if an e-mail should be sent...
        if self._addedInfo:
            # to notify the user of his/her addition
            if eventManager is None:
                return False
            data = self.prepareAddedInfo(participant, eventManager)
            GenericMailer.sendAndLog(GenericNotification(data),
                                     self._conference,
                                     log.ModuleNames.PARTICIPANTS)

        avatar = participant.getAvatar()

        if avatar is None:
            # or to encourage him/her to register at Indico
            #self.sendEncouragementToCreateAccount(participant)
            pass
        else:
            # OK, if we have an avatar, let's keep things consistent
            avatar.linkTo(self._conference, "participant")

        self.notifyModification()
        return True
示例#11
0
    def addParticipant(self, participant, eventManager = None):
        # check if it's worth to add the participant
        if participant.getConference().getId() != self._conference.getId() :
            return False
        self.removePendingParticipant(participant)
        if not participant.setId(self._newParticipantId()):
            return False
        if self.alreadyParticipating(participant) != 0 :
            return False
        self._participantList["%d"%self._lastParticipantId()] = participant

        # remove him from the "pending" list
        if participant in self._pendingParticipantList.values() :
            for k in self._pendingParticipantList.keys() :
                if self._pendingParticipantList[k] == participant :
                    del self._pendingParticipantList[k]
                    break

        logData = participant.getParticipantData()
        logData["subject"] = _("New participant added : %s")%participant.getWholeName()
        self._conference.getLogHandler().logAction(logData,
                                                   log.ModuleNames.PARTICIPANTS)

        participant.setStatusAdded()

        # check if an e-mail should be sent...
        if self._addedInfo :
            # to notify the user of his/her addition
            if eventManager is None :
                return False
            data = self.prepareAddedInfo(participant, eventManager)
            GenericMailer.sendAndLog(GenericNotification(data),
                                     self._conference,
                                     log.ModuleNames.PARTICIPANTS)

        avatar = participant.getAvatar()

        if avatar is None :
            # or to encourage him/her to register at Indico
            #self.sendEncouragementToCreateAccount(participant)
            pass
        else:
            # OK, if we have an avatar, let's keep things consistent
            avatar.linkTo(self._conference,"participant")

        self.notifyModification()
        return True
示例#12
0
    def addParticipant(self, participant, eventManager = None):
        # check if it's worth to add the participant
        if participant.getConference().getId() != self._conference.getId() :
            return False
        self.removePendingParticipant(participant)
        if not participant.setId(self._newParticipantId()):
            return False
        if self.alreadyParticipating(participant) != 0 :
            return False
        self._participantList["%d"%self._lastParticipantId()] = participant

        # remove him from the "pending" list
        if participant in self._pendingParticipantList.values() :
            for k in self._pendingParticipantList.keys() :
                if self._pendingParticipantList[k] == participant :
                    del self._pendingParticipantList[k]
                    break

        self.getConference().log(EventLogRealm.management, EventLogKind.positive, u'Participants',
                                 u'Participant added: {}'.format(to_unicode(participant.getName())),
                                 session.user, data=participant.getParticipantData())
        participant.setStatusAdded()

        # check if an e-mail should be sent...
        if self._addedInfo :
            # to notify the user of his/her addition
            if eventManager is None :
                return False
            data = self.prepareAddedInfo(participant, eventManager)
            GenericMailer.sendAndLog(GenericNotification(data),
                                     self._conference,
                                     'Participants')

        avatar = participant.getAvatar()

        if avatar is None :
            # or to encourage him/her to register at Indico
            #self.sendEncouragementToCreateAccount(participant)
            pass
        else:
            # OK, if we have an avatar, let's keep things consistent
            avatar.linkTo(self._conference,"participant")

        self.notifyModification()
        return True
示例#13
0
    def sendSpecialEmail(self, participantsIdList, eventManager, data):
        if participantsIdList is None :
            return False
        if eventManager is None :
            return False
        if len(participantsIdList) == 0:
            return True
        if data.get("subject",None) is None :
            return False
        if data.get("body",None) is None :
            return False
        data["fromAddr"] = eventManager.getEmail()

        toList = []
        for id in participantsIdList :
            participant = self._participantList.get(id,None)
            if Participant is not None :
                toList.append(p.getEmail())
        data["toList"] = toList
        GenericMailer.sendAndLog(GenericNotification(data),self._conference,"participants",eventManager)
        return True
示例#14
0
    def setStatusDeclined(self, responsibleUser=None, sendMail=True):
        if self._status != "pending":
            return False
        self._status = "declined"

        logData = self.getParticipantData()
        logData["subject"] = _(
            "%s : status set to DECLINED") % self.getWholeName()
        self.getConference().getLogHandler().logAction(logData, "participants",
                                                       responsibleUser)

        if sendMail:
            data = {}
            data["fromAddr"] = info.HelperMaKaCInfo.getMaKaCInfoInstance(
            ).getSupportEmail()
            confTitle = self._participation.getConference().getTitle()
            data["subject"] = _(
                "Your application for attendance in %s declined") % confTitle
            toList = []
            toList.append(self._email)
            title = ""
            if self._title == "" or self._title is None:
                title = self._firstName
            else:
                title = self._title
            data["toList"] = toList
            data["body"] = _("""
            Dear %s %s,
            
            your request to attend the %s has been declined by the event manager.
            
            Your Indico
            """) % (title, self._familyName, confTitle)

            GenericMailer.sendAndLog(GenericNotification(data),
                                     self.getConference(), "participants",
                                     responsibleUser)

        return True
示例#15
0
    def sendEncouragementToCreateAccount(self, participant):
        if participant is None:
            return False
        if participant.getEmail() is None or participant.getEmail() == "":
            return None
        data = {}
        title = participant.getTitle()
        if title is None or title == "":
            title = participant.getFirstName()

        createURL = urlHandlers.UHUserCreation.getURL()
        data["fromAddr"] = info.HelperMaKaCInfo.getMaKaCInfoInstance(
        ).getSupportEmail()
        toList = []
        toList.append(participant.getEmail())
        data["toList"] = toList
        data["subject"] = _("Invitation to create an Indico account")
        data["body"] = _("""
        Dear %s %s,
        
        You have been added as a participant to '%s' and you have started to use 
        the Indico system. Most probably you are going to use it in the future, 
        participating in other events supported by Indico. 
        Therefore we strongly recommend that you create your personal Indico Account - 
        storing your personal data it will make your work with Indico easier and 
        allow you access more sophisticated features of the system.
        
        To proceed in creating your Indico Account simply click on the following
        link : %s
        Please use this email address when creating your account: %s

        Your Indico
        """)%(participant.getFirstName(), participant.getFamilyName(), \
        self._conference.getTitle(), \
        createURL, participant.getEmail())

        GenericMailer.sendAndLog(GenericNotification(data), self._conference,
                                 "participants")
        return True
示例#16
0
    def sendSpecialEmail(self, participantsIdList, eventManager, data):
        if participantsIdList is None:
            return False
        if eventManager is None:
            return False
        if len(participantsIdList) == 0:
            return True
        if data.get("subject", None) is None:
            return False
        if data.get("body", None) is None:
            return False
        data["fromAddr"] = eventManager.getEmail()

        toList = []
        for userId in participantsIdList:
            participant = self._participantList.get(userId, None)
            if participant is not None:
                toList.append(participant.getEmail())
        data["toList"] = toList
        GenericMailer.sendAndLog(GenericNotification(data), self._conference,
                                 log.ModuleNames.PARTICIPANTS)
        return True
示例#17
0
    def sendEncouragementToCreateAccount(self, participant):
        if participant is None :
            return False
        if participant.getEmail() is None or participant.getEmail() == "" :
            return None
        data = {}
        title = participant.getTitle()
        if title is None or title == "" :
            title = participant.getFirstName()

        createURL = urlHandlers.UHUserCreation.getURL()
        data["fromAddr"] = Config.getInstance().getNoReplyEmail()
        toList = []
        toList.append(participant.getEmail())
        data["toList"] = toList
        data["subject"] = _("Invitation to create an Indico account")
        data["body"] = _("""
        Dear %s %s,

        You have been added as a participant to '%s' and you have started to use
        the Indico system. Most probably you are going to use it in the future,
        participating in other events supported by Indico.
        Therefore we strongly recommend that you create your personal Indico Account -
        storing your personal data it will make your work with Indico easier and
        allow you access more sophisticated features of the system.

        To proceed in creating your Indico Account simply click on the following
        link : %s
        Please use this email address when creating your account: %s

        Your Indico
        """)%(participant.getFirstName(), participant.getFamilyName(), \
        self._conference.getTitle(), \
        createURL, participant.getEmail())

        GenericMailer.sendAndLog(GenericNotification(data),self._conference,"participants")
        return True
示例#18
0
 def notify(self, registrant, params):
     if params.has_key("conf"):
         GenericMailer.sendAndLog(self.apply(registrant, params),
                                  params["conf"], 'Registration')
     else:
         GenericMailer.send(self.apply(registrant, params))
示例#19
0
 def inviteParticipant(self, participant, eventManager):
     if participant.getConference().getId() != self._conference.getId():
         return False
     if not participant.setId(self._newParticipantId()):
         return False
     if eventManager is None:
         return False
     if self.alreadyParticipating(participant) != 0:
         return False
     self._participantList["%d" % self._lastParticipantId()] = participant
     logData = participant.getParticipantData()
     logData["subject"] = _(
         "New participant invited : %s") % participant.getWholeName()
     self._conference.getLogHandler().logAction(logData, "participants",
                                                eventManager)
     participant.setStatusInvited()
     data = {}
     title = ""
     firstName = ""
     familyName = ""
     eventURL = urlHandlers.UHConferenceDisplay.getURL(self._conference)
     actionURL = urlHandlers.UHConfParticipantsInvitation.getURL(
         self._conference)
     actionURL.addParam("participantId", "%d" % self._lastParticipantId())
     toList = []
     if participant.getAvatar() is not None:
         toList.append(participant.getAvatar().getEmail())
         data["toList"] = toList
         title = participant.getAvatar().getTitle()
         familyName = participant.getAvatar().getFamilyName()
         firstName = participant.getAvatar().getFirstName()
     else:
         toList.append(participant.getEmail())
         data["toList"] = toList
         title = participant.getTitle()
         familyName = participant.getFamilyName()
         firstName = participant.getFamilyName()
     locationName = locationAddress = ""
     if self._conference.getLocation() is not None:
         locationName = self._conference.getLocation().getName()
         locationAddress = self._conference.getLocation().getAddress()
     if data["toList"] is None or len(data["toList"]) == 0:
         return False
     if title is None or title == "":
         title = firstName
     data["fromAddr"] = eventManager.getEmail()
     data["subject"] = _("Invitation to %s") % self._conference.getTitle()
     data["body"] = _("""
     Dear %s %s,
     
     %s %s, event manager of '%s' would like to invite you to take part in this event, 
     which will take place on %s in %s, %s. Further information on this event are
     available at %s
     You are kindly requested to accept or decline your participation in this event by 
     clicking on the link below :
      %s
     
     Looking forward to meeting you at %s
     Your Indico
     on behalf of %s %s
     
     """)%(title, familyName, \
          eventManager.getFirstName(), eventManager.getFamilyName(), \
          self._conference.getTitle(), \
          self._conference.getAdjustedStartDate(), \
          locationName, locationAddress, \
          eventURL, actionURL, \
          self._conference.getTitle(), \
          eventManager.getFirstName(), eventManager.getFamilyName())
     GenericMailer.sendAndLog(GenericNotification(data), self._conference,
                              "participants")
     #if participant.getAvatar() is None :
     #    self.sendEncouragementToCreateAccount(participant)
     self.notifyModification()
     return True
示例#20
0
 def inviteParticipant(self, participant, eventManager):
     if participant.getConference().getId() != self._conference.getId() :
         return False
     if not participant.setId(self._newParticipantId()):
         return False
     if eventManager is None :
         return False
     if self.alreadyParticipating(participant) != 0 :
         return False
     self._participantList["%d"%self._lastParticipantId()] = participant
     logData = participant.getParticipantData()
     logData["subject"] = _("New participant invited : %s")%participant.getWholeName()
     self._conference.getLogHandler().logAction(logData,"participants",eventManager)
     participant.setStatusInvited()
     data = {}
     title = ""
     firstName = ""
     familyName = ""
     eventURL = urlHandlers.UHConferenceDisplay.getURL( self._conference )
     actionURL = urlHandlers.UHConfParticipantsInvitation.getURL( self._conference )
     actionURL.addParam("participantId","%d"%self._lastParticipantId())
     toList = []
     if participant.getAvatar() is not None :
         toList.append(participant.getAvatar().getEmail())
         data["toList"] = toList
         title = participant.getAvatar().getTitle()
         familyName = participant.getAvatar().getFamilyName()
         firstName = participant.getAvatar().getFirstName()
     else :
         toList.append(participant.getEmail())
         data["toList"] = toList
         title = participant.getTitle()
         familyName = participant.getFamilyName()
         firstName = participant.getFamilyName()
     locationName = locationAddress = ""
     if self._conference.getLocation() is not None :
         locationName = self._conference.getLocation().getName()
         locationAddress = self._conference.getLocation().getAddress()
     if data["toList"] is None or len(data["toList"]) == 0 :
         return False
     if title is None or title == "" :
         title = firstName
     data["fromAddr"] = eventManager.getEmail()
     data["subject"] = _("Invitation to %s")%self._conference.getTitle()
     data["body"] = _("""
     Dear %s %s,
     
     %s %s, event manager of '%s' would like to invite you to take part in this event, 
     which will take place on %s in %s, %s. Further information on this event are
     available at %s
     You are kindly requested to accept or decline your participation in this event by 
     clicking on the link below :
      %s
     
     Looking forward to meeting you at %s
     Your Indico
     on behalf of %s %s
     
     """)%(title, familyName, \
          eventManager.getFirstName(), eventManager.getFamilyName(), \
          self._conference.getTitle(), \
          self._conference.getAdjustedStartDate(), \
          locationName, locationAddress, \
          eventURL, actionURL, \
          self._conference.getTitle(), \
          eventManager.getFirstName(), eventManager.getFamilyName())
     GenericMailer.sendAndLog(GenericNotification(data),self._conference,"participants")
     #if participant.getAvatar() is None :
     #    self.sendEncouragementToCreateAccount(participant)
     self.notifyModification()
     return True