Example #1
0
    def _checkParams(self, params):
        RHConferenceModifBase._checkParams(self, params)

        self._activeTabName = params.get("tab", None)

        # we build the list 'allowedTabs', a list of all tabs that the user can see
        allowedTabs = CollaborationTools.getTabs(self._conf, self._getUser())

        if self._target.canModify(self.getAW()) or RCVideoServicesManager.hasRights(self):
            allowedTabs.append('Managers')

        tabOrder = CollaborationTools.getCollaborationOptionValue('tabOrder')
        self._tabs = []

        for tabName in tabOrder:
            if tabName in allowedTabs:
                self._tabs.append(tabName)
                allowedTabs.remove(tabName)

        for tabName in allowedTabs:
            if tabName != 'Managers':
                self._tabs.append(tabName)

        if 'Managers' in allowedTabs:
            self._tabs.append('Managers')
Example #2
0
    def iter_bookings(self, fromDT, toDT):

        added_whole_events = set()

        for dt, bkw in self.iteritems(fromDT, toDT):
            evt = bkw.getOriginalBooking().getConference()
            entries = evt.getSchedule().getEntriesOnDay(dt)

            if bkw.getObject() == evt:
                # this means the booking relates to an event
                if evt in added_whole_events:
                    continue

                if evt.getType() == 'simple_event' or not evt.getSchedule().getEntries():
                    yield dt, CSBookingInstanceWrapper(bkw.getOriginalBooking(),
                                                       evt)
                    # mark whole event as "added"
                    added_whole_events.add(evt)

                if entries:
                    # what a mess...
                    if self.index_name == 'All Requests':
                        talks = set(CollaborationTools.getCommonTalkInformation(evt, 'RecordingRequest', 'recordingCapableRooms')[3]) | \
                            set(CollaborationTools.getCommonTalkInformation(evt, 'WebcastRequest', 'webcastCapableRooms')[3])
                    else:
                        var = 'recordingCapableRooms' if self.index_name == 'RecordingRequest' else 'webcastCapableRooms'
                        talks = CollaborationTools.getCommonTalkInformation(evt, self.index_name, var)[3]

                    # add contribs that concern this day
                    for contrib in talks:
                        if contrib.isScheduled() and contrib.getStartDate().date() == dt.date():
                            yield dt, CSBookingInstanceWrapper(bkw.getOriginalBooking(),
                                                               contrib)
            else:
                yield dt, bkw
Example #3
0
    def generateCDSCategoryXML(cls, out, obj):
        """Determine if this record should belong to any particular CDS categories,
        based on the recursive list of owners and Recording Manager options.
        This will become MARC tag 980__a after XSL transformation."""

        # Each Indico category may be associated with up to 1 CDS categories,
        # but multiple Indico categories may be associated with the same CDS category.
        listCDSCategories = []

        # Get every successive owner of this object up to the root category.
        # If this object is more than 20 levels deep that would be CRAZY!
        crazyCounter = 0
        while obj is not None and crazyCounter < 20:
            #Logger.get('RecMan').debug("obj id: %s, title: \"%s\"" % (obj.getId(), obj.getTitle()))

            # getId() is not unique for all objects across the database. It is unique for all categories, though,
            # so as long as we are only dealing with categories it's ok.
            if CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments").has_key(obj.getId()) \
                and CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()] is not None \
                and isinstance(obj, Category):
                if CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()] not in listCDSCategories:
                    listCDSCategories.append(CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()])
                    #Logger.get('RecMan').debug("  This one matches! Appending \"%s\"" % CollaborationTools.getOptionValue("RecordingManager", "CDSCategoryAssignments")[obj.getId()])

            obj = obj.getOwner()
            crazyCounter += 1

        # Generate the base XML tags
        if len(listCDSCategories) > 0:
            out.openTag("CDSCategories")
            for category in listCDSCategories:
                out.writeTag("category", category)
            out.closeTag("CDSCategories")
Example #4
0
def getOrphans():
    """Get list of Lecture Objects in the database that have no IndicoID assigned"""

    # Initialize success flag and result string
    flagSuccess = True
    result = ""

    try:
        connection = MySQLdb.connect(
            host=CollaborationTools.getOptionValue("RecordingManager",
                                                   "micalaDBServer"),
            port=int(
                CollaborationTools.getOptionValue("RecordingManager",
                                                  "micalaDBPort")),
            user=CollaborationTools.getOptionValue("RecordingManager",
                                                   "micalaDBReaderUser"),
            passwd=CollaborationTools.getOptionValue("RecordingManager",
                                                     "micalaDBReaderPW"),
            db=CollaborationTools.getOptionValue("RecordingManager",
                                                 "micalaDBName"))
    except NameError:
        raise MaKaCError(
            "You need to install MySQLdb (python-mysql) in order to use the Recording Manager"
        )
    except MySQLdb.Error, e:
        flagSuccess = False
        result += "MySQL error %d: %s" % (e.args[0], e.args[1])
Example #5
0
    def generateExperimentXML(cls, out, obj):
        """Determine if this record belongs to a particular experiment,
        based on the recursive list of owners and Recording Manager options.
        This will become tag 693__e after XSL transformation."""

        # Each Indico category may be associated with 1 experiment.
        experiment = None

        # Get every successive owner of this object up to the root category, stop if match is found.
        # If this object is more than 20 levels deep that would be CRAZY!
        crazyCounter = 0
        while obj is not None and crazyCounter < 20:
            #Logger.get('RecMan').debug("obj id: %s, title: \"%s\"" % (obj.getId(), obj.getTitle()))

            # getId() is not unique for all objects across the database. It is unique for all categories, though,
            # so as long as we are only dealing with categories it's ok.
            if CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments").has_key(obj.getId()) \
                and CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments")[obj.getId()] is not None \
                and isinstance(obj, Category):
                experiment = CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments")[obj.getId()]
                #Logger.get('RecMan').debug("  This one matches! Experiment is \"%s\"" % experiment)
                break

            obj = obj.getOwner()
            crazyCounter += 1

        # Generate the base XML tags
        if experiment is not None:
            out.writeTag("CDSExperiment", experiment)
Example #6
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
Example #7
0
def createIndicoLink(IndicoID, CDSID):
    """Create a link in Indico to the CDS record."""

#    Logger.get('RecMan').debug("in createIndicoLink()")
    # From IndicoID, get info
    try:
        talkInfo = parseIndicoID(IndicoID)
    except NoReportError:
        return False
    obj = talkInfo["object"]

    # Only one link per talk allowed.
    if doesExistIndicoLink(obj):
        return True # consider it a success anyway
    else:
#        Logger.get('RecMan').info("creating a new link in Indico for talk %s, CDS record %s" % (IndicoID, CDSID))

        # material object holds link object.
        # First create a material object with title "Video in CDS" or whatever the current text is.
        material = conference.Material()
        material.setTitle(CollaborationTools.getOptionValue("RecordingManager", "videoLinkName"))
        videoLink = Link()
        videoLink.setOwner(material)
#    I don't think this stuff is necessary:
#        videoLink.setName("Name goes here")
#        videoLink.setDescription("Description goes here")
        videoLink.setURL(CollaborationTools.getOptionValue("RecordingManager", "CDSBaseURL") % str(CDSID))
        material.addResource(videoLink)
        material.setMainResource(videoLink)
        obj.addMaterial(material)
        return True
Example #8
0
    def iter_bookings(self, fromDT, toDT):

        added_whole_events = set()

        for dt, bkw in self.iteritems(fromDT, toDT):
            evt = bkw.getOriginalBooking().getConference()
            entries = evt.getSchedule().getEntriesOnDay(dt)

            if bkw.getObject() == evt:
                # this means the booking relates to an event
                if evt in added_whole_events:
                    continue

                if not evt.getSchedule().getEntries():
                    yield dt, CSBookingInstanceWrapper(bkw.getOriginalBooking(),
                                                       evt)
                    # mark whole event as "added"
                    added_whole_events.add(evt)

                if entries:
                    # what a mess...
                    if self.index_name == 'All Requests':
                        talks = set(CollaborationTools.getCommonTalkInformation(evt, 'RecordingRequest', 'recordingCapableRooms')[3]) | \
                            set(CollaborationTools.getCommonTalkInformation(evt, 'WebcastRequest', 'webcastCapableRooms')[3])
                    else:
                        var = 'recordingCapableRooms' if self.index_name == 'RecordingRequest' else 'webcastCapableRooms'
                        talks = CollaborationTools.getCommonTalkInformation(evt, self.index_name, var)[3]

                    # add contribs that concern this day
                    for contrib in talks:
                        if contrib.isScheduled() and contrib.getStartDate().date() == dt.date():
                            yield dt, CSBookingInstanceWrapper(bkw.getOriginalBooking(),
                                                               contrib)
            else:
                yield dt, bkw
Example #9
0
    def generateExperimentXML(cls, out, obj):
        """Determine if this record belongs to a particular experiment,
        based on the recursive list of owners and Recording Manager options.
        This will become tag 693__e after XSL transformation."""

        # Each Indico category may be associated with 1 experiment.
        experiment = None

        # Get every successive owner of this object up to the root category, stop if match is found.
        # If this object is more than 20 levels deep that would be CRAZY!
        crazyCounter = 0
        while obj is not None and crazyCounter < 20:
            #Logger.get('RecMan').debug("obj id: %s, title: \"%s\"" % (obj.getId(), obj.getTitle()))

            # getId() is not unique for all objects across the database. It is unique for all categories, though,
            # so as long as we are only dealing with categories it's ok.
            if CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments").has_key(obj.getId()) \
                and CollaborationTools.getOptionValue("RecordingManager", "CDSExperimentAssignments")[obj.getId()] is not None \
                and isinstance(obj, Category):
                experiment = CollaborationTools.getOptionValue(
                    "RecordingManager",
                    "CDSExperimentAssignments")[obj.getId()]
                #Logger.get('RecMan').debug("  This one matches! Experiment is \"%s\"" % experiment)
                break

            obj = obj.getOwner()
            crazyCounter += 1

        # Generate the base XML tags
        if experiment is not None:
            out.writeTag("CDSExperiment", experiment)
Example #10
0
    def _checkParams(self, params):
        RHConferenceModifBase._checkParams(self, params)

        self._activeTabName = params.get("tab", None)

        # we build the list 'allowedTabs', a list of all tabs that the user can see
        allowedTabs = CollaborationTools.getTabs(self._conf, self._getUser())

        if self._target.canModify(
                self.getAW()) or RCVideoServicesManager.hasRights(self):
            allowedTabs.append('Managers')

        tabOrder = CollaborationTools.getCollaborationOptionValue('tabOrder')
        self._tabs = []

        for tabName in tabOrder:
            if tabName in allowedTabs:
                self._tabs.append(tabName)
                allowedTabs.remove(tabName)

        for tabName in allowedTabs:
            if tabName != 'Managers':
                self._tabs.append(tabName)

        if 'Managers' in allowedTabs:
            self._tabs.append('Managers')
Example #11
0
def createIndicoLink(IndicoID, CDSID):
    """Create a link in Indico to the CDS record."""

    #    Logger.get('RecMan').debug("in createIndicoLink()")
    # From IndicoID, get info
    try:
        talkInfo = parseIndicoID(IndicoID)
    except NoReportError:
        return False
    obj = talkInfo["object"]

    # Only one link per talk allowed.
    if doesExistIndicoLink(obj):
        return True  # consider it a success anyway
    else:
        #        Logger.get('RecMan').info("creating a new link in Indico for talk %s, CDS record %s" % (IndicoID, CDSID))

        # material object holds link object.
        # First create a material object with title "Video in CDS" or whatever the current text is.
        material = conference.Material()
        material.setTitle(
            CollaborationTools.getOptionValue("RecordingManager",
                                              "videoLinkName"))
        videoLink = Link()
        videoLink.setOwner(material)
        #    I don't think this stuff is necessary:
        #        videoLink.setName("Name goes here")
        #        videoLink.setDescription("Description goes here")
        videoLink.setURL(
            CollaborationTools.getOptionValue("RecordingManager", "CDSBaseURL")
            % str(CDSID))
        material.addResource(videoLink)
        material.setMainResource(videoLink)
        obj.addMaterial(material)
        return True
Example #12
0
    def _checkParams(self, params):
        RHConferenceModifBase._checkParams(self, params)
        
        self._activeTabName = params.get("tab", None)
        
        self._canSeeAllPluginTabs = self._target.canModify(self.getAW()) or RCCollaborationAdmin.hasRights(self) or RCVideoServicesManager.hasRights(self)
        
        # we build the list 'allowedTabs', a list of all tabs that the user can see
        if self._canSeeAllPluginTabs:
            #if the logged in user is event manager, server admin or collaboration admin: we show all plugin tabs
            allowedTabs = CollaborationTools.getTabs(self._conf)
        else:
            #else we show only the tabs of plugins of which the user is admin
            allowedTabs = CollaborationTools.getTabs(self._conf, self._getUser())
            
        if self._target.canModify(self.getAW()) or RCVideoServicesManager.hasRights(self):
            allowedTabs.append('Managers')
            
        # we order the list of allowedTabs into the self._tabs list
        tabOrder = CollaborationTools.getCollaborationOptionValue('tabOrder')
        self._tabs = []
        
        for tabName in tabOrder:
            if tabName in allowedTabs:
                self._tabs.append(tabName)
                allowedTabs.remove(tabName)
                
        for tabName in allowedTabs:
            if tabName != 'Managers':
                self._tabs.append(tabName)

        if 'Managers' in allowedTabs:
            self._tabs.append('Managers')
Example #13
0
    def associateCDSRecordToLOID(cls, CDSID, LODBID):
        """Update the micala DB to associate the CDS record number with the given lecture.
        Note: if you are using cdsdev, the CDSID stored in the micala database will be the cdsdev record, not the cds record.
        The micala database doesn't know the difference between cds and cdsdev. So if you create a bunch of test records and
        then want to go back and create them again in CDS, you'll have to tinker around with the micala database,
        deleting some status records and probably re-publish those lectures from the beginning."""

        # Initialize success flag and result string
        flagSuccess = True
        result = ""

        #        Logger.get('RecMan').debug("in associateIndicoIDToLOID()")

        try:
            connection = MySQLdb.connect(
                host=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBServer"),
                port=int(
                    CollaborationTools.getOptionValue("RecordingManager",
                                                      "micalaDBPort")),
                user=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBUser"),
                passwd=CollaborationTools.getOptionValue(
                    "RecordingManager", "micalaDBPW"),
                db=CollaborationTools.getOptionValue("RecordingManager",
                                                     "micalaDBName"))
        except MySQLdb.Error, e:
            flagSuccess = False
            result += _("MySQL error %d: %s") % (e.args[0], e.args[1])
Example #14
0
    def associateIndicoIDToLOID(cls, IndicoID, LODBID):
        """Update the micala DB to associate the given talk with the given LOID"""

        # Initialize success flag and result string
        flagSuccess = True
        result = ""

        #        Logger.get('RecMan').debug("in associateIndicoIDToLOID()")

        try:
            connection = MySQLdb.connect(
                host=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBServer"),
                port=int(
                    CollaborationTools.getOptionValue("RecordingManager",
                                                      "micalaDBPort")),
                user=CollaborationTools.getOptionValue("RecordingManager",
                                                       "micalaDBUser"),
                passwd=CollaborationTools.getOptionValue(
                    "RecordingManager", "micalaDBPW"),
                db=CollaborationTools.getOptionValue("RecordingManager",
                                                     "micalaDBName"))
        except MySQLdb.Error, e:
            flagSuccess = False
            result += _("MySQL error %d: %s") % (e.args[0], e.args[1])
Example #15
0
    def updateMicalaCDSExport(cls, cds_indico_matches, cds_indico_pending):
        '''If there are records found in CDS but not yet listed in the micala database as COMPLETE, then update it.
        cds_indico_matches is a dictionary of key-value pairs { IndicoID1: CDSID1, IndicoID2: CDSID2, ... }
        cds_indico_pending is a list of IndicoIDs (for whom the CDS export task has been started but not completed).'''

#        Logger.get('RecMan').debug('in updateMicalaCDSExport()')

        # debugging:
#        for matched in cds_indico_matches.keys():
#            Logger.get('RecMan').debug('Looping through cds_indico_matches: %s -> %s' % (matched, cds_indico_matches[matched]))
#        for pending in cds_indico_pending:
#            Logger.get('RecMan').debug('Looping through cds_indico_pending: %s' % pending)


        for pending in cds_indico_pending:
#            Logger.get('RecMan').debug('Looping through cds_indico_pending: %s (and looking up in cds_indico_matches)' % pending)
            try:
                newRecord = cds_indico_matches[pending]

                idMachine = cls.getIdMachine(CollaborationTools.getOptionValue("RecordingManager", "micalaDBMachineName"))
                idTask    = cls.getIdTask(CollaborationTools.getOptionValue("RecordingManager", "micalaDBStatusExportCDS"))
                idLecture = cls.getIdLecture(pending)
                cls.reportStatus("COMPLETE", "CDS record: %s" % newRecord, idMachine, idTask, idLecture)

                # add the CDS record number to the Lectures table
                resultAssociateCDSRecord = cls.associateCDSRecordToLOID(newRecord, idLecture)
                if not resultAssociateCDSRecord["success"]:
                    Logger.get('RecMan').error("Unable to update Lectures table in micala database: %s" % resultAssociateCDSRecord["result"])
                    # this is not currently used:
                    return resultAssociateCDSRecord["result"]

            except KeyError:
                # current pending lecture still not found in CDS so do nothing.
                Logger.get('RecMan').debug('%s listed as pending and not found in cds_indico_matches, so it must still be pending.' % pending)
    def testRightsFiltering(self):
        '''
        Test if the managing rights are respected.
        '''
        manager = self._conf.getCSBookingManager()

        # Test that person3 has not access to webcasted talks
        requestType = CollaborationTools.getRequestTypeUserCanManage(
            self._conf, self.person3)
        contributions = manager.getContributionSpeakerByType(requestType)
        for cont in contributions:
            for spk in contributions[cont]:
                sw = manager.getSpeakerWrapperByUniqueId("%s.%s" %
                                                         (cont, spk.getId()))
                self.assert_(sw.getRequestType() == "recording"
                             or sw.getRequestType() == "both")

        # Test that person4 has not access to recorded talks
        requestType = CollaborationTools.getRequestTypeUserCanManage(
            self._conf, self.person4)
        contributions = manager.getContributionSpeakerByType(requestType)
        for cont in contributions:
            for spk in contributions[cont]:
                sw = manager.getSpeakerWrapperByUniqueId("%s.%s" %
                                                         (cont, spk.getId()))
                self.assert_(sw.getRequestType() == "webcast"
                             or sw.getRequestType() == "both")
Example #17
0
def submitMicalaMetadata(aw, IndicoID, contentType, LODBID, LOID, videoFormat,
                         languages):
    '''Generate a lecture.xml file for the given event, then web upload it to the micala server.'''

    #    Logger.get('RecMan').debug('in submitMicalaMetadata()')

    # Initialize success flag, and result string to which we will append any errors.
    flagSuccess = True
    result = ""

    # First update the micala database that we've started this task
    try:
        idMachine = MicalaCommunication.getIdMachine(
            CollaborationTools.getOptionValue("RecordingManager",
                                              "micalaDBMachineName"))
        idTask = MicalaCommunication.getIdTask(
            CollaborationTools.getOptionValue("RecordingManager",
                                              "micalaDBStatusExportMicala"))
        idLecture = LODBID
        #        Logger.get('RecMan').debug('submitMicalaMetadata calling reportStatus...')
        MicalaCommunication.reportStatus('START', '', idMachine, idTask,
                                         idLecture)
    except Exception, e:
        flagSuccess = False
        result += _(
            "Unknown error occured when updating MICALA START task information in micala database: %s\n."
        ) % e
Example #18
0
 def getPaperAgreementURL(self):
     recordingFormURL = CollaborationTools.getOptionValue(
         "RecordingRequest", "ConsentFormURL")
     webcastFormURL = CollaborationTools.getOptionValue(
         "WebcastRequest", "ConsentFormURL")
     requestType = CollaborationTools.getRequestTypeUserCanManage(
         self._conf, self._user)
     #return recordingFormURL
     if requestType == 'recording' and recordingFormURL != '':
         return _("""<a href="%s">Paper version</a>.""" % recordingFormURL)
     elif requestType == 'webcast' and webcastFormURL != '':
         return _("""<a href="%s">Paper version</a>.""" % webcastFormURL)
     elif requestType == 'both':
         if recordingFormURL == webcastFormURL and recordingFormURL != '':  #same link, same file
             return _("""<a href="%s">Paper version</a>.""" %
                      recordingFormURL)
         elif recordingFormURL != '' and webcastFormURL != '':
             return _(
                 """<a href="%s">Paper version</a> for the recording request or
                     <a href="%s">Paper version</a> for the webcast request."""
                 % (recordingFormURL, webcastFormURL))
         elif recordingFormURL != '':
             return _("""<a href="%s">Paper version</a>.""" %
                      recordingFormURL)
         elif webcastFormURL != '':
             return _("""<a href="%s">Paper version</a>.""" %
                      webcastFormURL)
         else:
             return _("""<No agreement link available>.""")
     else:
         return _("""<No agreement link available>.""")
Example #19
0
    def updateLectureInfo(cls, idLecture, lectureTitle, lectureSpeakers):
        '''Update basic info in micala DB for convenience in identifying records.'''

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Example #20
0
    def getMatches(cls, confID):
        '''For the current conference, get list from the database of IndicoID's already matched to Lecture Objects.'''

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Example #21
0
 def _checkParams(self, params):
     RHConfModifCSBase._checkParams(self, params)
     
     if self._activeTabName and not self._activeTabName in self._tabs:
         raise MaKaCError(_("That Video Services tab doesn't exist or you cannot access it"), _("Video Services"))
     elif not self._activeTabName and self._tabs:
         self._activeTabName = self._tabs[0]
         
     if self._canSeeAllPluginTabs:
         self._tabPlugins = CollaborationTools.getPluginsByTab(self._activeTabName, self._conf)
     else:
         self._tabPlugins = CollaborationTools.getPluginsByTab(self._activeTabName, self._conf, self._getUser())
Example #22
0
    def getIdTask(cls, task_name):
        '''Look up ID of this task in database'''

#        Logger.get('RecMan').debug('task_name = [%s]' % task_name)

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Example #23
0
    def isTaskComplete(cls, idLecture, idTask):
        '''Check to see if given task has been completed for the given lecture.'''

        flagComplete = False

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Example #24
0
    def getCDSPending(cls, confId):
        """Query the Micala database to find Indico IDs whose MARC has been exported to CDS, but not marked as completed in the micala DB.
        (Note: they may have just been completed, but we'll deal with newly completed tasks separately)
         Return a list of these Indico IDs."""

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException("MySQL database error %d: %s" % (e.args[0], e.args[1]))
Example #25
0
    def createNewMicalaLecture(cls, lecture_name, contentType):
        '''insert a record into the micala database for a new lecture'''

#        Logger.get('RecMan').debug('createNewMicalaLecture for [%s]' % lecture_name)

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Example #26
0
    def getWebcastServiceURL(self, wc):
        """ Returns the Webcast Service URL ( a string ).
            It will be used to display a link when an event is a forthcoming webcast.
        """
        if not wc:
            return None
        elif not wc.getAudience():
            return CollaborationTools.getOptionValue('WebcastRequest', "webcastPublicURL")

        for row in CollaborationTools.getOptionValue('WebcastRequest', "webcastAudiences"):
            if row['name'] == wc.getAudience():
                return row['structure']

        return ''
Example #27
0
    def hasRights(user, plugins=[]):
        """ Returns True if the user is an admin of one of the plugins corresponding to pluginNames
            plugins: a list of Plugin objects (e.g. EVO, RecordingRequest) or strings with the plugin name ('EVO', 'RecordingRequest')
                     or the string 'any' (we will then check if the user is manager of any plugin),
        """
        if user:
            plist = CollaborationTools.getCollaborationPluginType().getPluginList() if plugins == 'any' else plugins

            if plist:
                for plugin in plist:
                    if not isinstance(plugin, Plugin):
                        plugin = CollaborationTools.getPlugin(plugin)
                    if user in plugin.getOption('admins').getValue():
                        return True
        return False
Example #28
0
    def hasRights(request=None, user=None, pluginName=""):
        """ Returns True if the logged in user is an authorised user to create bookings.
            This is true if:
                  - The user is in the list of authorised user and groups
            request: an RH or Service object
            pluginName: the plugin to check
        """
        if not PluginsHolder().hasPluginType("Collaboration"):
            return False

        if user is None:
            if request is None:
                return False
            else:
                user = request._getUser()

        if user:
            collaborationPluginType = CollaborationTools.getCollaborationPluginType(
            )
            plugin = collaborationPluginType.getPlugin(pluginName)
            if plugin.hasOption("AuthorisedUsersGroups"):
                if plugin.getOption("AuthorisedUsersGroups").getValue():
                    for entity in plugin.getOption(
                            "AuthorisedUsersGroups").getValue():
                        if isinstance(entity, Group) and entity.containsUser(user) or \
                            isinstance(entity, Avatar) and entity == user:
                            return True
                    return False
                else:
                    return True
            else:
                return True
        return False
Example #29
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,
            CollaborationTools.getCollaborationOptionValue("startMinutes"))
        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()
        nowEndDate = nowStartDate + timedelta(
            0, 0, 0, 0, self._EVOOptions["allowedMinutes"].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
Example #30
0
    def _checkParams(self, params):
        RHConfModifCSBase._checkParams(self, params)

        if self._activeTabName and not self._activeTabName in self._tabs:
            raise MaKaCError(
                _("That Video Services tab doesn't exist or you cannot access it"
                  ), _("Video Services"))
        elif not self._activeTabName and self._tabs:
            self._activeTabName = self._tabs[0]

        if self._canSeeAllPluginTabs:
            self._tabPlugins = CollaborationTools.getPluginsByTab(
                self._activeTabName, self._conf)
        else:
            self._tabPlugins = CollaborationTools.getPluginsByTab(
                self._activeTabName, self._conf, self._getUser())
Example #31
0
 def __init__(self, rh, queryParams):
     WPMainBase.__init__(self, rh)
     self._queryParams = queryParams
     self._user = self._rh.getAW().getUser()
     self._pluginsWithIndexing = CollaborationTools.pluginsWithIndexing(
     )  # list of names
     self._buildExtraJS()
Example #32
0
    def hasRights(request=None, user=None, plugins=[]):
        """ Returns True if the user is an admin of one of the plugins corresponding to pluginNames
            plugins: a list of Plugin objects (e.g. EVO, RecordingRequest) or strings with the plugin name ('EVO', 'RecordingRequest')
                     or the string 'any' (we will then check if the user is manager of any plugin),
        """
        if not PluginsHolder().hasPluginType("Collaboration"):
            return False

        if user is None:
            if request is None:
                return False
            else:
                user = request._getUser()

        if user:
            collaborationPluginType = CollaborationTools.getCollaborationPluginType()

            plist = collaborationPluginType.getPluginList() if plugins == "any" else plugins

            if plist:
                for plugin in plist:
                    if not isinstance(plugin, Plugin):
                        plugin = collaborationPluginType.getPlugin(plugin)

                    if user in plugin.getOption("admins").getValue():
                        return True

        return False
Example #33
0
    def getVars(self):
        variables = WCSPageTemplateBase.getVars(self)

        bookingClass = CollaborationTools.getCSBookingClass(self._pluginId)
        variables["CanBeNotified"] = bookingClass._canBeNotifiedOfEventDateChanges

        return variables
Example #34
0
 def __init__(self, rh, queryParams):
     WPMainBase.__init__(self, rh)
     WPCollaborationBase.__init__(self)
     self._queryParams = queryParams
     self._user = self._rh.getAW().getUser()
     self._pluginsWithIndexing = CollaborationTools.pluginsWithIndexing(True)  # list of names
     self._buildExtraJS()
Example #35
0
 def export_eAgreements(self, aw):
     manager = self._conf.getCSBookingManager()
     requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, aw.getUser())
     contributions = manager.getContributionSpeakerByType(requestType)
     for cont, speakers in contributions.items():
         for spk in speakers:
             sw = manager.getSpeakerWrapperByUniqueId('%s.%s' % (cont, spk.getId()))
             if not sw:
                 continue
             signed = None
             if sw.getStatus() in (SpeakerStatusEnum.FROMFILE, SpeakerStatusEnum.SIGNED):
                 signed = True
             elif sw.getStatus() == SpeakerStatusEnum.REFUSED:
                 signed = False
             yield {
                 'confId': sw.getConference().getId(),
                 'contrib': cont,
                 'type': sw.getRequestType(),
                 'status': sw.getStatus(),
                 'signed': signed,
                 'speaker': {
                     'id': spk.getId(),
                     'name': spk.getFullName(),
                     'email': spk.getEmail()
                 }
             }
Example #36
0
 def export_eAgreements(self, aw):
     manager = self._conf.getCSBookingManager()
     requestType = CollaborationTools.getRequestTypeUserCanManage(self._conf, aw.getUser())
     contributions = manager.getContributionSpeakerByType(requestType)
     for cont, speakers in contributions.items():
         for spk in speakers:
             sw = manager.getSpeakerWrapperByUniqueId('%s.%s' % (cont, spk.getId()))
             if not sw:
                 continue
             signed = None
             if sw.getStatus() in (SpeakerStatusEnum.FROMFILE, SpeakerStatusEnum.SIGNED):
                 signed = True
             elif sw.getStatus() == SpeakerStatusEnum.REFUSED:
                 signed = False
             yield {
                 'confId': sw.getConference().getId(),
                 'contrib': cont,
                 'type': sw.getRequestType(),
                 'status': sw.getStatus(),
                 'signed': signed,
                 'speaker': {
                     'id': spk.getId(),
                     'name': spk.getFullName(),
                     'email': spk.getEmail()
                 }
             }
Example #37
0
def getCommonTalkInformation(conference):
    """ Returns a tuple of 3 lists:
        -List of talks (Contribution objects which are not in a Poster session)
        -List of webcast capable rooms, as a list of "locationName:roomName" strings
        -List of webcast-able talks (list of Contribution objects who take place in a webcast capable room)
    """

    #a talk is defined as a non-poster contribution
    filter = PosterFilterField(conference, False, False)
    talks = [
        cont for cont in conference.getContributionList()
        if filter.satisfies(cont)
    ]

    #list of "locationName:roomName" strings
    webcastCapableRooms = CollaborationTools.getOptionValue(
        'WebcastRequest', "webcastCapableRooms")

    #a webcast-able talk is defined as a talk talking place in a webcast-able room
    webcastAbleTalks = []
    for t in talks:
        location = t.getLocation()
        room = t.getRoom()
        if location and room and (location.getName() + ":" + room.getName()
                                  in webcastCapableRooms):
            webcastAbleTalks.append(t)

    return (talks, webcastCapableRooms, webcastAbleTalks)
Example #38
0
    def getWebcastServiceURL(self, wc):
        """ Returns the Webcast Service URL ( a string ).
            It will be used to display a link when an event is a forthcoming webcast.
        """
        if not wc:
            return None
        elif not wc.getAudience():
            return CollaborationTools.getOptionValue('WebcastRequest',
                                                     "webcastPublicURL")

        for row in CollaborationTools.getOptionValue('WebcastRequest',
                                                     "webcastAudiences"):
            if row['name'] == wc.getAudience():
                return row['structure']

        return ''
Example #39
0
    def hasRights(request=None, user=None, plugins=[]):
        """ Returns True if the user is an admin of one of the plugins corresponding to pluginNames
            plugins: a list of Plugin objects (e.g. EVO, RecordingRequest) or strings with the plugin name ('EVO', 'RecordingRequest')
                     or the string 'any' (we will then check if the user is manager of any plugin),
        """
        if not PluginsHolder().hasPluginType("Collaboration"):
            return False

        if user is None:
            if request is None:
                return False
            else:
                user = request._getUser()

        if user:
            collaborationPluginType = CollaborationTools.getCollaborationPluginType(
            )

            plist = collaborationPluginType.getPluginList() \
                      if plugins == 'any' else plugins

            if plist:
                for plugin in plist:
                    if not isinstance(plugin, Plugin):
                        plugin = collaborationPluginType.getPlugin(plugin)

                    if user in plugin.getOption('admins').getValue():
                        return True

        return False
Example #40
0
    def reportStatus(cls, status, message, idMachine, idTask, idLecture):
        '''Make status report to the database'''

#        Logger.get('RecMan').debug('in reportStatus()')

        if idLecture == '':
            idLecture = None

        try:
            connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                         port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                         user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBUser"),
                                         passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBPW"),
                                         db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
        except MySQLdb.Error, e:
            raise RecordingManagerException(_("MySQL database error %d: %s") % (e.args[0], e.args[1]))
Example #41
0
    def getVars(self):
        variables = WCSPageTemplateBase.getVars(self)

        bookingClass = CollaborationTools.getCSBookingClass(self._pluginId)
        variables["CanBeNotified"] = bookingClass._canBeNotifiedOfEventDateChanges

        return variables
Example #42
0
    def hasRights(request=None, user = None, pluginName=""):
        """ Returns True if the logged in user is an authorised user to create bookings.
            This is true if:
                  - The user is in the list of authorised user and groups
            request: an RH or Service object
            pluginName: the plugin to check
        """
        if not PluginsHolder().hasPluginType("Collaboration"):
            return False

        if user is None:
            if request is None:
                return False
            else:
                user = request._getUser()

        if user:
            collaborationPluginType = CollaborationTools.getCollaborationPluginType()
            plugin = collaborationPluginType.getPlugin(pluginName)
            if plugin.hasOption("AuthorisedUsersGroups"):
                if plugin.getOption("AuthorisedUsersGroups").getValue():
                    for entity in plugin.getOption("AuthorisedUsersGroups").getValue():
                        if isinstance(entity, Group) and entity.containsUser(user) or \
                            isinstance(entity, Avatar) and entity == user:
                                return True
                    return False
                else:
                    return True
            else:
                return True
        return False
Example #43
0
def getCommonTalkInformation(conference):
    """ Returns a tuple of 3 lists:
        -List of talks (Contribution objects which are not in a Poster session)
        -List of webcast capable rooms, as a list of "locationName:roomName" strings
        -List of webcast-able talks (list of Contribution objects who take place in a webcast capable room)
    """

    #a talk is defined as a non-poster contribution
    filter = PosterFilterField(conference, False, False)
    talks = [cont for cont in conference.getContributionList() if filter.satisfies(cont)]

    #list of "locationName:roomName" strings
    webcastCapableRooms = CollaborationTools.getOptionValueRooms('WebcastRequest', "webcastCapableRooms")
    wcRoomFullNames = [r.locationName + ':' + r.getFullName() for r in webcastCapableRooms]
    wcRoomNames = [r.locationName + ':' + r.name for r in webcastCapableRooms]

    #a webcast-able talk is defined as a talk talking place in a webcast-able room
    webcastAbleTalks = []
    for t in talks:
        location = t.getLocation()
        room = t.getRoom()
        if location and room and (location.getName() + ":" + room.getName() in wcRoomNames):
            webcastAbleTalks.append(t)

    return (talks, wcRoomFullNames, wcRoomNames, webcastAbleTalks)
Example #44
0
    def getInstance(cls, ravemAPIUrl = None, username = None, password = None):

        if cls._instance is None or (ravemAPIUrl is not None or username is not None or password is not None):

            if ravemAPIUrl is None:
                ravemAPIUrl = CollaborationTools.getCollaborationOptionValue('ravemAPIURL')
            if username is None:
                username = CollaborationTools.getCollaborationOptionValue('ravemUsername')
            if password is None:
                password = CollaborationTools.getCollaborationOptionValue('ravemPassword')

            try:
                cls._instance = RavemClient(username, password, ravemAPIUrl)
            except Exception:
                Logger.get("Ravem").exception("Problem building RavemClient")
                raise
        return cls._instance
Example #45
0
 def cleanAll(self):
     """ Wipes out everything
     """
     CollaborationIndex.__init__(self)
     for pluginInfo in CollaborationTools.getCollaborationPluginType(
     ).getOption("pluginsPerIndex").getValue():
         self._indexes[pluginInfo.getName()] = BookingsIndex(
             pluginInfo.getName())
Example #46
0
def getCDSRecords(confId):
    '''Query CDS to see if it has an entry for the given event as well as all its sessions, contributions and subcontributions.
    If yes return a dictionary pairing CDS IDs with Indico IDs.'''

    # Also, this method should then make sure that the database Status table has been updated to show that the export to CDS task is complete

#    Logger.get('RecMan').debug('in getCDSRecords()')

    # Slap a wildcard on the end of the ID to find the conference itself as well as all children.
    id_plus_wildcard = confId + "*"

    # Here is a help page describing the GET args,
    # if this CDS query needs to be changed (thanks [email protected]):
    # http://invenio-demo.cern.ch/help/hacking/search-engine-api
    # NB: We replace the string REPLACE_WITH_INDICO_ID manually instead of using %s because
    # there are also url-encoded chars containing the % char.
    optionsCDSQueryURL = CollaborationTools.getOptionValue("RecordingManager", "CDSQueryURL")
    escapedOptionsCDSQueryURL = optionsCDSQueryURL.replace("REPLACE_WITH_INDICO_ID", id_plus_wildcard)
#    Logger.get('RecMan').debug("escapedOptionsCDSQueryURL = " + escapedOptionsCDSQueryURL)
    url = escapedOptionsCDSQueryURL

    # This dictionary will contain CDS ID's, referenced by Indico ID's
    results = {}

    # perform the URL query to CDS. It contains one line for each CDS record,
    # of the form:
    # 001121974 970__ $$aINDICO.21917c22
    # The first number is the CDS record ID, with leading zeros
    # The second number is the MARC XML tag
    # The third string contains the Indico ID
    # (see http://www.loc.gov/marc/bibliographic for detailed information on MARC)
    request = Request(url)
    f = urlopen(request)
    lines = f.readlines()
    f.close()

    # Read each line, extracting the IndicoIDs and their corresponding CDS IDs
    for line in lines:
        result = line.strip()
        if result != "":
#            Logger.get('RecMan').debug(" CDS query result: %s" % line)

            bigcdsid = result.split(" ")[0]
            CDSID = bigcdsid.lstrip("0")

            p = re.compile('INDICO\.(\w*[sc\d]+)')
            m = p.search(line)

            if m:
                IndicoID = m.group(1)
                results[IndicoID] = CDSID
            else:
                # If we end up here then probably something's wrong with the URL, or perhaps we jusy got a blank line
                pass

#            results.append({"CDSID": CDSID, "IndicoID": IndicoID})

    return results
Example #47
0
    def getInstance(cls, ravemAPIUrl = None, username = None, password = None):

        if cls._instance is None or (ravemAPIUrl is not None or username is not None or password is not None):

            if ravemAPIUrl is None:
                ravemAPIUrl = CollaborationTools.getCollaborationOptionValue('ravemAPIURL')
            if username is None:
                username = CollaborationTools.getCollaborationOptionValue('ravemUsername')
            if password is None:
                password = CollaborationTools.getCollaborationOptionValue('ravemPassword')

            try:
                client = requests.session(auth=HTTPDigestAuth(username, password), verify=False)
                cls._instance = RavemClient(client, ravemAPIUrl)
            except Exception:
                Logger.get("Ravem").exception("Problem building RavemClient")
                raise
        return cls._instance
Example #48
0
def getOrphans():
    """Get list of Lecture Objects in the database that have no IndicoID assigned"""

    # Initialize success flag and result string
    flagSuccess = True
    result      = ""

    try:
        connection = MySQLdb.connect(host   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBServer"),
                                     port   = int(CollaborationTools.getOptionValue("RecordingManager", "micalaDBPort")),
                                     user   = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderUser"),
                                     passwd = CollaborationTools.getOptionValue("RecordingManager", "micalaDBReaderPW"),
                                     db     = CollaborationTools.getOptionValue("RecordingManager", "micalaDBName"))
    except NameError:
        raise MaKaCError("You need to install MySQLdb (python-mysql) in order to use the Recording Manager")
    except MySQLdb.Error, e:
        flagSuccess = False
        result += "MySQL error %d: %s" % (e.args[0], e.args[1])
Example #49
0
    def _checkParams(self):
        CollaborationBase._checkParams(self)
        if self._params.has_key('plugin'):
            self._plugin = self._params['plugin']
        else:
            raise CollaborationException(_("Plugin name not set when trying to add or remove a manager on event: ") + str(self._conf.getId()) + _(" with the service ") + str(self.__class__) )

        if CollaborationTools.getCollaborationPluginType().hasPlugin(self._plugin) and CollaborationTools.isAdminOnlyPlugin(self._plugin):
            raise CollaborationException(_("Tried to add or remove a manager for an admin-only plugin on event : ") + str(self._conf.getId()) + _(" with the service ") + str(self.__class__) )
Example #50
0
    def index_booking(self, bk):
        conf = bk.getConference()
        contribs = bk.getTalkSelectionList()
        choose = bk.isChooseTalkSelected()

        # if contributions chosen individually
        if choose and contribs:
            for contrib_id in contribs:
                # check that contrib is in valid room
                if CollaborationTools.isAbleToBeWebcastOrRecorded(conf.getContributionById(contrib_id), bk.getType()):
                    self.index_obj(CSBookingInstanceWrapper(bk, conf.getContributionById(contrib_id)))
        # We need to check if it is a lecture with a correct room
        elif CollaborationTools.isAbleToBeWebcastOrRecorded(conf, bk.getType()) or conf.getType() !="simple_event":
            for day in daysBetween(conf.getStartDate(), conf.getEndDate()):
                bkw = CSBookingInstanceWrapper(bk, conf,
                                               day.replace(hour=0, minute=0, second=0),
                                               day.replace(hour=23, minute=59, second=59))
                self.index_obj(bkw)