Beispiel #1
0
 def _checkParams( self, params ):
     categIdList = self._normaliseListParam( params.get("selCateg", []) )
     self._categList = []
     cm = conference.CategoryManager()
     for id in categIdList:
         try:
             self._categList.append( cm.getById(id) )
         except KeyError:
             continue
     self._target = self._categList
     if not self._categList:
         cm = conference.CategoryManager()
         self._categList.append( cm.getRoot() )
     tz = DisplayTZ(self._aw).getDisplayTZ()
     months = params.get("months", 3)
     columns = params.get("columns",3)
     month = int( params.get("month", (nowutc()-relativedelta(months=1)).astimezone(timezone(tz)).month) )
     year = int( params.get("year", nowutc().astimezone(timezone(tz)).year) )
     sdate = timezone(tz).localize(datetime( year, month, 1 ))
     self._cal = wcalendar.MonthCalendar( self._aw, \
                                             sdate, \
                                             months, \
                                             columns, \
                                             self._categList )
     self._categ = self._categList[0]
Beispiel #2
0
 def _checkParams(self, params):
     categIdList = self._normaliseListParam(params.get("selCateg", []))
     self._categList = []
     cm = conference.CategoryManager()
     for id in categIdList:
         try:
             self._categList.append(cm.getById(id))
         except KeyError:
             continue
     self._target = self._categList
     if not self._categList:
         cm = conference.CategoryManager()
         self._categList.append(cm.getRoot())
     tz = DisplayTZ(self._aw).getDisplayTZ()
     months = params.get("months", 3)
     columns = params.get("columns", 3)
     month = int(
         params.get("month",
                    (nowutc() - relativedelta(months=1)).astimezone(
                        timezone(tz)).month))
     year = int(params.get("year", nowutc().astimezone(timezone(tz)).year))
     sdate = timezone(tz).localize(datetime(year, month, 1))
     self._cal = wcalendar.MonthCalendar( self._aw, \
                                             sdate, \
                                             months, \
                                             columns, \
                                             self._categList )
     self._categ = self._categList[0]
Beispiel #3
0
 def getMonthOverviewUrl(cls, categ):
     url = cls.getURL(categ)
     p = {"day": nowutc().day,
          "month": nowutc().month,
          "year": nowutc().year,
          "period": "month",
          "detail": "conference"}
     url.addParams(p)
     return url
Beispiel #4
0
 def getMonthOverviewUrl(cls, categ):
     url = cls.getURL(categ)
     p = {"day": nowutc().day,
          "month": nowutc().month,
          "year": nowutc().year,
          "period": "month",
          "detail": "conference"}
     url.addParams(p)
     return url
Beispiel #5
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)

        #dictionary where the keys are names of false "indexes" for the user, and the values are IndexInformation objects
        indexes = CollaborationTools.getCollaborationPluginType().getOption("pluginsPerIndex").getValue()
        indexNames = set(i.getName() for i in indexes)
        indexList = ['all', None, 'Vidyo', 'EVO', 'CERNMCU', 'All Videoconference', None, 'WebcastRequest', 'RecordingRequest', 'All Requests']
        vars["Indexes"] = [x for x in indexList if x is None or x in indexNames]
        vars["IndexInformation"] = fossilize(dict([(i.getName(), i) for i in indexes]), IIndexInformationFossil)
        vars["InitialIndex"] = self._queryParams["indexName"]
        vars["InitialViewBy"] = self._queryParams["viewBy"]
        vars["InitialOrderBy"] = self._queryParams["orderBy"]
        vars["InitialOnlyPending"] = self._queryParams["onlyPending"]
        vars["InitialConferenceId"] = self._queryParams["conferenceId"]
        vars["InitialCategoryId"] = self._queryParams["categoryId"]
        vars["InitialSinceDate"] = self._queryParams["sinceDate"]
        vars["InitialToDate"] = self._queryParams["toDate"]
        vars["InitialFromDays"] = self._queryParams["fromDays"]
        vars["InitialToDays"] = self._queryParams["toDays"]
        vars["InitialFromTitle"] = self._queryParams["fromTitle"]
        vars["InitialToTitle"] = self._queryParams["toTitle"]
        vars["InitialResultsPerPage"] = self._queryParams["resultsPerPage"]
        vars["InitialPage"] = self._queryParams["page"]
        vars["BaseURL"] = collaborationUrlHandlers.UHAdminCollaboration.getURL()
        vars["ConfCollaborationDisplay"] = collaborationUrlHandlers.UHCollaborationDisplay.getURL()

        if self._queryParams["queryOnLoad"]:
            ci = IndexesHolder().getById('collaboration')
            tz = self._rh._getUser().getTimezone()
            #####
            minKey = None
            maxKey = None
            if self._queryParams['sinceDate']:
                minKey = setAdjustedDate(datetime.strptime(self._queryParams['sinceDate'].strip(), '%Y/%m/%d'),
                                         tz=tz)
            if self._queryParams['toDate']:
                maxKey = setAdjustedDate(datetime.strptime(self._queryParams['toDate'].strip(), '%Y/%m/%d'),
                                         tz=tz)
            if self._queryParams['fromTitle']:
                minKey = self._queryParams['fromTitle'].strip()
            if self._queryParams['toTitle']:
                maxKey = self._queryParams['toTitle'].strip()
            if self._queryParams['fromDays']:
                try:
                    fromDays = int(self._queryParams['fromDays'])
                except ValueError, e:
                    raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e)
                midnight = nowutc().replace(hour=0, minute=0, second=0)
                minKey = midnight - timedelta(days = fromDays)
            if self._queryParams['toDays']:
                try:
                    toDays = int(self._queryParams['toDays'])
                except ValueError, e:
                    raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e)
                midnight_1 = nowutc().replace(hour=23, minute=59, second=59)
                maxKey = midnight_1 + timedelta(days = toDays)
Beispiel #6
0
    def _checkParams(self):
        AdminCollaborationBase._checkParams(self)
        user = self.getAW().getUser()
        if user: #someone is logged in. if not, AdminCollaborationBase's _checkProtection will take care of it
            self._tz = user.getTimezone()

            try:
                self._page = self._params.get("page", None)
                self._resultsPerPage = self._params.get("resultsPerPage", None)
                self._indexName = self._params['indexName']
                self._viewBy = self._params['viewBy']
                self._orderBy = self._params['orderBy']

                minKey = None
                maxKey = None
                if self._params['sinceDate']:
                    minKey = setAdjustedDate(parseDateTime(self._params['sinceDate'].strip()), tz = self._tz)
                if self._params['toDate']:
                    maxKey = setAdjustedDate(parseDateTime(self._params['toDate'].strip()), tz = self._tz)
                if self._params['fromTitle']:
                    minKey = self._params['fromTitle'].strip()
                if self._params['toTitle']:
                    maxKey = self._params['toTitle'].strip()

                """ For relative dates, create a diff timedelta for resetting to
                    00:00 at the start of range and 23:59 at the end.
                """
                if self._params['fromDays']:
                    try:
                        fromDays = int(self._params['fromDays'])
                    except ValueError, e:
                        raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e)
                    midnight = nowutc().replace(hour=0, minute=0, second=0)
                    minKey = midnight - timedelta(days = fromDays)
                if self._params['toDays']:
                    try:
                        toDays = int(self._params['toDays'])
                    except ValueError, e:
                        raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e)
                    midnight_1 = nowutc().replace(hour=23, minute=59, second=59)
                    maxKey = midnight_1 + timedelta(days = toDays)

                self._minKey = minKey
                self._maxKey = maxKey

                self._onlyPending = self._params['onlyPending']
                categoryId = self._params['categoryId'].strip()
                if categoryId:
                    self._categoryId = categoryId
                else:
                    self._categoryId = None
                conferenceId = self._params['conferenceId'].strip()
                if conferenceId:
                    self._conferenceId = conferenceId
                else:
                    self._conferenceId = None
Beispiel #7
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)

        #dictionary where the keys are names of false "indexes" for the user, and the values are IndexInformation objects
        indexes = CollaborationTools.getCollaborationPluginType().getOption("pluginsPerIndex").getValue()
        indexNames = set(i.getName() for i in indexes)
        indexList = ['all', None, 'Vidyo', 'EVO', 'CERNMCU', 'All Videoconference', None, 'WebcastRequest', 'RecordingRequest', 'All Requests']
        vars["Indexes"] = [x for x in indexList if x is None or x in indexNames]
        vars["IndexInformation"] = fossilize(dict([(i.getName(), i) for i in indexes]), IIndexInformationFossil)
        vars["InitialIndex"] = self._queryParams["indexName"]
        vars["InitialViewBy"] = self._queryParams["viewBy"]
        vars["InitialOrderBy"] = self._queryParams["orderBy"]
        vars["InitialOnlyPending"] = self._queryParams["onlyPending"]
        vars["InitialConferenceId"] = self._queryParams["conferenceId"]
        vars["InitialCategoryId"] = self._queryParams["categoryId"]
        vars["InitialSinceDate"] = self._queryParams["sinceDate"]
        vars["InitialToDate"] = self._queryParams["toDate"]
        vars["InitialFromDays"] = self._queryParams["fromDays"]
        vars["InitialToDays"] = self._queryParams["toDays"]
        vars["InitialFromTitle"] = self._queryParams["fromTitle"]
        vars["InitialToTitle"] = self._queryParams["toTitle"]
        vars["InitialResultsPerPage"] = self._queryParams["resultsPerPage"]
        vars["InitialPage"] = self._queryParams["page"]
        vars["BaseURL"] = collaborationUrlHandlers.UHAdminCollaboration.getURL()
        vars["ConfCollaborationDisplay"] = collaborationUrlHandlers.UHCollaborationDisplay.getURL()

        if self._queryParams["queryOnLoad"]:
            ci = IndexesHolder().getById('collaboration')
            tz = self._rh._getUser().getTimezone()
            #####
            minKey = None
            maxKey = None
            if self._queryParams['sinceDate']:
                minKey = setAdjustedDate(datetime.strptime(self._queryParams['sinceDate'].strip(), '%Y/%m/%d'),
                                         tz=tz)
            if self._queryParams['toDate']:
                maxKey = setAdjustedDate(datetime.strptime(self._queryParams['toDate'].strip(), '%Y/%m/%d'),
                                         tz=tz)
            if self._queryParams['fromTitle']:
                minKey = self._queryParams['fromTitle'].strip()
            if self._queryParams['toTitle']:
                maxKey = self._queryParams['toTitle'].strip()
            if self._queryParams['fromDays']:
                try:
                    fromDays = int(self._queryParams['fromDays'])
                except ValueError, e:
                    raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e)
                midnight = nowutc().replace(hour=0, minute=0, second=0)
                minKey = midnight - timedelta(days = fromDays)
            if self._queryParams['toDays']:
                try:
                    toDays = int(self._queryParams['toDays'])
                except ValueError, e:
                    raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e)
                midnight_1 = nowutc().replace(hour=23, minute=59, second=59)
                maxKey = midnight_1 + timedelta(days = toDays)
Beispiel #8
0
 def call(self):
     categ1 = CategoryManager().getById('1') #target category here
     for i in xrange(1, 0 + 1): #number of conferences to create here
         c = categ1.newConference(AvatarHolder().getById('1')) #creator of event
         c.setTitle("event " + str(i))
         c.setTimezone('UTC')
         c.setDates(nowutc() - timedelta(hours = i), nowutc() - timedelta(hours = i - 1))
         for j in xrange(1, 0+1): #number of bookings per event
             Catalog.getIdx("cs_bookingmanager_conference").get(c.getId()).createBooking("Vidyo", {"roomName":"room_"+str(i)+"_"+str(j),
                                                             "roomDescription": "test",
                                                             "owner":{"_type": "Avatar", "id":"1"}})
Beispiel #9
0
 def _checkParams(self):
     AdminCollaborationBase._checkParams(self)
     user = self.getAW().getUser()
     if user: #someone is logged in. if not, AdminCollaborationBase's _checkProtection will take care of it
         self._tz = user.getTimezone()
         
         try:
             self._page = self._params.get("page", None)
             self._resultsPerPage = self._params.get("resultsPerPage", None)
             self._indexName = self._params['indexName']
             self._viewBy = self._params['viewBy']
             self._orderBy = self._params['orderBy']
             
             minKey = None
             maxKey = None
             if self._params['sinceDate']:
                 minKey = setAdjustedDate(parseDateTime(self._params['sinceDate'].strip()), tz = self._tz)
             if self._params['toDate']:
                 maxKey = setAdjustedDate(parseDateTime(self._params['toDate'].strip()), tz = self._tz)
             if self._params['fromTitle']:
                 minKey = self._params['fromTitle'].strip()
             if self._params['toTitle']:
                 maxKey = self._params['toTitle'].strip()
             if self._params['fromDays']:
                 try:
                     fromDays = int(self._params['fromDays'])
                 except ValueError, e:
                     raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e)
                 minKey = nowutc() - timedelta(days = fromDays)
             if self._params['toDays']:
                 try:
                     toDays = int(self._params['toDays'])
                 except ValueError, e:
                     raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e)
                 maxKey = nowutc() + timedelta(days = toDays)
                 
             self._minKey = minKey
             self._maxKey = maxKey
                 
             self._onlyPending = self._params['onlyPending']
             categoryId = self._params['categoryId'].strip()
             if categoryId:
                 self._categoryId = categoryId
             else:
                 self._categoryId = None
             conferenceId = self._params['conferenceId'].strip()
             if conferenceId:
                 self._conferenceId = conferenceId
             else:
                 self._conferenceId = None
Beispiel #10
0
    def _processEventDisplay(self, event):

        dateTime = event.getStartDate()

        if dateTime < timezoneUtils.nowutc():
            status = 'ongoing'
            # return end date instead (for 'ongoing till...')
            dateTime = event.getEndDate()
        elif dateTime.date() == timezoneUtils.nowutc().date():
            status = 'today'
        else:
            status = 'future'

        return (status, dateTime, event.getTitle(), event.getId())
Beispiel #11
0
    def _processEventDisplay(self, event):

        dateTime = event.getStartDate()

        if dateTime < timezoneUtils.nowutc():
            status = 'ongoing'
            # return end date instead (for 'ongoing till...')
            dateTime = event.getEndDate()
        elif dateTime.date() == timezoneUtils.nowutc().date():
            status = 'today'
        else:
            status = 'future'

        return (status, dateTime, event.getTitle(), event.getId())
Beispiel #12
0
    def _checkParams(self):
        AdminCollaborationBase._checkParams(self)
        user = self.getAW().getUser()
        if user:  # someone is logged in. if not, AdminCollaborationBase's _checkProtection will take care of it
            self._tz = user.getTimezone()

            try:
                self._page = self._params.get("page", None)
                self._resultsPerPage = self._params.get("resultsPerPage", None)
                self._indexName = self._params["indexName"]
                self._viewBy = self._params["viewBy"]
                self._orderBy = self._params["orderBy"]

                minKey = None
                maxKey = None
                if self._params["sinceDate"]:
                    minKey = setAdjustedDate(parseDateTime(self._params["sinceDate"].strip()), tz=self._tz)
                if self._params["toDate"]:
                    maxKey = setAdjustedDate(parseDateTime(self._params["toDate"].strip()), tz=self._tz)
                if self._params["fromTitle"]:
                    minKey = self._params["fromTitle"].strip()
                if self._params["toTitle"]:
                    maxKey = self._params["toTitle"].strip()
                if self._params["fromDays"]:
                    try:
                        fromDays = int(self._params["fromDays"])
                    except ValueError, e:
                        raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner=e)
                    minKey = nowutc() - timedelta(days=fromDays)
                if self._params["toDays"]:
                    try:
                        toDays = int(self._params["toDays"])
                    except ValueError, e:
                        raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner=e)
                    maxKey = nowutc() + timedelta(days=toDays)

                self._minKey = minKey
                self._maxKey = maxKey

                self._onlyPending = self._params["onlyPending"]
                categoryId = self._params["categoryId"].strip()
                if categoryId:
                    self._categoryId = categoryId
                else:
                    self._categoryId = None
                conferenceId = self._params["conferenceId"].strip()
                if conferenceId:
                    self._conferenceId = conferenceId
                else:
                    self._conferenceId = None
Beispiel #13
0
    def getVars(self):
        wvars = wcomponents.WTemplated.getVars(self)
        evaluation = self._conf.getEvaluation()
        sDate = evaluation.getStartDate()
        eDate = evaluation.getEndDate()

        wvars["body_title"] = self._getTitle()
        wvars["msg"] = _("No period for evaluation:")
        if nowutc() < sDate:
            wvars["msg"] = _("Sorry, but the evaluation is not open yet.")
        elif nowutc() > eDate:
            wvars["msg"] = _("Sorry, but the evaluation period has finished.")
        wvars["startDate"] = sDate.strftime("%A %d %B %Y")
        wvars["endDate"] = eDate.strftime("%A %d %B %Y")
        return wvars
Beispiel #14
0
 def _checkParams( self, params ):
     # month/year indicates which month should be displayed in the calendar
     # date indicates if a day should be highlighted in the calendar
     tz = DisplayTZ(self._aw).getDisplayTZ()
     if params.has_key("month") and params.get("month")=="":
         del params["month"]
     if params.has_key("year") and params.get("year")=="":
         del params["year"]
     self._month = int( params.get("month", nowutc().astimezone(timezone(tz)).month) )
     self._year = int(params.get("year", nowutc().astimezone(timezone(tz)).year))
     if params.get('date','') == '--' or params.get('date','') == '':
         self._date = '%s-%s-%s' % ( '01', self._month, self._year )
     else:
         self._date = ""
     self._form = int(params.get('form',0) )
Beispiel #15
0
    def getVars(self):
        wvars = wcomponents.WTemplated.getVars(self)
        evaluation = self._conf.getEvaluation()
        sDate = evaluation.getStartDate()
        eDate = evaluation.getEndDate()

        wvars["body_title"] = self._getTitle()
        wvars["msg"] = _("No period for evaluation:")
        if nowutc() < sDate:
            wvars["msg"] = _("Sorry, but the evaluation is not open yet.")
        elif nowutc() > eDate:
            wvars["msg"] = _("Sorry, but the evaluation period has finished.")
        wvars["startDate"] = sDate.strftime("%A %d %B %Y")
        wvars["endDate"] = eDate.strftime("%A %d %B %Y")
        return wvars
Beispiel #16
0
    def getVars(self):
        wvars = WConfDisplayBodyBase.getVars(self)

        csbm = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
        pluginNames = csbm.getEventDisplayPlugins()
        bookings = csbm.getBookingList(filterByType=pluginNames, notify=True, onlyPublic=True)
        bookings.sort(key=lambda b: b.getStartDate() or minDatetime())

        timeless_bookings = []
        ongoingBookings = []
        scheduledBookings = {} #date, list of bookings

        for b in bookings:
            if b.canBeDisplayed():
                if not b.hasStartDate():
                    timeless_bookings.append(b)
                else:
                    if b.isHappeningNow():
                        ongoingBookings.append(b)
                    elif b.getStartDate() and b.getAdjustedStartDate('UTC') > nowutc():
                        scheduledBookings.setdefault(b.getAdjustedStartDate(self._tz).date(), []).append(b)

        keys = scheduledBookings.keys()
        keys.sort()
        scheduledBookings = [(date, scheduledBookings[date]) for date in keys]

        wvars["body_title"] = self._getTitle()
        wvars["OngoingBookings"] = ongoingBookings
        wvars["ScheduledBookings"] = scheduledBookings
        wvars["timeless_bookings"] = timeless_bookings
        wvars["all_bookings"] = fossilize(bookings)
        wvars["Timezone"] = self._tz
        wvars["conf"] = self._conf

        return wvars
Beispiel #17
0
 def __init__(self, title="", content="", type=""):
     self._id = None
     self._creationDate = nowutc()
     self._content = content
     self._title = title
     self._type = type
     self._new = True
Beispiel #18
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
Beispiel #19
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
Beispiel #20
0
    def OAuthCheckAccessResource(cls):
        from indico.modules.oauth.db import ConsumerHolder, AccessTokenHolder, OAuthServer

        oauth_request = oauth.Request.from_request(
            request.method,
            request.base_url,
            request.headers,
            parameters=create_flat_args())
        Logger.get('oauth.resource').info(oauth_request)
        try:
            now = nowutc()
            consumer_key = oauth_request.get_parameter('oauth_consumer_key')
            if not ConsumerHolder().hasKey(consumer_key):
                raise OAuthError('Invalid Consumer Key', 401)
            consumer = ConsumerHolder().getById(consumer_key)
            token = oauth_request.get_parameter('oauth_token')
            if not token or not AccessTokenHolder().hasKey(token):
                raise OAuthError('Invalid Token', 401)
            access_token = AccessTokenHolder().getById(token)
            oauth_consumer = oauth.Consumer(consumer.getId(),
                                            consumer.getSecret())
            OAuthServer.getInstance().verify_request(oauth_request,
                                                     oauth_consumer,
                                                     access_token.getToken())
            if access_token.getConsumer().getId() != oauth_consumer.key:
                raise OAuthError('Invalid Consumer Key', 401)
            elif (now - access_token.getTimestamp()) > timedelta(
                    seconds=Config.getInstance().getOAuthAccessTokenTTL()):
                raise OAuthError('Expired Token', 401)
            return access_token
        except oauth.Error, e:
            if e.message.startswith("Invalid Signature"):
                raise OAuthError("Invalid Signature", 401)
            else:
                raise OAuthError(e.message, 400)
Beispiel #21
0
    def getConferencesIds(self, from_date, until_date):
        if not (from_date or until_date):
            res = []
            for key in self._ids.keys():
                res.extend(self._ids[key])
            return res
        
        fd = self.firstDate
        if from_date:
            #fd = server2utc(datetime(int(from_date[0:4]), int(from_date[5:7]), int(from_date[8:10])))
            fd = datetime(int(from_date[0:4]), int(from_date[5:7]), int(from_date[8:10]), tzinfo=timezone('UTC'))
        ud = nowutc().replace( hour=23, minute=59, second=29, microsecond=0 )
        if until_date:
            #ud = server2utc(datetime(int(until_date[0:4]), int(until_date[5:7]), int(until_date[8:10])))
            ud = datetime(int(until_date[0:4]), int(until_date[5:7]), int(until_date[8:10]), tzinfo=timezone('UTC'))
        res = []
        if fd > ud:
            return res
        date = fd
        delta = timedelta(1)
        while date <= ud:
            if date.strftime("%Y-%m-%d") in self._ids.keys():
                res.extend(self._ids[date.strftime("%Y-%m-%d")])
            date = date + delta

        return res
Beispiel #22
0
    def register():
        """
        Run ONCE to add FoundationSync task
        """
        # Connect to Indico DB
        db.DBMgr.getInstance().startRequest()
        db.DBMgr.getInstance().sync()
        TASK_ID = 'FoundationSyncTask'

        t = task()
        t.setId( TASK_ID )
        d = nowutc() + timedelta( days = 1 )
        t.setStartDate( d.replace( hour=0, minute=0, second=0, microsecond=0 )) # This midnight
        t.setInterval( timedelta( days = 1 ) )
        t.addObj( FoundationSync() )

        # Check if tasks existis
        taskList = HelperTaskList.getTaskListInstance()
        for existing in taskList.getTasks():
            if existing.getId() == t.getId():
                print TASK_ID + " is already registered"
                return

        # Task does not exist: add it
        taskList.addTask( t )

        # Disconnect from Indico DB
        db.DBMgr.getInstance().endRequest()
        print "Successfully registered " + TASK_ID
Beispiel #23
0
 def __init__(self, title="", content="", type=""):
     self._id = None
     self._creationDate = nowutc()
     self._content = content
     self._title = title
     self._type = type
     self._new = True
Beispiel #24
0
    def register():
        """
        Run ONCE to add FoundationSync task
        """
        # Connect to Indico DB
        db.DBMgr.getInstance().startRequest()
        db.DBMgr.getInstance().sync()
        TASK_ID = 'FoundationSyncTask'

        t = task()
        t.setId(TASK_ID)
        d = nowutc() + timedelta(days=1)
        t.setStartDate(d.replace(hour=0, minute=0, second=0,
                                 microsecond=0))  # This midnight
        t.setInterval(timedelta(days=1))
        t.addObj(FoundationSync())

        # Check if tasks existis
        taskList = HelperTaskList.getTaskListInstance()
        for existing in taskList.getTasks():
            if existing.getId() == t.getId():
                print TASK_ID + " is already registered"
                return

        # Task does not exist: add it
        taskList.addTask(t)

        # Disconnect from Indico DB
        db.DBMgr.getInstance().endRequest()
        print "Successfully registered " + TASK_ID
Beispiel #25
0
 def getPresentParticipantListText(self):
     text = []
     for p in self.getParticipantList():
         if p.isPresent() or nowutc() < self._conference.getEndDate():
             part = p.getName()
             text.append(part)
     return "; ".join(text)
Beispiel #26
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
Beispiel #27
0
 def _process(self):
     try:
         user = self._request_token.getUser()
         access_tokens = Catalog.getIdx('user_oauth_access_token').get(user.getId())
         timestamp = nowutc()
         if access_tokens is not None:
             for access_token in list(access_tokens):
                 if access_token.getConsumer().getName() == self._request_token.getConsumer().getName():
                     access_token.setTimestamp(timestamp)
                     response = {'oauth_token': access_token.getId(),
                                 'oauth_token_secret': access_token.getToken().secret,
                                 'user_id': user.getId(),
                                 'oauth_token_ttl': Config.getInstance().getOAuthAccessTokenTTL(),
                                 'oauth_token_expiration_timestamp': access_token.getTimestamp() +
                                 timedelta(seconds=Config.getInstance().getOAuthAccessTokenTTL())}
                     return urlencode(response)
         access_token_key = OAuthUtils.gen_random_string()
         access_token_secret = OAuthUtils.gen_random_string()
         access_token = Token(access_token_key, oauth.Token(access_token_key, access_token_secret),
                              timestamp, self._request_token.getConsumer(), user)
         AccessTokenHolder().add(access_token)
         response = {'oauth_token': access_token_key,
                     'oauth_token_secret': access_token_secret,
                     'user_id': user.getId(),
                     'oauth_token_ttl': Config.getInstance().getOAuthAccessTokenTTL(),
                     'oauth_token_expiration_timestamp': access_token.getTimestamp() +
                     timedelta(seconds=Config.getInstance().getOAuthAccessTokenTTL())}
         return urlencode(response)
     except oauth.Error, err:
         raise OAuthError(err.message, 401)
Beispiel #28
0
 def getVars(self):
     vars = wcomponents.WTemplated.getVars( self )
     evaluation=self._conf.getEvaluation()
     sDate = evaluation.getStartDate()
     eDate = evaluation.getEndDate()
     vars["title"]= _("Impossible to do evaluation")
     vars["msg"]= _("No period for evaluation:")
     if nowutc()<sDate:
         vars["title"]= _("Evaluation is not open yet")
         vars["msg"]= _("Sorry but the evaluation will start later:")
     elif nowutc()>eDate:
         vars["title"]= _("Evaluation closed")
         vars["msg"]= _("Sorry but the evaluation is now over:")
     vars["startDate"] = sDate.strftime("%A %d %B %Y")
     vars["endDate"] = eDate.strftime("%A %d %B %Y")
     return vars
Beispiel #29
0
 def getPresentParticipantListText(self):
     text = []
     for p in self.getParticipantList():
         if p.isPresent() or nowutc() < self._conference.getEndDate():
             part = p.getName()
             text.append(part)
     return "; ".join(text)
Beispiel #30
0
        def getEndDate():
            today = nowutc()
            confEndDate = self._conf.getEndDate()

            self._endDateTime = confEndDate if today > confEndDate else today

            return str(self._endDateTime.date())
Beispiel #31
0
 def getVars(self):
     vars = wcomponents.WTemplated.getVars( self )
     evaluation=self._conf.getEvaluation()
     sDate = evaluation.getStartDate()
     eDate = evaluation.getEndDate()
     vars["title"]= _("Impossible to do evaluation")
     vars["msg"]= _("No period for evaluation:")
     if nowutc()<sDate:
         vars["title"]= _("Evaluation is not open yet")
         vars["msg"]= _("Sorry but the evaluation will start later:")
     elif nowutc()>eDate:
         vars["title"]= _("Evaluation closed")
         vars["msg"]= _("Sorry but the evaluation is now over:")
     vars["startDate"] = sDate.strftime("%A %d %B %Y")
     vars["endDate"] = eDate.strftime("%A %d %B %Y")
     return vars
Beispiel #32
0
        def getEndDate():
            today = nowutc()
            confEndDate = self._conf.getEndDate()

            self._endDateTime = confEndDate if today > confEndDate else today

            return str(self._endDateTime.date())
 def setSubmitted(self, submitted):
     if self._judgement is None:
         raise MaKaCError(
             "Cannot submit an opinion without choosing the judgemenent before"
         )
     self._submitted = submitted
     self._submissionDate = nowutc()
Beispiel #34
0
 def __init__( self, aw, categList=[] ):
     self._detailLevel = "conference"
     self._categList = categList
     self._tz = DisplayTZ(aw).getDisplayTZ()
     self._date = nowutc().astimezone(timezone(self._tz))
     self._aw = aw
     self._cal = None
Beispiel #35
0
 def __init__(self, aw, categList=[]):
     self._detailLevel = "conference"
     self._categList = categList
     self._tz = DisplayTZ(aw).getDisplayTZ()
     self._date = nowutc().astimezone(timezone(self._tz))
     self._aw = aw
     self._cal = None
Beispiel #36
0
    def OAuthCheckAccessResource(cls):
        from indico.modules.oauth.db import ConsumerHolder, AccessTokenHolder, OAuthServer

        oauth_request = oauth.Request.from_request(request.method, request.base_url, request.headers,
                                                   parameters=create_flat_args())
        Logger.get('oauth.resource').info(oauth_request)
        try:
            now = nowutc()
            consumer_key = oauth_request.get_parameter('oauth_consumer_key')
            if not ConsumerHolder().hasKey(consumer_key):
                raise OAuthError('Invalid Consumer Key', 401)
            consumer = ConsumerHolder().getById(consumer_key)
            token = oauth_request.get_parameter('oauth_token')
            if not token or not AccessTokenHolder().hasKey(token):
                raise OAuthError('Invalid Token', 401)
            access_token = AccessTokenHolder().getById(token)
            oauth_consumer = oauth.Consumer(consumer.getId(), consumer.getSecret())
            OAuthServer.getInstance().verify_request(oauth_request, oauth_consumer, access_token.getToken())
            if access_token.getConsumer().getId() != oauth_consumer.key:
                raise OAuthError('Invalid Consumer Key', 401)
            elif (now - access_token.getTimestamp()) > timedelta(seconds=Config.getInstance().getOAuthAccessTokenTTL()):
                raise OAuthError('Expired Token', 401)
            return access_token
        except oauth.Error, e:
            if e.message.startswith("Invalid Signature"):
                raise OAuthError("Invalid Signature", 401)
            else:
                raise OAuthError(e.message, 400)
Beispiel #37
0
    def getVars(self):
        vars = wcomponents.WTemplated.getVars(self)

        csbm = self._conf.getCSBookingManager()
        pluginNames = csbm.getEventDisplayPlugins()
        bookings = csbm.getBookingList(filterByType = pluginNames, notify = True, onlyPublic = True)
        bookings.sort(key = lambda b: b.getStartDate() or minDatetime())

        ongoingBookings = []
        scheduledBookings = {} #date, list of bookings

        for b in bookings:
            if b.isHappeningNow():
                ongoingBookings.append(b)
            if b.getStartDate() and b.getAdjustedStartDate('UTC') > nowutc():
                scheduledBookings.setdefault(b.getAdjustedStartDate(self._tz).date(), []).append(b)

        keys = scheduledBookings.keys()
        keys.sort()
        scheduledBookings = [(date, scheduledBookings[date]) for date in keys]

        vars["OngoingBookings"] = ongoingBookings
        vars["ScheduledBookings"] = scheduledBookings
        vars["all_bookings"] = fossilize(bookings)
        vars["Timezone"] = self._tz
        vars["conf"] = self._conf

        return vars
Beispiel #38
0
    def getVars(self):
        wvars = WConfDisplayBodyBase.getVars(self)

        csbm = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
        pluginNames = csbm.getEventDisplayPlugins()
        bookings = csbm.getBookingList(filterByType=pluginNames, notify=True, onlyPublic=True)
        bookings.sort(key=lambda b: b.getStartDate() or minDatetime())

        timeless_bookings = []
        ongoingBookings = []
        scheduledBookings = {} #date, list of bookings

        for b in bookings:
            if b.canBeDisplayed():
                if not b.hasStartDate():
                    timeless_bookings.append(b)
                else:
                    if b.isHappeningNow():
                        ongoingBookings.append(b)
                    elif b.getStartDate() and b.getAdjustedStartDate('UTC') > nowutc():
                        scheduledBookings.setdefault(b.getAdjustedStartDate(self._tz).date(), []).append(b)

        keys = scheduledBookings.keys()
        keys.sort()
        scheduledBookings = [(date, scheduledBookings[date]) for date in keys]

        wvars["body_title"] = self._getTitle()
        wvars["OngoingBookings"] = ongoingBookings
        wvars["ScheduledBookings"] = scheduledBookings
        wvars["timeless_bookings"] = timeless_bookings
        wvars["all_bookings"] = fossilize(bookings)
        wvars["Timezone"] = self._tz
        wvars["conf"] = self._conf

        return wvars
Beispiel #39
0
    def getElementIds(self, from_date, until_date):
        if not (from_date or until_date):
            return self.getAllElementIds()

        fd = self.firstDate
        if from_date:
            #            fd = server2utc(datetime(int(from_date[0:4]), int(from_date[5:7]), int(from_date[8:10])))
            fd = datetime(int(from_date[0:4]),
                          int(from_date[5:7]),
                          int(from_date[8:10]),
                          tzinfo=timezone('UTC'))
        ud = nowutc().replace(hour=23, minute=59, second=59, microsecond=0)
        if until_date:
            #            ud = server2utc(datetime(int(until_date[0:4]), int(until_date[5:7]), int(until_date[8:10])))
            ud = datetime(int(until_date[0:4]),
                          int(until_date[5:7]),
                          int(until_date[8:10]),
                          tzinfo=timezone('UTC'))
        res = []
        if fd > ud:
            return res
        date = fd
        delta = timedelta(1)
        while date <= ud:
            if date.strftime("%Y-%m-%d") in self._ids.keys():
                res.extend(self._ids[date.strftime("%Y-%m-%d")])
            date = date + delta
        return res
Beispiel #40
0
 def getVars( self ):
     vars = wcomponents.WTemplated.getVars( self )
     
     #dictionary where the keys are names of false "indexes" for the user, and the values are IndexInformation objects
     vars["Indexes"] = CollaborationTools.getCollaborationPluginType().getOption("pluginsPerIndex").getValue()
     vars["InitialIndex"] = self._queryParams["indexName"]
     vars["InitialViewBy"] = self._queryParams["viewBy"]
     vars["InitialOrderBy"] = self._queryParams["orderBy"]
     vars["InitialOnlyPending"] = self._queryParams["onlyPending"]
     vars["InitialConferenceId"] = self._queryParams["conferenceId"]
     vars["InitialCategoryId"] = self._queryParams["categoryId"]
     vars["InitialSinceDate"] = self._queryParams["sinceDate"]
     vars["InitialToDate"] = self._queryParams["toDate"]
     vars["InitialFromDays"] = self._queryParams["fromDays"]
     vars["InitialToDays"] = self._queryParams["toDays"]
     vars["InitialFromTitle"] = self._queryParams["fromTitle"]
     vars["InitialToTitle"] = self._queryParams["toTitle"]
     vars["InitialResultsPerPage"] = self._queryParams["resultsPerPage"]
     vars["InitialPage"] = self._queryParams["page"]
     vars["BaseURL"] = urlHandlers.UHAdminCollaboration.getURL()
     
     if self._queryParams["queryOnLoad"]:
         ci = IndexesHolder().getById('collaboration')
         tz = self._rh._getUser().getTimezone()
         #####
         minKey = None
         maxKey = None
         if self._queryParams['sinceDate']:
             minKey = setAdjustedDate(parseDateTime(self._queryParams['sinceDate'].strip()), tz = self._tz)
         if self._queryParams['toDate']:
             maxKey = setAdjustedDate(parseDateTime(self._queryParams['toDate'].strip()), tz = self._tz)
         if self._queryParams['fromTitle']:
             minKey = self._queryParams['fromTitle'].strip()
         if self._queryParams['toTitle']:
             maxKey = self._queryParams['toTitle'].strip()
         if self._queryParams['fromDays']:
             try:
                 fromDays = int(self._queryParams['fromDays'])
             except ValueError, e:
                 raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e)
             minKey = nowutc() - timedelta(days = fromDays)
         if self._queryParams['toDays']:
             try:
                 toDays = int(self._queryParams['toDays'])
             except ValueError, e:
                 raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e)
             maxKey = nowutc() + timedelta(days = toDays)
Beispiel #41
0
    def getBody(self):
        res = sets.Set()
        im = indexes.IndexesHolder()
        catIdx = im.getIndex('category')
        calIdx = im.getIndex('calendar')
        if self._date == None:
            c1 = calIdx.getObjectsEndingAfter(nowutc().astimezone(
                timezone(self._tz)))
        else:
            date = self._date
            c1 = calIdx.getObjectsInDay(date)
        confIds = sets.Set(catIdx.getItems(self._categ.getId()))
        confIds.intersection_update(c1)
        res.union_update(confIds)
        res = list(res)
        res.sort(sortByStartDate)
        rss = xmlGen.XMLGen()
        rss.openTag('rss version="2.0"')
        rss.openTag("channel")
        rss.writeTag(
            "title",
            "Indico RSS Feed for category %s" % self._categ.getTitle())

        rss.writeTag("link", Config.getInstance().getBaseURL())

        rss.writeTag(
            "description",
            "Forthcoming meetings in category %s" % self._categ.getTitle())
        rss.writeTag("language", "en")
        rss.writeTag(
            "pubDate",
            nowutc().astimezone(timezone(
                self._tz)).strftime("%a, %d %b %Y %H:%M:%S %Z"))
        rss.writeTag("category", "")
        rss.writeTag("generator",
                     "CDS Indico %s" % Config.getInstance().getVersion())
        rss.writeTag(
            "webMaster",
            info.HelperMaKaCInfo.getMaKaCInfoInstance().getSupportEmail())
        rss.writeTag("ttl", "1440")
        for confId in res:
            ch = ConferenceHolder()
            conf = ch.getById(confId)
            rss = ConferenceToRSS(conf, tz=self._tz).getCore(rss)
        rss.closeTag("channel")
        rss.closeTag("rss")
        return rss.getXml()
Beispiel #42
0
 def getPresenceText(self):
     presence = "n/a"
     if nowutc() > self.getConference().getStartDate():
         if self.isPresent():
             presence = "present"
         else:
             presence = "absent"
     return presence
Beispiel #43
0
 def __init__(self, conference, avatar, status):
     self.id = None
     self.conference = conference
     self.avatar = avatar
     self.requestTime = nowutc()
     self.creationTime = None
     self.status = status
     self.file = None
Beispiel #44
0
def iter_interesting_events(avatar, data):
    idx = IndexesHolder().getById('categoryDateAll')
    now_local = utc2server(nowutc(), False)
    aw = AccessWrapper()
    aw.setUser(avatar)
    for event in _unique_events(idx.iterateObjectsIn('0', now_local, now_local + timedelta(weeks=24))):
        if _is_event_interesting(avatar, event, data) and event.canAccess(aw):
            yield event
Beispiel #45
0
 def getParticipantListText(self):
     text = []
     for p in self.getParticipantList():
         part = p.getName()
         if not p.isPresent() and nowutc() > self._conference.getEndDate():
             part += " (absent)"
         text.append(part)
     return "; ".join(text)
Beispiel #46
0
 def _processIfActive(self):
     cfaMgr = self._conf.getAbstractMgr()
     #if the user is in the autorized list, don't check period
     if self._getUser() in cfaMgr.getAuthorizedSubmitterList():
         return self._processIfOpened()
     #if the submission period is not yet opened we show up a form informing
     #   about that.
     if timezoneUtils.nowutc() < cfaMgr.getStartSubmissionDate():
     #if the submission period is already closed we show up a form informing
     #   about that.
         p = abstracts.WPCFANotYetOpened(self, self._conf)
         return p.display()
     elif timezoneUtils.nowutc() > cfaMgr.getEndSubmissionDate():
         p = abstracts.WPCFAClosed(self, self._conf, False)
         return p.display()
     else:
         return self._processIfOpened()
Beispiel #47
0
 def __init__(self, conference, avatar, status):
     self.id = None
     self.conference = conference
     self.avatar = avatar
     self.requestTime = nowutc()
     self.creationTime = None
     self.status = status
     self.file = None
Beispiel #48
0
 def _process(self):
     # TODO: Token should have flag authorized=False
     token = oauth.Token(OAuthUtils.gen_random_string(), OAuthUtils.gen_random_string())
     token.set_callback(self._oauth_request.get_parameter('oauth_callback'))
     timestamp = nowutc()
     TempRequestTokenHolder().add(Token(token.key, token, timestamp, self._consumer, None))
     Logger.get('oauth.request_token').info(token.to_string())
     return token.to_string()
Beispiel #49
0
 def getParticipantListText(self):
     text = []
     for p in self.getParticipantList():
         part = p.getName()
         if not p.isPresent() and nowutc() > self._conference.getEndDate():
             part += " (absent)"
         text.append(part)
     return "; ".join(text)
Beispiel #50
0
 def getPresenceText(self):
     presence = "n/a"
     if nowutc() > self.getConference().getStartDate():
         if self.isPresent():
             presence = "present"
         else:
             presence = "absent"
     return presence
Beispiel #51
0
 def _processIfActive(self):
     cfaMgr = self._conf.getAbstractMgr()
     #if the user is in the autorized list, don't check period
     if self._getUser() in cfaMgr.getAuthorizedSubmitterList():
         return self._processIfOpened()
     #if the submission period is not yet opened we show up a form informing
     #   about that.
     if timezoneUtils.nowutc() < cfaMgr.getStartSubmissionDate():
         #if the submission period is already closed we show up a form informing
         #   about that.
         p = abstracts.WPCFANotYetOpened(self, self._conf)
         return p.display()
     elif timezoneUtils.nowutc() > cfaMgr.getEndSubmissionDate():
         p = abstracts.WPCFAClosed(self, self._conf, False)
         return p.display()
     else:
         return self._processIfOpened()
Beispiel #52
0
 def cacheObject(self, path, fileName, obj):
     """ path - Path where to store
     fileName - File name to use
     obj - MultiLevelCacheEntry to store
     """
     
     obj.setDate(timezoneUtils.nowutc())
     self._saveObject(self.getCacheDir(), path, fileName, obj.pickle())
     Logger.get('cache/%s'%self.cacheName).debug("Saved %s/%s" % (path, fileName))
Beispiel #53
0
def iter_interesting_events(avatar, data):
    idx = IndexesHolder().getById('categoryDateAll')
    now_local = utc2server(nowutc(), False)
    aw = AccessWrapper()
    aw.setUser(avatar)
    for event in _unique_events(
            idx.iterateObjectsIn('0', now_local,
                                 now_local + timedelta(weeks=24))):
        if _is_event_interesting(avatar, event, data) and event.canAccess(aw):
            yield event
Beispiel #54
0
 def call(self):
     categ1 = CategoryManager().getById('1')  #target category here
     for i in xrange(1, 0 + 1):  #number of conferences to create here
         c = categ1.newConference(
             AvatarHolder().getById('1'))  #creator of event
         c.setTitle("event " + str(i))
         c.setTimezone('UTC')
         c.setDates(nowutc() - timedelta(hours=i),
                    nowutc() - timedelta(hours=i - 1))
         for j in xrange(1, 0 + 1):  #number of bookings per event
             c.getCSBookingManager().createBooking(
                 "Vidyo", {
                     "roomName": "room_" + str(i) + "_" + str(j),
                     "roomDescription": "test",
                     "owner": {
                         "_type": "Avatar",
                         "id": "1"
                     }
                 })
Beispiel #55
0
 def _checkParams(self, params):
     # month/year indicates which month should be displayed in the calendar
     # date indicates if a day should be highlighted in the calendar
     tz = DisplayTZ(self._aw).getDisplayTZ()
     if params.has_key("month") and params.get("month") == "":
         del params["month"]
     if params.has_key("year") and params.get("year") == "":
         del params["year"]
     self._month = int(
         params.get("month",
                    nowutc().astimezone(timezone(tz)).month))
     self._year = int(
         params.get("year",
                    nowutc().astimezone(timezone(tz)).year))
     if params.get('date', '') == '--' or params.get('date', '') == '':
         self._date = '%s-%s-%s' % ('01', self._month, self._year)
     else:
         self._date = ""
     self._form = int(params.get('form', 0))