def __init__(self, user, judgement, contribution): GenericNotification.__init__(self) conference = contribution.event_new.as_legacy self.setFromAddr("Indico <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) self.setBCCList([judgement.getAuthor().getEmail()]) if isinstance(judgement, RefereeJudgement): typeR = "Referee" elif isinstance(judgement, EditorJudgement): typeR = "Layout Reviewer" elif isinstance(judgement, ReviewerJudgement): typeR = "Content Reviewer" self.setSubject(""""%s" has been put back into reviewing by the %s """ % (contribution.title.encode('utf-8'), typeR)) self.setBody("""Dear %s, Your paper entitled "%s" (id: %s) submitted for "%s" has been put back into reviewing by the assigned %s: %s Kind regards, Indico on behalf of "%s" """ % (user.full_name.encode('utf-8'), contribution.title.encode('utf-8'), str(contribution.friendly_id), conference.getTitle(), typeR, url_for('contributions.display_contribution', contribution, _external=True), conference.getTitle()))
def __init__(self, user, judgement, contribution): GenericNotification.__init__(self) conference = contribution.event_new.as_legacy self.setFromAddr("Indico <%s>"%Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) if isinstance(judgement, EditorJudgement): typeR = "Layout" elif isinstance(judgement, ReviewerJudgement): typeR = "Content" self.setSubject("""%s Assessment of the paper "%s" for "%s" """% (typeR, contribution.title, conference.getTitle())) self.setBody("""Dear %s, The assigned %s Reviewer, %s, has partially reviewed the paper entitled "%s" (id: %s) submitted for "%s". The assessment is as follows: %s. %s You may proceed to the Referee Area for this paper: %s Kind regards, Indico on behalf of "%s" """ % (user.user.full_name, typeR, judgement.getAuthor().getStraightFullName(), contribution.title, str(contribution.friendly_id),conference.getTitle(), judgement.getJudgement(), judgement.getCommentsVerbose(), url_for('event_mgmt.contributionReviewing-contributionReviewingJudgements', contribution, _external=True), conference.getTitle()))
def __init__(self, user, judgement, contribution): GenericNotification.__init__(self) conference = contribution.event_new.as_legacy self.setFromAddr("Indico <%s>"%Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) if isinstance(judgement, EditorJudgement): typeR = "Layout" elif isinstance(judgement, ReviewerJudgement): typeR = "Content" self.setSubject("""%s Assessment of the paper "%s" for "%s" """% (typeR, contribution.title.encode('utf-8'), conference.getTitle())) self.setBody("""Dear %s, The assigned %s Reviewer, %s, has partially reviewed the paper entitled "%s" (id: %s) submitted for "%s". The assessment is as follows: %s. %s You may proceed to the Referee Area for this paper: %s Kind regards, Indico on behalf of "%s" """ % (user.user.full_name.encode('utf-8'), typeR, judgement.getAuthor().getStraightFullName(), contribution.title.encode('utf-8'), str(contribution.friendly_id),conference.getTitle(), judgement.getJudgement(), judgement.getCommentsVerbose(), url_for('event_mgmt.contributionReviewing-contributionReviewingJudgements', contribution, _external=True), conference.getTitle()))
def __init__(self, psList): self._psList = psList self._participationsByConf = self._calculateParticipationsByConf() self._forceIndicoFromAddress = len(self._participationsByConf) > 1 data = {} data["subject"] = "[Indico] User account creation required" data["toList"] = [self._psList[0].getEmail()] GenericNotification.__init__(self, data)
def __init__(self, booking): GenericNotification.__init__(self) self._booking = booking self._bp = booking._bookingParams self._conference = booking.getConference() self._modifLink = str(booking.getModificationURL()) self.setFromAddr("Indico Mailer<%s>"%HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setContentType("text/html")
def sendAndLog(cls, notification, conference, module=None, user=None, skipQueue=False): from indico.modules.events.logs import EventLogRealm, EventLogKind if isinstance(notification, dict): # Wrap a raw dictionary in a notification class from MaKaC.webinterface.mail import GenericNotification notification = GenericNotification(notification) cls.send(notification, skipQueue=skipQueue) log_data = { u'content_type': to_unicode(notification.getContentType()), u'from': to_unicode(notification.getFromAddr()), u'to': map(to_unicode, notification.getToList()), u'cc': map(to_unicode, notification.getCCList()), u'bcc': map(to_unicode, notification.getBCCList()), u'subject': to_unicode(notification.getSubject()).strip(), u'body': to_unicode(notification.getBody()).strip() } summary = u'Sent email: {}'.format(log_data[u'subject']) conference.log(EventLogRealm.emails, EventLogKind.other, to_unicode(module or u'Unknown'), summary, user, type_=u'email', data=log_data)
def __init__(self, booking): GenericNotification.__init__(self) self._booking = booking self._bp = booking.getBookingParams() self._conference = booking.getConference() self._isLecture = self._conference.getType() == 'simple_event' self._modifLink = str(booking.getModificationURL()) self.setFromAddr("Indico Mailer<%s>"%Config.getInstance().getSupportEmail()) self.setContentType("text/html")
def __init__(self, user, judgement, contribution): GenericNotification.__init__(self) self.setFromAddr( "Indico Mailer<%s>" % HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) if isinstance(judgement, EditorJudgement): self.setSubject( """[Indico] The layout of your contribution "%s" (id: %s) has been reviewed""" % (contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, The layout of your contribution "%s" (id: %s) has been reviewed. The judgement was: %s The comments of the editor were: "%s" Thank you for using our system. """ % (contribution.getTitle(), str(contribution.getId()), judgement.getJudgement(), judgement.getComments())) elif isinstance(judgement, ReviewerJudgement): self.setSubject( """[Indico] The content of your contribution "%s" (id: %s) has been reviewed""" % (contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, The content of your contribution "%s" (id: %s) has been reviewed. The judgement was: %s The comments of the reviewer were: "%s" Thank you for using our system. """ % (contribution.getTitle(), str(contribution.getId()), judgement.getJudgement(), judgement.getComments())) elif isinstance(judgement, RefereeJudgement): self.setSubject( """[Indico] Your contribution "%s" (id: %s) has been completely reviewed by the referee""" % (contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, Your contribution "%s" (id: %s) has been completely reviewed by the assigned referee. The judgement was: %s The comments of the referee were: "%s" Thank you for using our system. """ % (contribution.getTitle(), str(contribution.getId()), judgement.getJudgement(), judgement.getComments()))
def __init__(self, booking): GenericNotification.__init__(self) self._booking = booking self._bp = booking._bookingParams self._conference = booking.getConference() self._modifLink = str(self._booking.getModificationURL()) self.setFromAddr("Indico Mailer <%s>"%Config.getInstance().getSupportEmail()) self.setToList(MailTools.getAdminEmailList()) self.setContentType("text/html")
def __init__(self, booking): GenericNotification.__init__(self) self._booking = booking self._bp = booking._bookingParams self._conference = booking.getConference() self._modifLink = str(booking.getModificationURL()) self.setFromAddr( "Indico Mailer<%s>" % HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setContentType("text/html")
def __init__(self, user, judgement, contribution): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer<%s>"%HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) if isinstance(judgement, EditorJudgement): self.setSubject("""[Indico] The layout of your contribution "%s" (id: %s) has been reviewed""" % (contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, The layout of your contribution "%s" (id: %s) has been reviewed. The judgement was: %s The comments of the editor were: "%s" Thank you for using our system. """ % ( contribution.getTitle(), str(contribution.getId()), judgement.getJudgement(), judgement.getComments()) ) elif isinstance(judgement, ReviewerJudgement): self.setSubject("""[Indico] The content of your contribution "%s" (id: %s) has been reviewed""" % (contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, The content of your contribution "%s" (id: %s) has been reviewed. The judgement was: %s The comments of the reviewer were: "%s" Thank you for using our system. """ % ( contribution.getTitle(), str(contribution.getId()), judgement.getJudgement(), judgement.getComments()) ) elif isinstance(judgement, RefereeJudgement): self.setSubject("""[Indico] Your contribution "%s" (id: %s) has been completely reviewed by the referee""" % (contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, Your contribution "%s" (id: %s) has been completely reviewed by the assigned referee. The judgement was: %s The comments of the referee were: "%s" Thank you for using our system. """ % ( contribution.getTitle(), str(contribution.getId()), judgement.getJudgement(), judgement.getComments()) )
def __init__(self, user, role, conference): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.getEmail()]) self.setSubject("""[Indico] You have been removed as %s of the conference "%s" (id: %s)""" % (role, conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Indico user, We are sorry to inform you that you have been removed as %s of the conference "%s" (id: %s). Thank you for using our system. """ % ( role, conference.getTitle(), str(conference.getId()) ))
def __init__(self, booking): GenericNotification.__init__(self) self._booking = booking self._bp = booking._bookingParams self._conference = booking.getConference() self._modifLink = str(self._booking.getModificationURL()) self.setFromAddr("Indico Mailer <%s>" % Config.getInstance().getSupportEmail()) self.setToList(MailTools.getAdminEmailList()) self.setContentType("text/html")
def __init__(self, user, role, contribution): conference = contribution.getConference() GenericNotification.__init__(self) self.setFromAddr("Indico Mailer<%s>"%HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject("""[Indico] You have been removed as %s of the contribution "%s" (id: %s) of the conference %s (id: %s)""" % (role, contribution.getTitle(), str(contribution.getId()), conference.getTitle(),str(conference.getId()))) self.setBody("""Dear Indico user, We are sorry to inform you that you have been removed as %s of the contribution "%s" (id: %s). Thank you for using our system. """ % ( role, contribution.getTitle(), str(contribution.getId()) ))
def sendAndLog(cls, notification, conference, module=None, user=None, skipQueue=False): if isinstance(notification, dict): # Wrap a raw dictionary in a notification class from MaKaC.webinterface.mail import GenericNotification notification = GenericNotification(notification) cls.send(notification, skipQueue=skipQueue) log_data = { u"content_type": to_unicode(notification.getContentType()), u"from": to_unicode(notification.getFromAddr()), u"to": map(to_unicode, notification.getToList()), u"cc": map(to_unicode, notification.getCCList()), u"bcc": map(to_unicode, notification.getBCCList()), u"subject": to_unicode(notification.getSubject()).strip(), u"body": to_unicode(notification.getBody()).strip(), } summary = u"Sent email: {}".format(log_data[u"subject"]) conference.log( EventLogRealm.emails, EventLogKind.other, to_unicode(module or u"Unknown"), summary, user, type_=u"email", data=log_data, )
def __init__(self, user, role, contribution): conference = contribution.getConference() GenericNotification.__init__(self) self.setFromAddr("Indico Mailer<%s>"%HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject("""[Indico] The author of the contribution %s (id: %s) of the conference %s has submitted his/her materials (id: %s)""" % (contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Indico user, The author of the contribution %s (id: %s) of the conference %s (id: %s) has marked his / her materials as submitted. You can now start the reviewing process as a %s. Thank you for using our system. """ % ( contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()), role))
def __init__(self, user, contribution): conference = contribution.getConference() GenericNotification.__init__(self) self.setFromAddr("Indico Mailer<%s>"%HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject("""[Indico] Warning: the author of the contribution %s (id: %s) of the conference %s (id: %s) has changed his/her materials """ % (contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Indico user, The author of the contribution %s (id: %s) of the conference %s (id: %s) has removed the 'submitted' mark from his / her materials. This means that he may have changed the content of the materials. Thus, you should wait until he has marked the materials again to start / continue the reviewing process. Thank you for using our system. """ % ( contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId())))
def __init__(self, user, role, contribution): GenericNotification.__init__(self) conference = contribution.event_new.as_legacy self.setFromAddr("Indico <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) self.setSubject("""You are no longer a %s of a paper for "%s" """ % (role, conference.getTitle())) self.setBody("""Dear %s, Please, be aware that you are no longer a %s of the paper entitled "%s" (id: %s) for the conference "%s": %s Kind regards, Indico on behalf of "%s" """ % ( user.full_name, role, contribution.title, str(contribution.friendly_id), conference.getTitle(), str(urlHandlers.UHConferenceDisplay.getURL(conference)), conference.getTitle()))
def __init__(self, user, role, conference): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.getEmail()]) self.setSubject("""You are no longer a %s of the conference "%s" """ % (role, conference.getTitle())) self.setBody("""Dear %s, Please, be aware that you are no longer a %s of the conference "%s": %s Kind regards, Indico on behalf of "%s" """% ( user.getStraightFullName(), role, conference.getTitle(), urlHandlers.UHConferenceDisplay.getURL(conference), conference.getTitle()))
def __init__(self, user, role, conference): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.getEmail()]) self.setSubject("""You have been chosen as a %s for the conference "%s" """ % (role, conference.getTitle())) self.setBody("""Dear %s, You have been chosen as a %s for the conference entitled "%s" in order to help with the paper reviewing process. Please find the Paper Reviewing utilities here: %s Kind regards, Indico on behalf of "%s" """ % ( user.getStraightFullName(), role, conference.getTitle(), urlHandlers.UHPaperReviewingDisplay.getURL(conference), conference.getTitle()))
def __init__(self, user, role, conference): GenericNotification.__init__(self) self.setFromAddr( "Indico Mailer<%s>" % HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject( """[Indico] You have been removed as %s of the conference "%s" (id: %s)""" % (role, conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Indico user, We are sorry to inform you that you have been removed as %s of the conference "%s" (id: %s). Thank you for using our system. """ % (role, conference.getTitle(), str(conference.getId())))
def _sendErrorEmail(self, e): ty, ex, tb = sys.exc_info() tracebackList = traceback.format_list(traceback.extract_tb(tb)) text = _(""" Offline website creation for the [event:%s] had caused an error while running the task. - Request from user: %s <%s> - Details of the exception: %s - Traceback: %s -- <Indico support> indico-project @ cern.ch """) % (self._conf.getId(), self._toUser.getFullName(), self._toUser.getEmail(), e, "\n".join(tracebackList)) maildata = { "fromAddr": Config.getInstance().getSupportEmail(), "toList": [Config.getInstance().getSupportEmail()], "subject": _("[Indico] Error in task: Offline website creation"), "body": text } GenericMailer.send(GenericNotification(maildata))
def __init__(self, user, role, conference): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.getEmail()]) self.setSubject("""[Indico] You have been chosen as %s for the conference "%s" (id: %s)""" % (role, conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Sir or Madam, You have been chosen as %s of the conference "%s" (id: %s), in order to help with the paper reviewing process. You can go to the conference main page: %s After logging in, you will find a link under 'Paper reviewing' on which you can click to perform your new functions. Best regards """ % ( role, conference.getTitle(), str(conference.getId()), urlHandlers.UHConferenceDisplay.getURL(conference) ))
def run(self, check=True): import smtplib from MaKaC.webinterface.mail import GenericMailer, GenericNotification # prepare the mail send = self._prepare(check=check) # _prepare decided we shouldn't send the mail? if not send: return # just in case some ill-behaved code generates empty addresses addrs = list(smtplib.quoteaddr(x) for x in self.toAddr if x) ccaddrs = list(smtplib.quoteaddr(x) for x in self.ccAddr if x) if len(addrs) + len(ccaddrs) == 0: self.getLogger().warning("Attention: no recipients, mail won't be sent") else: self.getLogger().info("Sending mail To: %s, CC: %s" % (addrs, ccaddrs)) for user in self.toUser: addrs.append(smtplib.quoteaddr(user.getEmail())) if addrs or ccaddrs: GenericMailer.send(GenericNotification({"fromAddr": self.fromAddr, "toList": addrs, "ccList": ccaddrs, "subject": self.subject, "body": self.text }))
def _sendReport(self): cfg = Config.getInstance() # if no e-mail address was specified, # add a default one if self._userMail: fromAddr = self._userMail else: fromAddr = '*****@*****.**' toAddr = Config.getInstance().getSupportEmail() Logger.get('errorReport').debug('mailing %s' % toAddr) subject = "[Indico@{}] Error report".format( url_parse(cfg.getBaseURL()).netloc) request_info = self._requestInfo or '' if isinstance(request_info, (dict, list)): request_info = pformat(request_info) # build the message body body = [ "-" * 20, "Error details\n", self._code, self._message, "Inner error: " + str(self._inner), request_info, "-" * 20 ] maildata = { "fromAddr": fromAddr, "toList": [toAddr], "subject": subject, "body": "\n".join(body) } GenericMailer.send(GenericNotification(maildata))
def __init__(self, task): GenericNotification.__init__(self) self.setFromAddr("Indico <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([task.avatar.getEmail()]) self.setSubject(""" The offline version of the event "%s" is ready to be downloaded """ % (task.conference.getTitle())) self.setBody(""" Dear %s, The offline version for the event "%s" was successfully generated and it is ready to be downloaded. Download link: %s Best Regards, -- Indico""" % (task.avatar.getStraightFullName(), task.conference.getTitle(), task.getDownloadLink()))
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
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
def __init__(self, user, role, contribution): GenericNotification.__init__(self) conference = contribution.getConference() self.setFromAddr("Indico Mailer<%s>"%HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject("""[Indico] You have been chosen as %s for the contribution "%s" (id: %s)""" % (role, contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, You have been chosen as %s of the contribution "%s" (id: %s) of the conference %s (id: %s). You can go to the contribution reviewing page: %s If you have not already, you will have to log in to see this page. Thank you for using our system. """ % ( role, contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()), urlHandlers.UHContributionModifReviewing.getURL(contribution) ))
def _sendReport(self): cfg = Config.getInstance() fromAddr = self._userMail toAddr = cfg.getSupportEmail() subject = "[Indico@%s] Error report" % cfg.getBaseURL() body = ["-"*20, "User Comments\n", "%s\n\n" % self._comments, "-"*20, "Error details\n", self._msg, "-" * 20] maildata = {"fromAddr": fromAddr, "toList": [toAddr], "subject": subject, "body": "\n".join(body)} GenericMailer.send(GenericNotification(maildata), skipQueue=True)
def wrapper(*args, **kwargs): mails = fn(*args, **kwargs) if mails is None: return if isinstance(mails, GeneratorType): mails = list(mails) elif not isinstance(mails, list): mails = [mails] for mail in filter(None, mails): GenericMailer.send(GenericNotification(mail))
def __init__(self, user, role, conference): GenericNotification.__init__(self) self.setFromAddr( "Indico Mailer<%s>" % HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject( """[Indico] You have been chosen as %s for the conference "%s" (id: %s)""" % (role, conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Indico user, You have been chosen as %s of the conference "%s" (id: %s), in order to help with the abstract / contribution reviewing process. You can go to the conference main page: %s After loggin in, you will find a link under 'My Conference' where you can click to perform your new functions. Thank you for using our system. """ % (role, conference.getTitle(), str(conference.getId()), urlHandlers.UHConferenceDisplay.getURL(conference)))
def approve(self, sendNotification=True): """ Approve the room blocking and reject colloding bookings """ self.active = True # If the blocking has not been saved yet, don't reject anything - will be done later in block.insert() if self.block.id is None: return # Create a fake reservation candidate to find bookings colliding with the blocking candResv = Location.parse(self.room.locationName).factory.newReservation() candResv.room = self.room candResv.startDT = datetime.datetime.combine(self.block.startDate, datetime.time()) candResv.endDT = datetime.datetime.combine(self.block.endDate, datetime.time(23, 59)) candResv.repeatability = RepeatabilityEnum.daily candResv.isConfirmed = None collisions = candResv.getCollisions() rejectionReason = "Conflict with blocking %s: %s" % (self.block.id, self.block.message) emailsToBeSent = [] for coll in collisions: collResv = coll.withReservation if collResv.isRejected: continue elif self.block.canOverride(collResv.createdByUser(), self.room): continue elif (collResv.repeatability is None or (collResv.startDT.date() >= self.block.startDate and collResv.endDT.date() <= self.block.endDate)): collResv.rejectionReason = rejectionReason collResv.reject() # Just sets isRejected = True collResv.update() emails = collResv.notifyAboutRejection() emailsToBeSent += emails # Add entry to the booking history info = [] info.append("Booking rejected") info.append("Reason: '%s'" % collResv.rejectionReason) histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails) collResv.getResvHistory().addHistoryEntry(histEntry) else: # repeatable -> only reject the specific days rejectDate = coll.startDT.date() collResv.excludeDay(rejectDate, unindex=True) collResv.update() emails = collResv.notifyAboutRejection(date=rejectDate, reason=rejectionReason) emailsToBeSent += emails # Add entry to the booking history info = [] info.append("Booking occurence of the %s rejected" % rejectDate.strftime("%d %b %Y")) info.append("Reason: '%s'" % rejectionReason) histEntry = ResvHistoryEntry(self.block.createdByUser, info, emails) collResv.getResvHistory().addHistoryEntry(histEntry) if sendNotification: emailsToBeSent += RoomBlockingNotification.blockingRequestProcessed(self) for email in emailsToBeSent: GenericMailer.send(GenericNotification(email))
def __init__(self, user, contribution): conference = contribution.getConference() GenericNotification.__init__(self) self.setFromAddr( "Indico Mailer<%s>" % HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject( """[Indico] Warning: the author of the contribution %s (id: %s) of the conference %s (id: %s) has changed his/her materials """ % (contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Indico user, The author of the contribution %s (id: %s) of the conference %s (id: %s) has removed the 'submitted' mark from his / her materials. This means that he may have changed the content of the materials. Thus, you should wait until he has marked the materials again to start / continue the reviewing process. Thank you for using our system. """ % (contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId())))
def __init__(self, user, role, contribution): conference = contribution.getConference() GenericNotification.__init__(self) self.setFromAddr( "Indico Mailer<%s>" % HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject( """[Indico] The author of the contribution %s (id: %s) of the conference %s has submitted his/her materials (id: %s)""" % (contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()))) self.setBody("""Dear Indico user, The author of the contribution %s (id: %s) of the conference %s (id: %s) has marked his / her materials as submitted. You can now start the reviewing process as a %s. Thank you for using our system. """ % (contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()), role))
def _send(action, user, plugin, event, room, subject, body): to_list = {user.getEmail()} cc_list = plugin.get_notification_cc_list(action, room, event) - to_list bcc_list = plugin.get_notification_bcc_list(action, room, event) - cc_list - to_list notification = { 'content-type': 'text/html', 'fromAddr': Config.getInstance().getNoReplyEmail(), 'toList': to_list, 'ccList': cc_list, 'bccList': bcc_list, 'subject': subject, 'body': body } if event is None: GenericMailer.send(GenericNotification(notification)) else: GenericMailer.sendAndLog(GenericNotification(notification), event, plugin.name)
def run(self): addrs = [] ccaddrs = [] for addr in self.toAddr: addrs.append(smtplib.quoteaddr(addr)) for ccaddr in self.ccAddr: ccaddrs.append(smtplib.quoteaddr(ccaddr)) for user in self.toUser: addrs.append(smtplib.quoteaddr(user.getEmail())) maildata = { "fromAddr": self.fromAddr, "toList": addrs, "ccList": ccaddrs, "subject": self.subject, "body": self.text } GenericMailer.send(GenericNotification(maildata))
def __init__(self, maxDate, previousTotal, newTotal, error=None, attainedDate=None): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer <%s>" % Config.getInstance().getSupportEmail()) self.setContentType("text/html") self.setToList(MailTools.getAdminEmailList('Vidyo')) serverTimezone = info.HelperMaKaCInfo.getMaKaCInfoInstance( ).getTimezone() if error: self.setSubject( """[Vidyo] Old room cleaning failed: %s rooms deleted""" % str(previousTotal - newTotal)) self.setBody("""Dear Vidyo Manager,<br /> <br /> A cleanup of old Vidyo rooms in <a href="%s">%s</a> encountered the following error:%s<br /> "All rooms before %s (%s, server timezone) should have been deleted but only the date %s was reached.<br /> There were %s rooms before the operation and there are %s rooms left now.<br /> """ % (MailTools.getServerName(), MailTools.getServerName(), escape( str(error)), formatDateTime(getAdjustedDate(maxDate, tz=serverTimezone)), serverTimezone, formatDateTime(getAdjustedDate(attainedDate, tz=serverTimezone)), str(previousTotal), str(newTotal))) else: self.setSubject( """[Vidyo] Old room cleaning successful: %s rooms deleted""" % str(previousTotal - newTotal)) self.setBody("""Dear Vidyo Manager,<br /> <br /> A cleanup was successfully executed for old Vidyo rooms in <a href="%s">%s</a>.<br /> All rooms attached to events finishing before %s (%s, server timezone) were deleted in the Vidyo server.<br /> There were %s rooms before the operation and there are %s rooms left now.<br /> """ % (MailTools.getServerName(), MailTools.getServerName(), formatDateTime(getAdjustedDate(maxDate, tz=serverTimezone)), serverTimezone, str(previousTotal), str(newTotal)))
def __init__(self, user, role, contribution): GenericNotification.__init__(self) conference = contribution.getConference() self.setFromAddr( "Indico Mailer<%s>" % HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail()) self.setToList([user.getEmail()]) self.setSubject( """[Indico] You have been chosen as %s for the contribution "%s" (id: %s)""" % (role, contribution.getTitle(), str(contribution.getId()))) self.setBody("""Dear Indico user, You have been chosen as %s of the contribution "%s" (id: %s) of the conference %s (id: %s). You can go to the contribution reviewing page: %s If you have not already, you will have to log in to see this page. Thank you for using our system. """ % (role, contribution.getTitle(), str(contribution.getId()), conference.getTitle(), str(conference.getId()), urlHandlers.UHContributionModifReviewing.getURL(contribution)))
def __init__(self, user, judgement, contribution): GenericNotification.__init__(self) conference = contribution.event_new.as_legacy self.setFromAddr("Indico <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) if isinstance(judgement, EditorJudgement): typeR = "Layout" elif isinstance(judgement, ReviewerJudgement): typeR = "Content" self.setSubject(""""%s" has been put back into reviewing by the %s Reviewer"""% (contribution.title, typeR)) self.setBody("""Dear %s, The paper entitled "%s" (id: %s) submitted for "%s" has been put back into reviewing by the assigned %s Reviewer: %s Kind regards, Indico on behalf of "%s" """ % (user.user.full_name, contribution.title, str(contribution.friendly_id), conference.getTitle(), typeR, url_for('event_mgmt.confListContribToJudge', contribution, _external=True), conference.getTitle()))
def reject(self, user=None, reason=None, sendNotification=True): """ Reject the room blocking """ self.active = False if reason: self.rejectionReason = reason if user: self.rejectedBy = user.getFullName() emails = RoomBlockingNotification.blockingRequestProcessed(self) for email in emails: GenericMailer.send(GenericNotification(email))
def addPendingParticipant(self, participant): if participant.getConference().getId() != self._conference.getId(): return False if participant.getId() is not None: return False if self.alreadyParticipating(participant) != 0: return False if self.getAutoAccept(): self.addParticipant(participant) else: self._pendingParticipantList["%d" % self._newPendingId()] = participant logData = participant.getParticipantData() logData["subject"] = _( "New pending participant : %s") % participant.getWholeName() self._conference.getLogHandler().logAction(logData, "participants") participant.setStatusPending() profileURL = urlHandlers.UHConfModifParticipantsPendingDetails.getURL( self._conference) profileURL.addParam("pendingId", self._lastPendingId()) toList = [] creator = self._conference.getCreator() if isinstance(creator, Avatar): toList.append(creator.getEmail()) for manager in self._conference.getAccessController( ).getModifierList(): if isinstance(manager, Avatar): toList.append(manager.getEmail()) data = {} data["toList"] = toList data["fromAddr"] = info.HelperMaKaCInfo.getMaKaCInfoInstance( ).getSupportEmail() data["subject"] = _("New pending participant for %s" ) % self._conference.getTitle() data["body"] = _(""" Dear Event Manager, a new person is asking for participation in %s. Personal profile of this pending participant is available at %s Please take this candidature into consideration and accept or reject it Your Indico """) % (self._conference.getTitle(), profileURL) GenericMailer.send(GenericNotification(data)) self.notifyModification() return True
def __init__(self, user, judgement, contribution): GenericNotification.__init__(self) conference = contribution.event_new.as_legacy self.setFromAddr("Indico <%s>"%Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) self.setBCCList([judgement.getAuthor().getEmail()]) if isinstance(judgement, EditorJudgement): if conference.getConfPaperReview().getChoice() == ConferencePaperReview.LAYOUT_REVIEWING: if judgement.getJudgement() in ["Accept", "Reject"]: self.setAcceptedRejected(user, judgement, contribution, conference, "Layout Reviewer") else: self.setFullyReviewed(user, judgement, contribution, conference, "Layout Reviewer") elif not judgement.getJudgement() in ["Accept", "Reject"]: self.setPartiallyReviewed(user, judgement, contribution, conference, "Layout") elif isinstance(judgement, ReviewerJudgement) and not judgement.getJudgement() in ["Accept", "Reject"]: self.setPartiallyReviewed(user, judgement, contribution, conference, "Content") elif isinstance(judgement, RefereeJudgement): if judgement.getJudgement() in ["Accept", "Reject"]: self.setAcceptedRejected(user, judgement, contribution, conference, "Referee") else: self.setFullyReviewed(user, judgement, contribution, conference, "Referee")
def __init__(self, user, role, contribution): conference = contribution.event_new.as_legacy GenericNotification.__init__(self) self.setFromAddr("Indico <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) self.setSubject("""An author has submitted a paper for "%s" """% conference.getTitle()) if role == 'Referee': url = url_for('event_mgmt.confListContribToJudge', conference, _external=True) elif role == 'Layout Reviewer': url = url_for('event_mgmt.confListContribToJudge-asEditor', conference, _external=True) elif role == 'Content Reviewer': url = url_for('event_mgmt.confListContribToJudge-asReviewer', conference, _external=True) self.setBody("""Dear %s, An author has submitted a paper entitled "%s" (id: %s) for the conference "%s". You can now start the reviewing process as a %s: %s Kind regards, Indico on behalf of "%s" """ % ( user.full_name, contribution.title, str(contribution.friendly_id), conference.getTitle(), role, url, conference.getTitle()))
def __init__(self, maxDate, previousTotal, newTotal, error = None, attainedDate = None): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer <%s>" % Config.getInstance().getSupportEmail()) self.setContentType("text/html") self.setToList(MailTools.getAdminEmailList('Vidyo')) serverTimezone = info.HelperMaKaCInfo.getMaKaCInfoInstance().getTimezone() if error: self.setSubject("""[Vidyo] Old room cleaning failed: %s rooms deleted""" % str(previousTotal - newTotal)) self.setBody("""Dear Vidyo Manager,<br /> <br /> A cleanup of old Vidyo rooms in <a href="%s">%s</a> encountered the following error:%s<br /> "All rooms before %s (%s, server timezone) should have been deleted but only the date %s was reached.<br /> There were %s rooms before the operation and there are %s rooms left now.<br /> """ % (MailTools.getServerName(), MailTools.getServerName(), escape(str(error)), formatDateTime(getAdjustedDate(maxDate, tz=serverTimezone)), serverTimezone, formatDateTime(getAdjustedDate(attainedDate, tz=serverTimezone)), str(previousTotal), str(newTotal))) else: self.setSubject("""[Vidyo] Old room cleaning successful: %s rooms deleted""" % str(previousTotal - newTotal)) self.setBody("""Dear Vidyo Manager,<br /> <br /> A cleanup was successfully executed for old Vidyo rooms in <a href="%s">%s</a>.<br /> All rooms attached to events finishing before %s (%s, server timezone) were deleted in the Vidyo server.<br /> There were %s rooms before the operation and there are %s rooms left now.<br /> """ % (MailTools.getServerName(), MailTools.getServerName(), formatDateTime(getAdjustedDate(maxDate, tz=serverTimezone)), serverTimezone, str(previousTotal), str(newTotal)))
def __init__(self, user, role, contribution): GenericNotification.__init__(self) conference = contribution.event_new.as_legacy self.setFromAddr("Indico <%s>" % Config.getInstance().getNoReplyEmail()) self.setToList([user.email]) self.setSubject("""You have been chosen as a %s for "%s" """% (role, conference.getTitle())) if role == 'Referee': url = url_for('event_mgmt.confListContribToJudge', conference, _external=True) elif role == 'Layout Reviewer': url = url_for('event_mgmt.confListContribToJudge-asEditor', conference, _external=True) elif role == 'Content Reviewer': url = url_for('event_mgmt.confListContribToJudge-asReviewer', conference, _external=True) self.setBody("""Dear %s, You have been chosen as a %s for the paper entitled "%s" (id: %s) for the conference "%s". Please find the %s utilities here: %s Kind regards, Indico on behalf of "%s" """ % (user.full_name.encode('utf-8'), role, contribution.title.encode('utf-8'), str(contribution.friendly_id), conference.getTitle(), role, url, conference.getTitle()))
def __init__(self, sendToList, fromEmail, fromName ="Indico Mailer"): GenericNotification.__init__(self) self.setContentType("text/html") self.setFromAddr("%s<%s>"%(fromName, fromEmail)) self.setToList(sendToList)
def __init__(self, sendToList, fromEmail): GenericNotification.__init__(self) self.setContentType("text/html") self.setFromAddr("Indico Mailer<%s>"%fromEmail) self.setToList(sendToList)
def __init__(self, room, userList): GenericNotification.__init__(self) self.setFromAddr("Indico Mailer <%s>"%Config.getInstance().getSupportEmail()) self.setToList(userList)