示例#1
0
    def getVars(self):
        vars = WCSPageTemplateBase.getVars(self)

        vars["EventTitle"] = self._conf.getTitle()
        vars["EventDescription"] = unescape_html(strip_ml_tags(self._conf.getDescription())).strip()

        defaultStartDate = self._conf.getAdjustedStartDate() - timedelta(
            0, 0, 0, 0, self._EVOOptions["defaultMinutesBefore"].getValue()
        )
        nowStartDate = getAdjustedDate(
            nowutc() - timedelta(0, 0, 0, 0, self._EVOOptions["allowedPastMinutes"].getValue() / 2), self._conf
        )
        vars["DefaultStartDate"] = formatDateTime(max(defaultStartDate, nowStartDate))

        defaultEndDate = self._conf.getAdjustedEndDate() + timedelta(
            0, 0, 0, 0, self._EVOOptions["defaultMinutesAfter"].getValue()
        )
        nowEndDate = nowStartDate + timedelta(0, 0, 0, 0, self._EVOOptions["extraMinutesAfter"].getValue())
        vars["DefaultEndDate"] = formatDateTime(max(defaultEndDate, nowEndDate))

        communities = self._EVOOptions["communityList"].getValue()  # a dict communityId : communityName
        communityItems = communities.items()  # a list of tuples (communityId, communityName)
        communityItems.sort(key=lambda t: t[1])  # we sort by the second member of the tuple (the name)
        vars["Communities"] = communityItems

        return vars
示例#2
0
    def getVars(self):
        vars = WCSPageTemplateBase.getVars(self)

        vars["EventTitle"] = self._conf.getTitle()
        vars["EventDescription"] = unescape_html(
            strip_ml_tags(self._conf.getDescription())).strip()

        defaultStartDate = self._conf.getAdjustedStartDate() - timedelta(
            0, 0, 0, 0, self._EVOOptions["defaultMinutesBefore"].getValue())
        nowStartDate = getAdjustedDate(
            nowutc() -
            timedelta(0, 0, 0, 0,
                      self._EVOOptions["allowedPastMinutes"].getValue() / 2),
            self._conf)
        vars["DefaultStartDate"] = formatDateTime(
            max(defaultStartDate, nowStartDate))

        defaultEndDate = self._conf.getAdjustedEndDate() + timedelta(
            0, 0, 0, 0, self._EVOOptions["defaultMinutesAfter"].getValue())
        nowEndDate = nowStartDate + timedelta(
            0, 0, 0, 0, self._EVOOptions["extraMinutesAfter"].getValue())
        vars["DefaultEndDate"] = formatDateTime(max(defaultEndDate,
                                                    nowEndDate))

        communities = self._EVOOptions["communityList"].getValue(
        )  # a dict communityId : communityName
        communityItems = communities.items(
        )  # a list of tuples (communityId, communityName)
        communityItems.sort(key=lambda t: t[
            1])  # we sort by the second member of the tuple (the name)
        vars["Communities"] = communityItems

        return vars
示例#3
0
文件: pages.py 项目: sylvestre/indico
    def getVars(self):
        vars = WCSPageTemplateBase.getVars(self)
        vars["EventTitle"] = self._conf.getTitle()
        vars["EventDescription"] = unescape_html(
            strip_ml_tags(self._conf.getDescription())).strip()

        vars["DefaultStartDate"] = formatDateTime(
            self._conf.getAdjustedStartDate())
        vars["DefaultEndDate"] = formatDateTime(
            self._conf.getAdjustedEndDate())

        vars["DefaultWebExUser"] = ""
        vars["DefaultWebExPass"] = ""
        vars["TimeZone"] = self._conf.getTimezone()
        sessions = "<select name='session' id='session' onchange='updateSessionTimes()'><option value=''>None</option>"
        count = 0
        sessionList = self._conf.getSessionList()
        for session in sessionList:
            count = count + 1
            sessions = sessions + "<option value='%s'>%s</option>" % (str(
                session.getId()), session.getTitle())
        sessions += "</select>"
        vars["SessionList"] = sessions

        return vars
示例#4
0
    def getVars(self):
        vars = WJSBase.getVars( self )

        vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf))
        vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf))
        vars["ExtraMinutesBefore"] = getCERNMCUOptionValueByName("extraMinutesBefore")
        vars["ExtraMinutesAfter"] = getCERNMCUOptionValueByName("extraMinutesAfter")

        # Code to retrieve the event's location and room in order to include the event's room
        # as an initial participant
        location = self._conf.getLocation()
        room = self._conf.getRoom()
        if location and room and location.getName() and room.getName() and location.getName().strip() and room.getName().strip():
            locationName = location.getName()
            roomName = room.getName()

            vars["IncludeInitialRoom"] = True
            vars["IPRetrievalResult"] = -1 # 0 = OK, 1 = room without H323 IP, 2 = room with invalid H323 IP, 3 = connection to RB problem, 4 = another unknown problem
            vars["InitialRoomName"] = roomName
            if self._conf.getLocation():
                vars["InitialRoomInstitution"] = locationName
            else:
                vars["InitialRoomInstitution"] = ""

            if not Config.getInstance().getIsRoomBookingActive():
                room_ip = "Please enter IP"
                vars["IPRetrievalResult"] = 3
            else:
                rb_room = Room.find_first(Location.name == locationName, Room.name == roomName, _join=Room.location)
                if rb_room is None:
                    room_ip = "Please enter IP."
                    vars["IPRetrievalResult"] = 1
                else:
                    vars["InitialRoomName"] = rb_room.full_name
                    attr_name = getCERNMCUOptionValueByName('H323_IP_att_name')
                    room_ip = rb_room.get_attribute_value(attr_name, '').strip()
                    if not room_ip:
                        room_ip = "Please enter IP."
                        vars["IPRetrievalResult"] = 1
                    elif not validIP(room_ip):
                        vars["IPRetrievalResult"] = 2
                    else:
                        vars["IPRetrievalResult"] = 0

            vars["InitialRoomIP"] = room_ip

        else:
            vars["IncludeInitialRoom"] = False
            vars["IPRetrieved"] = False
            vars["InitialRoomName"] = ""
            vars["InitialRoomInstitution"] = ""
            vars["InitialRoomIP"] = ""

        vars["CERNGatekeeperPrefix"] = getCERNMCUOptionValueByName("CERNGatekeeperPrefix")
        vars["GDSPrefix"] = getCERNMCUOptionValueByName("GDSPrefix")
        vars["MCU_IP"] = getCERNMCUOptionValueByName("MCU_IP")
        vars["Phone_number"] = getCERNMCUOptionValueByName("Phone_number")

        return vars
示例#5
0
    def getVars( self ):
        vars = WTemplated.getVars( self )

        vars["conf"] = self.__conf
        vars["startDate"] = utils.formatDateTime(self.__conf.getAdjustedStartDate(), format="d MMM")
        vars["endDate"] = utils.formatDateTime(self.__conf.getAdjustedEndDate(), format="d MMM")

        return vars
示例#6
0
 def getVars(self):
     vars = WJSBase.getVars( self )
     
     vars["AllowedStartMinutes"] = self._EVOOptions["allowedPastMinutes"].getValue()
     vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf))
     vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf))
     vars["AllowedMarginMinutes"] = self._EVOOptions["allowedMinutes"].getValue()
     
     return vars
示例#7
0
    def getVars(self):
        vars = WTemplated.getVars(self)

        vars["conf"] = self.__conf
        vars["startDate"] = utils.formatDateTime(
            self.__conf.getAdjustedStartDate(), format="d MMM")
        vars["endDate"] = utils.formatDateTime(
            self.__conf.getAdjustedEndDate(), format="d MMM")

        return vars
示例#8
0
 def getVars(self):
     vars = WJSBase.getVars(self)
     vars["AllowedStartMinutes"] = self._EVOOptions["allowedPastMinutes"].getValue()
     vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf))
     vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf))
     vars["ExtraMinutesBefore"] = self._EVOOptions["extraMinutesBefore"].getValue()
     vars["ExtraMinutesAfter"] = self._EVOOptions["extraMinutesAfter"].getValue()
     vars["PossibleToCreateOrModify"] = getAdjustedDate(nowutc(), self._conf) < getMaxEndDate(self._conf)
     vars["GeneralSettingsURL"] = urlHandlers.UHConferenceModification.getURL(self._conf)
     return vars
示例#9
0
    def getVars(self):
        vars = WCSPageTemplateBase.getVars( self )

        vars["EventTitle"] = self._conf.getTitle()
        vars["EventDescription"] = unescape_html(strip_ml_tags( self._conf.getDescription())).strip()
        vars["DefaultStartDate"] = formatDateTime(self._conf.getAdjustedStartDate())
        vars["DefaultEndDate"] = formatDateTime(self._conf.getAdjustedEndDate())
        vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate())
        vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate())

        return vars
示例#10
0
    def getVars(self):
        vars = WCSPageTemplateBase.getVars( self )

        vars["EventTitle"] = self._conf.getTitle()
        vars["EventDescription"] = unescape_html(strip_ml_tags( self._conf.getDescription())).strip()
        vars["DefaultStartDate"] = formatDateTime(self._conf.getAdjustedStartDate() - timedelta(0, 0, 0, 0, getCERNMCUOptionValueByName("defaultMinutesBefore")))
        vars["DefaultEndDate"] = formatDateTime(self._conf.getAdjustedEndDate() + timedelta(0, 0, 0, 0, getCERNMCUOptionValueByName("defaultMinutesAfter")))
        vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate())
        vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate())

        return vars
示例#11
0
    def getVars(self):
        vars = WJSBase.getVars(self)

        vars["AllowedStartMinutes"] = self._EVOOptions[
            "allowedPastMinutes"].getValue()
        vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf))
        vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf))
        vars["AllowedMarginMinutes"] = self._EVOOptions[
            "allowedMinutes"].getValue()

        return vars
示例#12
0
    def getVars(self):
        vars = WCSPageTemplateBase.getVars( self )

        vars["EventTitle"] = self._conf.getTitle()
        vars["EventDescription"] = unescape_html(strip_ml_tags( self._conf.getDescription())).strip()
        vars["DefaultStartDate"] = formatDateTime(self._conf.getAdjustedStartDate() - timedelta(0, 0, 0, 0, getCERNMCUOptionValueByName("defaultMinutesBefore")))
        vars["DefaultEndDate"] = formatDateTime(self._conf.getAdjustedEndDate() + timedelta(0, 0, 0, 0, getCERNMCUOptionValueByName("defaultMinutesAfter")))
        vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate())
        vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate())

        return vars
示例#13
0
    def getVars(self):
        vars = WJSBase.getVars(self)

        vars["AllowedStartMinutes"] = self._WebExOptions["allowedPastMinutes"].getValue()
        vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf))
        vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf))
        vars["AllowedMarginMinutes"] = self._WebExOptions["allowedMinutes"].getValue()
        # from indico.core.logger import Logger
        vars["LoggedInEmail"] = self._user.getEmail()
        # Logger.get('WebEx').error(self._user.getEmail())
        return vars
示例#14
0
文件: pages.py 项目: bubbas/indico
    def getVars(self):
        vars = WJSBase.getVars( self )

        vars["AllowedStartMinutes"] = self._EVOOptions["allowedPastMinutes"].getValue()
        if self._conf:
            vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf), format = "EEE d/M H:mm")
            vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf), format = "EEE d/M H:mm")
        else:
            vars["MinStartDate"] = ''
            vars["MaxEndDate"] = ''

        return vars
示例#15
0
    def formatDateTime(self, dateTime):
        now = timezoneUtils.nowutc().astimezone(self._timezone)

        if dateTime.date() == now.date():
            return _("today") + " " + formatTime(dateTime.time())
        elif dateTime.date() == (now + datetime.timedelta(days=1)).date():
            return _("tomorrow") + " " + formatTime(dateTime.time())
        elif dateTime < (now + datetime.timedelta(days=6)):
            return formatDateTime(dateTime, format="EEEE H:mm")
        elif dateTime.date().year == now.date().year:
            return formatDateTime(dateTime, format="d MMM")
        else:
            return formatDateTime(dateTime, format="d MMM yyyy")
示例#16
0
文件: pages.py 项目: sylvestre/indico
    def getVars(self):
        vars = WJSBase.getVars(self)

        vars["AllowedStartMinutes"] = self._WebExOptions[
            "allowedPastMinutes"].getValue()
        vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf))
        vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf))
        vars["AllowedMarginMinutes"] = self._WebExOptions[
            "allowedMinutes"].getValue()
        #        from MaKaC.common.logger import Logger
        vars["LoggedInEmail"] = self._user.getEmail()
        #        Logger.get('WebEx').error(self._user.getEmail())
        return vars
示例#17
0
    def formatDateTime(self, dateTime):
        now = timezoneUtils.nowutc().astimezone(self._timezone)

        if dateTime.date() == now.date():
            return _("today") + " " + formatTime(dateTime.time())
        elif dateTime.date() == (now + datetime.timedelta(days=1)).date():
            return _("tomorrow") + " " + formatTime(dateTime.time())
        elif dateTime < (now + datetime.timedelta(days=6)):
            return formatDateTime(dateTime, format="EEEE H:mm")
        elif dateTime.date().year == now.date().year:
            return formatDateTime(dateTime, format="d MMM")
        else:
            return formatDateTime(dateTime, format="d MMM yyyy")
示例#18
0
    def getVars(self):
        vars = WJSBase.getVars(self)

        vars["AllowedStartMinutes"] = self._EVOOptions[
            "allowedPastMinutes"].getValue()
        if self._conf:
            vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf),
                                                  format="EEE d/M H:mm")
            vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf),
                                                format="EEE d/M H:mm")
        else:
            vars["MinStartDate"] = ''
            vars["MaxEndDate"] = ''

        return vars
示例#19
0
 def getVars(self):
     vars = WJSBase.getVars(self)
     vars["AllowedStartMinutes"] = self._EVOOptions[
         "allowedPastMinutes"].getValue()
     vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf))
     vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf))
     vars["ExtraMinutesBefore"] = self._EVOOptions[
         "extraMinutesBefore"].getValue()
     vars["ExtraMinutesAfter"] = self._EVOOptions[
         "extraMinutesAfter"].getValue()
     vars["PossibleToCreateOrModify"] = getAdjustedDate(
         nowutc(), self._conf) < getMaxEndDate(self._conf)
     vars[
         "GeneralSettingsURL"] = urlHandlers.UHConferenceModification.getURL(
             self._conf)
     return vars
示例#20
0
 def getVars( self ):
     vars = wcomponents.WTemplated.getVars( self )
     
     plugins = self._tabPlugins
     singleBookingPlugins, multipleBookingPlugins = CollaborationTools.splitPluginsByAllowMultiple(plugins)
     CSBookingManager = self._conf.getCSBookingManager()
     
     bookingsS = {}
     for p in singleBookingPlugins:
         bookingList = CSBookingManager.getBookingList(filterByType = p.getName())
         if len(bookingList) > 0:
             bookingsS[p.getName()] = DictPickler.pickle(bookingList[0])
             
     bookingsM = DictPickler.pickle(CSBookingManager.getBookingList(
         sorted = True,
         notify = True,
         filterByType = [p.getName() for p in multipleBookingPlugins]))
     
     vars["Conference"] = self._conf
     vars["AllPlugins"] = plugins
     vars["SingleBookingPlugins"] = singleBookingPlugins
     vars["BookingsS"] = bookingsS
     vars["MultipleBookingPlugins"] = multipleBookingPlugins
     vars["BookingsM"] = bookingsM
     vars["Tab"] = self._activeTab
     vars["EventDate"] = formatDateTime(getAdjustedDate(nowutc(),self._conf))
     
     from MaKaC.webinterface.rh.collaboration import RCCollaborationAdmin, RCCollaborationPluginAdmin
     vars["UserIsAdmin"] = RCCollaborationAdmin.hasRights(user = self._user) or RCCollaborationPluginAdmin.hasRights(user = self._user, plugins = self._tabPlugins)
     
     singleBookingForms = {}
     multipleBookingForms = {}
     JSCodes = {}
     canBeNotified = {}
     
     for plugin in singleBookingPlugins:
         pluginName = plugin.getName()
         templateClass = CollaborationTools.getTemplateClass(pluginName, "WNewBookingForm")
         singleBookingForms[pluginName] = templateClass(self._conf, pluginName, self._user).getHTML()
         
     for plugin in multipleBookingPlugins:
         pluginName = plugin.getName()
         templateClass = CollaborationTools.getTemplateClass(pluginName, "WNewBookingForm")
         multipleBookingForms[pluginName] = templateClass(self._conf, pluginName, self._user).getHTML()
     
     for plugin in plugins:
         pluginName = plugin.getName()
         
         templateClass = CollaborationTools.getTemplateClass(pluginName, "WMain")
         JSCodes[pluginName] = templateClass(pluginName, self._conf).getHTML()
         
         bookingClass = CollaborationTools.getCSBookingClass(pluginName)
         canBeNotified[pluginName] = bookingClass._canBeNotifiedOfEventDateChanges
         
     vars["SingleBookingForms"] = singleBookingForms    
     vars["MultipleBookingForms"] = multipleBookingForms
     vars["JSCodes"] = JSCodes
     vars["CanBeNotified"] = canBeNotified
     
     return vars
示例#21
0
 def talkListText(cls, conf, talkList):
     text = []
     
     #we sort by start date
     talkList.sort(key = Contribution.contributionStartDateForSort)
     
     #we check is event is single day
     singleDayEvent = isSameDay(conf.getStartDate(), conf.getEndDate(), conf.getTimezone())
     
     for contribution in talkList:
         
         #1. speakers text
         speakerList = contribution.getSpeakerList()
         if speakerList:
             speakers = ', by ' + ", ".join([person.getFullName() for person in speakerList])
         else:
             speakers = ''
         
         #2. room and location text
         locationStr = MailTools.locationOrRoomToStr(contribution.getLocation())
         roomStr = MailTools.locationOrRoomToStr(contribution.getRoom())
         confLocationStr = MailTools.locationOrRoomToStr(conf.getLocation())
         confRoomStr = MailTools.locationOrRoomToStr(conf.getRoom())
         
         if locationStr == confLocationStr and roomStr == confRoomStr:
             locationText = ''
         else:
             if locationStr:
                 locationText = "Location: " + locationStr
                 if roomStr:
                     locationText += ', Room: ' + roomStr
                 else:
                     locationText += ', Room: not defined'
             else:
                 locationText = "Location: not defined"
             
             locationText = " (%s)" % locationText
             
         #3. dates text
         if not contribution.getStartDate():
             datesText = '(Not scheduled)'
         elif singleDayEvent and isSameDay(conf.getStartDate(), contribution.getStartDate(), conf.getTimezone()):
             datesText = formatTime(contribution.getAdjustedStartDate().time()) + ' (' + formatDuration(contribution.getDuration(), "hours_minutes") + ')'
         else:
             datesText = formatDateTime(contribution.getAdjustedStartDate(), showWeek = True) + ' (' + formatDuration(contribution.getDuration(), "hours_minutes") + ')'
             
         #4. returned result
         contributionLine = """•%s : <a href="%s">%s</a>%s (id: %s)%s""" % (
             datesText,
             urlHandlers.UHContributionDisplay.getURL(contribution),
             contribution.getTitle(),
             speakers,
             contribution.getId(),
             locationText
         )
         text.append(contributionLine)
     
     return text
示例#22
0
    def talkListText(cls, conf, talkList):
        text = []

        #we sort by start date
        talkList.sort(key = Contribution.contributionStartDateForSort)

        #we check is event is single day
        singleDayEvent = isSameDay(conf.getStartDate(), conf.getEndDate(), conf.getTimezone())

        for contribution in talkList:

            #1. speakers text
            speakerList = contribution.getSpeakerList()
            if speakerList:
                speakers = ', by ' + ", ".join([person.getFullName() for person in speakerList])
            else:
                speakers = ''

            #2. room and location text
            locationStr = MailTools.locationOrRoomToStr(contribution.getLocation())
            roomStr = MailTools.locationOrRoomToStr(contribution.getRoom())
            confLocationStr = MailTools.locationOrRoomToStr(conf.getLocation())
            confRoomStr = MailTools.locationOrRoomToStr(conf.getRoom())

            if locationStr == confLocationStr and roomStr == confRoomStr:
                locationText = ''
            else:
                if locationStr:
                    locationText = "Location: " + locationStr
                    if roomStr:
                        locationText += ', Room: ' + roomStr
                    else:
                        locationText += ', Room: not defined'
                else:
                    locationText = "Location: not defined"

                locationText = " (%s)" % locationText

            #3. dates text
            if not contribution.getStartDate():
                datesText = '(Not scheduled)'
            elif singleDayEvent and isSameDay(conf.getStartDate(), contribution.getStartDate(), conf.getTimezone()):
                datesText = formatTime(contribution.getAdjustedStartDate().time()) + ' (' + formatDuration(contribution.getDuration(), "hours_minutes") + ')'
            else:
                datesText = formatDateTime(contribution.getAdjustedStartDate(), showWeek = True) + ' (' + formatDuration(contribution.getDuration(), "hours_minutes") + ')'

            #4. returned result
            contributionLine = """•%s : <a href="%s">%s</a>%s (id: %s)%s""" % (
                datesText,
                urlHandlers.UHContributionDisplay.getURL(contribution),
                contribution.getTitle(),
                speakers,
                contribution.getId(),
                locationText
            )
            text.append(contributionLine)

        return text
示例#23
0
 def getVars(self):
     vars = WJSBase.getVars(self)
     vars["SessionTimes"] = "{}"
     vars["MinStartDate"] = ''
     vars["MaxEndDate"] = ''
     vars["AllowedStartMinutes"] = self._WebExOptions["allowedPastMinutes"].getValue()
     vars["LoggedInEmail"] = self._user.getEmail()
     sessionTimes = ""
     if not hasattr(self, "_conf") or self._conf is None:
         return vars
     sessionList = self._conf.getSessionList()
     for session in sessionList:
         sessionTimes = sessionTimes + """{"id":"%s", "start":"%s", "end":"%s" },""" % (str(session.getId()), formatDateTime(session.getAdjustedStartDate()), formatDateTime(session.getAdjustedEndDate()))
     vars["SessionTimes"] = '{ "sessions": [' + sessionTimes[:-1] + ']}'
     if self._conf:
         vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf), format="%a %d/%m %H:%M")
         vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf), format="%a %d/%m %H:%M")
     return vars
示例#24
0
    def _getAnswer(self):
        sessions = self._conf.getSessionList()
        result = {}

        for sess in sessions:
            for slot in sess.getSortedSlotList():
                time = " (" + formatDateTime(slot.getAdjustedStartDate(), format="dd MMM yyyy HH:mm") + ")"
                result["s"+sess.getId()+"l"+slot.getId()] = sess.getTitle() + (" - " + slot.getTitle() if slot.getTitle() else "") + time

        return result
示例#25
0
    def _getAnswer(self):
        contributions = self._conf.getContributionList()
        result = {}
        for cont in contributions:
            if not cont.isScheduled():
                continue
            session = (" (" + cont.getSession().getTitle() + ")") if (cont.getSession() is not None) else ""
            time = " (" + formatDateTime(cont.getAdjustedStartDate(), format="dd MMM yyyy HH:mm") + ")"
            result[cont.getId()] = cont.getTitle() + session + time

        return result
示例#26
0
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))
示例#27
0
文件: mail.py 项目: sylvestre/indico
    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)))
示例#28
0
    def bookingModificationDate(cls, booking, typeOfMail):
        if (typeOfMail == 'new'):
            return ""
        else:
            return """
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Modification date:</strong>
        </td>
        <td style="vertical-align: top;">
            %s
        </td>
    </tr>
""" % formatDateTime(getAdjustedDate(booking.getModificationDate(), booking.getConference()))
示例#29
0
文件: pages.py 项目: sylvestre/indico
 def getVars(self):
     vars = WJSBase.getVars(self)
     vars["SessionTimes"] = "{}"
     vars["MinStartDate"] = ''
     vars["MaxEndDate"] = ''
     vars["AllowedStartMinutes"] = self._WebExOptions[
         "allowedPastMinutes"].getValue()
     vars["LoggedInEmail"] = self._user.getEmail()
     sessionTimes = ""
     if not hasattr(self, "_conf") or self._conf == None:
         return vars
     sessionList = self._conf.getSessionList()
     for session in sessionList:
         sessionTimes = sessionTimes + """{"id":"%s", "start":"%s", "end":"%s" },""" % (
             str(session.getId()),
             formatDateTime(session.getAdjustedStartDate()),
             formatDateTime(session.getAdjustedEndDate()))
     vars["SessionTimes"] = '{ "sessions": [' + sessionTimes[:-1] + ']}'
     if self._conf:
         vars["MinStartDate"] = formatDateTime(getMinStartDate(self._conf),
                                               format="%a %d/%m %H:%M")
         vars["MaxEndDate"] = formatDateTime(getMaxEndDate(self._conf),
                                             format="%a %d/%m %H:%M")
     return vars
示例#30
0
文件: pages.py 项目: arturodr/indico
class WConfModifChat(wcomponents.WTemplated):
    def __init__(self, conference, activeTab, tabNames, aw):
        self._conf = conference
        self._activeTab = activeTab
        self._tabNames = tabNames
        self._aw = aw
        self._user = aw.getUser()

    def getVars(self):
        vars = WTemplated.getVars(self)
        vars["Conference"] = self._conf
        try:
            chatrooms = list(DBHelpers.getChatroomList(self._conf))
            vars["Chatrooms"] = fossilize(chatrooms)
            if len(vars['Chatrooms']) is 0:
                vars['Chatrooms'] = None
        except Exception, e:
            vars["Chatrooms"] = None
            chatrooms = {}
        links = {}

        for cr in chatrooms:
            crinfo = links[cr.getId()] = {}
            crinfo['custom'] = generateCustomLinks(cr)
            crinfo['logs'] = generateLogLink(cr, self._conf)

        vars['links'] = links

        vars['DefaultServer'] = PluginFieldsWrapper(
            'InstantMessaging', 'XMPP').getOption('chatServerHost')
        vars["EventDate"] = formatDateTime(
            getAdjustedDate(nowutc(), self._conf))
        vars["User"] = self._user
        vars["tz"] = DisplayTZ(self._aw, self._conf).getDisplayTZ()
        vars["MaterialUrl"] = RHMaterialsShow._uh().getURL(
            self._conf).__str__()
        vars["ShowLogsLink"] = XMPPLogsActivated()

        return vars
 def bookingCreationDate(cls, booking):
     return formatDateTime(
         getAdjustedDate(booking.getCreationDate(),
                         booking.getConference()))
示例#32
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)
        defaultDefinePlace = defaultDefineRoom = ""
        defaultInheritPlace = defaultInheritRoom = "checked"
        locationName, locationAddress, roomName, defaultExistRoom = "", "", "", ""

        vars["conference"] = self._conf
        vars["boardNumber"] = quoteattr(str(self._contrib.getBoardNumber()))
        vars["contrib"] = self._contrib
        vars["title"] = quoteattr(self._contrib.getTitle())
        vars["description"] = self.htmlText(self._contrib.getDescription())
        vars["additionalFields"] = self._contrib.getConference(
        ).getAbstractMgr().getAbstractFieldsMgr().getFields()
        vars["fieldDict"] = self._getAdditionalFieldsData()
        vars["day"] = ""
        vars["month"] = ""
        vars["year"] = ""
        vars["sHour"] = ""
        vars["sMinute"] = ""
        sDate = self._contrib.getStartDate()
        if sDate is not None:
            vars["day"] = quoteattr(str(sDate.day))
            vars["month"] = quoteattr(str(sDate.month))
            vars["year"] = quoteattr(str(sDate.year))
            vars["sHour"] = quoteattr(str(sDate.hour))
            vars["sMinute"] = quoteattr(str(sDate.minute))
        if self._contrib.getStartDate():
            vars["dateTime"] = formatDateTime(
                self._contrib.getAdjustedStartDate())
        else:
            vars["dateTime"] = ""
        vars["duration"] = self._contrib.getDuration().seconds / 60
        if self._contrib.getDuration() is not None:
            vars["durationHours"] = quoteattr(
                str((datetime(1900, 1, 1) + self._contrib.getDuration()).hour))
            vars["durationMinutes"] = quoteattr(
                str((datetime(1900, 1, 1) +
                     self._contrib.getDuration()).minute))
        if self._contrib.getOwnLocation():
            defaultDefinePlace = "checked"
            defaultInheritPlace = ""
            locationName = self._contrib.getLocation().getName()
            locationAddress = self._contrib.getLocation().getAddress()

        if self._contrib.getOwnRoom():
            defaultDefineRoom = "checked"
            defaultInheritRoom = ""
            defaultExistRoom = ""
            roomName = self._contrib.getRoom().getName()
        vars["defaultInheritPlace"] = defaultInheritPlace
        vars["defaultDefinePlace"] = defaultDefinePlace
        vars["confPlace"] = ""
        confLocation = self._owner.getLocation()
        if self._contrib.isScheduled():
            confLocation = self._contrib.getSchEntry().getSchedule().getOwner(
            ).getLocation()
        if self._contrib.getSession(
        ) and not self._contrib.getConference().getEnableSessionSlots():
            confLocation = self._contrib.getSession().getLocation()
        if confLocation:
            vars["confPlace"] = confLocation.getName()
        vars["locationName"] = locationName
        vars["locationAddress"] = locationAddress
        vars["defaultInheritRoom"] = defaultInheritRoom
        vars["defaultDefineRoom"] = defaultDefineRoom
        vars["defaultExistRoom"] = defaultExistRoom
        vars["confRoom"] = ""
        confRoom = self._owner.getRoom()
        rx = []
        roomsexist = self._conf.getRoomList()
        roomsexist.sort()
        for room in roomsexist:
            sel = ""
            rx.append("""<option value=%s%s>%s</option>""" %
                      (quoteattr(str(room)), sel, self.htmlText(room)))
        vars["roomsexist"] = "".join(rx)
        if self._contrib.isScheduled():
            confRoom = self._contrib.getSchEntry().getSchedule().getOwner(
            ).getRoom()
        if self._contrib.getSession(
        ) and not self._contrib.getConference().getEnableSessionSlots():
            confRoom = self._contrib.getSession().getRoom()
        if confRoom:
            vars["confRoom"] = confRoom.getName()
        vars["roomName"] = quoteattr(roomName)
        vars["parentType"] = "conference"
        if self._contrib.getSession() is not None:
            vars["parentType"] = "session"
            if self._contrib.isScheduled() and self._contrib.getConference(
            ).getEnableSessionSlots():
                vars["parentType"] = "session slot"
        vars["postURL"] = urlHandlers.UHContributionDataModif.getURL(
            self._contrib)
        vars["types"] = self._getTypeItemsHTML()
        vars["keywords"] = self._contrib.getKeywords()
        import MaKaC.webinterface.webFactoryRegistry as webFactoryRegistry
        wr = webFactoryRegistry.WebFactoryRegistry()
        wf = wr.getFactory(self._conf)
        if wf is not None:
            type = wf.getId()
        else:
            type = "conference"
        if type == "conference":
            vars["Type"] = WContributionDataModificationType().getHTML(vars)
            vars["Board"] = WContributionDataModificationBoard().getHTML(vars)
        else:
            vars["Type"] = ""
            vars["Board"] = ""

        vars["useRoomBookingModule"] = Config.getInstance(
        ).getIsRoomBookingActive()
        if self._contrib.getSession():
            vars["sessionType"] = self._contrib.getSession().getScheduleType()
        else:
            vars["sessionType"] = 'none'
        return vars
示例#33
0
    def getVars(self):
        vars = WJSBase.getVars( self )

        vars["MinStartDate"] = formatDateTime(self._conf.getAdjustedStartDate())
        vars["MaxEndDate"] = formatDateTime(self._conf.getAdjustedEndDate())

        # Code to retrieve the event's location and room in order to include the event's room
        # as an initial participant
        location = self._conf.getLocation()
        room = self._conf.getRoom()
        if location and room and location.getName() and room.getName() and location.getName().strip() and room.getName().strip():
            locationName = location.getName()
            roomName = room.getName()
            
            vars["IncludeInitialRoom"] = True
            vars["IPRetrievalResult"] = -1 # 0 = OK, 1 = room without H323 IP, 2 = room with invalid H323 IP, 3 = connection to RB problem, 4 = another unknown problem 
            vars["InitialRoomName"] = roomName
            if self._conf.getLocation():
                vars["InitialRoomInstitution"] = locationName
            else:
                vars["InitialRoomInstitution"] = ""

            # TODO: get IP of room from a plugin option instead of querying RB DB every time
            try:
                minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
                if minfo.getRoomBookingModuleActive():
                    Logger.get("CERNMCU").info("Connecting with Room Booking DB to get a room's H323 IP")
                    CrossLocationDB.connect()
                    Logger.get("CERNMCU").info("Connection successful")

                    attName = getCERNMCUOptionValueByName("H323_IP_att_name")

                    try:
                        returnedRooms = CrossLocationQueries.getRooms( location = locationName, roomName = roomName )
    
                        if isinstance(returnedRooms, list):
                            if len(returnedRooms) == 0:
                                returnedRoom = None
                            else:
                                returnedRoom = returnedRooms[0]
                        else:
                            returnedRoom = returnedRooms
    
                        if (returnedRoom != None) and (attName in returnedRoom.customAtts):
    
                            initialRoomIp = returnedRoom.customAtts[attName]
                            if (initialRoomIp.strip() == ""):
                                vars["IPRetrievalResult"] = 1
                            elif not validIP(initialRoomIp):
                                vars["IPRetrievalResult"] = 2
                            else:
                                vars["IPRetrievalResult"] = 0
    
                        else:
                            initialRoomIp = "IP not defined for this room."
                            vars["IPRetrievalResult"] = 2
                            
                    except AttributeError:
                        #CrossLocationQueries.getRooms fails because it does not handle location names that are not in the DB
                        initialRoomIp = "Please enter IP"
                        vars["IPRetrievalResult"] = 1
                    except Exception, e:
                        initialRoomIp = "IP not found."
                        vars["IPRetrievalResult"] = 4
                        Logger.get("CERNMCU").warning("Location: " + locationName + "Problem with CrossLocationQueries when retrieving the list of all rooms with a H323 IP: " + str(e))
                else:
                    initialRoomIp = "Please enter IP"
                    vars["IPRetrievalResult"] = 3
                    Logger.get("CERNMCU").info("Tried to retrieve a room's H323 IP, but Room Booking module was not active.")
示例#34
0
文件: mail.py 项目: sylvestre/indico
    def _getBookingDetails(self, typeOfMail):
        bp = self._bp

        return """
Request details:<br />
<table style="border-spacing: 10px 10px;">
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Booking id:</strong>
        </td>
        <td style="vertical-align: top;">
            %s
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Creation date:</strong>
        </td>
        <td style="vertical-align: top;">
            %s
        </td>
    </tr>
    %s
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Meeting title:</strong>
        </td>
        <td style="vertical-align: top;">
            %s
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Meeting description:</strong>
        </td>
        <td style="vertical-align: top;">
            %s
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Community:</strong>
        </td>
        <td style="vertical-align: top;">
            %s (id: %s)
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Phone bridge ID:</strong>
        </td>
        <td style="vertical-align: top;">
            %s
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Start date:</strong>
        </td>
        <td style="vertical-align: top">
            %s
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>End date:</strong>
        </td>
        <td style="vertical-align: top">
            %s
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Access password yes/no:</strong>
        </td>
        <td style="vertical-align: top">
            %s
        </td>
    </tr>
    <tr>
        <td style="vertical-align: top; white-space : nowrap;">
            <strong>Auto-join URL:</strong>
        </td>
        <td style="vertical-align: top">
            %s
        </td>
    </tr>
</table>
"""%(self._booking.getId(),
     MailTools.bookingCreationDate(self._booking),
     MailTools.bookingModificationDate(self._booking, typeOfMail),
     bp["meetingTitle"],
     bp["meetingDescription"],
     self._booking.getCommunityName(),
     bp["communityId"],
     self._booking.getPhoneBridgeId(),
     formatDateTime(self._booking.getAdjustedStartDate()),
     formatDateTime(self._booking.getAdjustedEndDate()),
     self._getHasAccessPassword(),
     self._getAutoJoinURL(typeOfMail)
     )
示例#35
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)

        plugins = self._tabPlugins
        singleBookingPlugins, multipleBookingPlugins = CollaborationTools.splitPluginsByAllowMultiple(plugins)
        csBookingManager = self._conf.getCSBookingManager()

        bookingsS = {}

        for p in singleBookingPlugins:
            bookingList = csBookingManager.getBookingList(filterByType = p.getId())
            if len(bookingList) > 0:
                bookingsS[p.getId()] = fossilize(bookingList[0]) #will use ICSBookingConfModifBaseFossil or inheriting fossil

        bookingsM = fossilize(csBookingManager.getBookingList(
            sorted = True,
            notify = True,
            filterByType = [p.getName() for p in multipleBookingPlugins])) #will use ICSBookingConfModifBaseFossil or inheriting fossil

        vars["Conference"] = self._conf
        vars["AllPlugins"] = plugins
        vars["SingleBookingPlugins"] = singleBookingPlugins
        vars["BookingsS"] = bookingsS
        vars["MultipleBookingPlugins"] = multipleBookingPlugins
        vars["BookingsM"] = bookingsM
        vars["Tab"] = self._activeTab
        vars["EventDate"] = formatDateTime(getAdjustedDate(nowutc(), self._conf))

        from MaKaC.webinterface.rh.collaboration import RCCollaborationAdmin, RCCollaborationPluginAdmin, RCVideoServicesUser
        vars["UserIsAdmin"] = RCCollaborationAdmin.hasRights(user = self._user) or RCCollaborationPluginAdmin.hasRights(user = self._user, plugins = self._tabPlugins)

        hasCreatePermissions = {}
        videoServSupport = {}
        for plugin in plugins:
            pname = plugin.getName()
            hasCreatePermissions[pname] = RCVideoServicesUser.hasRights(user = self._user, pluginName = pname)
            videoServSupport[pname] = plugin.getOption("contactSupport").getValue() if plugin.hasOption("contactSupport") else ""
        vars["HasCreatePermissions"] = hasCreatePermissions
        vars["VideoServiceSupport"] = videoServSupport




        singleBookingForms = {}
        multipleBookingForms = {}
        jsCodes = {}
        canBeNotified = {}

        for plugin in singleBookingPlugins:
            pluginId = plugin.getId()
            templateClass = CollaborationTools.getTemplateClass(pluginId, "WNewBookingForm")
            singleBookingForms[pluginId] = templateClass(self._conf, plugin.getId(), self._user).getHTML()

        for plugin in multipleBookingPlugins:
            pluginId = plugin.getId()
            templateClass = CollaborationTools.getTemplateClass(pluginId, "WNewBookingForm")
            newBookingFormHTML = templateClass(self._conf, plugin.getId(), self._user).getHTML()

            advancedTabClass = CollaborationTools.getTemplateClass(pluginId, "WAdvancedTab")
            if advancedTabClass:
                advancedTabClassHTML = advancedTabClass(self._conf, plugin.getId(), self._user).getHTML()
            else:
                advancedTabClassHTML = WConfModifCollaborationDefaultAdvancedTab(self._conf, plugin, self._user).getHTML()
            multipleBookingForms[pluginId] = (newBookingFormHTML, advancedTabClassHTML)

        for plugin in plugins:
            pluginId = plugin.getId()

            templateClass = CollaborationTools.getTemplateClass(pluginId, "WMain")
            jsCodes[pluginId] = templateClass(self._conf, plugin.getId(), self._user).getHTML()

            bookingClass = CollaborationTools.getCSBookingClass(pluginId)
            canBeNotified[pluginId] = bookingClass._canBeNotifiedOfEventDateChanges

        vars["SingleBookingForms"] = singleBookingForms
        vars["MultipleBookingForms"] = multipleBookingForms
        vars["JSCodes"] = jsCodes
        vars["CanBeNotified"] = canBeNotified

        return vars