Skip to content

Migrate Settings from block_opencast to tool_opencast #417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions addactivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
}

// If the intro feature is disabled or if we do not have an intro, use an empty string as intro.
if (get_config('block_opencast', 'addactivityintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
if (get_config('tool_opencast', 'addactivityintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
$introtext = '';
$introformat = FORMAT_HTML;

Expand All @@ -99,7 +99,7 @@
}

// If the section feature is disabled or if we do not have an intro, use the default section.
if (get_config('block_opencast', 'addactivitysection_' . $ocinstanceid) != true || !isset($data->section) || !$data->section) {
if (get_config('tool_opencast', 'addactivitysection_' . $ocinstanceid) != true || !isset($data->section) || !$data->section) {
$sectionid = 0;

// Otherwise.
Expand All @@ -108,7 +108,7 @@
}

// If the availability feature is disabled or if we do not have an availability given, use null.
if (get_config('block_opencast', 'addactivityavailability_' . $ocinstanceid) != true || empty($CFG->enableavailability) ||
if (get_config('tool_opencast', 'addactivityavailability_' . $ocinstanceid) != true || empty($CFG->enableavailability) ||
!isset($data->availabilityconditionsjson) || !$data->availabilityconditionsjson) {
$availability = null;

Expand Down
6 changes: 3 additions & 3 deletions addactivityepisode.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
}

// If the intro feature is disabled or if we do not have an intro, use an empty string as intro.
if (get_config('block_opencast', 'addactivityepisodeintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
if (get_config('tool_opencast', 'addactivityepisodeintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
$introtext = '';
$introformat = FORMAT_HTML;

Expand All @@ -95,7 +95,7 @@
}

// If the section feature is disabled or if we do not have an intro, use the default section.
if (get_config('block_opencast', 'addactivityepisodesection_' . $ocinstanceid) != true ||
if (get_config('tool_opencast', 'addactivityepisodesection_' . $ocinstanceid) != true ||
!isset($data->section) || !$data->section) {
$sectionid = 0;

Expand All @@ -105,7 +105,7 @@
}

// If the availability feature is disabled or if we do not have an availability given, use null.
if (get_config('block_opencast', 'addactivityepisodeavailability_' . $ocinstanceid) != true ||
if (get_config('tool_opencast', 'addactivityepisodeavailability_' . $ocinstanceid) != true ||
empty($CFG->enableavailability) ||
!isset($data->availabilityconditionsjson) || !$data->availabilityconditionsjson) {
$availability = null;
Expand Down
6 changes: 3 additions & 3 deletions addlti.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
}

// If the intro feature is disabled or if we do not have an intro, use an empty string as intro.
if (get_config('block_opencast', 'addltiintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
if (get_config('tool_opencast', 'addltiintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
$introtext = '';
$introformat = FORMAT_HTML;

Expand All @@ -106,7 +106,7 @@
}

// If the section feature is disabled or if we do not have an intro, use the default section.
if (get_config('block_opencast', 'addltisection_' . $ocinstanceid) != true || !isset($data->section) || !$data->section) {
if (get_config('tool_opencast', 'addltisection_' . $ocinstanceid) != true || !isset($data->section) || !$data->section) {
$sectionid = 0;

// Otherwise.
Expand All @@ -115,7 +115,7 @@
}

// If the availability feature is disabled or if we do not have an availability given, use null.
if (get_config('block_opencast', 'addltiavailability_' . $ocinstanceid) != true || empty($CFG->enableavailability) ||
if (get_config('tool_opencast', 'addltiavailability_' . $ocinstanceid) != true || empty($CFG->enableavailability) ||
!isset($data->availabilityconditionsjson) || !$data->availabilityconditionsjson) {
$availability = null;

Expand Down
6 changes: 3 additions & 3 deletions addltiepisode.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
}

// If the intro feature is disabled or if we do not have an intro, use an empty string as intro.
if (get_config('block_opencast', 'addltiepisodeintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
if (get_config('tool_opencast', 'addltiepisodeintro_' . $ocinstanceid) != true || !isset($data->intro) || !$data->intro) {
$introtext = '';
$introformat = FORMAT_HTML;

Expand All @@ -103,7 +103,7 @@
}

// If the section feature is disabled or if we do not have an intro, use the default section.
if (get_config('block_opencast', 'addltiepisodesection_' . $ocinstanceid) != true ||
if (get_config('tool_opencast', 'addltiepisodesection_' . $ocinstanceid) != true ||
!isset($data->section) || !$data->section) {
$sectionid = 0;

Expand All @@ -113,7 +113,7 @@
}

// If the availability feature is disabled or if we do not have an availability given, use null.
if (get_config('block_opencast', 'addltiepisodeavailability_' . $ocinstanceid) != true || empty($CFG->enableavailability) ||
if (get_config('tool_opencast', 'addltiepisodeavailability_' . $ocinstanceid) != true || empty($CFG->enableavailability) ||
!isset($data->availabilityconditionsjson) || !$data->availabilityconditionsjson) {
$availability = null;

Expand Down
2 changes: 1 addition & 1 deletion addtranscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
$apibridge = apibridge::get_instance($ocinstanceid);
$video = $apibridge->get_opencast_video($identifier);
if ($video->error || $video->video->processing_state != 'SUCCEEDED' ||
empty(get_config('block_opencast', 'transcriptionworkflow_' . $ocinstanceid))) {
empty(get_config('tool_opencast', 'transcriptionworkflow_' . $ocinstanceid))) {
redirect($redirecturl,
get_string('unabletoaddnewtranscription', 'block_opencast'), null, notification::NOTIFY_ERROR);
}
Expand Down
8 changes: 4 additions & 4 deletions addvideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,14 @@
$chunkuploadinstalled = class_exists('\local_chunkupload\chunkupload_form_element');

// Record the user draft area in this context.
if (!$chunkuploadinstalled || !get_config('block_opencast', 'enablechunkupload_' . $ocinstanceid) ||
if (!$chunkuploadinstalled || !get_config('tool_opencast', 'enablechunkupload_' . $ocinstanceid) ||
property_exists($data, 'presenter_already_uploaded') && $data->presenter_already_uploaded) {
$storedfilepresenter = $addvideoform->save_stored_file('video_presenter', $coursecontext->id,
'block_opencast', upload_helper::OC_FILEAREA, $data->video_presenter);
} else {
$chunkuploadpresenter = $data->video_presenter_chunk;
}
if (!$chunkuploadinstalled || !get_config('block_opencast', 'enablechunkupload_' . $ocinstanceid) ||
if (!$chunkuploadinstalled || !get_config('tool_opencast', 'enablechunkupload_' . $ocinstanceid) ||
property_exists($data, 'presentation_already_uploaded') && $data->presentation_already_uploaded) {
$storedfilepresentation = $addvideoform->save_stored_file('video_presentation', $coursecontext->id,
'block_opencast', upload_helper::OC_FILEAREA, $data->video_presentation);
Expand All @@ -165,8 +165,8 @@

// Transcription files.
$transcriptions = [];
if (!empty(get_config('block_opencast', 'transcriptionworkflow_' . $ocinstanceid))) {
$maxtranscriptionupload = (int)get_config('block_opencast', 'maxtranscriptionupload_' . $ocinstanceid);
if (!empty(get_config('tool_opencast', 'transcriptionworkflow_' . $ocinstanceid))) {
$maxtranscriptionupload = (int)get_config('tool_opencast', 'maxtranscriptionupload_' . $ocinstanceid);
// If the max upload limit is not set we assume only 1 field set.
if (!$maxtranscriptionupload || $maxtranscriptionupload < 0) {
$maxtranscriptionupload = 1;
Expand Down
6 changes: 3 additions & 3 deletions backup/moodle2/backup_opencast_block_task.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ protected function define_my_settings() {
if (importvideosmanager::is_enabled_and_working_for_coreimport($ocinstance->id) == true) {

// Get default value, to include opencast video.
$defaultimportvalue = boolval(get_config('block_opencast', 'importvideoscoredefaultvalue_' . $ocinstance->id));
$defaultimportvalue = boolval(get_config('tool_opencast', 'importvideoscoredefaultvalue_' . $ocinstance->id));

// Get import mode, to determine whether to offer selective feature or not.
// Duplicate videos mode is capable of selection.
// ACL Change mode is not, due to changing the acl of the whole series at once.
$importmode = get_config('block_opencast', 'importmode_' . $ocinstance->id);
$importmode = get_config('tool_opencast', 'importmode_' . $ocinstance->id);

// Check, whether there are course videos available.
$apibridge = apibridge::get_instance($ocinstance->id);
Expand Down Expand Up @@ -177,7 +177,7 @@ protected function define_my_steps() {
$ocinstances = settings_api::get_ocinstances();
$courseid = $this->get_courseid();
foreach ($ocinstances as $ocinstance) {
$importmode = get_config('block_opencast', 'importmode_' . $ocinstance->id);
$importmode = get_config('tool_opencast', 'importmode_' . $ocinstance->id);
$includesettingname = 'opencast_videos_' . $ocinstance->id . '_included';
// Checking the main level inclusion.
if (!$this->setting_exists($includesettingname)) {
Expand Down
2 changes: 1 addition & 1 deletion backup/moodle2/restore_opencast_stepslib.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ protected function define_structure() {
$apibridge = apibridge::get_instance($ocinstanceid);

// Get the import mode to decide the way of importing opencast videos.
$importmode = get_config('block_opencast', 'importmode_' . $ocinstanceid);
$importmode = get_config('tool_opencast', 'importmode_' . $ocinstanceid);
$this->importmode = $importmode;

// If ACL Change is the mode.
Expand Down
8 changes: 4 additions & 4 deletions batchupload.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
require_login($courseid, false);

// Check if the setting is on.
if (empty(get_config('block_opencast', 'batchuploadenabled_' . $ocinstanceid))) {
if (empty(get_config('tool_opencast', 'batchuploadenabled_' . $ocinstanceid))) {
throw new moodle_exception('batchupload_errornotenabled', 'block_opencast', $redirecturl);
}

Expand Down Expand Up @@ -140,13 +140,13 @@
$customdata['series'] = $series;
}

$uploadfilesizelimitmode = (int) get_config('block_opencast', 'uploadfilesizelimitmode_' . $ocinstanceid);
$uploadfilesizelimitmode = (int) get_config('tool_opencast', 'uploadfilesizelimitmode_' . $ocinstanceid);
$maxuploadsize = defined('USER_CAN_IGNORE_FILE_SIZE_LIMITS') ? USER_CAN_IGNORE_FILE_SIZE_LIMITS : -1; // Unlimited.
if ($uploadfilesizelimitmode !== 1) { // The flag for unlimited size is "1", and "0" for limited.
$maxuploadsize = (int) get_config('block_opencast', 'uploadfilelimit_' . $ocinstanceid);
$maxuploadsize = (int) get_config('tool_opencast', 'uploadfilelimit_' . $ocinstanceid);
}

$videotypescfg = get_config('block_opencast', 'uploadfileextensions_' . $ocinstanceid);
$videotypescfg = get_config('tool_opencast', 'uploadfileextensions_' . $ocinstanceid);
if (empty($videotypescfg)) {
// Fallback. Use Moodle defined video file types.
$videotypes = ['video'];
Expand Down
2 changes: 1 addition & 1 deletion block_opencast.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function get_content() {
}
}
$cacheobj = new stdClass();
$cacheobj->timevalid = time() + get_config('block_opencast', 'cachevalidtime');
$cacheobj->timevalid = time() + get_config('tool_opencast', 'cachevalidtime');
$cacheobj->videos = $videos;
$cache->set($COURSE->id, $cacheobj);
}
Expand Down
3 changes: 1 addition & 2 deletions changeowner.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
$viewfullnames = has_capability('moodle/site:viewfullnames', $coursecontext);
}

if (empty(get_config('block_opencast', 'aclownerrole_' . $ocinstanceid))) {
if (empty(get_config('tool_opencast', 'aclownerrole_' . $ocinstanceid))) {
redirect($redirecturl, get_string('functionalitydisabled', 'block_opencast'), null,
notification::NOTIFY_ERROR);
}
Expand Down Expand Up @@ -146,4 +146,3 @@
$changeownerform->display();
echo $OUTPUT->footer();
}

4 changes: 2 additions & 2 deletions changescheduledvisibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
$PAGE->navbar->add(get_string('changescheduledvisibilityheader', 'block_opencast'), $baseurl);

// Check if the ACL control feature is enabled.
if (get_config('block_opencast', 'aclcontrolafter_' . $ocinstanceid) != true) {
if (get_config('tool_opencast', 'aclcontrolafter_' . $ocinstanceid) != true) {
throw new moodle_exception('ACL control feature not enabled', 'block_opencast', $redirecturl);
}

Expand All @@ -70,7 +70,7 @@
'ocinstanceid' => $ocinstanceid, 'uploadjobid' => $uploadjobid, 'scheduledvisibility' => $scheduledvisibility, ]);

// Workflow is not set.
if (get_config('block_opencast', 'workflow_roles_' . $ocinstanceid) == "") {
if (get_config('tool_opencast', 'workflow_roles_' . $ocinstanceid) == "") {
$message = get_string('workflownotdefined', 'block_opencast');
redirect($redirecturl, $message, null, \core\notification::ERROR);
}
Expand Down
4 changes: 2 additions & 2 deletions changevisibility.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
$PAGE->navbar->add(get_string('changevisibility', 'block_opencast'), $baseurl);

// Check if the ACL control feature is enabled.
if (get_config('block_opencast', 'aclcontrolafter_' . $ocinstanceid) != true) {
if (get_config('tool_opencast', 'aclcontrolafter_' . $ocinstanceid) != true) {
throw new moodle_exception('ACL control feature not enabled', 'block_opencast', $redirecturl);
}

Expand Down Expand Up @@ -104,7 +104,7 @@
}

// Workflow is not set.
if (get_config('block_opencast', 'workflow_roles_' . $ocinstanceid) == "") {
if (get_config('tool_opencast', 'workflow_roles_' . $ocinstanceid) == "") {
$message = get_string('workflownotdefined', 'block_opencast');
redirect($redirecturl, $message, null, \core\notification::ERROR);
}
Expand Down
4 changes: 2 additions & 2 deletions changevisibility_massaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@
$PAGE->navbar->add(get_string('changevisibility_massaction', 'block_opencast'), $baseurl);

// Check if the ACL control feature is enabled.
if (get_config('block_opencast', 'aclcontrolafter_' . $ocinstanceid) != true) {
if (get_config('tool_opencast', 'aclcontrolafter_' . $ocinstanceid) != true) {
throw new moodle_exception('ACL control feature not enabled', 'block_opencast', $redirecturl);
}

// Workflow is not set.
if (get_config('block_opencast', 'workflow_roles_' . $ocinstanceid) == "") {
if (get_config('tool_opencast', 'workflow_roles_' . $ocinstanceid) == "") {
$message = get_string('workflownotdefined', 'block_opencast');
redirect($redirecturl, $message, null, \core\notification::ERROR);
}
Expand Down
6 changes: 3 additions & 3 deletions classes/external.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,15 @@ public static function submit_series_form($contextid, int $ocinstanceid, string

// Check if the maximum number of series is already reached.
$courseseries = $DB->get_records('tool_opencast_series', ['ocinstanceid' => $ocinstanceid, 'courseid' => $course->id]);
if (!$params['seriesid'] && count($courseseries) >= get_config('block_opencast', 'maxseries_' . $ocinstanceid)) {
if (!$params['seriesid'] && count($courseseries) >= get_config('tool_opencast', 'maxseries_' . $ocinstanceid)) {
throw new moodle_exception('maxseriesreached', 'block_opencast');
}

$data = [];
parse_str($params['jsonformdata'], $data);
$data['courseid'] = $course->id;

$metadatacatalog = json_decode(get_config('block_opencast', 'metadataseries_' . $params['ocinstanceid']));
$metadatacatalog = json_decode(get_config('tool_opencast', 'metadataseries_' . $params['ocinstanceid']));
// Make sure $metadatacatalog is array.
$metadatacatalog = !empty($metadatacatalog) ? $metadatacatalog : [];
$createseriesform = new series_form(null, ['courseid' => $course->id,
Expand Down Expand Up @@ -271,7 +271,7 @@ public static function import_series(int $contextid, int $ocinstanceid, string $

// Check if the maximum number of series is already reached.
$courseseries = $DB->get_records('tool_opencast_series', ['ocinstanceid' => $ocinstanceid, 'courseid' => $course->id]);
if (count($courseseries) >= get_config('block_opencast', 'maxseries_' . $ocinstanceid)) {
if (count($courseseries) >= get_config('tool_opencast', 'maxseries_' . $ocinstanceid)) {
throw new moodle_exception('maxseriesreached', 'block_opencast');
}

Expand Down
6 changes: 3 additions & 3 deletions classes/local/activitymodulemanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class activitymodulemanager {
* @return boolean
*/
public static function is_enabled_and_working_for_series($ocinstanceid): bool {
return get_config('block_opencast', 'addactivityenabled_' . $ocinstanceid) != false &&
return get_config('tool_opencast', 'addactivityenabled_' . $ocinstanceid) != false &&
core_plugin_manager::instance()->get_plugin_info('mod_opencast') != null;
}

Expand All @@ -60,7 +60,7 @@ public static function is_enabled_and_working_for_series($ocinstanceid): bool {
* @return boolean
*/
public static function is_enabled_and_working_for_episodes($ocinstanceid) {
return get_config('block_opencast', 'addactivityepisodeenabled_' . $ocinstanceid) != false &&
return get_config('tool_opencast', 'addactivityepisodeenabled_' . $ocinstanceid) != false &&
core_plugin_manager::instance()->get_plugin_info('mod_opencast') != null;
}

Expand Down Expand Up @@ -325,7 +325,7 @@ public static function get_module_for_episode($courseid, $episodeuuid, $ocinstan
*/
public static function get_default_title_for_series($ocinstanceid) {
// Get the default title from the admin settings.
$defaulttitle = get_config('block_opencast', 'addactivitydefaulttitle_' . $ocinstanceid);
$defaulttitle = get_config('tool_opencast', 'addactivitydefaulttitle_' . $ocinstanceid);

// Check if the configured default title is empty. This must not happen as a module needs a title.
if (empty($defaulttitle) || $defaulttitle == '') {
Expand Down
6 changes: 3 additions & 3 deletions classes/local/addactivity_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ public function definition() {
$mform->setDefault('allowdownload', get_config('mod_opencast', 'download_default_' . $ocinstanceid));
}

if (get_config('block_opencast', 'addactivityintro_' . $ocinstanceid) == true) {
if (get_config('tool_opencast', 'addactivityintro_' . $ocinstanceid) == true) {
$mform->addElement('editor', 'intro', get_string('addactivity_formactivityintro', 'block_opencast'),
['rows' => 5],
['maxfiles' => 0, 'noclean' => true]);
$mform->setType('intro', PARAM_RAW); // No XSS prevention here, users must be trusted.
}

if (get_config('block_opencast', 'addactivitysection_' . $ocinstanceid) == true) {
if (get_config('tool_opencast', 'addactivitysection_' . $ocinstanceid) == true) {
// Get course sections.
$sectionmenu = activitymodulemanager::get_course_sections($courseid);

Expand All @@ -90,7 +90,7 @@ public function definition() {
}
}

if (get_config('block_opencast', 'addactivityavailability_' . $ocinstanceid) == true && !empty($CFG->enableavailability)) {
if (get_config('tool_opencast', 'addactivityavailability_' . $ocinstanceid) == true && !empty($CFG->enableavailability)) {
$mform->addElement('textarea', 'availabilityconditionsjson',
get_string('addactivity_formactivityavailability', 'block_opencast'));
frontend::include_all_javascript(get_course($courseid));
Expand Down
Loading
Loading