You have been invited as a guest to a BigblueButton session "{$a->name}" on "{$a->course_fullname}" course.
+You can join the session by following the link here. +You will then be prompted for your name and the following password: "{$a->guestpassword}".
+If you need help, please contact {$a->sender}.
'; + $string['index_confirm_end'] = 'Do you want to end the session?'; $string['index_disabled'] = 'disabled'; $string['index_enabled'] = 'enabled'; @@ -317,6 +358,7 @@ $string['index_heading_viewer'] = 'Viewers'; $string['index_heading'] = 'BigBlueButton rooms'; $string['instanceprofilewithoutrecordings'] = 'This instance profile cannot display recordings'; $string['mod_form_block_general'] = 'General'; +$string['mod_form_block_guestaccess'] = 'Guest access'; $string['mod_form_block_room'] = 'Room settings'; $string['mod_form_block_recordings'] = 'Recording view'; $string['mod_form_block_presentation'] = 'Presentation content'; @@ -330,6 +372,8 @@ $string['mod_form_field_intro'] = 'Description'; $string['mod_form_field_intro_help'] = 'A short description of the room.'; $string['mod_form_field_duration_help'] = 'Setting the duration for a meeting will establish the maximum time for a meeting to keep alive before the recording finish'; $string['mod_form_field_duration'] = 'Duration'; +$string['mod_form_field_guestallowed'] = 'Allow guest access in the meeting'; +$string['mod_form_field_mustapproveuser'] = 'User must be approved by moderators'; $string['mod_form_field_userlimit'] = 'User limit'; $string['mod_form_field_userlimit_help'] = 'The maximum number of users allowed in a session. Set to 0 to allow an unlimited number of users.'; $string['mod_form_field_name'] = 'Room name'; @@ -443,18 +487,18 @@ $string['view_message_notavailableyet'] = 'This session is not yet available.'; $string['view_recording_select_course'] = 'Select a course first in the drop down menu'; -$string['view_message_session_started_at'] = 'This session started at'; +$string['view_message_session_started_at'] = 'Session started at'; $string['view_message_session_running_for'] = 'This session has been running for'; $string['view_message_hour'] = 'hour'; $string['view_message_hours'] = 'hours'; $string['view_message_minute'] = 'minute'; $string['view_message_minutes'] = 'minutes'; -$string['view_message_moderator'] = 'moderator'; -$string['view_message_moderators'] = 'moderators'; -$string['view_message_viewer'] = 'viewer'; -$string['view_message_viewers'] = 'viewers'; -$string['view_message_user'] = 'user'; -$string['view_message_users'] = 'users'; +$string['view_message_moderator'] = 'Moderator'; +$string['view_message_moderators'] = 'Moderators'; +$string['view_message_viewer'] = 'Viewer'; +$string['view_message_viewers'] = 'Viewers'; +$string['view_message_user'] = 'User'; +$string['view_message_users'] = 'Users'; $string['view_message_has_joined'] = 'has joined'; $string['view_message_have_joined'] = 'have joined'; $string['view_message_session_no_users'] = 'There are no users in this session'; diff --git a/mod/bigbluebuttonbn/lib.php b/mod/bigbluebuttonbn/lib.php index 42bd42155a6..9bad150b749 100644 --- a/mod/bigbluebuttonbn/lib.php +++ b/mod/bigbluebuttonbn/lib.php @@ -99,6 +99,8 @@ function bigbluebuttonbn_add_instance($bigbluebuttonbn) { $bigbluebuttonbn->presentation = files::save_media_file($bigbluebuttonbn); // Encode meetingid. $bigbluebuttonbn->meetingid = meeting::get_unique_meetingid_seed(); + [$bigbluebuttonbn->guestlinkuid, $bigbluebuttonbn->guestpassword] = + \mod_bigbluebuttonbn\plugin::generate_guest_meeting_credentials(); // Insert a record. $bigbluebuttonbn->id = $DB->insert_record('bigbluebuttonbn', $bigbluebuttonbn); // Log insert action. @@ -125,6 +127,10 @@ function bigbluebuttonbn_update_instance($bigbluebuttonbn) { $bigbluebuttonbn->id = $bigbluebuttonbn->instance; $bigbluebuttonbn->presentation = files::save_media_file($bigbluebuttonbn); + if (empty($bigbluebuttonbn->guestjoinurl) || empty($bigbluebuttonbn->guestpassword)) { + [$bigbluebuttonbn->guestlinkuid, $bigbluebuttonbn->guestpassword] = + \mod_bigbluebuttonbn\plugin::generate_guest_meeting_credentials(); + } // Update a record. $DB->update_record('bigbluebuttonbn', $bigbluebuttonbn); diff --git a/mod/bigbluebuttonbn/mod_form.php b/mod/bigbluebuttonbn/mod_form.php index 4f39eece603..01c86e5c9de 100644 --- a/mod/bigbluebuttonbn/mod_form.php +++ b/mod/bigbluebuttonbn/mod_form.php @@ -24,6 +24,7 @@ * @author Fred Dixon (ffdixon [at] blindsidenetworks [dt] com) */ +use mod_bigbluebuttonbn\instance; use mod_bigbluebuttonbn\local\helpers\roles; use mod_bigbluebuttonbn\local\proxy\bigbluebutton_proxy; @@ -80,6 +81,8 @@ class mod_bigbluebuttonbn_mod_form extends moodleform_mod { $this->bigbluebuttonbn_mform_add_block_preuploads($mform, $cfg); // Add block 'Participant List'. $this->bigbluebuttonbn_mform_add_block_user_role_mapping($mform, $participantlist); + // Add block 'Guest Access'. + $this->bigbluebuttonbn_mform_add_block_guest_access($mform, $cfg, $this->current); // Add block 'Schedule'. $this->bigbluebuttonbn_mform_add_block_schedule($mform, $this->current); // Add standard elements, common to all modules. @@ -597,6 +600,42 @@ class mod_bigbluebuttonbn_mod_form extends moodleform_mod { get_string('mod_form_field_participant_list', 'bigbluebuttonbn'), $html); } + /** + * Function to add guest acces settings to the instance + * + * @param MoodleQuickForm $mform + * @param array $cfg + * @param stdClass $current + * @return void + * @throws coding_exception + */ + private function bigbluebuttonbn_mform_add_block_guest_access(MoodleQuickForm $mform, array $cfg, stdClass $current) { + if (!empty($cfg['guestaccess_enabled'])) { + $mform->addElement('header', 'guestaccess', get_string('mod_form_block_guestaccess', 'bigbluebuttonbn')); + $mform->setExpanded('guestaccess'); + $mform->addElement('advcheckbox', 'guestallowed', + get_string('mod_form_field_guestallowed', 'bigbluebuttonbn')); + $mform->addElement('advcheckbox', 'mustapproveuser', + get_string('mod_form_field_mustapproveuser', 'bigbluebuttonbn')); + $mform->hideIf('mustapproveuser', 'guestallowed'); + if (!empty($this->_cm)) { + $instance = instance::get_from_cmid($this->_cm->id); + \mod_bigbluebuttonbn\form\guest_add::add_meeting_links_elements($mform); + $mform->setDefault('guestjoinurl', $instance->get_guest_access_url()); + $mform->setDefault('guestpassword', $instance->get_guest_access_password()); + $mform->hideIf('guestjoinurl', 'guestallowed'); + $mform->hideIf('guestpassword', 'guestallowed'); + } + } else { + $mform->addElement('hidden', 'guestallowed', 0); + $mform->addElement('hidden', 'mustapproveuser', 0); + } + $mform->setType('guestallowed', PARAM_BOOL); + $mform->setType('mustapproveuser', PARAM_BOOL); + $mform->setDefault('guestallowed', 0); + $mform->setDefault('mustapproveuser', 1); + } + /** * Function for showing the block for integration with the calendar. * diff --git a/mod/bigbluebuttonbn/styles.css b/mod/bigbluebuttonbn/styles.css index c3ed3edc06d..445d7cf58ad 100644 --- a/mod/bigbluebuttonbn/styles.css +++ b/mod/bigbluebuttonbn/styles.css @@ -34,3 +34,12 @@ .bbb_index_form { display: inline-block; } + +.bigbluebuttonbn_icon_btn i.icon { + margin-right: auto; +} +/* Disable gray background for text input */ +input.form-control[readonly][name="guestpassword"], +input.form-control[readonly][name="guestjoinurl"] { + background: initial; +} \ No newline at end of file diff --git a/mod/bigbluebuttonbn/templates/element_text_with_copy.mustache b/mod/bigbluebuttonbn/templates/element_text_with_copy.mustache new file mode 100644 index 00000000000..2913954ae7d --- /dev/null +++ b/mod/bigbluebuttonbn/templates/element_text_with_copy.mustache @@ -0,0 +1,71 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see