Exemplo n.º 1
0
 def createChatroom(cls, obj, params):
     room = params['room']
     # we give this operation the name createSomething in the externaloperationsmanager
     # we will execute the method performOperation in a chat room creation, which will send an email to all the requested users
     # saying that a chat room was created. We pass the 2 mandatory arguments and finally the arguments required for performOperation
     # (in this case, only one argument)
     ExternalOperationsManager.execute(cls, "create_"+str(cls.__class__)+str(room.getId()), cls.performOperation, 'create', room.getConferences().values()[0], room, room)
Exemplo n.º 2
0
    def _connect(self, force=False):
        self._checkStatus()

        connectionStatus = self.connectionStatus()
        if isinstance(connectionStatus, VidyoError):
            return connectionStatus

        confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject())
        if confRoomIp == "":
            return VidyoError("noValidConferenceRoom", "connect")

        if connectionStatus.get("isConnected") == True:
            if connectionStatus.get("roomName") == self.getBookingParamByName(
                    "roomName"):
                return VidyoError(
                    "alreadyConnected", "connect",
                    _("It seems that the room has been already connected to the room, please refresh the page."
                      ))
            if not force:
                # if connect is not forced, give up
                return VidyoError(
                    "alreadyConnected", "connect",
                    _("The room is already connected to some other endpoint. Please refresh the page."
                      ))
            else:
                # otherwise, replace whatever call is going on
                ExternalOperationsManager.execute(
                    self, "disconnectRoom", VidyoOperations.disconnectRoom,
                    self, confRoomIp, connectionStatus.get("service"))

                retry = 15
                connected = True

                # wait for the current call to be disconnected
                while retry:
                    connectionStatus = self.connectionStatus()
                    time.sleep(2)
                    retry -= 1
                    if connectionStatus.get("isConnected") == False:
                        connected = False
                        break
                if connected:
                    return VidyoError(
                        "couldntStop", "connect",
                        _("It seems like we haven't managed to stop "
                          "the current call. Please refresh the page and try again."
                          ))
                else:
                    # give it some time before trying to connect
                    time.sleep(5)

        prefixConnect = getVidyoOptionValue("prefixConnect")
        result = ExternalOperationsManager.execute(self, "connectRoom",
                                                   VidyoOperations.connectRoom,
                                                   self, self._roomId,
                                                   prefixConnect + confRoomIp)
        if isinstance(result, VidyoError):
            return result
        return self
Exemplo n.º 3
0
 def addConference2Room(cls, obj, params):
     if not params.get("clone", False):
         room = params['room']
         conf = ConferenceHolder().getById(params['conf'])
         #without the number added it would only send 1 mail, because for every new chat room it'd think that there has been a retry
         ExternalOperationsManager.execute(
             cls, "add_" + str(cls.__class__) + str(room.getId()),
             cls.performOperation, 'create', conf, room, room, conf)
Exemplo n.º 4
0
 def createChatroom(cls, obj, params):
     room = params['room']
     # we give this operation the name createSomething in the externaloperationsmanager
     # we will execute the method performOperation in a chat room creation, which will send an email to all the requested users
     # saying that a chat room was created. We pass the 2 mandatory arguments and finally the arguments required for performOperation
     # (in this case, only one argument)
     ExternalOperationsManager.execute(
         cls, "create_" + str(cls.__class__) + str(room.getId()),
         cls.performOperation, 'create',
         room.getConferences().values()[0], room, room)
Exemplo n.º 5
0
    def _connect(self, force=False):
        self._checkStatus()

        connectionStatus = self.connectionStatus()
        if isinstance(connectionStatus, VidyoError):
            return connectionStatus

        confRoomIp = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="H323 IP")
        confRoomPanoramaUser = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="VidyoPanorama ID")
        if confRoomIp == "" and confRoomPanoramaUser == "":
            return VidyoError("noValidConferenceRoom", "connect")

        if connectionStatus.get("isConnected") == True:
            if connectionStatus.get("roomName") == self.getBookingParamByName("roomName"):
                return VidyoError("alreadyConnected", "connect",
                                  _("It seems that the room has been already connected to the room, please refresh the page."))
            if not force:
                # if connect is not forced, give up
                return VidyoError("alreadyConnected", "connect",
                                  _("The room is already connected to some other endpoint. Please refresh the page."))
            else:
                # otherwise, replace whatever call is going on
                ExternalOperationsManager.execute(
                    self, "disconnectRoom", VidyoOperations.disconnectRoom,
                    self, connectionStatus, confRoomIp, confRoomPanoramaUser)

                retry = 15
                connected = True

                # wait for the current call to be disconnected
                while retry:
                    connectionStatus = self.connectionStatus()
                    time.sleep(2)
                    retry -= 1
                    if connectionStatus.get("isConnected") == False:
                        connected = False
                        break
                if connected:
                    return VidyoError("couldntStop", "connect",
                                      _("It seems like we haven't managed to stop "
                                        "the current call. Please refresh the page and try again."))
                else:
                    # give it some time before trying to connect
                    time.sleep(5)

        query = (getVidyoOptionValue("prefixConnect") + confRoomIp) if confRoomIp else confRoomPanoramaUser
        result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId,
                                                   query)
        if isinstance(result, VidyoError):
            return result
        return self
Exemplo n.º 6
0
    def _setModeratorPIN(self):
        result = ExternalOperationsManager.execute(self, "setModeratorPIN", VidyoOperations.setModeratorPIN, self)

        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            raise result
Exemplo n.º 7
0
    def _delete(self, fromDeleteOld=False, maxDate=None):
        """ Deletes the Vidyo Public room associated to this CSBooking, based on the roomId
            Returns None if success.
            If trying to delete a non existing room, there will be a message in self._warning
            so that it is caught by Main.js's postDelete function.
        """

        if self.isCreated():
            deleteRemote = unindexBooking = False

            if self.hasToBeDeleted(fromDeleteOld, maxDate):
                self.setCreated(False)
                deleteRemote = unindexBooking = True
            elif not fromDeleteOld:
                unindexBooking = True

            if deleteRemote:
                result = ExternalOperationsManager.execute(
                    self, "deleteRoom", VidyoOperations.deleteRoom, self,
                    self._roomId)

                if isinstance(result, VidyoError):
                    if result.getErrorType(
                    ) == "unknownRoom" and result.getOperation() == "delete":
                        if not fromDeleteOld:
                            self._warning = "cannotDeleteNonExistant"
                    else:
                        return result

            if unindexBooking:
                VidyoTools.getEventEndDateIndex().unindexBooking(self)
                VidyoTools.getIndexByVidyoRoom().unindexBooking(self)
Exemplo n.º 8
0
    def _attach(self):
        """ Creates the Vidyo public room that will be associated to this CSBooking,
            based on the booking params.
            Returns None if success.
            Returns a VidyoError if there is a problem.
        """
        result = ExternalOperationsManager.execute(self, "attachRoom",
                                                   VidyoOperations.attachRoom,
                                                   self)
        if isinstance(result, VidyoError):
            return result

        else:
            self._roomId = str(result.roomID)
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName), updateAvatar=True)
            recoveredDescription = VidyoTools.recoverVidyoDescription(
                result.description)
            if recoveredDescription:
                self._bookingParams["roomDescription"] = recoveredDescription
            else:
                self._warning = "invalidDescription"
            if bool(result.RoomMode.hasPIN):
                self.setPin(str(result.RoomMode.roomPIN))
            else:
                self.setPin("")
            if bool(result.RoomMode.hasModeratorPIN):
                self.setModeratorPin(str(result.RoomMode.moderatorPIN))
            else:
                self.setModeratorPin("")
            self._bookingParams["autoMute"] = self._getAutomute()
            self.setBookingOK()
            VidyoTools.getEventEndDateIndex().indexBooking(self)
            VidyoTools.getIndexByVidyoRoom().indexBooking(self)
Exemplo n.º 9
0
    def _attach(self):
        """ Creates the Vidyo public room that will be associated to this CSBooking,
            based on the booking params.
            Returns None if success.
            Returns a VidyoError if there is a problem.
        """
        result = ExternalOperationsManager.execute(self, "attachRoom", VidyoOperations.attachRoom, self)
        if isinstance(result, VidyoError):
            return result

        else:
            self._roomId = str(result.roomID)
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName), updateAvatar = True)
            recoveredDescription = VidyoTools.recoverVidyoDescription(result.description)
            if recoveredDescription:
                self._bookingParams["roomDescription"] = recoveredDescription
            else:
                self._warning = "invalidDescription"
            if bool(result.RoomMode.hasPIN):
                self.setPin(str(result.RoomMode.roomPIN))
            else:
                self.setPin("")
            if bool(result.RoomMode.hasModeratorPIN):
                self.setModeratorPin(str(result.RoomMode.moderatorPIN))
            else:
                self.setModeratorPin("")
            self._bookingParams["autoMute"] = self._getAutomute()
            self.setBookingOK()
            VidyoTools.getEventEndDateIndex().indexBooking(self)
            VidyoTools.getIndexByVidyoRoom().indexBooking(self)
Exemplo n.º 10
0
    def _create(self):
        """ Creates the Vidyo public room that will be associated to this CSBooking,
            based on the booking params.
            After creation, it also retrieves some more information from the newly created room.
            Returns None if success.
            Returns a VidyoError if there is a problem, such as the name being duplicated.
        """
        result = ExternalOperationsManager.execute(self, "createRoom",
                                                   VidyoOperations.createRoom,
                                                   self)
        if isinstance(result, VidyoError):
            return result

        else:
            # Link to a Session or Contribution if requested
            self._roomId = str(
                result.roomID
            )  #we need to convert values read to str or there will be a ZODB exception
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName))
            self.setBookingOK()
            VidyoTools.getEventEndDateIndex().indexBooking(self)
            VidyoTools.getIndexByVidyoRoom().indexBooking(self)

            self._setAutomute()
Exemplo n.º 11
0
    def run(self):
        logger = self.getLogger()
        storage = getAvatarConferenceStorage()
        keysToDelete = []

        # Send the requests
        for key, eventList in storage.iteritems():
            for event in eventList:
                logger.info("Processing: {}:{}".format(key, event))
                if not event.get('request_sent', False):  # only the ones that are not already sent
                    result = ExternalOperationsManager.execute(self,
                                                               'sendEventRequest{}{}'.format(key, event['eventType']),
                                                               self._sendEventRequest, key, event['eventType'],
                                                               event['avatar'], event['conference'])
                    if result is None:
                        logger.error("Request failed")
                        break
                    elif result.status_code != 200:
                        logger.error('Request unsuccessful({})\nPayload: {}\nResponse: {}'
                                     .format(result.status_code, self.payload, result.content))
                        break
                    else:
                        logger.debug("Processed successfully")
                        event['request_sent'] = True
            else:
                keysToDelete.append(key)

        self._clearAvatarConferenceStorage(keysToDelete)
Exemplo n.º 12
0
    def run(self):
        logger = self.getLogger()
        storage = getAvatarConferenceStorage()
        keysToDelete = []

        # Send the requests
        for key, eventList in storage.iteritems():
            for event in eventList:
                logger.info("Processing: {}:{}".format(key, event))
                if not event.get(
                        'request_sent',
                        False):  # only the ones that are not already sent
                    result = ExternalOperationsManager.execute(
                        self,
                        'sendEventRequest{}{}'.format(key, event['eventType']),
                        self._sendEventRequest, key, event['eventType'],
                        event['avatar'], event['conference'])
                    if result is None:
                        logger.error("Request failed")
                        break
                    elif result.status_code != 200:
                        logger.error(
                            'Request unsuccessful({})\nPayload: {}\nResponse: {}'
                            .format(result.status_code, self.payload,
                                    result.content))
                        break
                    else:
                        logger.debug("Processed successfully")
                        event['request_sent'] = True
            else:
                keysToDelete.append(key)

        self._clearAvatarConferenceStorage(keysToDelete)
Exemplo n.º 13
0
    def _delete(self, fromDeleteOld = False, maxDate = None):
        """ Deletes the Vidyo Public room associated to this CSBooking, based on the roomId
            Returns None if success.
            If trying to delete a non existing room, there will be a message in self._warning
            so that it is caught by Main.js's postDelete function.
        """

        if self.isCreated():
            deleteRemote = unindexBooking = False

            if self.hasToBeDeleted(fromDeleteOld, maxDate):
                self.setCreated(False)
                deleteRemote = unindexBooking = True
            elif not fromDeleteOld:
                unindexBooking = True

            if deleteRemote:
                result = ExternalOperationsManager.execute(self, "deleteRoom", VidyoOperations.deleteRoom, self, self._roomId)

                if isinstance(result, VidyoError):
                    if result.getErrorType() == "unknownRoom" and result.getOperation() == "delete":
                        if not fromDeleteOld:
                            self._warning = "cannotDeleteNonExistant"
                    else:
                        return result

            if unindexBooking:
                VidyoTools.getEventEndDateIndex().unindexBooking(self)
                VidyoTools.getIndexByVidyoRoom().unindexBooking(self)
Exemplo n.º 14
0
 def _performCall(self, default=None):
     """
     Acts as an entry point for all derivative classes to use the
     ExternalOperationsManager for performing remote calls.
     """
     return ExternalOperationsManager.execute(self, "performCall",
                                              self._performExternalCall,
                                              default)
Exemplo n.º 15
0
    def _setModeratorPIN(self):
        result = ExternalOperationsManager.execute(
            self, "setModeratorPIN", VidyoOperations.setModeratorPIN, self)

        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            raise result
Exemplo n.º 16
0
    def _automute_op(self, op):
        op_name = "{0}Automute".format(op)
        result = ExternalOperationsManager.execute(self, op_name, getattr(VidyoOperations, op_name), self)

        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            raise automute_result
Exemplo n.º 17
0
    def _automute_op(self, op):
        op_name = "{0}Automute".format(op)
        result = ExternalOperationsManager.execute(
            self, op_name, getattr(VidyoOperations, op_name), self)

        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            raise automute_result
Exemplo n.º 18
0
 def _performCall(self, default=None):
     """
     Acts as an entry point for all derivative classes to use the
     ExternalOperationsManager for performing remote calls.
     """
     return ExternalOperationsManager.execute(self,
                                              "performCall",
                                              self._performExternalCall,
                                              default)
Exemplo n.º 19
0
 def _connect(self):
     self._checkStatus()
     if self.canBeConnected():
         confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject())
         if confRoomIp == "":
             return VidyoError("noValidConferenceRoom", "connect")
         prefixConnect = getVidyoOptionValue("prefixConnect")
         result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId, prefixConnect + confRoomIp)
         if isinstance(result, VidyoError):
             return result
         return self
Exemplo n.º 20
0
 def _create(self):
     """ Creates a booking in the WebEx server if all conditions are met.
     """
     params = self.getBookingParams()
     self.setAccessPassword( params['accessPassword'] )
     self._duration = findDuration( self.getStartDate(), self.getEndDate() )
     try:
         result = ExternalOperationsManager.execute(self, "createBooking", WebExOperations.createBooking, self)
     except Exception,e:
         Logger.get('WebEx').error(
             """Could not create booking with id %s of event with id %s, exception: %s""" %
             (self.getId(), self.getConference().getId(), str(e)))
         return WebExError( errorType = None, userMessage = _("""There was an error communicating with the WebEx server.  The request was unsuccessful.  Error information: %s""" % str(e)) )
Exemplo n.º 21
0
 def _delete(self):
     """
     This function will delete the specified video booking from the WebEx server
     """
     try:
         result = ExternalOperationsManager.execute(self, "deleteBooking", WebExOperations.deleteBooking, self)
         if isinstance(result, WebExError):
             return result
     except Exception,e:
         Logger.get('WebEx').error(
             """Could not delete booking with id %s of event with id %s, exception: %s""" %
             (self.getId(), self.getConference().getId(), str(e)))
         return WebExError( errorType = None, userMessage = _("""There was an error communicating with the WebEx server.  The request was unsuccessful.  Error information: %s""" % str(e)) )
Exemplo n.º 22
0
 def _disconnect(self):
     self._checkStatus()
     confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject())
     if confRoomIp == "":
         return VidyoError("noValidConferenceRoom", "disconnect")
     connectionStatus = self.connectionStatus()
     if isinstance(connectionStatus, VidyoError):
         return connectionStatus
     if not connectionStatus.get("isConnected"):
         return VidyoError("alreadyDisconnected", "disconnect", _("It seems that the room has been already disconnected, please refresh the page"))
     result = ExternalOperationsManager.execute(self, "disconnectRoom", VidyoOperations.disconnectRoom, self, confRoomIp, connectionStatus.get("service"))
     if isinstance(result, VidyoError):
         return result
     return self
Exemplo n.º 23
0
    def _modify(self, oldBookingParams):
        """ Modifies the Vidyo public room in the remote system
        """
        result = ExternalOperationsManager.execute(self, "modifyRoom", VidyoOperations.modifyRoom, self, oldBookingParams)
        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            return result
        else:
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName))
            self.setBookingOK()

            if oldBookingParams["owner"]["id"] != self.getOwnerObject().getId():
                self._sendNotificationToOldNewOwner(oldBookingParams["owner"])
Exemplo n.º 24
0
 def _delete(self):
     """
     This function will delete the specified video booking from the WebEx server
     """
     try:
         result = ExternalOperationsManager.execute(
             self, "deleteBooking", WebExOperations.deleteBooking, self)
         if isinstance(result, WebExError):
             return result
     except Exception, e:
         Logger.get('WebEx').error(
             """Could not delete booking with id %s of event with id %s, exception: %s"""
             % (self.getId(), self.getConference().getId(), str(e)))
         return WebExError(
             errorType=None,
             userMessage=_(
                 """There was an error communicating with the WebEx server.  The request was unsuccessful.  Error information: %s"""
                 % str(e)))
Exemplo n.º 25
0
 def _create(self):
     """ Creates a booking in the WebEx server if all conditions are met.
     """
     params = self.getBookingParams()
     self.setAccessPassword(params['accessPassword'])
     self._duration = findDuration(self.getStartDate(), self.getEndDate())
     try:
         result = ExternalOperationsManager.execute(
             self, "createBooking", WebExOperations.createBooking, self)
     except Exception, e:
         Logger.get('WebEx').error(
             """Could not create booking with id %s of event with id %s, exception: %s"""
             % (self.getId(), self.getConference().getId(), str(e)))
         return WebExError(
             errorType=None,
             userMessage=_(
                 """There was an error communicating with the WebEx server.  The request was unsuccessful.  Error information: %s"""
                 % str(e)))
Exemplo n.º 26
0
    def _create(self):
        """ Creates the Vidyo public room that will be associated to this CSBooking,
            based on the booking params.
            After creation, it also retrieves some more information from the newly created room.
            Returns None if success.
            Returns a VidyoError if there is a problem, such as the name being duplicated.
        """
        result = ExternalOperationsManager.execute(self, "createRoom", VidyoOperations.createRoom, self)
        if isinstance(result, VidyoError):
            return result

        else:
            # Link to a Session or Contribution if requested
            self._roomId = str(result.roomID)  # we need to convert values read to str or there will be a ZODB exception
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName))
            self.setBookingOK()
            VidyoTools.getEventEndDateIndex().indexBooking(self)
Exemplo n.º 27
0
 def _disconnect(self):
     self._checkStatus()
     confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject())
     if confRoomIp == "":
         return VidyoError("noValidConferenceRoom", "disconnect")
     connectionStatus = self.connectionStatus()
     if isinstance(connectionStatus, VidyoError):
         return connectionStatus
     if not connectionStatus.get("isConnected"):
         return VidyoError(
             "alreadyDisconnected", "disconnect",
             _("It seems that the room has been already disconnected, please refresh the page"
               ))
     result = ExternalOperationsManager.execute(
         self, "disconnectRoom", VidyoOperations.disconnectRoom, self,
         confRoomIp, connectionStatus.get("service"))
     if isinstance(result, VidyoError):
         return result
     return self
Exemplo n.º 28
0
    def run(self):
        logger = self.getLogger()
        storage = getAvatarConferenceStorage()
        keysToDelete = []

        # Send the requests
        for key, eventList in storage.iteritems():
            for event in eventList:
                logger.info("processing: %s:%s" % (key, event))
                if not event.get('request_sent', False): # only the ones that are not already sent
                    result = ExternalOperationsManager.execute(self, 'sendEventRequest' + key + event['eventType'], self._sendEventRequest, key, event['eventType'], event['avatar'], event['conference'])
                    if result != 200:
                        logger.debug("POST failed")
                        break
                    else:
                        logger.debug("processing successful")
                        event['request_sent'] = True
            else:
                keysToDelete.append(key)

        self._clearAvatarConferenceStorage(keysToDelete)
Exemplo n.º 29
0
Arquivo: tasks.py Projeto: Ictp/indico
    def run(self):
        logger = self.getLogger()
        storage = getAvatarConferenceStorage()
        keysToDelete = []

        # Send the requests
        for key, eventList in storage.iteritems():
            for event in eventList:
                logger.info("processing: %s:%s" % (key, event))
                if not event.get('request_sent', False): # only the ones that are not already sent
                    result = ExternalOperationsManager.execute(self, 'sendEventRequest' + key + event['eventType'], self._sendEventRequest, key, event['eventType'], event['avatar'], event['conference'])
                    if result != 200:
                        logger.debug("POST failed")
                        break
                    else:
                        logger.debug("processing successful")
                        event['request_sent'] = True
            else:
                keysToDelete.append(key)

        self._clearAvatarConferenceStorage(keysToDelete)
Exemplo n.º 30
0
    def _modify(self, oldBookingParams):
        """ Modifies the Vidyo public room in the remote system
        """
        result = ExternalOperationsManager.execute(self, "modifyRoom",
                                                   VidyoOperations.modifyRoom,
                                                   self, oldBookingParams)
        if isinstance(result, VidyoError):
            if result.getErrorType() == 'unknownRoom':
                self.setBookingNotPresent()
            return result
        else:
            self._extension = str(result.extension)
            self._url = str(result.RoomMode.roomURL)
            self.setOwnerAccount(str(result.ownerName))
            self.setBookingOK()

            if oldBookingParams["owner"]["id"] != self.getOwnerObject().getId(
            ):
                self._sendNotificationToOldNewOwner(oldBookingParams["owner"])

            self._setAutomute()
Exemplo n.º 31
0
 def addConference2Room(cls, obj, params):
     if not params.get("clone", False):
         room = params['room']
         conf = ConferenceHolder().getById(params['conf'])
         #without the number added it would only send 1 mail, because for every new chat room it'd think that there has been a retry
         ExternalOperationsManager.execute(cls, "add_"+str(cls.__class__)+str(room.getId()), cls.performOperation, 'create', conf, room, room, conf)
Exemplo n.º 32
0
 def deleteChatroom(cls, obj, params):
     room = params['room']
     conf = ConferenceHolder().getById(obj._conferenceID)
     ExternalOperationsManager.execute(cls, "delete_"+str(cls.__class__)+str(room.getId()), cls.performOperation, 'delete', conf, room, room, conf)
Exemplo n.º 33
0
 def _modify(self, oldBookingParams):
     """ Modifies a booking in the WebEx server if all conditions are met.
     """
     verboseKeyNames = {
         "meetingDescription": _("Meeting description"),
         "meetingTitle": _("Title"),
         "webExUser": _("WebEx username"),
         "webExPass": _("WebEx password"),
         "meet:meetingPassword": _("Meeting password"),
         "participants" : _("Participants"),
         "startDate" : _("Start date"),
         "endDate" : _("End date"),
         "hidden" : _("Is hidden"),
         "sendAttendeesEmail" : _("Send emails to participants"),
         "sendCreatorEmail" : _("Send emails to event managers"),
         "sendSelfEmail":_("Send user booking WebEx an email copy"),
         "showAccessPassword" : _("Show meeting password on event page"),
         "seeParticipants" : _("See participants"),
         "enableChat" : _("Participant chat"),
         "joinBeforeHost" : _("Participants can join before host"),
         "joinBeforeTime": _("Time an attendee can join a meeting before the official start time"),
         "notifyOnDateChanges" : _("Keep booking synchronized"),
         "accessPassword" : _("Meeting password"),
         "session" : _("Session")
     }
     self._latestChanges = []
     self._warning = None
     if self._created:
         params = self.getBookingParams()
         # Create entries for the keys that aren't always present
         hidden_keys = ["hidden", "notifyOnDateChanges", "sendAttendeesEmail", "sendCreatorEmail", "sendSelfEmail", "showAccessPassword", "seeParticipants", "enableChat", "joinBeforeHost", "joinBeforeTime"]
         for key in hidden_keys:
             if not params.has_key( key ):
                 params[key] = "no"
             if not oldBookingParams.has_key( key ):
                 oldBookingParams[key] = "no"
         try:
             result = ExternalOperationsManager.execute(self, "modifyBooking", WebExOperations.modifyBooking, self)
             if isinstance(result, WebExError):
                 return result
         except Exception,e:
             Logger.get('WebEx').error(
                 """Could not modify booking with id %s of event with id %s, exception: %s""" %
                 (self.getId(), self.getConference().getId(), str(e)))
             return WebExError( errorType = None, userMessage = _("""There was an error communicating with the WebEx server.  The request was unsuccessful.  Error information: %s""" % str(e)) )
         for key in params.keys():
                 if key == "loggedInEmail":
                     continue
                 if key in hidden_keys:
                     if oldBookingParams.has_key( key ) != params.has_key( key ) or oldBookingParams[key] != params[key]:
                         self._bookingChangesHistory.append( "%s has changed." % ( verboseKeyNames[key] ) )
                         self._latestChanges.append( "%s has changed." % ( verboseKeyNames[key] ) )
                         continue
                 if oldBookingParams[key] != params[key]:
                     if key == "participants":
                         #Number of participants changed - report this
                         if len(params[key]) != len(oldBookingParams[key]):
                             self._bookingChangesHistory.append( "%s has changed." % ( verboseKeyNames[key] ) )
                             self._latestChanges.append( "%s has changed." % ( verboseKeyNames[key] ) )
                             continue
                         count = -1
                         for participant in params[key]:
                             count = count + 1
                             for participantKey in participant.keys():
                                 if participantKey=="id":
                                     continue
                                 if oldBookingParams[key][count].get(participantKey) != params[key][count].get(participantKey):
                                     self._bookingChangesHistory.append( "%s has changed." % ( verboseKeyNames[key] ) )
                                     self._latestChanges.append( "%s has changed." % ( verboseKeyNames[key] ) )
                                     break
                     else:
                         self._bookingChangesHistory.append( "%s has changed: %s" % ( verboseKeyNames[key], params[key] ) )
                         self._latestChanges.append( "%s has changed." % ( verboseKeyNames[key] ) )
         self._checkStatus()
         self.getLoginURL()
         self.sendParticipantsEmail('modify')
Exemplo n.º 34
0
 def _modify(self, oldBookingParams):
     """ Modifies a booking in the WebEx server if all conditions are met.
     """
     verboseKeyNames = {
         "meetingDescription":
         _("Meeting description"),
         "meetingTitle":
         _("Title"),
         "webExUser":
         _("WebEx username"),
         "webExPass":
         _("WebEx password"),
         "meet:meetingPassword":
         _("Meeting password"),
         "participants":
         _("Participants"),
         "startDate":
         _("Start date"),
         "endDate":
         _("End date"),
         "hidden":
         _("Is hidden"),
         "sendAttendeesEmail":
         _("Send emails to participants"),
         "sendCreatorEmail":
         _("Send emails to event managers"),
         "sendSelfEmail":
         _("Send user booking WebEx an email copy"),
         "showAccessPassword":
         _("Show meeting password on event page"),
         "seeParticipants":
         _("See participants"),
         "enableChat":
         _("Participant chat"),
         "joinBeforeHost":
         _("Participants can join before host"),
         "joinBeforeTime":
         _("Time an attendee can join a meeting before the official start time"
           ),
         "notifyOnDateChanges":
         _("Keep booking synchronized"),
         "accessPassword":
         _("Meeting password"),
         "session":
         _("Session")
     }
     self._latestChanges = []
     self._warning = None
     if self._created:
         params = self.getBookingParams()
         # Create entries for the keys that aren't always present
         hidden_keys = [
             "hidden", "notifyOnDateChanges", "sendAttendeesEmail",
             "sendCreatorEmail", "sendSelfEmail", "showAccessPassword",
             "seeParticipants", "enableChat", "joinBeforeHost",
             "joinBeforeTime"
         ]
         for key in hidden_keys:
             if not params.has_key(key):
                 params[key] = "no"
             if not oldBookingParams.has_key(key):
                 oldBookingParams[key] = "no"
         try:
             result = ExternalOperationsManager.execute(
                 self, "modifyBooking", WebExOperations.modifyBooking, self)
             if isinstance(result, WebExError):
                 return result
         except Exception, e:
             Logger.get('WebEx').error(
                 """Could not modify booking with id %s of event with id %s, exception: %s"""
                 % (self.getId(), self.getConference().getId(), str(e)))
             return WebExError(
                 errorType=None,
                 userMessage=_(
                     """There was an error communicating with the WebEx server.  The request was unsuccessful.  Error information: %s"""
                     % str(e)))
         for key in params.keys():
             if key == "loggedInEmail":
                 continue
             if key in hidden_keys:
                 if oldBookingParams.has_key(key) != params.has_key(
                         key) or oldBookingParams[key] != params[key]:
                     self._bookingChangesHistory.append(
                         "%s has changed." % (verboseKeyNames[key]))
                     self._latestChanges.append("%s has changed." %
                                                (verboseKeyNames[key]))
                     continue
             if oldBookingParams[key] != params[key]:
                 if key == "participants":
                     #Number of participants changed - report this
                     if len(params[key]) != len(oldBookingParams[key]):
                         self._bookingChangesHistory.append(
                             "%s has changed." % (verboseKeyNames[key]))
                         self._latestChanges.append("%s has changed." %
                                                    (verboseKeyNames[key]))
                         continue
                     count = -1
                     for participant in params[key]:
                         count = count + 1
                         for participantKey in participant.keys():
                             if participantKey == "id":
                                 continue
                             if oldBookingParams[key][count].get(
                                     participantKey
                             ) != params[key][count].get(participantKey):
                                 self._bookingChangesHistory.append(
                                     "%s has changed." %
                                     (verboseKeyNames[key]))
                                 self._latestChanges.append(
                                     "%s has changed." %
                                     (verboseKeyNames[key]))
                                 break
                 else:
                     self._bookingChangesHistory.append(
                         "%s has changed: %s" %
                         (verboseKeyNames[key], params[key]))
                     self._latestChanges.append("%s has changed." %
                                                (verboseKeyNames[key]))
         self._checkStatus()
         self.getLoginURL()
         self.sendParticipantsEmail('modify')
Exemplo n.º 35
0
 def deleteChatroom(cls, obj, params):
     room = params['room']
     conf = ConferenceHolder().getById(obj._conferenceID)
     ExternalOperationsManager.execute(
         cls, "delete_" + str(cls.__class__) + str(room.getId()),
         cls.performOperation, 'delete', conf, room, room, conf)