bigbluebutton_rails 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +11 -0
- data/Gemfile.lock +1 -1
- data/README.rdoc +46 -32
- data/Rakefile +0 -1
- data/app/controllers/bigbluebutton/rooms_controller.rb +17 -16
- data/app/controllers/bigbluebutton/servers_controller.rb +6 -2
- data/app/models/bigbluebutton_room.rb +35 -1
- data/app/models/bigbluebutton_server.rb +1 -1
- data/app/views/bigbluebutton/rooms/_form.html.erb +7 -3
- data/app/views/bigbluebutton/rooms/_rooms.html.erb +37 -0
- data/app/views/bigbluebutton/rooms/edit.html.erb +2 -2
- data/app/views/bigbluebutton/rooms/external.html.erb +2 -1
- data/app/views/bigbluebutton/rooms/index.html.erb +2 -37
- data/app/views/bigbluebutton/rooms/invite.html.erb +2 -2
- data/app/views/bigbluebutton/rooms/join.html.erb +1 -1
- data/app/views/bigbluebutton/rooms/new.html.erb +1 -1
- data/app/views/bigbluebutton/rooms/show.html.erb +10 -4
- data/app/views/bigbluebutton/servers/_activity_list.html.erb +6 -6
- data/app/views/bigbluebutton/servers/index.html.erb +4 -3
- data/app/views/bigbluebutton/servers/rooms.html.erb +2 -0
- data/app/views/bigbluebutton/servers/show.html.erb +3 -4
- data/config/locales/en.yml +7 -3
- data/lib/bigbluebutton_rails/exceptions.rb +4 -0
- data/lib/bigbluebutton_rails/rails/routes.rb +28 -35
- data/lib/bigbluebutton_rails/version.rb +1 -1
- data/spec/controllers/bigbluebutton/rooms_controller_exception_handling_spec.rb +13 -10
- data/spec/controllers/bigbluebutton/rooms_controller_json_responses_spec.rb +13 -13
- data/spec/controllers/bigbluebutton/rooms_controller_spec.rb +114 -115
- data/spec/controllers/bigbluebutton/servers_controller_json_responses_spec.rb +12 -1
- data/spec/controllers/bigbluebutton/servers_controller_spec.rb +11 -0
- data/spec/generators/install_generator_spec.rb +1 -1
- data/spec/models/bigbluebutton_room_spec.rb +166 -80
- data/spec/models/bigbluebutton_server_spec.rb +4 -4
- data/spec/rails_app/features/activity_monitor_servers.feature +6 -0
- data/spec/rails_app/features/create_rooms.feature +5 -0
- data/spec/rails_app/features/create_servers.feature +7 -2
- data/spec/rails_app/features/edit_rooms.feature +7 -0
- data/spec/rails_app/features/edit_servers.feature +8 -2
- data/spec/rails_app/features/join_rooms.feature +1 -0
- data/spec/rails_app/features/list_and_show_rooms.feature +10 -2
- data/spec/rails_app/features/step_definitions/activity_monitor_servers_step.rb +10 -10
- data/spec/rails_app/features/step_definitions/common_steps.rb +6 -4
- data/spec/rails_app/features/step_definitions/create_rooms_steps.rb +1 -0
- data/spec/rails_app/features/step_definitions/join_mobile_steps.rb +1 -3
- data/spec/rails_app/features/step_definitions/join_rooms_steps.rb +3 -7
- data/spec/rails_app/features/step_definitions/list_and_show_rooms_steps.rb +12 -5
- data/spec/rails_app/features/step_definitions/list_and_show_servers_steps.rb +1 -5
- data/spec/rails_app/features/support/{application_controller.rb → patches/application_controller.rb} +0 -0
- data/spec/rails_app/features/support/patches/bigbluebutton_room.rb +9 -0
- data/spec/rails_app/features/support/paths.rb +12 -10
- data/spec/rails_app/features/support/templates.rb +90 -46
- data/spec/routing/bigbluebutton/custom_controllers_routing_spec.rb +38 -22
- data/spec/routing/bigbluebutton/rooms_routing_spec.rb +142 -58
- data/spec/routing/bigbluebutton/servers_routing_spec.rb +9 -1
- metadata +11 -8
data/CHANGELOG.rdoc
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
== 1.1.0
|
2
|
+
|
3
|
+
* Rooms are now decoupled from servers:
|
4
|
+
* A room can exist without a server;
|
5
|
+
* Everytime a 'send_create' is called in a room, the method 'select_server' is called to select a server where the meeting will be held. The room is saved if the server changed;
|
6
|
+
* The method 'select_server' by default selects the server with less rooms;
|
7
|
+
* The routes for rooms are not nested with servers anymore ('/bigbluebutton/rooms' instead of '/bigbluebutton/server/:id/rooms').
|
8
|
+
* Because of this change all path helpers for rooms <b>must be updated!</b>
|
9
|
+
* rooms/external now receives a parameter "server_id" to indicate the server in which the external rooms is running. The views were updated.
|
10
|
+
* "bigbluebutton_routes :room_matchers" now generates all routes available for rooms, not only a selected set as before.
|
11
|
+
|
1
12
|
== 1.0.0
|
2
13
|
|
3
14
|
* First version with support to BigBlueButton 0.8:
|
data/Gemfile.lock
CHANGED
data/README.rdoc
CHANGED
@@ -1,24 +1,23 @@
|
|
1
1
|
= BigBlueButton on Rails
|
2
|
-
http://travis-ci.org/mconf/bigbluebutton_rails.png
|
2
|
+
{<img src="http://travis-ci.org/mconf/bigbluebutton_rails.png" alt="Travis CI Status" />}[http://travis-ci.org/#!/mconf/bigbluebutton_rails]
|
3
3
|
|
4
4
|
{BigBlueButton}[http://bigbluebutton.org] integration for Ruby on Rails 3.
|
5
5
|
|
6
6
|
Features:
|
7
|
-
* Allows multiple servers and multiple conference rooms
|
8
|
-
* Full API access using {bigbluebutton-api-ruby}[https://github.com/mconf/bigbluebutton-api-ruby]
|
9
|
-
* Easy way to join conferences: simply create a room and call the "join" action
|
10
|
-
* Easy integration with authentication and authorization mechanisms, such as Devise and CanCan
|
11
|
-
* Possibility to create private rooms, that require a password to join
|
12
|
-
* Deals with visitors (users that are not logged), allowing (or forbidding) them to join rooms
|
13
|
-
* Random meeting IDs to avoid problems with end_meeting, timeouts and reuse of URLs
|
14
|
-
* Server activity monitor
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
* Limit the number of users per room and rooms per server
|
19
|
-
* Server administration (modify config.xml, use bbb-conf, etc.)
|
20
|
-
*
|
21
|
-
* Load balancing
|
7
|
+
* Allows multiple servers and multiple conference rooms.
|
8
|
+
* Full API access using {bigbluebutton-api-ruby}[https://github.com/mconf/bigbluebutton-api-ruby].
|
9
|
+
* Easy way to join conferences: simply create a room and call the "join" action.
|
10
|
+
* Easy integration with authentication and authorization mechanisms, such as Devise and CanCan.
|
11
|
+
* Possibility to create private rooms, that require a password to join.
|
12
|
+
* Deals with visitors (users that are not logged), allowing (or forbidding) them to join rooms.
|
13
|
+
* Random meeting IDs to avoid problems with end_meeting, timeouts and reuse of URLs.
|
14
|
+
* Server activity monitor.
|
15
|
+
* "On-the-fly" server selection when a meeting is started.
|
16
|
+
|
17
|
+
Possible future features:
|
18
|
+
* Limit the number of users per room and rooms per server.
|
19
|
+
* Server administration (modify config.xml, use bbb-conf, etc.).
|
20
|
+
* Load balancing.
|
22
21
|
|
23
22
|
For more future features and issues check {our google code page}[http://code.google.com/p/mconf/issues/list?can=2&q=label%3AComponent%20label%3ABigBlueButtonRails].
|
24
23
|
|
@@ -66,33 +65,32 @@ The routes to BigbluebuttonRails can be generated with the helper <tt>bigbluebut
|
|
66
65
|
It will generate the default routes. You need to call it at least once and the routes will be scoped with 'bigbluebutton'. They will look like:
|
67
66
|
|
68
67
|
/bigbluebutton/servers
|
69
|
-
/bigbluebutton/servers/
|
70
|
-
/bigbluebutton/servers/
|
68
|
+
/bigbluebutton/servers/my-server/new
|
69
|
+
/bigbluebutton/servers/my-server/rooms
|
70
|
+
/bigbluebutton/rooms
|
71
|
+
/bigbluebutton/rooms/my-room/join
|
71
72
|
|
72
|
-
You can customize the scope name and also make the routes
|
73
|
+
You can customize the scope name and also make the routes use custom controllers.
|
73
74
|
|
74
75
|
bigbluebutton_routes :default, :scope => 'webconference', :controllers => { :servers => 'custom_servers', :rooms => 'custom_rooms' }
|
75
76
|
bigbluebutton_routes :default, :scope => '' # to remove the scope
|
76
77
|
|
77
78
|
You may also want shorter routes to access conference rooms. For that, use the option <tt>room_matchers</tt>:
|
78
79
|
|
79
|
-
bigbluebutton_routes :room_matchers
|
80
|
-
|
81
80
|
resources :users do
|
82
81
|
bigbluebutton_routes :room_matchers
|
83
82
|
end
|
84
83
|
|
85
|
-
It creates routes to the actions used to access
|
84
|
+
It creates routes to the actions used to access a conference room, so you can allow access to webconference rooms using URLs such as:
|
86
85
|
|
87
|
-
http://myserver.com/
|
88
|
-
http://myserver.com/user-name/
|
89
|
-
http://myserver.com/ziltoid-room/join
|
86
|
+
http://myserver.com/my-community/room-name/join
|
87
|
+
http://myserver.com/user-name/room-name/join
|
90
88
|
|
91
89
|
For more information see:
|
92
90
|
|
93
91
|
* {How to: Routes}[https://github.com/mconf/bigbluebutton_rails/wiki/How-to:-Routes]
|
94
92
|
|
95
|
-
===
|
93
|
+
=== Basic configurations
|
96
94
|
|
97
95
|
There are some basic assumptions made by BigbluebuttonRails:
|
98
96
|
|
@@ -103,7 +101,21 @@ If you don't, you can change this behaviour easily, keep reading.
|
|
103
101
|
|
104
102
|
BigbluebuttonRails uses the methods <tt>bigbluebutton_user</tt> and <tt>bigbluebutton_role(room)</tt> to get the current user and to get the permission that the current
|
105
103
|
user has in the <tt>room</tt>, respectively. These methods are defined in {lib/bigbluebutton_rails/controller_methods.rb}[https://github.com/mconf/bigbluebutton_rails/blob/master/lib/bigbluebutton_rails/controller_methods.rb]
|
106
|
-
and you can reimplement them in your application controller to change their behaviour.
|
104
|
+
and you can reimplement them in your application controller to change their behaviour as shown below.
|
105
|
+
|
106
|
+
class ApplicationController < ActionController::Base
|
107
|
+
|
108
|
+
# overriding bigbluebutton_rails function
|
109
|
+
def bigbluebutton_user
|
110
|
+
current_user && current_user.is_a?(User) ? current_user : nil
|
111
|
+
end
|
112
|
+
|
113
|
+
def bigbluebutton_role(room)
|
114
|
+
...
|
115
|
+
end
|
116
|
+
|
117
|
+
end
|
118
|
+
|
107
119
|
|
108
120
|
==== See also
|
109
121
|
|
@@ -116,25 +128,27 @@ Fork this repository, clone your fork and start by installing the dependencies:
|
|
116
128
|
|
117
129
|
bundle install
|
118
130
|
|
119
|
-
|
131
|
+
Save <tt>spec/rails_app/features/config.yml.example</tt> as <tt>config.yml</tt> and edit it to set values for an existent BigBlueButton server. You will need it to run the integration tests. For more information see the page {Testing}[https://github.com/mconf/bigbluebutton_rails/wiki/Testing] in our wiki.
|
120
132
|
|
121
133
|
Prepare the rails_app used for tests:
|
122
134
|
|
123
135
|
rake setup:rails_app
|
124
|
-
rake setup:rails_app:db
|
136
|
+
rake setup:rails_app:db SERVER=my-server # select a server you defined in 'config.yml'
|
125
137
|
|
126
138
|
Run the tests:
|
127
139
|
|
128
140
|
rake spec
|
129
|
-
rake cucumber
|
141
|
+
rake cucumber SERVER=my-server
|
130
142
|
|
131
143
|
Or simply:
|
132
144
|
|
133
|
-
rake
|
145
|
+
rake SERVER=my-server
|
146
|
+
|
147
|
+
Note: If you don't set the SERVER variable, the first server in <tt>config.yml</tt> will be used.
|
134
148
|
|
135
149
|
Develop. :)
|
136
150
|
|
137
|
-
If you want your code to be integrated in this repository, please create a branch with your modifications and submit a pull request.
|
151
|
+
If you want your code to be integrated in this repository, please fork it, create a branch with your modifications and submit a pull request.
|
138
152
|
|
139
153
|
=== Test Coverage
|
140
154
|
|
data/Rakefile
CHANGED
@@ -69,7 +69,6 @@ task :notes do
|
|
69
69
|
puts `grep -r 'OPTIMIZE\\|FIXME\\|TODO' app/ public/ spec/`
|
70
70
|
end
|
71
71
|
|
72
|
-
# FIXME: not the best way to test these migrations, but works for now
|
73
72
|
desc 'Setup the rails_app using the migration files created when upgrading the gem
|
74
73
|
version, run all tests and destroys the generated files.'
|
75
74
|
namespace :spec do
|
@@ -2,13 +2,12 @@ require 'bigbluebutton_api'
|
|
2
2
|
|
3
3
|
class Bigbluebutton::RoomsController < ApplicationController
|
4
4
|
|
5
|
-
before_filter :find_server
|
6
5
|
before_filter :find_room, :only => [:show, :edit, :update, :destroy, :join, :invite, :running, :end, :destroy, :end, :join_mobile]
|
6
|
+
before_filter :find_server, :only => [:external, :external_auth]
|
7
7
|
respond_to :html, :except => :running
|
8
8
|
respond_to :json, :only => [:running, :show, :new, :index, :create, :update]
|
9
9
|
|
10
10
|
def index
|
11
|
-
# TODO restrict to rooms belonging to the selected server
|
12
11
|
respond_with(@rooms = BigbluebuttonRoom.all)
|
13
12
|
end
|
14
13
|
|
@@ -26,7 +25,6 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
26
25
|
|
27
26
|
def create
|
28
27
|
@room = BigbluebuttonRoom.new(params[:bigbluebutton_room])
|
29
|
-
@room.server = @server
|
30
28
|
|
31
29
|
if !params[:bigbluebutton_room].has_key?(:meetingid) or
|
32
30
|
params[:bigbluebutton_room][:meetingid].blank?
|
@@ -37,7 +35,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
37
35
|
if @room.save
|
38
36
|
message = t('bigbluebutton_rails.rooms.notice.create.success')
|
39
37
|
format.html {
|
40
|
-
params[:redir_url] ||=
|
38
|
+
params[:redir_url] ||= bigbluebutton_room_path(@room)
|
41
39
|
redirect_to params[:redir_url], :notice => message
|
42
40
|
}
|
43
41
|
format.json { render :json => { :message => message }, :status => :created }
|
@@ -65,7 +63,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
65
63
|
if @room.update_attributes(params[:bigbluebutton_room])
|
66
64
|
message = t('bigbluebutton_rails.rooms.notice.update.success')
|
67
65
|
format.html {
|
68
|
-
params[:redir_url] ||=
|
66
|
+
params[:redir_url] ||= bigbluebutton_room_path(@room)
|
69
67
|
redirect_to params[:redir_url], :notice => message
|
70
68
|
}
|
71
69
|
format.json { render :json => { :message => message } }
|
@@ -101,7 +99,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
101
99
|
respond_with do |format|
|
102
100
|
format.html {
|
103
101
|
flash[:error] = message if error
|
104
|
-
params[:redir_url] ||=
|
102
|
+
params[:redir_url] ||= bigbluebutton_rooms_url
|
105
103
|
redirect_to params[:redir_url]
|
106
104
|
}
|
107
105
|
if error
|
@@ -173,24 +171,31 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
173
171
|
end
|
174
172
|
end
|
175
173
|
|
174
|
+
# receives :server_id to indicate the server and :meeting to indicate the
|
175
|
+
# MeetingID of the meeting that should be joined
|
176
176
|
def external
|
177
177
|
if params[:meeting].blank?
|
178
178
|
message = t('bigbluebutton_rails.rooms.errors.external.blank_meetingid')
|
179
|
-
params[:redir_url] ||=
|
179
|
+
params[:redir_url] ||= bigbluebutton_rooms_path
|
180
180
|
redirect_to params[:redir_url], :notice => message
|
181
181
|
end
|
182
|
-
@room = BigbluebuttonRoom.new(:meetingid => params[:meeting])
|
182
|
+
@room = BigbluebuttonRoom.new(:server => @server, :meetingid => params[:meeting])
|
183
183
|
end
|
184
184
|
|
185
185
|
# Authenticates an user using name and password passed in the params from #external
|
186
186
|
# Uses params[:meeting] to get the meetingID of the target room
|
187
187
|
def external_auth
|
188
|
+
# check :meeting and :user
|
188
189
|
if !params[:meeting].blank? && !params[:user].blank?
|
189
190
|
@server.fetch_meetings
|
190
191
|
@room = @server.meetings.select{ |r| r.meetingid == params[:meeting] }.first
|
192
|
+
message = t('bigbluebutton_rails.rooms.errors.external.inexistent_meeting') if @room.nil?
|
191
193
|
else
|
194
|
+
message = t('bigbluebutton_rails.rooms.errors.external.wrong_params')
|
195
|
+
end
|
196
|
+
|
197
|
+
unless message.nil?
|
192
198
|
@room = nil
|
193
|
-
message = t('bigbluebutton_rails.rooms.errors.auth.wrong_params')
|
194
199
|
redirect_to request.referer, :notice => message
|
195
200
|
return
|
196
201
|
end
|
@@ -255,7 +260,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
255
260
|
else
|
256
261
|
respond_with do |format|
|
257
262
|
format.html {
|
258
|
-
redirect_to(
|
263
|
+
redirect_to(bigbluebutton_room_path(@room), :notice => message)
|
259
264
|
}
|
260
265
|
format.json { render :json => message }
|
261
266
|
end
|
@@ -264,7 +269,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
264
269
|
end
|
265
270
|
|
266
271
|
def join_mobile
|
267
|
-
@join_url =
|
272
|
+
@join_url = join_bigbluebutton_room_url(@room, :mobile => '1')
|
268
273
|
@join_url.gsub!(/http:\/\//i, "bigbluebutton://")
|
269
274
|
|
270
275
|
# TODO: we can't use the mconf url because the mobile client scanning the qrcode is not
|
@@ -280,11 +285,7 @@ class Bigbluebutton::RoomsController < ApplicationController
|
|
280
285
|
end
|
281
286
|
|
282
287
|
def find_server
|
283
|
-
|
284
|
-
@server = BigbluebuttonServer.find_by_param(params[:server_id])
|
285
|
-
else
|
286
|
-
@server = BigbluebuttonServer.first
|
287
|
-
end
|
288
|
+
@server = BigbluebuttonServer.find(params[:server_id])
|
288
289
|
end
|
289
290
|
|
290
291
|
def join_internal(username, role, wait_action)
|
@@ -1,8 +1,8 @@
|
|
1
1
|
class Bigbluebutton::ServersController < ApplicationController
|
2
2
|
|
3
3
|
respond_to :html
|
4
|
-
respond_to :json, :only => [:index, :show, :new, :create, :update, :destroy, :activity]
|
5
|
-
before_filter :find_server, :only => [:show, :edit, :activity, :update, :destroy]
|
4
|
+
respond_to :json, :only => [:index, :show, :new, :create, :update, :destroy, :activity, :rooms]
|
5
|
+
before_filter :find_server, :only => [:show, :edit, :activity, :update, :destroy, :rooms]
|
6
6
|
|
7
7
|
def index
|
8
8
|
respond_with(@servers = BigbluebuttonServer.all)
|
@@ -97,6 +97,10 @@ class Bigbluebutton::ServersController < ApplicationController
|
|
97
97
|
end
|
98
98
|
end
|
99
99
|
|
100
|
+
def rooms
|
101
|
+
respond_with(@rooms = @server.rooms)
|
102
|
+
end
|
103
|
+
|
100
104
|
protected
|
101
105
|
|
102
106
|
def find_server
|
@@ -2,7 +2,6 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
2
2
|
belongs_to :server, :class_name => 'BigbluebuttonServer'
|
3
3
|
belongs_to :owner, :polymorphic => true
|
4
4
|
|
5
|
-
validates :server_id, :presence => true
|
6
5
|
validates :meetingid, :presence => true, :uniqueness => true,
|
7
6
|
:length => { :minimum => 1, :maximum => 100 }
|
8
7
|
validates :name, :presence => true, :uniqueness => true,
|
@@ -64,6 +63,8 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
64
63
|
#
|
65
64
|
# Triggers API call: <tt>get_meeting_info</tt>.
|
66
65
|
def fetch_meeting_info
|
66
|
+
require_server
|
67
|
+
|
67
68
|
response = self.server.api.get_meeting_info(self.meetingid, self.moderator_password)
|
68
69
|
|
69
70
|
@participant_count = response[:participantCount]
|
@@ -86,6 +87,7 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
86
87
|
#
|
87
88
|
# Triggers API call: <tt>is_meeting_running</tt>.
|
88
89
|
def fetch_is_running?
|
90
|
+
require_server
|
89
91
|
@running = self.server.api.is_meeting_running?(self.meetingid)
|
90
92
|
end
|
91
93
|
|
@@ -93,17 +95,25 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
93
95
|
#
|
94
96
|
# Triggers API call: <tt>end_meeting</tt>.
|
95
97
|
def send_end
|
98
|
+
require_server
|
96
99
|
self.server.api.end_meeting(self.meetingid, self.moderator_password)
|
97
100
|
end
|
98
101
|
|
99
102
|
# Sends a call to the BBB server to create the meeting.
|
100
103
|
#
|
104
|
+
# Will trigger 'select_server' to select a server where the meeting
|
105
|
+
# will be created. If a server is selected, the model is saved.
|
106
|
+
#
|
101
107
|
# With the response, updates the following attributes:
|
102
108
|
# * <tt>attendee_password</tt>
|
103
109
|
# * <tt>moderator_password</tt>
|
104
110
|
#
|
105
111
|
# Triggers API call: <tt>create_meeting</tt>.
|
106
112
|
def send_create
|
113
|
+
# updates the server whenever a meeting will be created
|
114
|
+
self.server = select_server
|
115
|
+
self.save unless self.new_record?
|
116
|
+
require_server
|
107
117
|
|
108
118
|
unless self.randomize_meetingid
|
109
119
|
response = do_create_meeting
|
@@ -145,6 +155,8 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
145
155
|
#
|
146
156
|
# Uses the API but does not require a request to the server.
|
147
157
|
def join_url(username, role, password=nil)
|
158
|
+
require_server
|
159
|
+
|
148
160
|
case role
|
149
161
|
when :moderator
|
150
162
|
self.server.api.join_meeting_url(self.meetingid, username, self.moderator_password)
|
@@ -234,6 +246,28 @@ class BigbluebuttonRoom < ActiveRecord::Base
|
|
234
246
|
|
235
247
|
protected
|
236
248
|
|
249
|
+
# Every room needs a server to be used.
|
250
|
+
# The server of a room can change during the room's lifespan, but
|
251
|
+
# it should not change if the room is running or if it was created
|
252
|
+
# but not yet ended.
|
253
|
+
# Any action that requires a server should call 'require_server' before
|
254
|
+
# anything else.
|
255
|
+
def require_server
|
256
|
+
if self.server.nil?
|
257
|
+
msg = I18n.t('bigbluebutton_rails.rooms.errors.server.not_set')
|
258
|
+
raise BigbluebuttonRails::ServerRequired.new(msg)
|
259
|
+
end
|
260
|
+
end
|
261
|
+
|
262
|
+
# This method can be overridden to change the way the server is selected
|
263
|
+
# before a room is created
|
264
|
+
# This one selects the server with less rooms in it
|
265
|
+
def select_server
|
266
|
+
BigbluebuttonServer.
|
267
|
+
select("bigbluebutton_servers.*, count(bigbluebutton_rooms.id) as room_count").
|
268
|
+
joins(:rooms).group(:server_id).order("room_count ASC").first
|
269
|
+
end
|
270
|
+
|
237
271
|
def init
|
238
272
|
self[:meetingid] ||= random_meetingid
|
239
273
|
self[:voice_bridge] ||= random_voice_bridge
|
@@ -1,10 +1,10 @@
|
|
1
1
|
<% if @room.new_record? %>
|
2
|
-
<% url =
|
2
|
+
<% url = bigbluebutton_rooms_path %>
|
3
3
|
<% else %>
|
4
|
-
<% url =
|
4
|
+
<% url = bigbluebutton_room_path(@room) %>
|
5
5
|
<% end %>
|
6
6
|
|
7
|
-
<%= form_for
|
7
|
+
<%= form_for @room, :url => url do |f| %>
|
8
8
|
<% if @room.errors.any? %>
|
9
9
|
<div id="error_explanation">
|
10
10
|
<h2><%= pluralize(@room.errors.count, "error") %>:</h2>
|
@@ -16,6 +16,10 @@
|
|
16
16
|
</div>
|
17
17
|
<% end %>
|
18
18
|
|
19
|
+
<div class="field">
|
20
|
+
<%= f.label :server_id %><br />
|
21
|
+
<%= f.text_field :server_id %>
|
22
|
+
</div>
|
19
23
|
<div class="field">
|
20
24
|
<%= f.label :name %><br />
|
21
25
|
<%= f.text_field :name %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
<div id="bbbrails_rooms_links">
|
2
|
+
<%= link_to('View servers list', bigbluebutton_servers_path) %><br/>
|
3
|
+
<%= link_to('New room', new_bigbluebutton_room_path) %>
|
4
|
+
</div>
|
5
|
+
|
6
|
+
<ul id="bbbrails_rooms_list">
|
7
|
+
<% @rooms.each do |room| %>
|
8
|
+
<li>
|
9
|
+
<div class="field">
|
10
|
+
<label><%= BigbluebuttonRoom.human_attribute_name(:server_id) %></label> <%= room.server_id %>
|
11
|
+
<%= link_to('(view server)', bigbluebutton_server_path(room.server)) unless room.server.nil? %>
|
12
|
+
</div>
|
13
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:meetingid) %></label> <%= room.meetingid %></div>
|
14
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:randomize_meetingid) %></label> <%= room.randomize_meetingid %></div>
|
15
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:name) %></label> <%= room.name %></div>
|
16
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:private) %></label> <%= room.private %></div>
|
17
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:attendee_password) %></label> <%= room.attendee_password %></div>
|
18
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:moderator_password) %></label> <%= room.moderator_password %></div>
|
19
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:welcome_msg) %></label> <%= room.welcome_msg %></div>
|
20
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:logout_url) %></label> <%= room.logout_url %></div>
|
21
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:dial_number) %></label> <%= room.dial_number %></div>
|
22
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:voice_bridge) %></label> <%= room.voice_bridge %></div>
|
23
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:max_participants) %></label> <%= room.max_participants %></div>
|
24
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:external) %></label> <%= room.external %></div>
|
25
|
+
<div class="field"><label><%= BigbluebuttonRoom.human_attribute_name(:param) %></label> <%= room.param %></div>
|
26
|
+
<div class="field"><label>Access</label>
|
27
|
+
<%= link_to 'Show', bigbluebutton_room_path(room) %> |
|
28
|
+
<%= link_to 'Join', join_bigbluebutton_room_path(room) %> |
|
29
|
+
<%= link_to 'Invite', invite_bigbluebutton_room_path(room) %> |
|
30
|
+
<%= link_to 'Mobile Join', join_mobile_bigbluebutton_room_path(room) %> |
|
31
|
+
<%= link_to 'Edit', edit_bigbluebutton_room_path(room) %> |
|
32
|
+
<%= link_to 'End', end_bigbluebutton_room_path(room), :confirm => 'Are you sure?' %> |
|
33
|
+
<%= link_to 'Destroy', bigbluebutton_room_path(room), :confirm => 'Are you sure?', :method => :delete %>
|
34
|
+
</div>
|
35
|
+
</li>
|
36
|
+
<% end %>
|
37
|
+
</ul>
|