Changeset 31a202 in indico


Ignore:
Timestamp:
06/10/10 18:11:34 (3 years ago)
Author:
Jeremy Herr <jeremy.herr@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, new-webex, v0.97-series, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 0da0c1403bae8e51d8229f460181c71b9e6dda72
Children:
5f80ed
Parents:
04afe9
git-author:
Jeremy Herr <jeremy.herr@…> (04/06/10 16:09:23)
git-committer:
Jeremy Herr <jeremy.herr@…> (06/10/10 18:11:34)
Message:

[IMP] Got createIndicoLink() mostly working

  • now parseIndicoID() also returns the object in question
  • createIndicoLink() now works, but I still need to provide it with a CDSID
  • added the following options to options.py
    • CDSBaseURL
    • mediaArchiveFormatPlainVideo
    • mediaArchiveFormatWebLecture
  • in services.py, several fixes to get createIndicoLink() working
  • in Extra.js fixed minor errors to get RMCreateIndicoLink() working
Location:
indico/MaKaC/plugins/Collaboration/RecordingManager
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/plugins/Collaboration/RecordingManager/common.py

    r444cd19 r31a202  
    3737from MaKaC.common.output import outputGenerator, XSLTransformer 
    3838from MaKaC.conference import Link 
     39from MaKaC import conference 
    3940 
    4041from urllib2 import Request, urlopen 
     
    268269    if mE: 
    269270        Logger.get('RecMan').info("searched %s, matched %s" % (IndicoID, 'conference')) 
     271        conference = ConferenceHolder().getById(mE.group(1)) 
    270272        return {'type':           'conference', 
     273                'object':         conference, 
    271274                'conference':     mE.group(1), 
    272275                'session':        '', 
     
    275278    elif mS: 
    276279        Logger.get('RecMan').info("searched %s, matched %s" % (IndicoID, 'session')) 
     280        conference = ConferenceHolder().getById(mS.group(1)) 
    277281        return {'type':           'session', 
     282                'object':         conference.getSessionById(mS.group(2)), 
    278283                'conference':     mS.group(1), 
    279284                'session':        mS.group(2), 
     
    282287    elif mC: 
    283288        Logger.get('RecMan').info("searched %s, matched %s" % (IndicoID, 'contribution')) 
     289        conference = ConferenceHolder().getById(mC.group(1)) 
    284290        return {'type':           'contribution', 
     291                'object':         conference.getContributionById(mC.group(2)), 
    285292                'conference':     mC.group(1), 
    286293                'session':        '', 
     
    289296    elif mSC: 
    290297        Logger.get('RecMan').info("searched %s, matched %s" % (IndicoID, 'subcontribution')) 
     298        conference = ConferenceHolder().getById(mSC.group(1)) 
     299        contribution = conference.getContributionById(mSC.group(2)) 
    291300        return {'type':           'subcontribution', 
     301                'object':         contribution.getSubContributionById(mSC.group(3)), 
    292302                'conference':     mSC.group(1), 
    293303                'session':        '', 
     
    384394    '''Retrieve a MARC XML string for the given conference, then package it up and send it to CDS.''' 
    385395 
    386     # I don't understand what some of the following lines do. Pedro did some of it for me. 
     396    # Incantation to initialize XML that I don't fully understand 
    387397    xmlGen = XMLGen() 
    388398    xmlGen.initXml() 
     
    392402    og = outputGenerator(aw, xmlGen) 
    393403 
    394     # Generate XML tag to enclose the entire conference 
     404    # Generate XML event tag to enclose the entire conference 
    395405    xmlGen.openTag("event") 
    396406 
     
    559569    return results 
    560570 
    561 def createIndicoLink(IndicoID): 
     571def createIndicoLink(IndicoID, CDSID): 
    562572    """Create a link in Indico to the CDS record.""" 
    563573 
    564     eventInfo = parseIndicoID(IndicoID) 
     574    Logger.get('RecMan').info("in createIndicoLink()") 
     575    # From IndicoID, get info 
     576    talkInfo = parseIndicoID(IndicoID) 
     577    obj = talkInfo["object"] 
     578 
     579    # Only one link per talk allowed. 
     580    if doesExistIndicoLink(obj): 
     581        pass 
     582    else: 
     583        Logger.get('RecMan').info("trying to create new link in Indico") 
     584 
     585        # material object holds link object. 
     586        # First create a material object with title "Video in CDS" or whatever the current text is. 
     587        material = conference.Material() 
     588        material.setTitle(CollaborationTools.getOptionValue("RecordingManager", "videoLinkName")) 
     589 
     590        videoLink = Link() 
     591        videoLink.setOwner(material) 
     592        videoLink.setName("Name goes here") 
     593        videoLink.setDescription("Description goes here") 
     594        videoLink.setURL(CollaborationTools.getOptionValue("RecordingManager", "CDSBaseURL") % str(CDSID)) 
     595        material.addResource(videoLink) 
     596        obj.addMaterial(material) 
    565597 
    566598 
  • indico/MaKaC/plugins/Collaboration/RecordingManager/options.py

    r444cd19 r31a202  
    9595               "visible": True} ), 
    9696 
     97    ("CDSBaseURL", {"description" : _("Base URL for CDS record"), 
     98               "type": str, 
     99               "defaultValue": "http://cdsweb.cern.ch/record/%s", 
     100               "editable": True, 
     101               "visible": True} ), 
     102 
    97103    ("videoLinkName", {"description" : _("Name of Indico link to CDS"), 
    98104               "type": str, 
    99105               "defaultValue": "Video in CDS", 
     106               "editable": True, 
     107               "visible": True} ), 
     108 
     109# need to look over this again: 
     110    ("mediaArchiveFormatPlainVideo", {"description" : _("Format of plain video filename"), 
     111               "type": str, 
     112               "defaultValue": "http://mediaarchive.cern.ch/MediaArchive/Video/Public2/WebLectures/%s/%s", 
     113               "editable": True, 
     114               "visible": True} ), 
     115 
     116# need to look over this again: 
     117    ("mediaArchiveFormatWebLecture", {"description" : _("Format of web lecture filename"), 
     118               "type": str, 
     119               "defaultValue": "http://mediaarchive.cern.ch/MediaArchive/Video/Public2/WebLectures/%s/%s", 
    100120               "editable": True, 
    101121               "visible": True} ), 
  • indico/MaKaC/plugins/Collaboration/RecordingManager/services.py

    r3e6afb r31a202  
    2121 
    2222from MaKaC.services.implementation.collaboration import CollaborationPluginServiceBase 
    23 from MaKaC.plugins.Collaboration.RecordingRequest.common import getTalks 
    2423from MaKaC.plugins.Collaboration.RecordingManager.common import RecordingManagerException,\ 
    25     updateMicala, createCDSRecord 
     24    updateMicala, createCDSRecord, createIndicoLink 
    2625 
    2726 
     
    4746    def _checkParams(self): 
    4847        CollaborationPluginServiceBase._checkParams(self) #puts the Conference in self._conf 
    49         self._IndicoID    = self._params.get('IndicoID', None) 
    50         self._LOID        = self._params.get('LOID', None) 
    51         self._confId      = self._params.get('conference', None) 
     48        self._IndicoID    = self._params.get('IndicoID',    None) 
     49        self._LOID        = self._params.get('LOID',        None) 
     50        self._confId      = self._params.get('conference',  None) 
    5251        self._videoFormat = self._params.get('videoFormat', None) 
    5352        self._contentType = self._params.get('contentType', None) 
     
    8887    def _checkParams(self): 
    8988        CollaborationPluginServiceBase._checkParams(self) #puts the Conference in self._conf 
    90         self._IndicoID = self._params.get('IndicoID', None) 
    91         self._LOID     = self._params.get('LOID', None) 
     89        self._IndicoID = self._params.get('IndicoID',   None) 
     90        self._LOID     = self._params.get('LOID',       None) 
    9291        self._confId   = self._params.get('conference', None) 
    9392 
    9493        if not self._IndicoID: 
    9594            raise RecordingManagerException("No IndicoID supplied") 
    96         if not self._LOID: 
    97             raise RecordingManagerException("No LOID supplied") 
    9895        if not self._confId: 
    9996            raise RecordingManagerException("No conference ID supplied") 
     
    10198    def _getAnswer(self): 
    10299        # Create the Indico link 
    103         resultCreateIndicoLink = createIndicoLink(self._IndicoID) 
     100        resultCreateIndicoLink = createIndicoLink(self._IndicoID, "12345") 
    104101 
    105102        return str(resultCreateIndicoLink) 
  • indico/MaKaC/plugins/Collaboration/RecordingManager/tpls/Extra.js

    r3e6afb r31a202  
    101101 
    102102// following added by jherr - I just copied and modified RRUpdateContributionList 
     103var ButtonCreateIndicoLink = new DisabledButton(Html.input("button", {disabled:true}, $T("Create Indico Link"))); 
     104var ButtonCreateCDSRecord  = new DisabledButton(Html.input("button", {disabled:true}, $T("Create CDS Record"))); 
     105 
    103106var REUpdateOrphanList = function () { 
    104107    if (RE_orphans.length > 0) { 
     
    113116} 
    114117 
    115  
    116 var ButtonCreateIndicoLink = new DisabledButton(Html.input("button", {disabled:true}, $T("Create Indico Link"))); 
    117 var ButtonCreateCDSRecord  = new DisabledButton(Html.input("button", {disabled:true}, $T("Create CDS Record"))); 
    118  
    119118ButtonCreateCDSRecord.observeClick(function(){ 
    120119    if (ButtonCreateCDSRecord.isEnabled()) { 
     
    142141 
    143142ButtonCreateIndicoLink.observeClick(function(){ 
    144     if (!ButtonCreateIndicoLink.isEnabled()) { 
     143    if (ButtonCreateIndicoLink.isEnabled()) { 
    145144        if (typeof RMselectedTalkId != 'undefined' && RMselectedTalkId != '' && 
    146145                (RMviewMode == 'plain_video' || 
Note: See TracChangeset for help on using the changeset viewer.