Class: Bigbluebutton::ServersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Bigbluebutton::ServersController
- Defined in:
- app/controllers/bigbluebutton/servers_controller.rb
Instance Method Summary collapse
- #activity ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
-
#fetch_recordings ⇒ Object
- Accepts the following parameters in URL: meetings
-
A list of meetingIDs to be used as filter.
- #index ⇒ Object
- #new ⇒ Object
- #publish_recordings ⇒ Object
- #recordings ⇒ Object
- #rooms ⇒ Object
- #show ⇒ Object
- #unpublish_recordings ⇒ Object
- #update ⇒ Object
Methods included from BigbluebuttonRails::InternalControllerMethods
Instance Method Details
#activity ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 24 def activity error = false begin @server.fetch_meetings @server.meetings.each do |meeting| meeting.fetch_meeting_info end rescue BigBlueButton::BigBlueButtonException => e error = true = e.to_s[0..200] end # update_list works only for html if params[:update_list] && (params[:format].nil? || params[:format].to_s == "html") render :partial => 'activity_list', :locals => { :server => @server } return end respond_with @server.meetings do |format| # we return/render the fetched meetings even in case of error # but we set the error message in the response if error flash[:error] = format.html { render :activity } format.json { array = @server.meetings array.insert(0, { :message => }) render :json => array, :status => :error } else format.html format.json end end end |
#create ⇒ Object
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 60 def create @server = BigbluebuttonServer.new(server_params) respond_with @server do |format| if @server.save format.html { = t('bigbluebutton_rails.servers.notice.create.success') redirect_to_using_params @server, :notice => } format.json { render :json => @server, :status => :created } else format.html { redirect_to_params_or_render :new } format.json { render :json => @server.errors., :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
92 93 94 95 96 97 98 99 100 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 92 def destroy # TODO: what if it fails? @server.destroy respond_with do |format| format.html { redirect_to_using_params } format.json { render :json => true, :status => :ok } end end |
#edit ⇒ Object
20 21 22 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 20 def edit respond_with(@server) end |
#fetch_recordings ⇒ Object
Accepts the following parameters in URL:
- meetings
-
A list of meetingIDs to be used as filter.
- meta_*
-
To filter by metadata, where “*” can be anything.
For example: fetch_recordings?meetings=meeting1,meeting2&meta_name=value
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 123 def fetch_recordings error = false begin # accept meetingID and meta_* filters filter = {} filter.merge!({ :meetingID => params[:meetings] }) if params[:meetings] params.each do |key, value| filter.merge!({ key.to_sym => value }) if key.match(/^meta_/) end @server.fetch_recordings(filter) = t('bigbluebutton_rails.servers.notice.fetch_recordings.success') rescue BigBlueButton::BigBlueButtonException => e error = true = e.to_s[0..200] end respond_with do |format| format.html { flash[error ? :error : :notice] = redirect_to (@server) } format.json { if error render :json => { :message => }, :status => :error else render :json => true, :status => :ok end } end end |
#index ⇒ Object
8 9 10 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 8 def index respond_with(@servers = BigbluebuttonServer.all) end |
#new ⇒ Object
16 17 18 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 16 def new respond_with(@server = BigbluebuttonServer.new) end |
#publish_recordings ⇒ Object
110 111 112 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 110 def publish_recordings self.publish_unpublish(params[:recordings], true) end |
#recordings ⇒ Object
102 103 104 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 102 def recordings respond_with(@recordings = @server.recordings) end |
#rooms ⇒ Object
106 107 108 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 106 def rooms respond_with(@rooms = @server.rooms) end |
#show ⇒ Object
12 13 14 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 12 def show respond_with(@server) end |
#unpublish_recordings ⇒ Object
114 115 116 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 114 def unpublish_recordings self.publish_unpublish(params[:recordings], false) end |
#update ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'app/controllers/bigbluebutton/servers_controller.rb', line 77 def update respond_with @server do |format| if @server.update_attributes(server_params) format.html { = t('bigbluebutton_rails.servers.notice.update.success') redirect_to_using_params @server, :notice => } format.json { render :json => true, :status => :ok } else format.html { redirect_to_params_or_render :edit } format.json { render :json => @server.errors., :status => :unprocessable_entity } end end end |