Class: Bigbluebutton::RecordingsController

Inherits:
ApplicationController
  • Object
show all
Includes:
BigbluebuttonRails::InternalControllerMethods
Defined in:
app/controllers/bigbluebutton/recordings_controller.rb

Instance Method Summary collapse

Methods included from BigbluebuttonRails::InternalControllerMethods

included

Instance Method Details

#destroyObject



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
65
66
67
68
69
70
71
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 38

def destroy
  error = false
  begin
    if @recording.server
      server = @recording.server
      server.send_delete_recordings(@recording.recordid)
    end
    message = t('bigbluebutton_rails.recordings.notice.destroy.success')
  rescue BigBlueButton::BigBlueButtonException => e
    error = true
    message = t('bigbluebutton_rails.recordings.notice.destroy.success_with_bbb_error', :error => e.to_s[0..200])
  end

  # TODO: what if it fails?
  @recording.destroy

  respond_with do |format|
    format.html {
      if error
        flash[:error] = message
        redirect_to_using_params bigbluebutton_recordings_url
      else
        redirect_to_using_params bigbluebutton_recordings_url, :notice => message
      end
    }
    format.json {
      if error
        render :json => { :message => message }, :status => :error
      else
        render :json => { :message => message }
      end
    }
  end
end

#editObject



19
20
21
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 19

def edit
  respond_with(@recording)
end

#indexObject



10
11
12
13
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 10

def index
  @recordings ||= BigbluebuttonRecording.all
  respond_with(@recordings)
end

#playObject



73
74
75
76
77
78
79
80
81
82
83
84
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 73

def play
  respond_with do |format|
    format.html {
      if @playback
        redirect_to @playback.url
      else
        flash[:error] = t('bigbluebutton_rails.recordings.errors.play.no_format')
        redirect_to_using_params bigbluebutton_recording_url(@recording)
      end
    }
  end
end

#publishObject



86
87
88
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 86

def publish
  self.publish_unpublish(true)
end

#showObject



15
16
17
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 15

def show
  respond_with(@recording)
end

#unpublishObject



90
91
92
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 90

def unpublish
  self.publish_unpublish(false)
end

#updateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/bigbluebutton/recordings_controller.rb', line 23

def update
  respond_with @recording do |format|
    if @recording.update_attributes(recording_params)
      format.html {
        message = t('bigbluebutton_rails.recordings.notice.update.success')
        redirect_to_using_params @recording, :notice => message
      }
      format.json { render :json => true, :status => :ok }
    else
      format.html { redirect_to_params_or_render :edit }
      format.json { render :json => @recording.errors.full_messages, :status => :unprocessable_entity }
    end
  end
end