Class: Bigbluebutton::RoomsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Bigbluebutton::RoomsController
- Defined in:
- app/controllers/bigbluebutton/rooms_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #end ⇒ Object
- #fetch_recordings ⇒ Object
- #generate_dial_number ⇒ Object
- #index ⇒ Object
-
#invite ⇒ Object
Used to join private rooms or to invite anonymous users (not logged).
-
#join ⇒ Object
Used to join users into a meeting.
- #join_mobile ⇒ Object
- #new ⇒ Object
- #recordings ⇒ Object
- #running ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from BigbluebuttonRails::InternalControllerMethods
Instance Method Details
#create ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 38 def create @room ||= BigbluebuttonRoom.new(room_params) if params[:bigbluebutton_room] and (not params[:bigbluebutton_room].has_key?(:meetingid) or params[:bigbluebutton_room][:meetingid].blank?) @room.meetingid = @room.name end respond_with @room do |format| if @room.save = t('bigbluebutton_rails.rooms.notice.create.success') format.html { redirect_to_using_params (@room), :notice => } format.json { render :json => { :message => }, :status => :created } else format.html { = t('bigbluebutton_rails.rooms.notice.create.failure') redirect_to_params_or_render :new, :error => } format.json { render :json => @room.errors., :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 84 def destroy error = false begin @room.fetch_is_running? @room.send_end if @room.is_running? = t('bigbluebutton_rails.rooms.notice.destroy.success') rescue BigBlueButton::BigBlueButtonException => e error = true = t('bigbluebutton_rails.rooms.notice.destroy.success_with_bbb_error', :error => e.to_s[0..200]) end # TODO: what if it fails? @room.destroy respond_with do |format| format.html { flash[:error] = if error redirect_to_using_params } format.json { if error render :json => { :message => }, :status => :error else render :json => { :message => } end } end end |
#edit ⇒ Object
34 35 36 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 34 def edit respond_with(@room) end |
#end ⇒ Object
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 144 def end error = false begin @room.fetch_is_running? if @room.is_running? @room.send_end = t('bigbluebutton_rails.rooms.notice.end.success') else error = true = t('bigbluebutton_rails.rooms.notice.end.not_running') end rescue BigBlueButton::BigBlueButtonException => e error = true = e.to_s[0..200] end if error respond_with do |format| format.html { flash[:error] = redirect_to_using_params :back } format.json { render :json => , :status => :error } end else respond_with do |format| format.html { redirect_to_using_params (@room), :notice => } format.json { render :json => } end end end |
#fetch_recordings ⇒ Object
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 185 def fetch_recordings error = false begin result = @room.fetch_recordings if result = t('bigbluebutton_rails.rooms.notice.fetch_recordings.success') else error = true = t('bigbluebutton_rails.rooms.errors.fetch_recordings.no_server') end rescue BigBlueButton::BigBlueButtonException => e error = true = e.to_s[0..200] end respond_with do |format| format.html { flash[error ? :error : :notice] = redirect_to_using_params (@room) } format.json { if error render :json => { :message => }, :status => :error else render :json => true, :status => :ok end } end end |
#generate_dial_number ⇒ Object
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 221 def generate_dial_number pattern = params[:pattern].blank? ? nil : params[:pattern] if @room.generate_dial_number!(pattern) = t('bigbluebutton_rails.rooms.notice.generate_dial_number.success') respond_with do |format| format.html { redirect_to_using_params :back, notice: } format.json { render json: true, status: :ok } end else = t('bigbluebutton_rails.rooms.errors.generate_dial_number.not_unique') respond_with do |format| format.html { flash[:error] = redirect_to_using_params :back } format.json { render json: { message: }, status: :error } end end end |
#index ⇒ Object
20 21 22 23 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 20 def index @rooms ||= BigbluebuttonRoom.all respond_with(@rooms) end |
#invite ⇒ Object
Used to join private rooms or to invite anonymous users (not logged)
120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 120 def invite respond_with @room do |format| @user_role = (@room) if @user_role.nil? raise BigbluebuttonRails::RoomAccessDenied.new else format.html end end end |
#join ⇒ Object
Used to join users into a meeting. Most of the work is done in before filters. Can be called via GET or POST and accepts parameters both in the POST data and URL.
115 116 117 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 115 def join join_internal(@user_name, @user_role, @user_id) end |
#join_mobile ⇒ Object
179 180 181 182 183 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 179 def join_mobile filtered_params = select_params_for_join_mobile(params.clone) @join_mobile = (@room, filtered_params.merge({:auto_join => '1' })) @join_desktop = (@room, filtered_params.merge({:desktop => '1' })) end |
#new ⇒ Object
29 30 31 32 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 29 def new @room ||= BigbluebuttonRoom.new respond_with(@room) end |
#recordings ⇒ Object
216 217 218 219 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 216 def recordings @recordings ||= @room.recordings respond_with(@recordings) end |
#running ⇒ Object
133 134 135 136 137 138 139 140 141 142 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 133 def running begin @room.fetch_is_running? rescue BigBlueButton::BigBlueButtonException => e flash[:error] = e.to_s[0..200] render :json => { :running => "false", :error => "#{e.to_s[0..200]}" } else render :json => { :running => "#{@room.is_running?}" } end end |
#show ⇒ Object
25 26 27 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 25 def show respond_with(@room) end |
#update ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'app/controllers/bigbluebutton/rooms_controller.rb', line 66 def update respond_with @room do |format| if @room.update_attributes(room_params) = t('bigbluebutton_rails.rooms.notice.update.success') format.html { redirect_to_using_params (@room), :notice => } format.json { render :json => { :message => } } else format.html { = t('bigbluebutton_rails.rooms.notice.update.failure') redirect_to_params_or_render :edit, :error => } format.json { render :json => @room.errors., :status => :unprocessable_entity } end end end |