コード例 #1
0
ファイル: notifications.py プロジェクト: sylvestre/indico
def sendReservationStartStopNotification(resv, which, occurrence):
    if which == 'start' and resv.room.resvStartNotification:
        msg = getRoomBookingOption('startNotificationEmail')
        subject = getRoomBookingOption('startNotificationEmailSubject')
    elif which == 'end' and resv.room.resvEndNotification:
        msg = getRoomBookingOption('endNotificationEmail')
        subject = getRoomBookingOption('endNotificationEmailSubject')
    else:
        return

    av = resv.bookedForUser
    if av:
        bookedForDetails = '%s %s\n%s' % (av.getFullName(), av.getPersonId()
                                          or '', av.getEmail())
    else:
        bookedForDetails = '%s\n%s' % (resv.bookedForName, resv.contactEmail)

    msgArgs = {
        'bookedForUser': bookedForDetails,
        'roomName': resv.room.getFullName(),
        'roomAtts': resv.room.customAtts,
        'bookingStart': formatDateTime(resv.startDT),
        'bookingEnd': formatDateTime(resv.endDT),
        'occStart': formatDateTime(occurrence.startDT),
        'occEnd': formatDateTime(occurrence.endDT),
        'detailsLink': urlHandlers.UHRoomBookingBookingDetails.getURL(resv)
    }

    recipients = set()
    recipients.update(getRoomBookingOption('notificationEmails'))
    if getRoomBookingOption('notificationEmailsToBookedFor'):
        recipients.update(getEmailList(resv.contactEmail))
    if resv.room.resvNotificationToResponsible:
        recipients.add(resv.room.getResponsible().getEmail())
    maildata = {
        'fromAddr': Config.getInstance().getNoReplyEmail(),
        'toList': list(recipients),
        'subject': subject.format(**msgArgs),
        'body': msg.format(**msgArgs)
    }
    GenericMailer.send(GenericNotification(maildata))
コード例 #2
0
ファイル: notifications.py プロジェクト: Ictp/indico
def sendReservationStartStopNotification(resv, which, occurrence):
    if which == 'start' and resv.room.resvStartNotification:
        msg = getRoomBookingOption('startNotificationEmail')
        subject = getRoomBookingOption('startNotificationEmailSubject')
    elif which == 'end' and resv.room.resvEndNotification:
        msg = getRoomBookingOption('endNotificationEmail')
        subject = getRoomBookingOption('endNotificationEmailSubject')
    else:
        return

    av = resv.bookedForUser
    if av:
        bookedForDetails = '%s %s\n%s' % (av.getFullName(), av.getPersonId() or '', av.getEmail())
    else:
        bookedForDetails = '%s\n%s' % (resv.bookedForName, resv.contactEmail)

    msgArgs = {
        'bookedForUser': bookedForDetails,
        'roomName': resv.room.getFullName(),
        'roomAtts': resv.room.customAtts,
        'bookingStart': formatDateTime(resv.startDT),
        'bookingEnd': formatDateTime(resv.endDT),
        'occStart': formatDateTime(occurrence.startDT),
        'occEnd': formatDateTime(occurrence.endDT),
        'detailsLink': urlHandlers.UHRoomBookingBookingDetails.getURL(resv)
    }

    recipients = set()
    recipients.update(getRoomBookingOption('notificationEmails'))
    if getRoomBookingOption('notificationEmailsToBookedFor'):
        recipients.update(getEmailList(resv.contactEmail))
    if resv.room.resvNotificationToResponsible:
        recipients.add(resv.room.getResponsible().getEmail())
    maildata = {
        'fromAddr': Config.getInstance().getNoReplyEmail(),
        'toList': list(recipients),
        'subject': subject.format(**msgArgs),
        'body': msg.format(**msgArgs)
    }
    GenericMailer.send(GenericNotification(maildata))
コード例 #3
0
 def _importedXml(self, evaluation, params):
     """ Importation of an evaluation.
         Note: original 'isVisible' and the dates are kept.
     """
     try:
         xmlString = params["xmlFile"].file.read()
     except AttributeError:  #no file given
         self._redirect(
             urlHandlers.UHConfModifEvaluationSetup.getURL(self._conf))
         return
     try:
         doc = parseString(xmlString)
     except:
         raise MaKaCError(
             _("""System can't import an evaluation from your file.
                             Be sure to import the right XML file."""),
             _("evaluation"))
     #parse begins
     evalNode = self._getElement(doc, "evaluation")
     if params.get("configOption", "") == "imported":
         #parse node /evaluation/
         title = self._getValue(evalNode, "title")
         announcement = self._getValue(evalNode, "announcement")
         submissionsLimit = self._getValue(evalNode, "submissionsLimit")
         contactInfo = self._getValue(evalNode, "contactInfo")
         mandatoryAccount = self._getValue(evalNode, "mandatoryAccount")
         mandatoryParticipant = self._getValue(evalNode,
                                               "mandatoryParticipant")
         anonymous = self._getValue(evalNode, "anonymous")
         evaluation.setTitle(title)
         evaluation.setAnnouncement(announcement)
         evaluation.setSubmissionsLimit(submissionsLimit)
         evaluation.setContactInfo(contactInfo)
         evaluation.setMandatoryAccount(mandatoryAccount)
         evaluation.setMandatoryParticipant(mandatoryParticipant)
         if anonymous.strip() == "":
             evaluation.setAnonymous(True)
         else:
             evaluation.setAnonymous(anonymous)
         #parse node /evaluation/notifications/
         notificationsNode = self._getElement(evalNode, "notifications")
         evaluation.removeAllNotifications()
         for notificationNode in notificationsNode.childNodes:
             if isinstance(notificationNode, Element):
                 from MaKaC.registration import Notification
                 notification = Notification()
                 toList = self._getValue(notificationNode, "toList")
                 ccList = self._getValue(notificationNode, "ccList")
                 notification.setToList(utils.getEmailList(toList))
                 notification.setCCList(utils.getEmailList(ccList))
                 evaluation.setNotification(notificationNode.tagName,
                                            notification)
     if params.get("questionsOption",
                   "") != "current":  # in ["imported", "both"]
         if params.get("questionsOption", "") == "imported":
             evaluation.removeAllQuestions()
         #parse node /evaluation/questions/
         questionsNode = self._getElement(evalNode, "questions")
         for questionNode in questionsNode.childNodes:
             if isinstance(questionNode, Element):
                 questionValue = self._getValue(questionNode,
                                                "questionValue")
                 keyword = self._getValue(questionNode, "keyword")
                 required = self._getValue(questionNode, "required")
                 description = self._getValue(questionNode, "description")
                 help = self._getValue(questionNode, "help")
                 try:
                     question = eval(questionNode.tagName)()
                     if isinstance(question, Question):
                         question.setQuestionValue(questionValue)
                         question.setKeyword(keyword)
                         question.setRequired(required)
                         question.setDescription(description)
                         question.setHelp(help)
                         evaluation.insertQuestion(question)
                 except NameError:
                     raise MaKaCError(
                         _("""xml parse error: unknown question type "%s"
                                         """) % questionNode.tagName,
                         _("evaluation"))
                 if isinstance(question, Box):
                     defaultAnswer = self._getValue(questionNode,
                                                    "defaultAnswer")
                     question.setDefaultAnswer(defaultAnswer)
                 elif isinstance(question, Choice):
                     #parse node /evaluation/questions/*/choiceItems/
                     choiceItemsNode = self._getElement(
                         questionNode, "choiceItems")
                     for choiceItemNode in choiceItemsNode.childNodes:
                         if isinstance(choiceItemNode, Element):
                             itemText = self._getValue(
                                 choiceItemNode, "itemText")
                             if itemText.strip() != "":
                                 isSelected = self._getValue(
                                     choiceItemNode, "isSelected")
                                 question.insertChoiceItem(
                                     itemText, isSelected)
コード例 #4
0
 evaluation.setAnonymous(params.has_key("anonymous"))
 evaluation.setAnnouncement(params.get("announcement", ""))
 evaluation.setTitle(params.get("title", "Evaluation"))
 evaluation.setContactInfo(params.get("contactInfo", ""))
 evaluation.setMandatoryParticipant(
     params.has_key("mandatoryParticipant"))
 evaluation.setMandatoryAccount(params.has_key("mandatoryAccount"))
 try:
     evaluation.setSubmissionsLimit(
         params.get("submissionsLimit", 0))
 except ValueError, e:
     raise FormValuesError(
         "You must enter an integer for 'Max number of submissions'!",
         "Evaluation")
 #notifications
 evaluationStartNotifyTo = utils.getEmailList(
     params.get("evaluationStartNotifyTo", ""))
 evaluationStartNotifyCc = utils.getEmailList(
     params.get("evaluationStartNotifyCc", ""))
 newSubmissionNotifyTo = utils.getEmailList(
     params.get("newSubmissionNotifyTo", ""))
 newSubmissionNotifyCc = utils.getEmailList(
     params.get("newSubmissionNotifyCc", ""))
 if params.has_key("notifyAllAdherents"):
     if self.getWebFactory() != None:  #Event == Meeting/Lecture
         for participant in evaluation.getConference(
         ).getParticipation().getParticipantList():
             email = participant.getEmail()
             if email not in evaluationStartNotifyTo:
                 evaluationStartNotifyTo.append(email)
     else:  #Event == Conference
         for registrant in evaluation.getConference(
コード例 #5
0
ファイル: evaluationModif.py プロジェクト: bubbas/indico
 def _importedXml(self, evaluation, params):
     """ Importation of an evaluation.
         Note: original 'isVisible' and the dates are kept.
     """
     try:
         xmlString = params["xmlFile"].file.read()
     except AttributeError: #no file given
         self._redirect(urlHandlers.UHConfModifEvaluationSetup.getURL(self._conf))
         return
     try:
         doc = parseString(xmlString)
     except:
         raise MaKaCError( _("""System can't import an evaluation from your file.
                             Be sure to import the right XML file."""), _("evaluation"))
     #parse begins
     evalNode = self._getElement(doc,"evaluation")
     if params.get("configOption","")=="imported":
         #parse node /evaluation/
         title                = self._getValue(evalNode,"title")
         announcement         = self._getValue(evalNode,"announcement")
         submissionsLimit     = self._getValue(evalNode,"submissionsLimit")
         contactInfo          = self._getValue(evalNode,"contactInfo")
         mandatoryAccount     = self._getValue(evalNode,"mandatoryAccount")
         mandatoryParticipant = self._getValue(evalNode,"mandatoryParticipant")
         anonymous            = self._getValue(evalNode,"anonymous")
         evaluation.setTitle(title)
         evaluation.setAnnouncement(announcement)
         evaluation.setSubmissionsLimit(submissionsLimit)
         evaluation.setContactInfo(contactInfo)
         evaluation.setMandatoryAccount(mandatoryAccount)
         evaluation.setMandatoryParticipant(mandatoryParticipant)
         if anonymous.strip()=="" :
             evaluation.setAnonymous(True)
         else :
             evaluation.setAnonymous(anonymous)
         #parse node /evaluation/notifications/
         notificationsNode    = self._getElement(evalNode, "notifications")
         evaluation.removeAllNotifications()
         for notificationNode in notificationsNode.childNodes :
             if isinstance(notificationNode, Element) :
                 from MaKaC.registration import Notification
                 notification = Notification()
                 toList       = self._getValue(notificationNode,"toList")
                 ccList       = self._getValue(notificationNode,"ccList")
                 notification.setToList( utils.getEmailList(toList) )
                 notification.setCCList( utils.getEmailList(ccList) )
                 evaluation.setNotification(notificationNode.tagName, notification)
     if params.get("questionsOption","")!="current" : # in ["imported", "both"]
         if params.get("questionsOption","")=="imported" :
             evaluation.removeAllQuestions()
         #parse node /evaluation/questions/
         questionsNode        = self._getElement(evalNode,"questions")
         for questionNode in questionsNode.childNodes :
             if isinstance(questionNode, Element):
                 questionValue= self._getValue(questionNode,"questionValue")
                 keyword      = self._getValue(questionNode,"keyword")
                 required     = self._getValue(questionNode,"required")
                 description  = self._getValue(questionNode,"description")
                 help         = self._getValue(questionNode,"help")
                 try:
                     question = eval(questionNode.tagName)()
                     if isinstance(question, Question):
                         question.setQuestionValue(questionValue)
                         question.setKeyword(keyword)
                         question.setRequired(required)
                         question.setDescription(description)
                         question.setHelp(help)
                         evaluation.insertQuestion(question)
                 except NameError:
                     raise MaKaCError( _("""xml parse error: unknown question type "%s"
                                         """)%questionNode.tagName, _("evaluation"))
                 if isinstance(question, Box):
                     defaultAnswer= self._getValue(questionNode,"defaultAnswer")
                     question.setDefaultAnswer(defaultAnswer)
                 elif isinstance(question, Choice):
                     #parse node /evaluation/questions/*/choiceItems/
                     choiceItemsNode = self._getElement(questionNode,"choiceItems")
                     for choiceItemNode in choiceItemsNode.childNodes :
                         if isinstance(choiceItemNode, Element):
                             itemText = self._getValue(choiceItemNode,"itemText")
                             if itemText.strip()!="" :
                                 isSelected = self._getValue(choiceItemNode,"isSelected")
                                 question.insertChoiceItem(itemText, isSelected)
コード例 #6
0
ファイル: evaluationModif.py プロジェクト: bubbas/indico
 if eDate < sDate :
     raise FormValuesError("End date can't be before start date!", "Evaluation")
 evaluation.setStartDate(sDate)
 evaluation.setEndDate(eDate)
 evaluation.setAnonymous(params.has_key("anonymous"))
 evaluation.setAnnouncement(params.get("announcement",""))
 evaluation.setTitle( params.get("title","Evaluation") )
 evaluation.setContactInfo( params.get("contactInfo","") )
 evaluation.setMandatoryParticipant(params.has_key("mandatoryParticipant"))
 evaluation.setMandatoryAccount(params.has_key("mandatoryAccount"))
 try:
     evaluation.setSubmissionsLimit( params.get("submissionsLimit",0) )
 except ValueError,e:
     raise FormValuesError("You must enter an integer for 'Max number of submissions'!", "Evaluation")
 #notifications
 evaluationStartNotifyTo = utils.getEmailList(params.get("evaluationStartNotifyTo", ""))
 evaluationStartNotifyCc = utils.getEmailList(params.get("evaluationStartNotifyCc", ""))
 newSubmissionNotifyTo = utils.getEmailList(params.get("newSubmissionNotifyTo", ""))
 newSubmissionNotifyCc = utils.getEmailList(params.get("newSubmissionNotifyCc", ""))
 if params.has_key("notifyAllAdherents") :
     if self.getWebFactory()!=None : #Event == Meeting/Lecture
         for participant in evaluation.getConference().getParticipation().getParticipantList() :
             email = participant.getEmail()
             if email not in evaluationStartNotifyTo :
                 evaluationStartNotifyTo.append(email)
     else : #Event == Conference
         for registrant in evaluation.getConference().getRegistrantsList() :
             email = registrant.getEmail()
             if email not in evaluationStartNotifyTo :
                 evaluationStartNotifyTo.append(email)
 if len( evaluationStartNotifyTo + evaluationStartNotifyCc ) < 1 :
コード例 #7
0
                    "The modification end date you have entered is not correct: %s"
                    % e, "RegistrationForm")
            if meDate is not None and (meDate < sDate or meDate < eDate):
                raise FormValuesError("End date must be after end date!",
                                      "RegistrationForm")
            regForm.setStartRegistrationDate(sDate)
            regForm.setEndRegistrationDate(eDate)
            regForm.setEndExtraTimeAmount(self._extraTimeAmount)
            regForm.setEndExtraTimeUnit(self._extraTimeUnit)
            regForm.setModificationEndDate(meDate)
            regForm.setAnnouncement(params["announcement"])
            regForm.setTitle(params["title"])
            regForm.setContactInfo(params["contactInfo"])
            regForm.setUsersLimit(params["usersLimit"])
            regForm.getNotification().setToList(
                utils.getEmailList(params.get("toList", "")))
            regForm.getNotification().setCCList(
                utils.getEmailList(params.get("ccList", "")))
            regForm.setMandatoryAccount(params.has_key("mandatoryAccount"))
            regForm.setNotificationSender(params["notificationSender"])
            regForm.setSendRegEmail(params.has_key("sendRegEmail"))
            regForm.setSendReceiptEmail(params.has_key("sendReceiptEmail"))
            regForm.setSendPaidEmail(params.has_key("sendPaidEmail"))
        self._redirect(urlHandlers.UHConfModifRegForm.getURL(self._conf))


class RHRegistrationFormModifSessions(RHRegistrationFormModifBase):
    def _process(self):
        p = registrationForm.WPConfModifRegFormSessions(self, self._conf)
        return p.display()
コード例 #8
0
                    meDate = datetime(int(params["meYear"]), int(params["meMonth"]), int(params["meDay"]))
            except ValueError, e:
                raise FormValuesError("The modification end date you have entered is not correct: %s" % e,
                                      "RegistrationForm")
            if meDate is not None and meDate < eDate:
                raise FormValuesError("Modification end date must be after end date!", "RegistrationForm")
            regForm.setStartRegistrationDate(sDate)
            regForm.setEndRegistrationDate(eDate)
            regForm.setEndExtraTimeAmount(self._extraTimeAmount)
            regForm.setEndExtraTimeUnit(self._extraTimeUnit)
            regForm.setModificationEndDate(meDate)
            regForm.setAnnouncement(params["announcement"])
            regForm.setTitle( params["title"] )
            regForm.setContactInfo( params["contactInfo"] )
            regForm.setUsersLimit( params["usersLimit"] )
            regForm.getNotification().setToList( utils.getEmailList(params.get("toList", "")) )
            regForm.getNotification().setCCList( utils.getEmailList(params.get("ccList", "")) )
            regForm.setMandatoryAccount(params.has_key("mandatoryAccount"))
            regForm.setNotificationSender(params["notificationSender"])
            regForm.setSendRegEmail(params.has_key("sendRegEmail"))
            regForm.setSendReceiptEmail(params.has_key("sendReceiptEmail"))
            regForm.setSendPaidEmail(params.has_key("sendPaidEmail"))
        self._redirect(urlHandlers.UHConfModifRegForm.getURL(self._conf))

class RHRegistrationFormActionStatuses( RHRegistrationFormModifBase ):

    def _checkParams( self, params ):
        RHRegistrationFormModifBase._checkParams( self, params )
        self._action=None
        if params.has_key("addStatus"):
            self._action=_ActionNewStatus(self, self._conf, params)