This commit is contained in:
Markos Gogoulos
2026-02-19 10:48:47 +02:00
parent ae9d614e84
commit 23c5c544ce
8 changed files with 66 additions and 67 deletions

View File

@@ -1,14 +1,20 @@
# MediaCMS for Moodle
This package provides the integration between MediaCMS and Moodle (versions 4.x and 5.x).
It consists of two separate plugins that work together to provide a seamless video experience:
**Version:** 1.0.0 | **Release Date:** 2026-02-12 | **Moodle:** 4.5+
This package provides complete MediaCMS integration for Moodle, consisting of two plugins that work together with **unified settings**:
1. **Filter Plugin (filter_mediacms):**
* **Purpose:** Handles the display of videos using secure LTI 1.3 launches and provides "Auto-convert" to turn URLs into players.
* Handles LTI 1.3 authentication and secure video launches
* Auto-converts MediaCMS URLs to embedded players
* **Provides core settings** (MediaCMS URL, LTI Tool ID) used by both plugins
* **Location:** `filter/mediacms`
2. **Editor Plugin (tiny_mediacms):**
* **Purpose:** Adds a "Insert MediaCMS Media" button to the TinyMCE editor, allowing users to select videos from the MediaCMS library or paste URLs.
* Adds MediaCMS button to TinyMCE editor
* Browse authenticated video library via LTI Deep Linking
* Configure embed options (dimensions, display, start time)
* **Reads core settings** from filter plugin
* **Location:** `lib/editor/tiny/plugins/mediacms`
## Installation
@@ -42,21 +48,32 @@ chmod -R 755 /var/www/moodle/public/lib/editor/tiny/plugins/mediacms
## Configuration
You must configure both plugins to fully enable the integration.
### Step 1: Core Settings (Required) - Configure Once
### Filter Configuration
1. Go to **Site administration > Plugins > Filters > Manage filters**.
2. Enable **MediaCMS** (set it to "On").
3. Click **Settings** next to MediaCMS.
4. **MediaCMS URL:** Enter the base URL of your MediaCMS instance (e.g., `https://lti.mediacms.io`).
5. **LTI Tool:** Select the External Tool configuration that corresponds to MediaCMS.
* *Note:* You must first create an LTI 1.3 External Tool in *Site administration > Plugins > Activity modules > External tool > Manage tools*.
6. **Auto-convert:** Check "Enable auto-convert" if you want plain text URLs (e.g., `https://video.example.com/view?m=xyz`) to automatically become video players.
Go to **Site administration > Plugins > Filters > MediaCMS** (Settings)
### Editor Configuration (TinyMCE)
1. Go to **Site administration > Plugins > Text editors > TinyMCE editor > MediaCMS settings**.
2. **LTI Tool:** Select the same Tool configured for the Filter to enable the "Video Library" picker button.
3. **Auto-convert:** (Implicitly enabled) Pasting MediaCMS URLs into the editor will automatically convert them to placeholders.
* **MediaCMS URL:** Enter your MediaCMS instance URL (e.g., `https://lti.mediacms.io`)
* **LTI Tool:** Select the External Tool configuration for MediaCMS
* *First create an LTI 1.3 tool at: Site administration > Plugins > Activity modules > External tool > Manage tools*
> **✨ Note:** These core settings are automatically used by **both** the filter and TinyMCE editor plugin.
### Step 2: Enable Filter
1. Go to **Site administration > Plugins > Filters > Manage filters**
2. Set **MediaCMS** to "On"
### Step 3: Configure Auto-convert Defaults (Optional)
Go to **Site administration > Plugins > Text editors > TinyMCE editor > MediaCMS settings**
Configure default display options for auto-converted URLs:
* Show video title
* Link video title
* Show related videos
* Show user avatar
> **Note:** The core settings (URL, LTI Tool) are managed in the filter plugin settings.
## Usage

View File

@@ -3,10 +3,12 @@ defined('MOODLE_INTERNAL') || die();
$string['filtername'] = 'MediaCMS';
$string['pluginname'] = 'MediaCMS';
$string['coresettings'] = 'Core MediaCMS Settings';
$string['coresettings_desc'] = 'These settings are shared with the TinyMCE MediaCMS editor plugin.';
$string['mediacmsurl'] = 'MediaCMS URL';
$string['mediacmsurl_desc'] = 'The base URL of your MediaCMS instance (e.g., https://lti.mediacms.io).';
$string['mediacmsurl_desc'] = 'The base URL of your MediaCMS instance (e.g., https://lti.mediacms.io). This setting is used by both the filter and the TinyMCE editor plugin.';
$string['ltitoolid'] = 'LTI Tool';
$string['ltitoolid_desc'] = 'Select the External Tool configuration for MediaCMS. If "Auto-detect" is selected, the plugin will try to find a tool matching the MediaCMS URL.';
$string['ltitoolid_desc'] = 'Select the External Tool configuration for MediaCMS. This enables the video library in the TinyMCE editor and LTI authentication. To set up an LTI tool, go to Site Administration > Plugins > Activity modules > External tool > Manage tools.';
$string['noltitoolsfound'] = 'No LTI tools found';
$string['iframewidth'] = 'Default Width';
$string['iframewidth_desc'] = 'Default width for embedded videos (pixels).';

View File

@@ -2,6 +2,13 @@
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// Info heading
$settings->add(new admin_setting_heading(
'filter_mediacms/coresettings',
get_string('coresettings', 'filter_mediacms'),
get_string('coresettings_desc', 'filter_mediacms')
));
// MediaCMS URL
$settings->add(new admin_setting_configtext(
'filter_mediacms/mediacmsurl',

View File

@@ -1,7 +1,7 @@
<?php
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2026020100;
$plugin->version = 2026021200; // 2026-02-12
$plugin->requires = 2024100700; // Requires Moodle 4.5+
$plugin->component = 'filter_mediacms';
$plugin->maturity = MATURITY_STABLE;

View File

@@ -109,7 +109,8 @@ class plugininfo extends plugin implements plugin_with_buttons, plugin_with_menu
* @return array Auto-convert configuration data
*/
protected static function get_autoconvert_configuration(): array {
$baseurl = get_config('tiny_mediacms', 'autoconvert_baseurl');
// Read MediaCMS base URL from filter settings (unified)
$baseurl = get_config('filter_mediacms', 'mediacmsurl');
// Helper function to get config with default value of true.
$getboolconfig = function($name) {
@@ -142,8 +143,8 @@ class plugininfo extends plugin implements plugin_with_buttons, plugin_with_menu
protected static function get_lti_configuration(context $context): array {
global $COURSE;
// Get the configured LTI tool ID from plugin settings.
$ltitoolid = get_config('tiny_mediacms', 'ltitoolid');
// Read LTI tool ID from filter settings (unified)
$ltitoolid = get_config('filter_mediacms', 'ltitoolid');
// Determine the course ID from context.
$courseid = 0;

View File

@@ -159,12 +159,9 @@ $string['libraryselect'] = 'Select';
$string['librarypage'] = 'Page {$a->current} of {$a->total}';
$string['libraryvideoselected'] = 'Video selected. Configure embed options below.';
// LTI settings strings.
$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).';
// Core settings (configured in filter plugin).
$string['coresettingsheading'] = 'Core MediaCMS Settings';
$string['coresettingsheading_desc'] = '<strong>Note:</strong> MediaCMS URL and LTI Tool configuration are managed in the filter plugin. Go to: <a href="../filter/manage.php">Site Administration &gt; Plugins &gt; Filters &gt; Manage filters</a>, then click "Settings" next to MediaCMS.';
// Iframe library from LTI strings.
$string['iframelibraryloading'] = 'Loading MediaCMS video library...';

View File

@@ -25,42 +25,15 @@
defined('MOODLE_INTERNAL') || die();
if ($ADMIN->fulltree) {
global $DB;
// Note: Core MediaCMS settings (URL, LTI Tool) are configured in the filter plugin
// Go to: Site Administration > Plugins > Filters > MediaCMS
$settings->add(new admin_setting_heading(
'tiny_mediacms/coresettingsheading',
new lang_string('coresettingsheading', 'tiny_mediacms'),
new lang_string('coresettingsheading_desc', 'tiny_mediacms')
));
// 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'),
0,
$ltioptions
);
$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);
// Editor-specific settings: Auto-convert default options
// Auto-convert embed options.
$setting = new admin_setting_configcheckbox(

View File

@@ -24,7 +24,9 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2026020200; // Updated 2026-02-02
$plugin->requires = 2024100100;
$plugin->version = 2026021200; // 2026-02-12 - Unified settings release
$plugin->requires = 2024100700; // Requires Moodle 4.5+
$plugin->component = 'tiny_mediacms';
$plugin->dependencies = ['filter_mediacms' => 2026020100]; // Keep dependency on our filter
$plugin->maturity = MATURITY_STABLE;
$plugin->release = 'v1.0.0';
$plugin->dependencies = ['filter_mediacms' => 2026021200]; // Requires filter plugin for shared settings