Changeset 010517 in indico


Ignore:
Timestamp:
01/26/11 18:37:45 (2 years ago)
Author:
Pedro Ferreira <jose.pedro.ferreira@…>
Branches:
master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
Children:
5bcab3
Parents:
e952fe
git-author:
Pedro Ferreira <jose.pedro.ferreira@…> (01/26/11 09:17:14)
git-committer:
Pedro Ferreira <jose.pedro.ferreira@…> (01/26/11 18:37:45)
Message:

[IMP] Several fixes in IM module

  • Moved static resources out of indico core;
  • Fixed index inconsistencies and some code formatting;
  • Some other minimal changes;
Location:
indico
Files:
1 added
16 edited
3 moved

Legend:

Unmodified
Added
Removed
  • indico/MaKaC/plugins/InstantMessaging/XMPP/components.py

    rb8c483 r010517  
    9494                out.writeTag("server", 'conference.' + chatroom.getHost() if chatroom.getCreatedInLocalServer() else chatroom.getHost()) 
    9595                out.writeTag("description", chatroom.getDescription()) 
    96                 out.writeTag("reqPassword", _('Yes') if len(chatroom.getPassword()) > 0 else _('No')) 
     96                out.writeTag("reqPassword", _('Yes') if chatroom.getPassword() else _('No')) 
    9797                out.writeTag("showPassword", chatroom.getShowPass()) 
    9898                out.writeTag("password", chatroom.getPassword()) 
     
    169169        room = params['room'] 
    170170 
    171         conference = room.getConference() 
     171        conference = params['conference'] 
    172172 
    173173        # index by conference id 
    174         confIndex = IndexByConf(conference.getId()) 
     174        confIndex = IndexByConf() 
    175175        room.setId(DBHelpers.newID()) 
    176         confIndex.index(room) 
     176        confIndex.index(conference.getId(), room) 
    177177 
    178178        # Index by chat room's name 
    179         crNameIndex = IndexByCRName(room.getTitle()) 
     179        crNameIndex = IndexByCRName() 
    180180        crNameIndex.index(room) 
    181181 
     
    185185 
    186186        # Index by room creator 
    187         userIndex = IndexByUser(room.getOwner().getId()) 
    188         userIndex.index(room) 
     187        userIndex = IndexByUser() 
     188        userIndex.index(room.getOwner().getId(), room) 
    189189 
    190190    @classmethod 
     
    195195        if oldTitle != newRoom.getTitle(): 
    196196            #the title has been changed. Get rid of the old index and substitute it for the new one 
    197             crNameIndex = IndexByCRName(newRoom.getTitle()) 
     197            crNameIndex = IndexByCRName() 
    198198            crNameIndex.unindex(newRoom, oldTitle) 
    199             crNameIndex.index(newRoom) 
     199            crNameIndex.index(newRoom.getTitle(), newRoom) 
    200200 
    201201    @classmethod 
    202202    def deleteChatroom(cls, obj, params): 
    203203        """ Deletes the chat room in the database according to all kind of indexing types""" 
    204         try: 
    205             chatroom = params['room'] 
    206  
    207             confId = obj._conferenceID 
    208             #if we have the same room used in two or more different conferences, we just delete it from the 
    209             #conferences list in the chat room and from the IndexByConf index 
    210             chatroom.getConferences().pop(confId) 
    211             confIndex = IndexByConf(confId) 
    212             confIndex.unindex(chatroom) 
    213  
    214             if len(chatroom.getConferences()) is 0: 
    215                 #there are no more references to the chat room, we completely delete it 
    216                 crNameIndex = IndexByCRName(chatroom.getTitle()) 
    217                 crNameIndex.unindex(chatroom) 
    218  
    219                 idIndex = IndexByID() 
    220                 idIndex.unindex(chatroom) 
    221  
    222                 userIndex = IndexByUser(chatroom.getOwner().getId()) 
    223                 userIndex.unindex(chatroom) 
    224  
    225         except Exception, e: 
    226             raise ServiceError(message=str(e)) 
     204 
     205        chatroom = params['room'] 
     206 
     207        confId = obj._conferenceID 
     208        #if we have the same room used in two or more different conferences, we just delete it from the 
     209        #conferences list in the chat room and from the IndexByConf index 
     210        chatroom.getConferences().pop(confId) 
     211        confIndex = IndexByConf() 
     212        confIndex.unindex(confId, chatroom) 
     213 
     214        if len(chatroom.getConferences()) is 0: 
     215            #there are no more references to the chat room, we completely delete it 
     216            crNameIndex = IndexByCRName() 
     217            crNameIndex.unindex(chatroom) 
     218 
     219            idIndex = IndexByID() 
     220            idIndex.unindex(chatroom) 
     221 
     222            userIndex = IndexByUser() 
     223            userIndex.unindex(chatroom.getOwner().getId(), chatroom) 
    227224 
    228225    @classmethod 
     
    234231        confId = params['conf'] 
    235232 
    236         try: 
    237             confIndex = IndexByConf(confId) 
    238             confIndex.index(room) 
    239  
    240         except Exception, e: 
    241             raise NoReportError( _('The chat room %s could not be re-used' %room.getTitle())) 
     233        confIndex = IndexByConf() 
     234        confIndex.index(confId, room) 
    242235 
    243236 
     
    254247        # saying that a chat room was created. We pass the 2 mandatory arguments and finally the arguments required for performOperation 
    255248        # (in this case, only one argument) 
    256         ExternalOperationsManager.execute(cls, "create_"+str(cls.__class__)+str(room.getId()), cls.performOperation, 'create', room.getConference(), room, room) 
     249        ExternalOperationsManager.execute(cls, "create_"+str(cls.__class__)+str(room.getId()), cls.performOperation, 'create', room.getConferences().values()[0], room, room) 
    257250 
    258251    @classmethod 
  • indico/MaKaC/plugins/InstantMessaging/XMPP/handlers.py

    rb8c483 r010517  
    161161 
    162162    def _getAnswer( self ): 
     163        conference = ConferenceHolder().getById(self._conferenceID) 
    163164        self._room = XMPPChatroom(self._title, \ 
    164165                              self._user, \ 
    165                               ConferenceHolder().getById(self._conferenceID), \ 
     166                              conference, \ 
    166167                              None, \ 
    167168                              self._description, \ 
     
    176177        try: 
    177178            ContextManager.getdefault('mailHelper', MailHelper()) 
    178             self._notify('createChatroom', {'room': self._room}) 
     179            self._notify('createChatroom', {'room': self._room, 
     180                                            'conference': conference}) 
    179181        except ServiceError, e: 
    180             Logger.get('InstantMessaging (XMPP-Indico server)').error("Exception while notifying observers: %s" %e) 
     182            Logger.get('ext.im').error("Exception while notifying observers: %s" %e) 
    181183            raise ServiceError( message=self.messages['sameId']+e ) 
    182184        except NoReportError, e: 
    183             Logger.get('InstantMessaging (XMPP-Indico server)').error("Room exists: %s" %e) 
     185            Logger.get('ext.im').error("Room exists: %s" %e) 
    184186            raise NoReportError(self.messages['sameName'], explanation='roomExists') 
    185187        except Exception, e: 
    186             Logger.get('InstantMessaging (XMPP-Indico server)').error("Weird exception while notifying observers: %s" %e) 
     188            Logger.get('ext.im').error("Weird exception while notifying observers: %s" %e) 
    187189            raise ServiceError( message=str(e) ) 
    188190        if self._room.getCreatedInLocalServer(): 
     
    190192            self.createRoomXMPP(self._botJID, self._botPass, self._room) 
    191193 
    192         Logger.get('InstantMessaging (XMPP-Indico server)').info("The room %s has been created by the user %s at %s hours" %(self._title, self._user.getName(), self._room.getModificationDate())) 
    193  
    194         tz = DisplayTZ(self._aw, self._room.getConference()).getDisplayTZ() 
     194        Logger.get('ext.im').info("The room %s has been created by the user %s at %s hours" %(self._title, self._user.getName(), self._room.getModificationDate())) 
     195 
     196        tz = DisplayTZ(self._aw, conference).getDisplayTZ() 
    195197 
    196198        ContextManager.get('mailHelper').sendMails() 
    197199        fossilizedRoom = self._room.fossilize(tz=tz) 
     200 
    198201        # add links to join the room 
    199         generateCustomLinks(fossilizedRoom, self._room) 
     202        fossilizedRoom['custom'] = generateCustomLinks(self._room) 
     203 
    200204        # add link to retrieve logs 
    201         generateLogLink(fossilizedRoom, self._room, self._room.getConference() if len(self._room.getConferences()) is 1 else self._room.getConference().values()[0]) 
     205        fossilizedRoom['logs'] = generateLogLink(self._room, conference) 
    202206 
    203207        return fossilizedRoom 
     
    249253            self._notify('editChatroom', {'oldTitle': oldRoom.getTitle(), 'newRoom':self._room}) 
    250254        except ServiceError, e: 
    251             Logger.get('InstantMessaging (XMPP-Indico server)').error("Exception while editing: %s" %e) 
     255            Logger.get('ext.im').error("Exception while editing: %s" %e) 
    252256            raise ServiceError( message=_('Problem while accessing the database: %s' %e)) 
    253257        except Exception, e: 
    254             Logger.get('InstantMessaging (XMPP-Indico server)').error("Weird exception while notifying observers: %s" %e) 
     258            Logger.get('ext.im').error("Weird exception while notifying observers: %s" %e) 
    255259            raise NoReportError( self.messages['editing'], explanation='roomExists') 
    256260 
     
    281285 
    282286        if modified: 
    283             Logger.get('InstantMessaging (XMPP-Indico server)').info("The room %s has been modified by the user %s at %s hours" %(self._title, self._user.getName(), self._room.getModificationDate())) 
     287            Logger.get('ext.im').info("The room %s has been modified by the user %s at %s hours" %(self._title, self._user.getName(), self._room.getModificationDate())) 
    284288 
    285289        ContextManager.get('mailHelper').sendMails() 
     
    307311            self._notify('deleteChatroom', {'room': self._room}) 
    308312        except ServiceError, e: 
    309             Logger.get('InstantMessaging (XMPP-Indico server)').error(message=_('Problem deleting indexes in the database for chat room %s: %s' %(self._room.getTitle(), e))) 
     313            Logger.get('ext.im').exception(_('Problem deleting indexes in the database for chat room %s' % self._room.getTitle())) 
    310314            raise ServiceError( message=_('Problem deleting indexes in the database for chat room %s: %s' %(self._room.getTitle(), e))) 
    311315 
     
    320324            req = urllib2.Request(url, None, {'Accept-Charset' : 'utf-8'}) 
    321325            document = urllib2.urlopen(req) 
    322             Logger.get('InstantMessaging (XMPP-Indico server)').info("The room %s has been deleted by the user %s at %s hours" %(self._title, self._user.getName(), nowutc())) 
     326            Logger.get('ext.im').info("The room %s has been deleted by the user %s at %s hours" %(self._title, self._user.getName(), nowutc())) 
    323327 
    324328        ContextManager.get('mailHelper').sendMails() 
     
    388392                    room = DBHelpers.getChatroom(roomID) 
    389393                except Exception, e: 
    390                     Logger.get('InstantMessaging (XMPP-Indico server)').warning("The user %s tried to re-use the chat room %s, but it was deleted before he clicked the Add button: %s" %(self._aw.getUser().getFullName(), roomID, e)) 
     394                    Logger.get('ext.im').warning("The user %s tried to re-use the chat room %s, but it was deleted before he clicked the Add button: %s" %(self._aw.getUser().getFullName(), roomID, e)) 
    391395                    raise NoReportError(_('Some of the rooms were deleted from the other conference(s) they belonged to. Please refresh your browser')) 
    392396                room.setConference(ConferenceHolder().getById(self._conference)) 
     
    394398                fossilizedRoom = room.fossilizeMultiConference(ConferenceHolder().getById(self._conference)) 
    395399                # add links to join the room 
    396                 generateCustomLinks(fossilizedRoom, room) 
     400                fossilizedRoom['custom'] = generateCustomLinks(room) 
    397401                # add link to retrieve logs 
    398                 generateLogLink(fossilizedRoom, room, room.getConference() if len(room.getConferences()) is 1 else room.getConference().values()[0]) 
     402                fossilizedRoom['logs'] = generateLogLink(room, room.getConferences().values()[0]) 
    399403                rooms.append(fossilizedRoom) 
    400404        except NoReportError, e: 
    401             Logger.get('InstantMessaging (XMPP-Indico server)').error("Error adding chat rooms. User: %s. Chat room: %s. Traceback: %s" %(self._aw.getUser().getFullName(), roomID, e)) 
     405            Logger.get('ext.im').exception("Error adding chat rooms. User: %s. Chat room: %s" %(self._aw.getUser().getFullName(), roomID)) 
    402406            raise ServiceError(message = _('There was an error trying to add the chat rooms. Please refresh your browser and try again')) 
    403407 
  • indico/MaKaC/plugins/InstantMessaging/XMPP/helpers.py

    rb8c483 r010517  
    4141 
    4242    def generate(self): 
    43  
    4443        link = re.sub('\[chatroom\]', self._chatroom.getTitle(), self._structure) 
    4544        link = re.sub('\[host\]', self._chatroom.getHost(), link) 
     
    5049        return link 
    5150 
    52 def generateCustomLinks(var, chatroom): 
     51 
     52def generateCustomLinks(chatroom): 
    5353    linkList = PluginFieldsWrapper('InstantMessaging').getOption('customLinks') 
    54     # if some link type is specified 
    55     if linkList.__len__() > 0: 
    56         var['custom'] = [] 
    57         for link in linkList: 
    58             addLink(var['custom'], link['name'], GeneralLinkGenerator(chatroom, link['structure']).generate(), chatroom.getId()) 
     54 
     55    result = [] 
     56    for link in linkList: 
     57        result.append({'name': link['name'], 
     58                       'link': GeneralLinkGenerator(chatroom, 
     59                                                    link['structure']).generate() 
     60                       }) 
     61    return result 
    5962 
    6063 
    61 def generateLogLink(var, chatroom, conf): 
     64def generateLogLink(chatroom, conf): 
    6265    if XMPPLogsActivated(): 
    63         var['logs'] = UHConfModifChatSeeLogs.getURL(conf) 
    64         var['logs'].addParam('chatroom', chatroom.getId()) 
    65         var['logs'] = var['logs'].__str__() 
     66        url = UHConfModifChatSeeLogs.getURL(conf) 
     67        url.addParam('chatroom', chatroom.getId()) 
     68        return str(url) 
     69    else: 
     70        return None 
    6671 
    6772 
  • indico/MaKaC/plugins/InstantMessaging/XMPP/options.py

    rf7f228 r010517  
    7171</table>"}), 
    7272 
    73     ("activateLogs", {"description": _("Make possible to see chat logs and attach them to the material \ 
    74     \ 
    75     REMEMBER, you will need to put in the Jappix dir the code.py file contained in the ext folder, inside the XMPP plugin."), 
     73    ("activateLogs", {"description": _("""Make possible to see chat logs and attach them to the material <div style="font-style: italic; margin-top:5px;">You will need to configure a web service in your XMPP server - see <a href="">here</a>.</div>"""), 
    7674                            "type": bool, 
    7775                            "defaultValue": False, 
  • indico/MaKaC/plugins/InstantMessaging/chatroom.py

    rf7f228 r010517  
    4040        self._owner = owner 
    4141        self._creationDate = nowutc() 
    42         self._conference = PersistentMapping() 
    43         self._conference[conference.getId()] = conference 
     42        self._conferences = PersistentMapping() 
     43        self._conferences[conference.getId()] = conference 
    4444        self._modificationDate = modificationDate 
    4545        self._createdInLocalServer = createdInLocalServer 
     
    5858        self._owner = values['user'] 
    5959        #it has to be a dictionary with conferences, otherwise it'll make everything go wrong 
    60         self._conference[values['conference'].getId()] = values['conference'] 
     60        self._conferences[values['conference'].getId()] = values['conference'] 
    6161        self._modificationDate = values['modificationDate'] 
    6262        self._createdInLocalServer = values['createdInLocalServer'] 
     
    112112 
    113113    def setConference(self, conference): 
    114         if len(self._conference) is 0: 
    115             self._conference = PersistentMapping() 
    116         self._conference[conference.getId()] = conference 
    117  
    118     def getConference(self): 
    119         """ If there's only one conference in the dictionary it returns the conference itself, otherwise returns the dictionary""" 
    120         if len(self._conference) is 1: 
    121             return self._conference.values()[0] 
    122         elif len(self._conference) >1: 
    123             return self._conference 
    124         else: 
    125             raise ServiceError(message='No conferences found in the chat room %s'%self._name) 
     114        self._conferences[conference.getId()] = conference 
    126115 
    127116    def getConferences(self): 
    128         """ returns always the dictionary""" 
    129         return self._conference 
     117        return self._conferences 
    130118 
    131119    def getId(self): 
  • indico/MaKaC/plugins/InstantMessaging/indexes.py

    rf7f228 r010517  
    4444        if not self._root.has_key(self._index): 
    4545            self._root[self._index] = self 
    46             self._storingStructure = self._storingStructure() 
     46            self._data = self._storingStructure() 
    4747        self._indexToAccess = self._root[self._index] 
    48         self._storingStructure = self._indexToAccess.get() 
     48        self._data = self._indexToAccess.get() 
    4949 
    5050    def _indexCheckDelete(self, element): 
     
    5757    def get(self): 
    5858        #return self._indexToAccess 
    59         return self._storingStructure 
     59        return self._data 
    6060 
    6161    def index(self, element): 
     
    7676    """ Index by conference. Using the conference id as the key, there will be a OOTreeSet inside with all the existing chat rooms for that conference""" 
    7777 
    78     def __init__(self, conf): 
     78    def __init__(self): 
    7979        IMIndex.__init__(self, 'indexByConf') 
    80         self._conf = conf 
    8180 
    82     def index(self, element): 
     81    def index(self, conf, element): 
    8382        self._indexCheck() 
    8483 
    8584        # self.get is equivalent to root['indexByConf'] 
    86         if not self.get().has_key(self._conf): 
    87             self.get()[self._conf] = OOTreeSet() 
     85        if not self.get().has_key(conf): 
     86            self.get()[conf] = OOTreeSet() 
    8887 
    89         self.get()[self._conf].insert(element) 
     88        self.get()[conf].insert(element) 
    9089 
    91     def unindex(self, element): 
    92         self.get()[self._conf].remove(element) 
     90    def unindex(self, conf, element): 
     91        self.get()[conf].remove(element) 
    9392 
    94         self._indexCheckDelete(self._conf) 
     93        self._indexCheckDelete(conf) 
    9594 
    9695 
     
    9897    """ Index by user ID. We use a OOTreeSet to store the chat rooms""" 
    9998 
    100     def __init__(self, id): 
     99    def __init__(self): 
    101100        IMIndex.__init__(self, 'indexByUser') 
    102         self._id = id 
    103101 
    104     def index(self, element): 
     102    def index(self, userId, element): 
    105103        self._indexCheck() 
    106104 
    107105        # self.get is equivalent to root['IndexByUser'] 
    108         if not self.get().has_key(self._id): 
    109             self.get()[self._id] = OOTreeSet() 
     106        if not self.get().has_key(userId): 
     107            self.get()[userId] = OOTreeSet() 
    110108 
    111         self.get()[self._id].insert(element) 
     109        self.get()[userId].insert(element) 
    112110 
    113     def unindex(self, element): 
    114         self.get()[self._id].remove(element) 
     111    def unindex(self, userId, element): 
     112        self.get()[userId].remove(element) 
    115113 
    116         self._indexCheckDelete(self._id) 
     114        self._indexCheckDelete(userId) 
    117115 
    118116 
     
    120118    """ Index by chat room name. We allow chat rooms to have the same name if they are in different servers. For each key we use a OOTreeSet to store them""" 
    121119 
    122     def __init__(self, name): 
     120    def __init__(self): 
    123121        IMIndex.__init__(self, 'indexByCRName') 
    124         self._name = name 
    125122 
    126123    def index(self, element): 
     
    146143            self._indexCheckDelete(indexToRemove) 
    147144        else: 
    148             self.get()[self._name].remove(element) 
    149             self._indexCheckDelete(self._name) 
     145            title = element.getTitle() 
     146            self.get()[title].remove(element) 
     147            self._indexCheckDelete(title) 
    150148 
    151149 
     
    167165    def unindex(self, element): 
    168166        self.get().pop(element.getId()) 
    169  
  • indico/MaKaC/plugins/InstantMessaging/pages.py

    rb8c483 r010517  
    2626from MaKaC.common.fossilize import fossilize 
    2727from MaKaC.common.timezoneUtils import getAdjustedDate, nowutc, setAdjustedDate, DisplayTZ, minDatetime 
    28 from MaKaC.plugins import PluginsHolder 
     28from MaKaC.plugins import PluginsHolder, InstantMessaging 
    2929from MaKaC.plugins.helpers import DBHelpers 
    3030from MaKaC.plugins.util import PluginFieldsWrapper 
     
    3333from MaKaC.plugins.InstantMessaging.XMPP.helpers import generateCustomLinks, generateLogLink, XMPPLogsActivated, DesktopLinkGenerator, WebLinkGenerator 
    3434from MaKaC.i18n import _ 
     35import zope.interface 
     36from indico.core.api import Component 
     37from indico.core.api.conference import IEventDisplayContributor 
     38 
    3539 
    3640class WPConfModifChat(WPConferenceModifBase): 
     
    5054    def getJSFiles(self): 
    5155        return WPConferenceModifBase.getJSFiles(self) + self._includeJSPackage('Plugins') 
     56 
     57    def getJSFiles(self): 
     58        return WPConferenceModifBase.getJSFiles(self) + \ 
     59               self._includeJSFile('InstantMessaging/js', 'InstantMessaging') 
     60 
     61    def getCSSFiles(self): 
     62        return WPConferenceModifBase.getCSSFiles(self) + \ 
     63               ['InstantMessaging/im.css'] 
    5264 
    5365    def _createTabCtrl(self): 
     
    7082        if len(self._tabNames) > 0: 
    7183            self._createTabCtrl() 
    72             wc = WConfModifChat(self._conf, self._activeTabName, self._tabNames, self._aw) 
     84            wc = WConfModifChat.forModule(InstantMessaging, self._conf, 
     85                                          self._activeTabName, self._tabNames, self._aw) 
    7386            return wcomponents.WTabControl(self._tabCtrl, self._getAW()).getHTML(wc.getHTML({})) 
    7487        else: 
     
    8497 
    8598    def _getBody(self, params): 
    86         wc = WConferenceInstantMessaging(self._conf, self._aw) 
     99        wc = WConferenceInstantMessaging.forModule(InstantMessaging, 
     100                                                   self._conf, self._aw) 
    87101        return wc.getHTML({}) 
    88102 
     
    91105        self._sectionMenu.setCurrentItem(self._sectionMenu.getLinkByName("instantMessaging")) 
    92106 
     107 
     108class IMEventDisplayComponent(Component): 
     109 
     110    zope.interface.implements(IEventDisplayContributor) 
     111 
     112    # EventDisplayContributor 
     113    def injectCSSFiles(self, obj): 
     114        return ['InstantMessaging/im.css'] 
    93115 
    94116 
     
    113135            vars["Chatrooms"] = None 
    114136            chatrooms = {} 
    115         vars['links'] = {} 
     137        links = {} 
    116138 
    117139        for cr in chatrooms: 
    118             vars['links'][cr.getId() ] = {} 
    119             generateCustomLinks(vars["links"][cr.getId()], cr) 
    120             generateLogLink(vars["links"][cr.getId()], cr, self._conf) 
     140            crinfo = links[cr.getId() ] = {} 
     141            crinfo['custom'] = generateCustomLinks(cr) 
     142            crinfo['logs'] = generateLogLink(cr, self._conf) 
     143 
     144        vars['links'] = links 
    121145 
    122146        vars['DefaultServer'] = PluginFieldsWrapper('InstantMessaging', 'XMPP').getOption('chatServerHost') 
     
    128152 
    129153        return vars 
    130  
    131  
    132154 
    133155class WConferenceInstantMessaging(wcomponents.WTemplated): 
     
    150172        for cr in vars["Chatrooms"]: 
    151173            vars["Links"][cr.getId()] = {} 
    152             generateCustomLinks(vars["Links"][cr.getId()], cr) 
     174            vars["Links"][cr.getId()]['custom'] = generateCustomLinks(cr) 
    153175 
    154176        return vars 
    155  
  • indico/MaKaC/plugins/InstantMessaging/rh.py

    rb8c483 r010517  
    2626from MaKaC.plugins.InstantMessaging.urlHandlers import UHConfModifChat, UHConfModifChatSeeLogs, UHConferenceInstantMessaging 
    2727from MaKaC.plugins.InstantMessaging.XMPP.helpers import LogLinkGenerator 
     28from MaKaC.plugins import InstantMessaging 
    2829from MaKaC.webinterface.rh.conferenceDisplay import RHConferenceBaseDisplay 
    2930from MaKaC.webinterface.rh.conferenceModif import RHConferenceModifBase 
    3031from MaKaC.errors import MaKaCError 
    3132from MaKaC.i18n import _ 
    32 import urllib2 
     33import urllib2, os 
    3334 
    3435from indico.web.legacy import wrapUH 
     36from indico.web.rh import RHHtdocs 
     37 
     38class RHInstantMessagingHtdocs(RHHtdocs): 
     39    """ 
     40    Static file handler for InstantMessaging plugin 
     41    """ 
     42 
     43    _url = r"^/InstantMessaging/(?P<filepath>.*)$" 
     44    _local_path = os.path.join(InstantMessaging.__path__[0], 'htdocs') 
     45 
    3546 
    3647class RHChatModifBase(RHConferenceModifBase): 
  • indico/MaKaC/plugins/InstantMessaging/tpls/ConferenceInstantMessaging.tpl

    r2f5998 r010517  
    3333                <td><div id='desc<%= cr.getId() %>'> <%= cr.getDescription()%></div></td> 
    3434 
    35                 <td> <%= _('Yes') if len(cr.getPassword()) > 0 else _('No')%></td> 
     35                <td> <%= _('Yes') if cr.getPassword() else _('No')%></td> 
    3636 
    37                 <% if cr.getShowPass() and len(cr.getPassword()) > 0:%> 
     37                <% if cr.getShowPass() and cr.getPassword():%> 
    3838                    <td> <%= cr.getPassword()%> </td> 
    3939                <% end %> 
    40                 <% elif not cr.getShowPass() and len(cr.getPassword()) > 0:%> 
     40                <% elif not cr.getShowPass() and cr.getPassword():%> 
    4141                    <td style="font-style:italic;"> <%= _('Not displayed')%> </td> 
    4242                <% end %> 
     
    4444                    <td style="font-style:italic;"> - </td> 
    4545                <% end %> 
    46                 <% if PluginFieldsWrapper('InstantMessaging').getOption('customLinks').__len__() > 0: %> 
     46                <% if len(PluginFieldsWrapper('InstantMessaging').getOption('customLinks')) > 0: %> 
    4747                    <td style="font-weight: bold;" nowrap><a id="joinLink<%= cr.getId() %>" name = "<%= cr.getId() %>" class="dropDownMenu highlight" href="#"><%= _("Join now!")%></a></td> 
    4848                <% end %> 
  • indico/MaKaC/plugins/base.py

    r6df324 r010517  
    103103        #Register it. We take the list of the interfaces implemented by the component 
    104104        implementedInterfaces = list(zope.interface.implementedBy(component)) 
     105 
    105106        for interface in implementedInterfaces: 
    106107 
     
    139140            try: 
    140141                results.append(f(obj, *params)) 
    141             except NoReportError, e: 
    142                 raise NoReportError(str(e)) 
    143142            except Exception, e: 
    144143                Logger.get('PluginNotifier').exception("Exception while calling subscriber %s" % str(subscriber.__class__)) 
  • indico/MaKaC/plugins/helpers.py

    rb8c483 r010517  
    5050    def getChatroomList(cls, conf): 
    5151        conf = str(conf.getId()) 
    52         index = IndexByConf(conf).get() 
     52        index = IndexByConf().get() 
    5353 
    5454        if not index.has_key(conf): 
     
    6868        """ Will return the chat rooms created by the requested user """ 
    6969        userID = str(user['id']) 
    70         index = IndexByUser(userID).get() 
     70        index = IndexByUser().get() 
    7171 
    7272        if not index.has_key(userID): 
  • indico/MaKaC/webinterface/pages/base.py

    r216b1e r010517  
    2525from MaKaC.i18n import _ 
    2626 
    27 class WPBase: 
     27from MaKaC.plugins.base import OldObservable 
     28 
     29 
     30class WPBase(OldObservable): 
    2831    """ 
    2932    """ 
  • indico/MaKaC/webinterface/pages/conferences.py

    r216b1e r010517  
    6969from MaKaC.fossils.conference import IConferenceEventInfoFossil 
    7070from MaKaC.common.Conversion import Conversion 
     71from MaKaC.common.logger import Logger 
    7172from MaKaC.plugins.base import OldObservable 
    72 from MaKaC.common.logger import Logger 
    73  
    7473from indico.modules import ModuleHolder 
    7574 
     
    120119        return urlHandlers.UHSignOut.getURL(str(urlHandlers.UHConferenceDisplay.getURL(self._conf))) 
    121120 
    122 class WPConferenceDisplayBase( WPConferenceBase ): 
     121class WPConferenceDisplayBase( WPConferenceBase, OldObservable ): 
    123122 
    124123    def getJSFiles(self): 
     
    126125               self._includeJSPackage('MaterialEditor') 
    127126 
    128 class WPConferenceDefaultDisplayBase( WPConferenceBase, OldObservable ): 
     127    def getCSSFiles(self): 
     128        # flatten returned list 
     129 
     130        return WPConferenceBase.getCSSFiles(self) + \ 
     131               sum(self._notify('injectCSSFiles'), []) 
     132 
     133class WPConferenceDefaultDisplayBase( WPConferenceBase): 
    129134    navigationEntry = None 
    130135 
     
    919924            self._webcastadd = True 
    920925 
     926    def getCSSFiles(self): 
     927        # flatten returned list 
     928 
     929        return WPConferenceBase.getCSSFiles(self) + \ 
     930               sum(self._notify('injectCSSFiles'), []) 
    921931 
    922932    def getJSFiles(self): 
  • indico/MaKaC/webinterface/wcomponents.py

    r6df324 r010517  
    8181 
    8282    @classmethod 
    83     def forModule(cls, module): 
    84         tplobj = cls() 
     83    def forModule(cls, module, *args): 
     84        tplobj = cls(*args) 
    8585        # HACK :/ 
    8686        tplobj._dir = os.path.join(module.__path__[0], 'tpls') 
  • indico/core/api/conference.py

    rdb8136 r010517  
    1919## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 
    2020 
    21 from indico.core.api import IListener, IContributor 
     21from indico.core.api import IContributor 
    2222 
    2323 
     
    8989        pass 
    9090 
     91 
     92class IEventDisplayContributor(IContributor): 
     93 
     94    """ 
     95    Aggregates extension points that relate to event display pages 
     96    """ 
     97 
     98    def injectCSSFiles(self, obj): 
     99        """ 
     100        Observers should contribute with CSS files they wish to add to the 
     101        <head></head> block 
     102        """ 
  • indico/ext/livesync/chrome.py

    r756437 r010517  
    169169 
    170170 
    171 NUM_CELLS = 10 
    172  
    173  
    174171class WPluginAgentStatus(WTemplated): 
     172 
     173    NUM_CELLS = 10 
    175174 
    176175    def _tsToDate(self, ts): 
     
    207206                showTS = ts == first or ts in agentMap 
    208207 
    209                 if showTS or extra < 10: 
     208                if showTS or extra < self.NUM_CELLS: 
    210209                    if breakContinuity: 
    211210                        queue.append(('break', numBreakTS, sumElems, [])) 
  • indico/htdocs/css/Default.css

    r2f5998 r010517  
    41894189} 
    41904190 
    4191 /* CHAT */ 
    4192  
    4193 td.chatTitleCell { 
    4194     color: #523D04; 
    4195     /*text-align: center;*/ 
    4196     padding-bottom: 3px; 
    4197 } 
    4198  
    4199 td.chatCell { 
    4200     padding: 0px; 
    4201     padding-right: 30px; 
    4202     padding-top: 10px; 
    4203     padding-bottom: 5px; 
    4204     /*text-align: center;*/ 
    4205     white-space: nowrap; 
    4206 } 
    4207  
    4208 td.chatCellNarrow { 
    4209     padding: 0px; 
    4210     padding-right: 30px; 
    4211     padding-top: 10px; 
    4212     padding-bottom: 5px; 
    4213     width: 0px; 
    4214     white-space: nowrap; 
    4215 } 
    4216  
    4217 td.titleChat { 
    4218         padding-top: 5px; 
    4219     font-size: 13px; 
    4220     font-family: Verdana, Arial; 
    4221     color: #523D04; 
    4222 } 
    4223  
    4224 .chatInfoCell { 
    4225     padding: 0px; 
    4226     padding-top: 15px; 
    4227     padding-left: 20px; 
    4228     padding-bottom: 5px; 
    4229         padding-right: 15px; 
    4230         background-color: #FEFEFE; 
    4231         -moz-box-shadow: 2px 2px 2px #444444; 
    4232     -moz-border-radius-bottomleft:10px; 
    4233     -moz-border-radius-bottomright:10px; 
    4234     -moz-border-radius-topleft:10px; 
    4235     -moz-border-radius-topright:10px; 
    4236 } 
    4237  
    4238 div.chatListDiv { 
    4239     margin-bottom: 10px; 
    4240     height:200px; 
    4241     width: 300px; 
    4242     border: 1px solid #CCCCCC; 
    4243     overflow: auto; 
    4244     margin-top: 10px; 
    4245 } 
    4246  
    4247 ul.chatList { 
    4248     border: none; 
    4249     display: block; 
    4250     list-style-type: none; 
    4251     padding-left: 0px; 
    4252     margin: 0; 
    4253  
    4254 } 
    4255  
    4256 ul.chatList li { 
    4257     cursor: pointer; 
    4258     padding: 5px; 
    4259     border-bottom: 1px solid #DDDDDD; 
    4260 } 
    4261  
    4262 ul.chatList li.selected { 
    4263     background-color: #CDEB8B; 
    4264 } 
    4265  
    4266 div.chatTable { 
    4267     color: #523D04; 
    4268         -moz-box-shadow: 4px 4px 4px #444444; 
    4269     -moz-border-radius-bottomleft:10px; 
    4270     -moz-border-radius-bottomright:10px; 
    4271     -moz-border-radius-topleft:10px; 
    4272     -moz-border-radius-topright:10px; 
    4273 } 
    4274  
    4275 div.chatAdvancedTabTitle { 
    4276     font-size:13px; 
    4277     background:none repeat scroll 0 0 white; 
    4278     position:absolute; 
    4279     padding-right:5px; 
    4280 } 
    4281  
    4282 div.chatAdvancedTabTitleLine { 
    4283     height: 9px; 
    4284     border-bottom: 1px dotted #777; 
    4285     position: relative; 
    4286     min-width: 200px; 
    4287 } 
    4288  
    4289 div.chatAdvancedTabCheckboxDiv { 
    4290     margin-left:50px; 
    4291     padding-top:5px; 
    4292 } 
    4293  
    4294 td.chatInfoLeftCol { 
    4295     vertical-align: top; 
    4296     text-align: left; 
    4297     padding-right: 5px; 
    4298     white-space: nowrap; 
    4299     color: #523D04; 
    4300 } 
    4301  
    4302  
    43034191/* COLLABORATION */ 
    43044192 
     
    47824670} 
    47834671 
    4784 /* Instant Messaging display pages */ 
    4785  
    4786 .CRDisplayMoreInfo { 
    4787     color: #0B63A5; 
    4788     text-decoration: none; 
    4789     cursor: pointer; 
    4790 } 
    4791  
    4792 .CRDisplayHideInfo { 
    4793     color: #B38B1F; 
    4794     text-decoration: none; 
    4795     cursor: pointer; 
    4796 } 
    4797  
    4798 div.CRDisplayInfoLine { 
    4799     padding-bottom: 8px; 
    4800 } 
    4801  
    4802  
    48034672/* Collaboration display pages */ 
    48044673 
Note: See TracChangeset for help on using the changeset viewer.