Ejemplo n.º 1
0
class IConferenceMetadataFossil(_IncludeMaterialFossil, IFossil):

    def getId(self):
        pass

    def getStartDate(self):
        pass
    getStartDate.convert = Conversion.datetime

    def getEndDate(self):
        pass
    getEndDate.convert = Conversion.datetime

    def getTitle(self):
        pass

    def getDescription(self):
        pass

    def getType(self):
        pass

    def getOwner(self):
        pass
    getOwner.convert = lambda x: x.getTitle()
    getOwner.name = 'category'

    def getCategoryId(self):
        pass
    getCategoryId.produce = lambda x: x.getOwner().getId()

    def getTimezone(self):
        pass

    def getChairList(self):
        pass
    getChairList.name = 'chairs'
    getChairList.result = IConferenceChairMetadataFossil

    def getLocation(self):
        """ Location (CERN/...) """
    getLocation.convert = lambda l: l and l.getName()

    def getLocator(self):
        pass
    getLocator.convert = Conversion.url(urlHandlers.UHConferenceDisplay)
    getLocator.name = 'url'

    def getRoom(self):
        """ Room (inside location) """
    getRoom.convert = lambda r: r and r.getName()

    def getVisibility(self):
        pass
    getVisibility.name = 'visibility'
    getVisibility.produce = lambda x: Conversion.visibility(x)

    def getRoomMapURL(self):
        pass
    getRoomMapURL.produce = lambda x: RoomLinker().getURL(x.getRoom(), x.getLocation())
Ejemplo n.º 2
0
def getLocationInfo(item, roomLink=True, fullName=False):
    """Return a tuple (location, room, url) containing
    information about the location of the item."""
    minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
    location = item.getLocation().getName() if item.getLocation() else ""
    customRoom = item.getRoom()
    if not customRoom:
        roomName = ''
    elif fullName and location and minfo.getRoomBookingModuleActive():
        # if we want the full name and we have a RB DB to search in
        roomName = customRoom.getFullName()
        if not roomName:
            customRoom.retrieveFullName(location)  # try to fetch the full name
            roomName = customRoom.getFullName() or customRoom.getName()
    else:
        roomName = customRoom.getName()
    # TODO check if the following if is required
    if roomName in ['', '0--', 'Select:']:
        roomName = ''
    if roomLink:
        url = RoomLinker().getURL(item.getRoom(), item.getLocation())
    else:
        url = ""
    return (location, roomName, url)
Ejemplo n.º 3
0
 def _getAnswer(self):
     return RoomLinker().getURLByName(self._room, self._location)
Ejemplo n.º 4
0
class IConferenceMetadataFossil(_IncludeMaterialFossil, _IncludeACLFossil, IFossil):

    def getId(self):
        pass

    def getStartDate(self):
        pass
    getStartDate.convert = Conversion.datetime

    def getEndDate(self):
        pass
    getEndDate.convert = Conversion.datetime

    def getTitle(self):
        pass

    def getDescription(self):
        pass

    def getType(self):
        pass

    def getOwner(self):
        pass
    getOwner.convert = lambda x: x.getTitle()
    getOwner.name = 'category'

    def getCategoryId(self):
        pass
    getCategoryId.produce = lambda x: x.getOwner().getId()

    def getTimezone(self):
        pass

    def getNote(self):
        pass
    getNote.produce = lambda x: build_note_api_data(x.note)

    def getChairList(self):
        pass
    getChairList.name = 'chairs'
    getChairList.result = IConferenceChairMetadataFossil

    def getLocation(self):
        """ Location (CERN/...) """
    getLocation.convert = lambda l: l and l.getName()

    def getLocator(self):
        pass
    getLocator.convert = Conversion.url(urlHandlers.UHConferenceDisplay)
    getLocator.name = 'url'

    def getRoom(self):
        """ Room (inside location) """
    getRoom.convert = lambda r: r and r.getName()

    def getRoomFullName(self):
        """ Conference Room """
    getRoomFullName.produce = lambda c: c.getRoom()
    getRoomFullName.convert = Conversion.roomFullName
    getRoomFullName.name = 'roomFullname'

    def getVisibility(self):
        pass
    getVisibility.name = 'visibility'
    getVisibility.produce = lambda x: Conversion.visibility(x)

    def hasAnyProtection(self):
        pass

    def getAddress(self):
        pass

    def getCreator(self):
        pass
    getCreator.produce = lambda x: x.as_event.creator.as_avatar
    getCreator.result = IConferenceChairMetadataFossil

    def getCreationDate(self):
        pass

    def getModificationDate(self):
        pass

    def getRoomMapURL(self):
        pass
    getRoomMapURL.produce = lambda x: RoomLinker().getURL(x.getRoom(), x.getLocation())