diff --git a/.github/workflows/moodle-release.yml b/.github/workflows/moodle-release.yml index ec6c283..27444a0 100644 --- a/.github/workflows/moodle-release.yml +++ b/.github/workflows/moodle-release.yml @@ -10,7 +10,7 @@ on: jobs: call-moodle-release-workflow: - uses: Opencast-Moodle/moodle-workflows-opencast/.github/workflows/moodle-release.yml@master + uses: Opencast-Moodle/moodle-workflows-opencast/.github/workflows/moodle-release.yml@main with: plugin-name: 'mod_opencast' secrets: inherit diff --git a/downloadvideo.php b/downloadvideo.php index 3c70d9f..4888d17 100644 --- a/downloadvideo.php +++ b/downloadvideo.php @@ -22,7 +22,7 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -use block_opencast\local\apibridge; +use tool_opencast\local\apibridge; require_once('../../config.php'); global $PAGE, $OUTPUT, $CFG, $DB; diff --git a/lib.php b/lib.php index aed8be8..96a083b 100644 --- a/lib.php +++ b/lib.php @@ -144,8 +144,8 @@ function mod_opencast_get_fontawesome_icon_map() { function opencast_dndupload_register() { // Getting default opencast instance. $defaultocinstanceid = \tool_opencast\local\settings_api::get_default_ocinstance()->id; - // Getting file extensions from the block_opencast configuration using default ocinstanceid. - $videotypescfg = get_config('block_opencast', 'uploadfileextensions_' . $defaultocinstanceid); + // Getting file extensions from the tool_opencast configuration using default ocinstanceid. + $videotypescfg = get_config('tool_opencast', 'uploadfileextensions_' . $defaultocinstanceid); $videoexts = empty($videotypescfg) || $videotypescfg == 'video' ? file_get_typegroup('extension', 'video') : array_map('trim', explode(',', $videotypescfg)); diff --git a/uploadvideo.php b/uploadvideo.php index 6356add..ece3092 100644 --- a/uploadvideo.php +++ b/uploadvideo.php @@ -28,9 +28,9 @@ require_once($CFG->libdir . '/gradelib.php'); require_once(__DIR__ . '/uploadvideo_form.php'); -use block_opencast\local\apibridge; +use tool_opencast\local\apibridge; use tool_opencast\local\settings_api; -use block_opencast\local\upload_helper; +use tool_opencast\local\upload_helper; global $PAGE, $OUTPUT, $USER, $DB; @@ -48,8 +48,8 @@ $context = context_module::instance($cm->id); $coursecontext = context_course::instance($course->id); -// As we are doing the upload using the block_opencast, we have to use its capability as well. -require_capability('block/opencast:addvideo', $coursecontext); +// As we are doing the upload using the tool_opencast, we have to use its capability as well. +require_capability('tool/opencast:addvideo', $coursecontext); $PAGE->set_pagelayout('frametop'); $PAGE->set_context($context); @@ -62,7 +62,7 @@ // Getting all the oc instances. $ocinstances = settings_api::get_ocinstances(); // Getting user defaults. -$userdefaultsrecord = $DB->get_record('block_opencast_user_default', ['userid' => $USER->id]); +$userdefaultsrecord = $DB->get_record('tool_opencast_user_default', ['userid' => $USER->id]); $userdefaults = $userdefaultsrecord ? json_decode($userdefaultsrecord->defaults, true) : []; $usereventdefaults = (!empty($userdefaults['event'])) ? $userdefaults['event'] : []; // Getting medatadata catalogs based on the ocinstances. @@ -128,9 +128,9 @@ // Saving and getting the file. $newitemid = rand(1000000, 9999999); file_save_draft_area_files($moduleinstance->uploaddraftitemid, $coursecontext->id, - 'block_opencast', upload_helper::OC_FILEAREA, $newitemid); + 'tool_opencast', upload_helper::OC_FILEAREA, $newitemid); $fs = get_file_storage(); - $files = $fs->get_area_files($coursecontext->id, 'block_opencast', upload_helper::OC_FILEAREA, $newitemid, '', false); + $files = $fs->get_area_files($coursecontext->id, 'tool_opencast', upload_helper::OC_FILEAREA, $newitemid, '', false); $savedvideofile = null; if ($files) { $savedvideofile = reset($files); @@ -142,7 +142,7 @@ redirect($redirecturl, get_string('uploadmissingfile', 'mod_opencast'), null, \core\output\notification::NOTIFY_ERROR); } else { $coursecontext = context_course::instance($course->id); - \block_opencast\local\file_deletionmanager::track_draftitemid($coursecontext->id, $savedvideofile->get_itemid()); + \tool_opencast\local\file_deletionmanager::track_draftitemid($coursecontext->id, $savedvideofile->get_itemid()); } $flavorfieldname = 'flavor_' . $ocinstanceid; @@ -234,10 +234,10 @@ \core\notification::warning($e->getMessage()); } } - $blockopencastlink = new moodle_url('/blocks/opencast/index.php', + $indexopencastlink = new moodle_url('/admin/tool/opencast/index.php', ['courseid' => $course->id, 'ocinstanceid' => $ocinstanceid]); redirect($redirecturl, - get_string('uploadsaved', 'mod_opencast', $blockopencastlink->out()), null, \core\output\notification::NOTIFY_SUCCESS); + get_string('uploadsaved', 'mod_opencast', $indexopencastlink->out()), null, \core\output\notification::NOTIFY_SUCCESS); } $PAGE->set_title(get_string('uploadformtitle', 'mod_opencast')); diff --git a/uploadvideo_form.php b/uploadvideo_form.php index 67fe81b..2ea15b2 100644 --- a/uploadvideo_form.php +++ b/uploadvideo_form.php @@ -27,7 +27,7 @@ require_once($CFG->libdir . '/formslib.php'); -use block_opencast\local\autocomplete_suggestion_helper; +use tool_opencast\local\autocomplete_suggestion_helper; /** * Video Upload form @@ -45,7 +45,7 @@ class mod_opencast_uploadvideo_form extends moodleform { public function definition() { global $PAGE, $OUTPUT; // Get the renderer to use its methods. - $renderer = $PAGE->get_renderer('block_opencast'); + $renderer = $PAGE->get_renderer('tool_opencast'); $cmid = $this->_customdata['cmid']; $ocinstances = $this->_customdata['ocinstances']; @@ -123,11 +123,11 @@ public function definition() { if ($field->datatype == 'autocomplete') { $attributes = [ 'multiple' => true, - 'placeholder' => get_string('metadata_autocomplete_placeholder', 'block_opencast', - $this->try_get_string($field->name, 'block_opencast')), + 'placeholder' => get_string('metadata_autocomplete_placeholder', 'tool_opencast', + $this->try_get_string($field->name, 'tool_opencast')), 'showsuggestions' => true, - 'noselectionstring' => get_string('metadata_autocomplete_noselectionstring', 'block_opencast', - $this->try_get_string($field->name, 'block_opencast')), + 'noselectionstring' => get_string('metadata_autocomplete_noselectionstring', 'tool_opencast', + $this->try_get_string($field->name, 'tool_opencast')), 'tags' => true, ]; @@ -145,14 +145,14 @@ public function definition() { } // Get the created element back from addElement function, in order to further use its attrs. - $lbltext = $this->try_get_string($field->name, 'block_opencast'); + $lbltext = $this->try_get_string($field->name, 'tool_opencast'); $element = $mform->addElement($field->datatype, $elementid, $lbltext, $param, $attributes); // Check if the description is set for the field, to display it as help icon. if (isset($field->description) && !empty($field->description)) { // Use the renderer to generate a help icon with custom text. $element->_helpbutton = $renderer->render_help_icon_with_custom_text( - $this->try_get_string($field->name, 'block_opencast'), $field->description); + $this->try_get_string($field->name, 'tool_opencast'), $field->description); } if ($field->datatype == 'text') { @@ -169,7 +169,7 @@ public function definition() { } if ($settitle) { $elementid = 'title_' . $ocinstance->id; - $mform->addElement('text', 'title_' . $elementid, get_string('title', 'block_opencast')); + $mform->addElement('text', 'title_' . $elementid, get_string('title', 'tool_opencast')); $mform->setType($elementid, PARAM_TEXT); $mform->disabledIf($elementid, 'ocinstance' , 'neq', $ocinstance->id); $mform->hideif($elementid, 'ocinstance' , 'neq', $ocinstance->id); @@ -201,7 +201,7 @@ public function definition() { $mform->setType('metadatacatalogs', PARAM_TEXT); $mform->closeHeaderBefore('buttonar'); - $this->add_action_buttons(true, get_string('addvideo', 'block_opencast')); + $this->add_action_buttons(true, get_string('addvideo', 'tool_opencast')); } /** diff --git a/version.php b/version.php index 83a1709..380da78 100644 --- a/version.php +++ b/version.php @@ -27,10 +27,10 @@ $plugin->component = 'mod_opencast'; $plugin->release = 'v4.5-r4'; -$plugin->version = 2024111103; +$plugin->version = 2025042200; $plugin->requires = 2024100700; // Requires Moodle 4.5+. $plugin->supported = [405, 405]; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = [ - 'tool_opencast' => 2024111103, + 'tool_opencast' => 2025042200, ]; diff --git a/view.php b/view.php index 141d5f3..634c4c6 100644 --- a/view.php +++ b/view.php @@ -104,9 +104,9 @@ $messagetext = get_string('uploadlandinginfo', 'mod_opencast'); $messagestatus = \core\output\notification::NOTIFY_INFO; $url = new moodle_url('/mod/opencast/uploadvideo.php', ['cmid' => $cm->id]); - // Check the addvideo capability from block_opencast. + // Check the addvideo capability from tool_opencast. $coursecontext = context_course::instance($course->id); - if (!has_capability('block/opencast:addvideo', $coursecontext)) { + if (!has_capability('tool/opencast:addvideo', $coursecontext)) { // If capability is not met, redirect back with message. $url = new moodle_url('/course/view.php', ['id' => $course->id]); $messagetext = get_string('uploadnotallowed', 'mod_opencast'); @@ -125,7 +125,7 @@ redirect($url, $messagetext, null, $messagestatus); } else if ($moduleinstance->type == opencasttype::UPLOADED) { $url = new moodle_url('/course/view.php', ['id' => $course->id]); - $uploadjob = $DB->get_record('block_opencast_uploadjob', ['id' => $moduleinstance->uploadjobid]); + $uploadjob = $DB->get_record('tool_opencast_uploadjob', ['id' => $moduleinstance->uploadjobid]); if (empty($uploadjob) || empty($uploadjob->opencasteventid)) { $messagetext = get_string('uploadinprogress', 'mod_opencast', $moduleinstance->name); $messagestatus = \core\output\notification::NOTIFY_INFO; @@ -139,7 +139,7 @@ redirect($url, $messagetext, null, $messagestatus); } $opencasteventid = $uploadjob->opencasteventid; - $apibridge = \block_opencast\local\apibridge::get_instance($moduleinstance->ocinstanceid); + $apibridge = \tool_opencast\local\apibridge::get_instance($moduleinstance->ocinstanceid); $video = $apibridge->get_opencast_video($opencasteventid); if ($video->video->processing_state != 'SUCCEEDED') { $messagetext = get_string('uploadedvideoisbeingprocesses', 'mod_opencast', $moduleinstance->name);