示例#1
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)
示例#2
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)
示例#3
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
示例#4
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
示例#5
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
示例#6
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)
示例#7
0
    def _handleSet(self):
        try:
            naiveDate = parseDateTime(self._value)
        except ValueError:
            raise ServiceError("ERR-E2",
                               "Date/time is not in the correct format")

        try:
            self._pTime = setAdjustedDate(naiveDate, self._conf)
            return self._setParam()
        except TimingError, e:
            raise ServiceError("ERR-E2", e.getMessage())
示例#8
0
文件: base.py 项目: bubbas/indico
    def _handleSet(self):
        try:
            naiveDate = parseDateTime(self._value)
        except ValueError:
            raise ServiceError("ERR-E2",
                               "Date/time is not in the correct format")

        try:
            self._pTime = setAdjustedDate(naiveDate, self._conf)
            return self._setParam()
        except TimingError,e:
            raise ServiceError("ERR-E2", e.getMsg())
示例#9
0
文件: news.py 项目: NIIF/indico
 def getCreationDate(self):
     if not isTimezoneAware(self._creationDate):
         self._creationDate = setAdjustedDate(self._creationDate, tz = 'UTC')
     return self._creationDate
示例#10
0
 def getCreationDate(self):
     if not isTimezoneAware(self._creationDate):
         self._creationDate = setAdjustedDate(self._creationDate, tz='UTC')
     return self._creationDate