This commit is contained in:
Markos Gogoulos
2026-02-01 15:51:14 +02:00
parent 7126cf1cbd
commit d00b4ed3c5
7 changed files with 66 additions and 48 deletions

View File

@@ -121,7 +121,7 @@ class plugininfo extends plugin implements plugin_with_buttons, plugin_with_menu
return [
'data' => [
'autoConvertEnabled' => $getboolconfig('autoconvertenabled'),
'autoConvertEnabled' => true, // Always enabled
'autoConvertBaseUrl' => !empty($baseurl) ? $baseurl : '',
'autoConvertOptions' => [
'showTitle' => $getboolconfig('autoconvert_showtitle'),
@@ -168,6 +168,8 @@ class plugininfo extends plugin implements plugin_with_buttons, plugin_with_menu
$contentitemurl = (new moodle_url('/mod/lti/contentitem.php', [
'id' => $ltitoolid,
'course' => $courseid,
'title' => 'MediaCMS Library',
'return_types' => 1 // LTI_DEEPLINKING_RETURN_TYPE_LTI_LINK
]))->out(false);
}

View File

@@ -159,8 +159,10 @@ $string['librarypage'] = 'Page {$a->current} of {$a->total}';
$string['libraryvideoselected'] = 'Video selected. Configure embed options below.';
// LTI settings strings.
$string['ltitoolid'] = 'MediaCMS LTI tool ID';
$string['ltitoolid_desc'] = 'The ID of the external tool (LTI) configured in Moodle for MediaCMS. This enables the authenticated video library in the editor.';
$string['ltitoolid'] = 'LTI Tool';
$string['ltitoolid_desc'] = 'Select the External Tool configuration for MediaCMS. This enables the authenticated video library in the editor.';
$string['noltitoolsfound'] = 'No LTI tools found';
$string['choose'] = 'Choose...';
$string['ltitoolid_help'] = 'To find the LTI tool ID, go to Site administration > Plugins > Activity modules > External tool > Manage tools. The ID is shown in the URL when editing a tool (e.g., id=2).';
// Iframe library from LTI strings.
@@ -173,9 +175,9 @@ $string['iframelibrarynotconfigured'] = 'The MediaCMS LTI tool has not been conf
$string['autoconvertheading'] = 'Auto-convert MediaCMS URLs';
$string['autoconvertheading_desc'] = 'Configure automatic conversion of pasted MediaCMS URLs to embedded videos.';
$string['autoconvertenabled'] = 'Enable auto-convert';
$string['autoconvertenabled_desc'] = 'When enabled, pasting a MediaCMS video URL (e.g., https://deic.mediacms.io/view?m=VIDEO_ID) into the editor will automatically convert it to an embedded video player.';
$string['autoconvert_baseurl'] = 'MediaCMS base URL';
$string['autoconvert_baseurl_desc'] = 'The base URL of your MediaCMS instance (e.g., https://deic.mediacms.io). If specified, only URLs from this domain will be auto-converted. Leave empty to allow any MediaCMS URL.';
$string['autoconvertenabled_desc'] = 'When enabled, pasting a MediaCMS video URL (e.g., https://lti.mediacms.io/view?m=VIDEO_ID) into the editor will automatically convert it to an embedded video player.';
$string['autoconvert_baseurl'] = 'MediaCMS URL';
$string['autoconvert_baseurl_desc'] = 'The base URL of your MediaCMS instance (e.g., https://lti.mediacms.io). If specified, only URLs from this domain will be auto-converted. Leave empty to allow any MediaCMS URL.';
$string['autoconvert_showtitle'] = 'Show video title';
$string['autoconvert_showtitle_desc'] = 'Display the video title in the embedded player.';
$string['autoconvert_linktitle'] = 'Link video title';

View File

@@ -25,39 +25,39 @@
defined('MOODLE_INTERNAL') || die();
if ($ADMIN->fulltree) {
// LTI Tool ID setting.
// This should be the ID of the external tool (LTI) configured in Moodle for MediaCMS.
$setting = new admin_setting_configtext(
global $DB;
// LTI Tool ID setting (Dropdown).
$ltioptions = [0 => get_string('noltitoolsfound', 'tiny_mediacms')];
try {
$tools = $DB->get_records('lti_types', null, 'name ASC', 'id, name, baseurl');
if (!empty($tools)) {
$ltioptions = [0 => get_string('choose', 'tiny_mediacms')];
foreach ($tools as $tool) {
$ltioptions[$tool->id] = $tool->name . ' (' . $tool->baseurl . ')';
}
}
} catch (Exception $e) {
// Database might not be ready during install
}
$setting = new admin_setting_configselect(
'tiny_mediacms/ltitoolid',
new lang_string('ltitoolid', 'tiny_mediacms'),
new lang_string('ltitoolid_desc', 'tiny_mediacms'),
'',
PARAM_INT
0,
$ltioptions
);
$settings->add($setting);
// Auto-convert heading.
$settings->add(new admin_setting_heading(
'tiny_mediacms/autoconvertheading',
new lang_string('autoconvertheading', 'tiny_mediacms'),
new lang_string('autoconvertheading_desc', 'tiny_mediacms')
));
// Enable/disable auto-convert of pasted MediaCMS URLs.
$setting = new admin_setting_configcheckbox(
'tiny_mediacms/autoconvertenabled',
new lang_string('autoconvertenabled', 'tiny_mediacms'),
new lang_string('autoconvertenabled_desc', 'tiny_mediacms'),
1
);
$settings->add($setting);
// Auto-convert is enabled by default in plugininfo.php (data.autoConvertEnabled = true).
// MediaCMS base URL for auto-convert.
$setting = new admin_setting_configtext(
'tiny_mediacms/autoconvert_baseurl',
new lang_string('autoconvert_baseurl', 'tiny_mediacms'),
new lang_string('autoconvert_baseurl_desc', 'tiny_mediacms'),
'',
'https://lti.mediacms.io', // Default matching filter
PARAM_URL
);
$settings->add($setting);

View File

@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2026020102; // Bumped version to ensure upgrade
$plugin->version = 2026020103; // Bumped version to ensure upgrade
$plugin->requires = 2024100100;
$plugin->component = 'tiny_mediacms';
$plugin->dependencies = ['filter_mediacms' => 2026020100]; // Keep dependency on our filter