mirror of
https://github.com/mediacms-io/mediacms.git
synced 2026-03-15 17:31:56 -04:00
all
This commit is contained in:
@@ -1,34 +1,26 @@
|
||||
# MediaCMS for Moodle
|
||||
|
||||
**Version:** 1.0.0 | **Release Date:** 2026-02-12 | **Moodle:** 4.5+
|
||||
Version: 1.0.0, tested on Moodle 5
|
||||
|
||||
This package provides complete MediaCMS integration for Moodle, consisting of two plugins that work together with **unified settings**:
|
||||
This plugin provides complete MediaCMS integration for Moodle, consisting of two plugins that work together with unified settings:
|
||||
|
||||
1. **Filter Plugin (filter_mediacms):**
|
||||
* 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`
|
||||
* **Location:** Admin, Plugins, Manage filters, MediaCMS
|
||||
|
||||
2. **Editor Plugin (tiny_mediacms):**
|
||||
* 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`
|
||||
* **Location:** Admin, Plugins, TinyMCE, MediaCMS
|
||||
|
||||
## Installation
|
||||
|
||||
This package is distributed as a single repository but contains two distinct Moodle plugins that must be installed in their respective directories.
|
||||
|
||||
### 1. Copy Files
|
||||
|
||||
Copy the directories into your Moodle installation as follows (example assuming Moodle is at `/var/www/moodle/public`):
|
||||
|
||||
* Copy `filter/mediacms` to `/var/www/moodle/public/filter/mediacms`.
|
||||
* Copy `tiny/mediacms` to `/var/www/moodle/public/lib/editor/tiny/plugins/mediacms`.
|
||||
|
||||
### 2. Set Permissions
|
||||
Upload the plugin in Moodle's public directory and unzip
|
||||
# cd /var/www/moodle/public ; cp /root/mediacms-moodle-v1.0.0.zip . && unzip mediacms-moodle-v1.0.0.zip
|
||||
|
||||
Ensure the web server user (typically `www-data`) has ownership of the new directories:
|
||||
|
||||
@@ -111,4 +103,8 @@ npx grunt amd
|
||||
cp files back...
|
||||
sudo cp -r /home/user/mediacms/moodle/public/lib/editor/tiny/plugins/mediacms /home/user/mediacms/lms-plugins/mediacms-moodle/tiny/
|
||||
|
||||
php admin/cli/purge_caches.php after
|
||||
php admin/cli/purge_caches.php after
|
||||
|
||||
|
||||
### Troubleshooting
|
||||
Admin, advanced theme settings, add `My Media|/filter/mediacms/my_media.php` in case the position is not workin
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Hook callbacks for filter_mediacms.
|
||||
*
|
||||
* @package filter_mediacms
|
||||
* @copyright 2026 MediaCMS
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace filter_mediacms;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
class hooks {
|
||||
/**
|
||||
* Appends the My Media link to the custom menus after configuration is loaded.
|
||||
*
|
||||
* @param \core\hook\after_config $hook
|
||||
*/
|
||||
public static function append_my_media_link(\core\hook\after_config $hook): void {
|
||||
global $CFG;
|
||||
|
||||
$navposition = get_config('filter_mediacms', 'mymedia_nav_position');
|
||||
|
||||
// MEDIACMS_NAV_PLACEMENT_NONE = 2
|
||||
if ($navposition == 2) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_string_manager()->string_exists('mymedia', 'filter_mediacms')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$linktext = get_string('mymedia', 'filter_mediacms');
|
||||
$linkurl = '/filter/mediacms/my_media.php';
|
||||
$menuitem = "\n{$linktext}|{$linkurl}";
|
||||
|
||||
// MEDIACMS_NAV_PLACEMENT_PROFILE = 1
|
||||
if ($navposition == 1) {
|
||||
// Add to User Profile Menu
|
||||
if (!isset($CFG->customusermenuitems)) {
|
||||
$CFG->customusermenuitems = '';
|
||||
}
|
||||
if (strpos($CFG->customusermenuitems, $linktext) === false) {
|
||||
$CFG->customusermenuitems .= $menuitem;
|
||||
}
|
||||
} else {
|
||||
// Default to Top Navigation Menu (MEDIACMS_NAV_PLACEMENT_TOP = 0)
|
||||
if (!isset($CFG->custommenuitems)) {
|
||||
$CFG->custommenuitems = '';
|
||||
}
|
||||
if (strpos($CFG->custommenuitems, $linktext) === false) {
|
||||
$CFG->custommenuitems .= $menuitem;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Hook registrations for filter_mediacms.
|
||||
* Primary navigation is handled via extend_navigation() in lib.php instead.
|
||||
*
|
||||
* @package filter_mediacms
|
||||
* @copyright 2026 MediaCMS
|
||||
@@ -10,4 +9,10 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$callbacks = [];
|
||||
$callbacks = [
|
||||
[
|
||||
'hook' => \core\hook\after_config::class,
|
||||
'callback' => [\filter_mediacms\hooks::class, 'append_my_media_link'],
|
||||
'priority' => 100,
|
||||
],
|
||||
];
|
||||
|
||||
@@ -22,3 +22,9 @@ $string['mymedia'] = 'My Media';
|
||||
$string['notconfigured'] = 'MediaCMS is not fully configured. Please set the MediaCMS URL and LTI Tool in Site Administration → Plugins → Filters → MediaCMS.';
|
||||
$string['ltitoolnotfound'] = 'The configured LTI tool could not be found. Please check the MediaCMS filter settings.';
|
||||
$string['cannotcreatedummyactivity'] = 'Could not create the MediaCMS launcher activity. Please check course permissions.';
|
||||
|
||||
$string['mymediaposition'] = 'My Media Link Position';
|
||||
$string['mymediaposition_desc'] = 'Select where the "My Media" link should appear in the Moodle interface.';
|
||||
$string['pos_topbar'] = 'Top Navigation Bar';
|
||||
$string['pos_userdrop'] = 'User Profile Dropdown';
|
||||
$string['pos_none'] = 'None (Do not display)';
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<?php
|
||||
/**
|
||||
* @package filter_mediacms
|
||||
* @copyright 2026 MediaCMS
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
define('MEDIACMS_NAV_PLACEMENT_TOP', 0);
|
||||
define('MEDIACMS_NAV_PLACEMENT_PROFILE', 1);
|
||||
define('MEDIACMS_NAV_PLACEMENT_NONE', 2);
|
||||
|
||||
@@ -1,15 +1,27 @@
|
||||
<?php
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
require_once($CFG->dirroot . '/filter/mediacms/lib.php');
|
||||
|
||||
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_configselect(
|
||||
'filter_mediacms/mymedia_nav_position',
|
||||
get_string('mymediaposition', 'filter_mediacms'),
|
||||
get_string('mymediaposition_desc', 'filter_mediacms'),
|
||||
MEDIACMS_NAV_PLACEMENT_TOP,
|
||||
array(
|
||||
MEDIACMS_NAV_PLACEMENT_TOP => 'Top Navigation Bar',
|
||||
MEDIACMS_NAV_PLACEMENT_PROFILE => 'User Profile Dropdown',
|
||||
MEDIACMS_NAV_PLACEMENT_NONE => 'None (Do not display)'
|
||||
)
|
||||
));
|
||||
|
||||
$settings->add(new admin_setting_configtext(
|
||||
'filter_mediacms/mediacmsurl',
|
||||
get_string('mediacmsurl', 'filter_mediacms'),
|
||||
@@ -18,7 +30,6 @@ if ($ADMIN->fulltree) {
|
||||
PARAM_URL
|
||||
));
|
||||
|
||||
// LTI Tool Selector
|
||||
$ltioptions = [0 => get_string('noltitoolsfound', 'filter_mediacms')];
|
||||
try {
|
||||
$tools = $DB->get_records('lti_types', null, 'name ASC', 'id, name, baseurl');
|
||||
@@ -29,7 +40,6 @@ if ($ADMIN->fulltree) {
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// Database might not be ready during install
|
||||
}
|
||||
|
||||
$settings->add(new admin_setting_configselect(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2026021200; // 2026-02-12
|
||||
$plugin->version = 2026021202; // 2026-02-12
|
||||
$plugin->requires = 2024100700; // Requires Moodle 4.5+
|
||||
$plugin->component = 'filter_mediacms';
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user