diff --git a/.gitignore b/.gitignore index a0c48d6e..1b2c485b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,6 @@ !local/kalturamediagallery/**/* !local/mymedia/**/* -!lib/editor/atto/plugins/kalturamedia/**/* !lib/editor/tinymce/plugins/kalturamedia/**/* !createPackage.sh diff --git a/blocks/kalturamediagallery/version.php b/blocks/kalturamediagallery/version.php index 54b4da40..338d280d 100644 --- a/blocks/kalturamediagallery/version.php +++ b/blocks/kalturamediagallery/version.php @@ -14,11 +14,11 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024042202; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->version = 2026060700; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->component = 'block_kalturamediagallery'; $plugin->dependencies = array( - 'local_kaltura' => 2024042202, - 'local_kalturamediagallery' => 2024042202 + 'local_kaltura' => 2026060700, + 'local_kalturamediagallery' => 2026060700 ); diff --git a/filter/kaltura/filter.php b/filter/kaltura/classes/text_filter.php similarity index 71% rename from filter/kaltura/filter.php rename to filter/kaltura/classes/text_filter.php index 8c4c1565..71eab536 100644 --- a/filter/kaltura/filter.php +++ b/filter/kaltura/classes/text_filter.php @@ -14,6 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Moodle. If not, see . +namespace filter_kaltura; +use context_system; +use moodle_url; +use html_writer; + /** * Kaltura filter script. * @@ -23,7 +28,7 @@ * @copyright (C) 2014 Remote-Learner.net Inc (http://www.remote-learner.net) */ -class filter_kaltura extends moodle_text_filter { +class text_filter extends \core_filters\text_filter { /** @var object $context The current page context. */ public static $pagecontext = null; @@ -48,6 +53,7 @@ class filter_kaltura extends moodle_text_filter { * @param object $page Moodle page object. * @param object $context Page context object. */ + #[\Override] public function setup($page, $context) { global $CFG; require_once($CFG->dirroot.'/local/kaltura/locallib.php'); @@ -85,6 +91,66 @@ protected function get_course_context($context) { return $coursecontext; } + /** + * Change links to Kaltura into embedded Kaltura videos. + * @param array $link An array of elements matching the regular expression from class filter_kaltura - filter(). + * @return string Kaltura embed video markup. + */ + function filter_kaltura_callback($link) { + $width = self::$defaultwidth; + $height = self::$defaultheight; + $source = ''; + + // Convert KAF URI anchor tags into iframe markup. + $count = count($link); + if ($count > 7) { + // Get the height and width of the iframe. + $properties = explode('||', $link[$count - 1]); + + $width = $properties[2]; + $height = $properties[3]; + + if (4 != count($properties)) { + return $link[0]; + } + + $source = self::$kafuri . '/browseandembed/index/media/entryid/' . $link[$count - 4] . $link[$count - 3]; + } + + // Convert v3 anchor tags into iframe markup. + if (7 == count($link) && $link[1] == self::$apiurl) { + $source = self::$kafuri.'/browseandembed/index/media/entryid/'.$link[4].'/playerSize/'; + $source .= self::$defaultwidth.'x'.self::$defaultheight.'/playerSkin/'.$link[3]; + } + + $params = array( + 'courseid' => self::$pagecontext->instanceid, + 'height' => $height, + 'width' => $width, + 'withblocks' => 0, + 'source' => $source + + ); + + $url = new moodle_url('/filter/kaltura/lti_launch.php', $params); + + $iframe = html_writer::tag('iframe', '', array( + 'width' => $width, + 'height' => $height, + 'class' => 'kaltura-player-iframe', + 'allowfullscreen' => 'true', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', + 'src' => $url->out(false), + 'frameborder' => '0' + )); + + $iframeContainer = html_writer::tag('div', $iframe, array( + 'class' => 'kaltura-player-container' + )); + + return $iframeContainer; + } + /** * This function does the work of converting text that matches a regular expression into * Kaltura video markup, so that links to Kaltura videos are displayed in the Kaltura @@ -93,6 +159,7 @@ protected function get_course_context($context) { * @param array $options An array of additional options. * @return string The same text or modified text is returned. */ + #[\Override] public function filter($text, array $options = array()) { global $CFG; @@ -120,7 +187,7 @@ public function filter($text, array $options = array()) { $uri = str_replace(array('.', '/', 'https'), array('\.', '\/', 'https?'), $uri); $oldsearch = '/]*href="('.$uri.')\/index\.php\/kwidget\/wid\/_([0-9]+)\/uiconf_id\/([0-9]+)\/entry_id\/([\d]+_([a-z0-9]+))\/v\/flash"[^>]*>([^>]*)<\/a>/is'; - $newtext = preg_replace_callback($oldsearch, 'filter_kaltura_callback', $newtext); + $newtext = preg_replace_callback($oldsearch, [$this, 'filter_kaltura_callback'], $newtext); // Search for newer versoin of Kaltura embedded anchor tag format. $kafuri = self::$kafuri; @@ -151,7 +218,7 @@ public function filter($text, array $options = array()) { $search .= '))\/browseandembed\/index\/media\/entryid\/([\d]+_[a-z0-9]+)(\/([a-zA-Z0-9]+\/[a-zA-Z0-9]+\/)*)"[^>]*>([^>]*)<\/a>/is'; } - $newtext = preg_replace_callback($search, 'filter_kaltura_callback', $newtext); + $newtext = preg_replace_callback($search, [$this, 'filter_kaltura_callback'], $newtext); if (empty($newtext) || $newtext === $text) { // Error or not filtered. @@ -162,63 +229,3 @@ public function filter($text, array $options = array()) { return $newtext; } } - -/** - * Change links to Kaltura into embedded Kaltura videos. - * @param array $link An array of elements matching the regular expression from class filter_kaltura - filter(). - * @return string Kaltura embed video markup. - */ -function filter_kaltura_callback($link) { - $width = filter_kaltura::$defaultwidth; - $height = filter_kaltura::$defaultheight; - $source = ''; - - // Convert KAF URI anchor tags into iframe markup. - $count = count($link); - if ($count > 7) { - // Get the height and width of the iframe. - $properties = explode('||', $link[$count - 1]); - - $width = $properties[2]; - $height = $properties[3]; - - if (4 != count($properties)) { - return $link[0]; - } - - $source = filter_kaltura::$kafuri . '/browseandembed/index/media/entryid/' . $link[$count - 4] . $link[$count - 3]; - } - - // Convert v3 anchor tags into iframe markup. - if (7 == count($link) && $link[1] == filter_kaltura::$apiurl) { - $source = filter_kaltura::$kafuri.'/browseandembed/index/media/entryid/'.$link[4].'/playerSize/'; - $source .= filter_kaltura::$defaultwidth.'x'.filter_kaltura::$defaultheight.'/playerSkin/'.$link[3]; - } - - $params = array( - 'courseid' => filter_kaltura::$pagecontext->instanceid, - 'height' => $height, - 'width' => $width, - 'withblocks' => 0, - 'source' => $source - - ); - - $url = new moodle_url('/filter/kaltura/lti_launch.php', $params); - - $iframe = html_writer::tag('iframe', '', array( - 'width' => $width, - 'height' => $height, - 'class' => 'kaltura-player-iframe', - 'allowfullscreen' => 'true', - 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *;', - 'src' => $url->out(false), - 'frameborder' => '0' - )); - - $iframeContainer = html_writer::tag('div', $iframe, array( - 'class' => 'kaltura-player-container' - )); - - return $iframeContainer; -} diff --git a/filter/kaltura/version.php b/filter/kaltura/version.php index 29e4fb19..b335cd8e 100644 --- a/filter/kaltura/version.php +++ b/filter/kaltura/version.php @@ -24,11 +24,11 @@ */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024042202; //version date YYYYMMDDXX 10 represent 3.0 for future option to moodle use 2 digit version +$plugin->version = 2026060700; //version date YYYYMMDDXX 10 represent 3.0 for future option to moodle use 2 digit version $plugin->component = 'filter_kaltura'; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2024042202 + 'local_kaltura' => 2026060700 ); diff --git a/lib/editor/atto/plugins/kalturamedia/.gitignore b/lib/editor/atto/plugins/kalturamedia/.gitignore deleted file mode 100644 index 74e5b1d3..00000000 --- a/lib/editor/atto/plugins/kalturamedia/.gitignore +++ /dev/null @@ -1 +0,0 @@ -!* \ No newline at end of file diff --git a/lib/editor/atto/plugins/kalturamedia/classes/privacy/provider.php b/lib/editor/atto/plugins/kalturamedia/classes/privacy/provider.php deleted file mode 100644 index fa00b278..00000000 --- a/lib/editor/atto/plugins/kalturamedia/classes/privacy/provider.php +++ /dev/null @@ -1,20 +0,0 @@ -. - -/** - * Atto text editor integration version file. - * - * @package atto_media - * @copyright 2013 Damyon Wiese - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * Initialise the js strings required for this plugin - */ -function atto_kalturamedia_strings_for_js() { - global $PAGE; - - $PAGE->requires->strings_for_js(array('popuptitle', 'embedbuttontext', 'browse_and_embed'), 'atto_kalturamedia'); -} - -function atto_kalturamedia_params_for_js($elementid, $options, $fpoptions) { - global $CFG; - require_once($CFG->dirroot.'/local/kaltura/locallib.php'); - - $context = $options['context']; - if (!$context) { - $context = context_system::instance(); - } - - return array( - 'contextid' => $context->id, - 'kafuri' => local_kaltura_get_config()->kaf_uri - ); -} diff --git a/lib/editor/atto/plugins/kalturamedia/ltibrowse.php b/lib/editor/atto/plugins/kalturamedia/ltibrowse.php deleted file mode 100644 index 12edb800..00000000 --- a/lib/editor/atto/plugins/kalturamedia/ltibrowse.php +++ /dev/null @@ -1,78 +0,0 @@ -. - -/** - * Kaltura media LTI launch page. - * - * @package tinymce_kalturamedia - * @author Remote-Learner.net Inc - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net - */ - -require_once(dirname(dirname(dirname(dirname(dirname(dirname(__FILE__)))))).'/config.php'); -require_once($CFG->dirroot.'/local/kaltura/locallib.php'); -//require_once('renderer.php'); - -global $PAGE, $USER; - -require_login(); - -$contextid = required_param('contextid', PARAM_INT); -$height = required_param('height', PARAM_INT); -$width = required_param('width', PARAM_INT); -$withblocks = optional_param('withblocks', 0, PARAM_INT); - -$context = context::instance_by_id($contextid); - -$launch = array(); -$course = 0; - -if ($context instanceof context_course) { - $course = get_course($context->instanceid); - -} else if ($context instanceof context_system || $context instanceof context_coursecat) { - $course = get_course(1); -} else { - // Find parent context - $parentcontexts = $context->get_parent_contexts(false); - - foreach ($parentcontexts as $ctx) { - if ($ctx instanceof context_course) { - $course = get_course($ctx->instanceid); - break; - } else if ($ctx instanceof context_system || $ctx instanceof context_coursecat) { - $course = get_course(1); - break; - } - } -} - -$launch['id'] = 1; -$launch['cmid'] = 0; -$launch['title'] = 'Kaltura media'; -$launch['module'] = KAF_BROWSE_EMBED_MODULE; -$launch['course'] = $course; -$launch['width'] = $width; -$launch['height'] = $height; -$launch['custom_publishdata'] = ''; - -if (local_kaltura_validate_browseembed_required_params($launch)) { - $content = local_kaltura_request_lti_launch($launch, $withblocks, $editor = 'atto'); - echo $content; -} else { - echo get_string('invalid_launch_parameters', 'mod_kalvidres'); -} diff --git a/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php b/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php deleted file mode 100644 index eede4901..00000000 --- a/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php +++ /dev/null @@ -1,21 +0,0 @@ -set_context(context_system::instance()); - $PAGE->set_pagelayout('embedded'); - echo $OUTPUT->header(); - $requestQueryString = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : ""; - parse_str($requestQueryString, $params); - $ltibrowseUrl = new moodle_url('ltibrowse.php', $params); -?> - - - diff --git a/lib/editor/atto/plugins/kalturamedia/pix/icon.png b/lib/editor/atto/plugins/kalturamedia/pix/icon.png deleted file mode 100644 index 8d596139..00000000 Binary files a/lib/editor/atto/plugins/kalturamedia/pix/icon.png and /dev/null differ diff --git a/lib/editor/atto/plugins/kalturamedia/pix/icon.svg b/lib/editor/atto/plugins/kalturamedia/pix/icon.svg deleted file mode 100644 index 23a9f3a2..00000000 --- a/lib/editor/atto/plugins/kalturamedia/pix/icon.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-debug.js b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-debug.js deleted file mode 100644 index 2d22a45c..00000000 --- a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-debug.js +++ /dev/null @@ -1,155 +0,0 @@ -YUI.add('moodle-atto_kalturamedia-button', function (Y, NAME) { - -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . - -/* - * @package atto_kalturamedia - * @copyright 2Kaltura - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * @module moodle-atto_kalturamedia-button - */ - -/** - * Atto text editor kalturamedia plugin. - * - * @namespace M.atto_kalturamedia - * @class button - * @extends M.editor_atto.EditorPlugin - */ - -var COMPONENTNAME = 'atto_kalturamedia', - CSS = { - URLINPUT: 'atto_kalturamedia_urlentry', - NAMEINPUT: 'atto_kalturamedia_nameentry' - }, - SELECTORS = { - URLINPUT: '.' + CSS.URLINPUT, - NAMEINPUT: '.' + CSS.NAMEINPUT - }; - -Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { - _currentSelection: null, - embedWindow: null, - - initializer: function() { - this.addButton({ - icon: 'icon', - iconComponent: COMPONENTNAME, - callback: this._kalturamedia - }); - }, - _kalturamedia: function() { - this._currentSelection = this.get('host').getSelection(); - if (this._currentSelection === false) { - return; - } - - var w = 1200; - var h = 700; - var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; - var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; - - var left = ((width / 2) - (w / 2)) + dualScreenLeft; - var top = ((height / 2) - (h / 2)) + dualScreenTop; - var newWindow = window.open(this._getIframeURL(), M.util.get_string("browse_and_embed", COMPONENTNAME), 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); - - window.buttonJs = this; - - if (window.focus) { - newWindow.focus(); - } - - this.embedWindow = newWindow; - }, - - _getIframeURL: function() { - - var args = Y.mix({ - elementid: this.get('host').get('elementid'), - contextid: this.get('contextid'), - height: '600px', - width: '1112px' - }, - this.get('area')); - return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' + - Y.QueryString.stringify(args); - }, - - _getCourseId: function() { - var courseId; - var bodyClasses = document.getElementsByTagName('body')[0].className; - var classes = bodyClasses.split(' '); - for(i in classes) - { - if(classes[i].indexOf('course-') > -1) - { - var parts = classes[i].split('-'); - courseId = parts[1]; - } - } - - return courseId; - }, - - _removeProtocolFromUrl: function(fullUrl) { - return fullUrl.replace(/^https?:\/\//,''); - }, - - embedItem: function(what, data) { - var sourceUrl = data.url; - var url = this._removeProtocolFromUrl(sourceUrl); - var parser = document.createElement('a'); - parser.href = sourceUrl; - url += parser.search; - - var content = 'tinymce-kalturamedia-embed||'+data.title+'||'+data.width+'||'+data.height+''; - - host = this.get('host'); - host.setSelection(this._currentSelection); - host.insertContentAtFocusPoint(content); - this.markUpdated(); - this.embedWindow.close(); - } - - } , { - ATTRS: { - /** - * The contextid to use when generating this preview. - * - * @attribute contextid - * @type String - */ - contextid: { - value: null - }, - - /** - * The KAF URI, as configured in Kaltura's plugin settings. - */ - kafuri: { - value: null - } - }} -); - - -}, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-min.js b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-min.js deleted file mode 100644 index 196c77e7..00000000 --- a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button-min.js +++ /dev/null @@ -1 +0,0 @@ -YUI.add("moodle-atto_kalturamedia-button",function(e,t){var n="atto_kalturamedia",r={URLINPUT:"atto_kalturamedia_urlentry",NAMEINPUT:"atto_kalturamedia_nameentry"},s={URLINPUT:"."+r.URLINPUT,NAMEINPUT:"."+r.NAMEINPUT};e.namespace("M.atto_kalturamedia").Button=e.Base.create("button",e.M.editor_atto.EditorPlugin,[],{_currentSelection:null,embedWindow:null,initializer:function(){this.addButton({icon:"icon",iconComponent:n,callback:this._kalturamedia})},_kalturamedia:function(){this._currentSelection=this.get("host").getSelection();if(this._currentSelection===!1)return;var e=1200,t=700,r=window.screenLeft!=undefined?window.screenLeft:screen.left,i=window.screenTop!=undefined?window.screenTop:screen.top,s=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,o=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,u=s/2-e/2+r,a=o/2-t/2+i,f=window.open(this._getIframeURL(),M.util.get_string("browse_and_embed",n),"scrollbars=no, width="+e+", height="+t+", top="+a+", left="+u);window.buttonJs=this,window.focus&&f.focus(),this.embedWindow=f},_getIframeURL:function(){var t=e.mix({elementid:this.get("host").get("elementid"),contextid:this.get("contextid"),height:"600px",width:"1112px"},this.get("area"));return M.cfg.wwwroot+"/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?"+e.QueryString.stringify(t)},_getCourseId:function(){var e,t=document.getElementsByTagName("body")[0].className,n=t.split(" ");for(i in n)if(n[i].indexOf("course-")>-1){var r=n[i].split("-");e=r[1]}return e},_removeProtocolFromUrl:function(e){return e.replace(/^https?:\/\//,"")},embedItem:function(e,t){var n=t.url,r=this._removeProtocolFromUrl(n),i=document.createElement("a");i.href=n,r+=i.search;var s='tinymce-kalturamedia-embed||'+t.title+"||"+t.width+"||"+t.height+"";host=this.get("host"),host.setSelection(this._currentSelection),host.insertContentAtFocusPoint(s),this.markUpdated(),this.embedWindow.close()}},{ATTRS:{contextid:{value:null},kafuri:{value:null}}})},"@VERSION@",{requires:["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button.js b/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button.js deleted file mode 100644 index 2d22a45c..00000000 --- a/lib/editor/atto/plugins/kalturamedia/yui/build/moodle-atto_kalturamedia-button/moodle-atto_kalturamedia-button.js +++ /dev/null @@ -1,155 +0,0 @@ -YUI.add('moodle-atto_kalturamedia-button', function (Y, NAME) { - -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . - -/* - * @package atto_kalturamedia - * @copyright 2Kaltura - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * @module moodle-atto_kalturamedia-button - */ - -/** - * Atto text editor kalturamedia plugin. - * - * @namespace M.atto_kalturamedia - * @class button - * @extends M.editor_atto.EditorPlugin - */ - -var COMPONENTNAME = 'atto_kalturamedia', - CSS = { - URLINPUT: 'atto_kalturamedia_urlentry', - NAMEINPUT: 'atto_kalturamedia_nameentry' - }, - SELECTORS = { - URLINPUT: '.' + CSS.URLINPUT, - NAMEINPUT: '.' + CSS.NAMEINPUT - }; - -Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { - _currentSelection: null, - embedWindow: null, - - initializer: function() { - this.addButton({ - icon: 'icon', - iconComponent: COMPONENTNAME, - callback: this._kalturamedia - }); - }, - _kalturamedia: function() { - this._currentSelection = this.get('host').getSelection(); - if (this._currentSelection === false) { - return; - } - - var w = 1200; - var h = 700; - var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; - var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; - - var left = ((width / 2) - (w / 2)) + dualScreenLeft; - var top = ((height / 2) - (h / 2)) + dualScreenTop; - var newWindow = window.open(this._getIframeURL(), M.util.get_string("browse_and_embed", COMPONENTNAME), 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); - - window.buttonJs = this; - - if (window.focus) { - newWindow.focus(); - } - - this.embedWindow = newWindow; - }, - - _getIframeURL: function() { - - var args = Y.mix({ - elementid: this.get('host').get('elementid'), - contextid: this.get('contextid'), - height: '600px', - width: '1112px' - }, - this.get('area')); - return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' + - Y.QueryString.stringify(args); - }, - - _getCourseId: function() { - var courseId; - var bodyClasses = document.getElementsByTagName('body')[0].className; - var classes = bodyClasses.split(' '); - for(i in classes) - { - if(classes[i].indexOf('course-') > -1) - { - var parts = classes[i].split('-'); - courseId = parts[1]; - } - } - - return courseId; - }, - - _removeProtocolFromUrl: function(fullUrl) { - return fullUrl.replace(/^https?:\/\//,''); - }, - - embedItem: function(what, data) { - var sourceUrl = data.url; - var url = this._removeProtocolFromUrl(sourceUrl); - var parser = document.createElement('a'); - parser.href = sourceUrl; - url += parser.search; - - var content = 'tinymce-kalturamedia-embed||'+data.title+'||'+data.width+'||'+data.height+''; - - host = this.get('host'); - host.setSelection(this._currentSelection); - host.insertContentAtFocusPoint(content); - this.markUpdated(); - this.embedWindow.close(); - } - - } , { - ATTRS: { - /** - * The contextid to use when generating this preview. - * - * @attribute contextid - * @type String - */ - contextid: { - value: null - }, - - /** - * The KAF URI, as configured in Kaltura's plugin settings. - */ - kafuri: { - value: null - } - }} -); - - -}, '@VERSION@', {"requires": ["moodle-editor_atto-plugin"]}); diff --git a/lib/editor/atto/plugins/kalturamedia/yui/src/button/build.json b/lib/editor/atto/plugins/kalturamedia/yui/src/button/build.json deleted file mode 100644 index c49f6778..00000000 --- a/lib/editor/atto/plugins/kalturamedia/yui/src/button/build.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "moodle-atto_kalturamedia-button", - "builds": { - "moodle-atto_kalturamedia-button": { - "jsfiles": [ - "button.js" - ] - } - } -} diff --git a/lib/editor/atto/plugins/kalturamedia/yui/src/button/js/button.js b/lib/editor/atto/plugins/kalturamedia/yui/src/button/js/button.js deleted file mode 100644 index 146ce934..00000000 --- a/lib/editor/atto/plugins/kalturamedia/yui/src/button/js/button.js +++ /dev/null @@ -1,150 +0,0 @@ -// This file is part of Moodle - http://moodle.org/ -// -// Moodle is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// Moodle is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with Moodle. If not, see . - -/* - * @package atto_kalturamedia - * @copyright 2Kaltura - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -/** - * @module moodle-atto_kalturamedia-button - */ - -/** - * Atto text editor kalturamedia plugin. - * - * @namespace M.atto_kalturamedia - * @class button - * @extends M.editor_atto.EditorPlugin - */ - -var COMPONENTNAME = 'atto_kalturamedia', - CSS = { - URLINPUT: 'atto_kalturamedia_urlentry', - NAMEINPUT: 'atto_kalturamedia_nameentry' - }, - SELECTORS = { - URLINPUT: '.' + CSS.URLINPUT, - NAMEINPUT: '.' + CSS.NAMEINPUT - }; - -Y.namespace('M.atto_kalturamedia').Button = Y.Base.create('button', Y.M.editor_atto.EditorPlugin, [], { - _currentSelection: null, - embedWindow: null, - - initializer: function() { - this.addButton({ - icon: 'icon', - iconComponent: COMPONENTNAME, - callback: this._kalturamedia - }); - }, - _kalturamedia: function() { - this._currentSelection = this.get('host').getSelection(); - if (this._currentSelection === false) { - return; - } - - var w = 1200; - var h = 700; - var dualScreenLeft = window.screenLeft != undefined ? window.screenLeft : screen.left; - var dualScreenTop = window.screenTop != undefined ? window.screenTop : screen.top; - - var width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width; - var height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height; - - var left = ((width / 2) - (w / 2)) + dualScreenLeft; - var top = ((height / 2) - (h / 2)) + dualScreenTop; - var newWindow = window.open(this._getIframeURL(), M.util.get_string("browse_and_embed", COMPONENTNAME), 'scrollbars=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left); - - window.buttonJs = this; - - if (window.focus) { - newWindow.focus(); - } - - this.embedWindow = newWindow; - }, - - _getIframeURL: function() { - - var args = Y.mix({ - elementid: this.get('host').get('elementid'), - contextid: this.get('contextid'), - height: '600px', - width: '1112px' - }, - this.get('area')); - return M.cfg.wwwroot + '/lib/editor/atto/plugins/kalturamedia/ltibrowse_container.php?' + - Y.QueryString.stringify(args); - }, - - _getCourseId: function() { - var courseId; - var bodyClasses = document.getElementsByTagName('body')[0].className; - var classes = bodyClasses.split(' '); - for(i in classes) - { - if(classes[i].indexOf('course-') > -1) - { - var parts = classes[i].split('-'); - courseId = parts[1]; - } - } - - return courseId; - }, - - _removeProtocolFromUrl: function(fullUrl) { - return fullUrl.replace(/^https?:\/\//,''); - }, - - embedItem: function(what, data) { - var sourceUrl = data.url; - var url = this._removeProtocolFromUrl(sourceUrl); - var parser = document.createElement('a'); - parser.href = sourceUrl; - url += parser.search; - - var content = 'tinymce-kalturamedia-embed||'+data.title+'||'+data.width+'||'+data.height+''; - - host = this.get('host'); - host.setSelection(this._currentSelection); - host.insertContentAtFocusPoint(content); - this.markUpdated(); - this.embedWindow.close(); - } - - } , { - ATTRS: { - /** - * The contextid to use when generating this preview. - * - * @attribute contextid - * @type String - */ - contextid: { - value: null - }, - - /** - * The KAF URI, as configured in Kaltura's plugin settings. - */ - kafuri: { - value: null - } - }} -); diff --git a/lib/editor/atto/plugins/kalturamedia/yui/src/button/meta/button.json b/lib/editor/atto/plugins/kalturamedia/yui/src/button/meta/button.json deleted file mode 100644 index 60494a63..00000000 --- a/lib/editor/atto/plugins/kalturamedia/yui/src/button/meta/button.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "moodle-atto_kalturamedia-button": { - "requires": [ - "moodle-editor_atto-plugin" - ] - } -} diff --git a/local/kaltura/attoembed.php b/lib/editor/tiny/plugins/kalturamedia/db/access.php similarity index 51% rename from local/kaltura/attoembed.php rename to lib/editor/tiny/plugins/kalturamedia/db/access.php index 223b4082..94df84bf 100644 --- a/local/kaltura/attoembed.php +++ b/lib/editor/tiny/plugins/kalturamedia/db/access.php @@ -15,24 +15,21 @@ // along with Moodle. If not, see . /** - * Kaltura LTI service script used receive data sent from the Kaltura content provider. + * Capabilities for the tiny_kalturamedia plugin. * - * @package local_kaltura - * @author Remote-Learner.net Inc - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @copyright (C) 2014 Remote Learner.net Inc http://www.remote-learner.net + * @package tiny_kalturamedia + * @copyright 2023 Roi Levi + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$PAGE->set_pagelayout('embedded'); -echo $OUTPUT->header(); -$playurl = urldecode($url); -?> - +defined('MOODLE_INTERNAL') || die(); + +$capabilities = [ + 'tiny/kalturamedia:use' => [ + 'captype' => 'read', + 'contextlevel' => CONTEXT_MODULE, + 'archetypes' => [ + 'user' => CAP_ALLOW, + ], + ], +]; \ No newline at end of file diff --git a/lib/editor/tiny/plugins/kalturamedia/lang/en/tiny_kalturamedia.php b/lib/editor/tiny/plugins/kalturamedia/lang/en/tiny_kalturamedia.php index 6106367f..1d28546c 100644 --- a/lib/editor/tiny/plugins/kalturamedia/lang/en/tiny_kalturamedia.php +++ b/lib/editor/tiny/plugins/kalturamedia/lang/en/tiny_kalturamedia.php @@ -28,3 +28,4 @@ $string['pluginname'] = 'Kaltura media plugin'; $string['privacy:metadata'] = 'Kaltura media plugin does not store any personal data'; $string['buttontitle'] = 'Embed Kaltura Media'; +$string['kalturamedia:use'] = 'Use Embed Kaltura Media button'; diff --git a/lib/editor/tiny/plugins/kalturamedia/version.php b/lib/editor/tiny/plugins/kalturamedia/version.php index f8378a58..0b43f2f4 100644 --- a/lib/editor/tiny/plugins/kalturamedia/version.php +++ b/lib/editor/tiny/plugins/kalturamedia/version.php @@ -24,10 +24,10 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024042202; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->version = 2026060700; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->component = 'tiny_kalturamedia'; $plugin->dependencies = array( - 'local_kaltura' => 2024042202 + 'local_kaltura' => 2026060700 ); diff --git a/local/kaltura/db/upgrade.php b/local/kaltura/db/upgrade.php index 45c16d63..fb512f47 100644 --- a/local/kaltura/db/upgrade.php +++ b/local/kaltura/db/upgrade.php @@ -74,5 +74,13 @@ function xmldb_local_kaltura_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2016120130, 'local', 'kaltura'); } + if ($oldversion < 2025041401) { + // Because the plug-in is being upgraded we need to set the guest_support flag to true. + set_config('guest_support', 1, KALTURA_PLUGIN_NAME); + + // Kaltura savepoint reached. + upgrade_plugin_savepoint(true, 2025041401, 'local', 'kaltura'); + } + return true; } \ No newline at end of file diff --git a/local/kaltura/js/bse_iframe_resize.js b/local/kaltura/js/bse_iframe_resize.js index b11172c9..bff8b833 100644 --- a/local/kaltura/js/bse_iframe_resize.js +++ b/local/kaltura/js/bse_iframe_resize.js @@ -7,7 +7,10 @@ if (height.toString().indexOf("%") === -1) { height += "px"; } - $('.kaltura-player-iframe').height(height); + var iframes = document.querySelectorAll('.kaltura-player-iframe'); + iframes.forEach(function(iframe) { + iframe.style.height = height; + }) } } catch (ex) { diff --git a/local/kaltura/lang/en/local_kaltura.php b/local/kaltura/lang/en/local_kaltura.php index 4a20e598..cf5ee11a 100644 --- a/local/kaltura/lang/en/local_kaltura.php +++ b/local/kaltura/lang/en/local_kaltura.php @@ -101,4 +101,6 @@ $string['client_id'] = 'Client ID'; $string['client_id_desc'] = 'Client ID'; $string['redirection_uris'] = 'Redirection URIs'; -$string['redirection_uris_desc'] = 'Redirection URIs'; \ No newline at end of file +$string['redirection_uris_desc'] = 'Redirection URIs'; +$string['guest_support'] = 'Guest support'; +$string['guest_support_desc'] = "If enabled, use Moodle's ability to identify guests and non-logged in users, and provide them with the 'Guest' LTI role."; \ No newline at end of file diff --git a/local/kaltura/locallib.php b/local/kaltura/locallib.php index f12db817..e3b19645 100644 --- a/local/kaltura/locallib.php +++ b/local/kaltura/locallib.php @@ -47,6 +47,7 @@ define('KALTURA_LTI_LEARNER_ROLE', 'Learner'); define('KALTURA_LTI_INSTRUCTOR_ROLE', 'Instructor'); define('KALTURA_LTI_ADMIN_ROLE', 'urn:lti:sysrole:ims/lis/Administrator'); +define('KALTURA_LTI_GUEST_ROLE', 'urn:lti:instrole:ims/lis/Guest'); define('KALTURA_REPO_NAME', 'kaltura'); // For KALTURA_URI_TOKEN // 1. Do not use characters that are used in regular expressions like {}[]() @@ -412,6 +413,8 @@ function local_kaltura_request_lti_launch($ltirequest, $withblocks = true, $edit $requestparams['assignment'] = $ltirequest['submission']; } + $requestparams['roles'] = local_kaltura_modify_role($requestparams['roles'] ?? KALTURA_LTI_LEARNER_ROLE); + $params = lti_sign_parameters($requestparams, $endpoint, 'POST', $lti->resourcekey, $lti->password); local_kaltura_strip_querystring($endpoint, $params); @@ -438,6 +441,10 @@ function local_kaltura_request_lti1p3_launch($ltirequest, $withblocks = true, $e $config->lti_launchcontainer = local_kaltura_get_lti_launch_container($withblocks); $instance = local_kaltura_format_lti_instance_object($ltirequest); + if (isset($ltirequest['submission']) && $ltirequest['submission'] === 'yes') { + $instance->toolurl .= '/assignment/yes'; + $instance->securetool .= '/assignment/yes'; + } if(is_null($editor)) { $editor = 'tinymce'; } @@ -584,6 +591,8 @@ function local_kaltura_lti1p3_get_launch_data($module, $withblocks, $editor = nu $serviceurl = new moodle_url('/local/kaltura/service.php'); $requestparams['lis_outcome_service_url'] = $serviceurl->out(false); + $requestparams['roles'] = local_kaltura_modify_role($requestparams['roles'] ?? KALTURA_LTI_LEARNER_ROLE); + if ((!empty($key) && !empty($secret)) || ($ltiversion === LTI_VERSION_1P3)) { if ($ltiversion !== LTI_VERSION_1P3) { $parms = lti_sign_parameters($requestparams, $endpoint, 'POST', $key, $secret); @@ -949,3 +958,11 @@ function local_kaltura_build_kaf_uri($source_url) { return $source_url; } + +function local_kaltura_modify_role(string $currentrole) { + if (!empty(get_config(KALTURA_PLUGIN_NAME, 'guest_support')) && + (isguestuser() || !isloggedin())) { + return KALTURA_LTI_GUEST_ROLE; + } + return $currentrole; +} diff --git a/local/kaltura/service.php b/local/kaltura/service.php index 19383c1f..7d546f7f 100644 --- a/local/kaltura/service.php +++ b/local/kaltura/service.php @@ -26,9 +26,25 @@ require_once(dirname(__FILE__).'/../../config.php'); require_once($CFG->dirroot.'/local/kaltura/locallib.php'); -require_login(); +global $PAGE, $_POST, $_SERVER; + +$PAGE->set_url(new moodle_url('/local/kaltura/service.php')); +$PAGE->set_context(context_system::instance()); +$PAGE->set_pagelayout('embedded'); -global $PAGE; +// When KAF POSTs back to this endpoint cross-site, SameSite=Lax causes the moodle session cookie to be dropped. +// Re-post from the same origin so the browser attaches the session cookie on the second request. +if (!isloggedin() && empty($_POST['repost'])) { + header_remove('Set-Cookie'); + $output = $PAGE->get_renderer('mod_lti'); + $page = new \mod_lti\output\repost_crosssite_page($_SERVER['REQUEST_URI'], $_POST); + echo $output->header(); + echo $output->render($page); + echo $output->footer(); + return; +} + +require_login(); $url = required_param('url', PARAM_URL); @@ -89,8 +105,6 @@ $metadata = local_kaltura_encode_object_for_storage($metadata); -$PAGE->set_url($serviceurl); -$PAGE->set_context(context_system::instance()); $previewltilaunchurl = new moodle_url('/local/kaltura/bsepreview_ltilaunch.php?playurl=' . urlencode($url)); $params = array( 'iframeurl' => urlencode($url), @@ -102,15 +116,9 @@ 'editor' => $editor, 'previewltilauncher' => $previewltilaunchurl->out(), ); -if($editor == 'atto') -{ - require_once('attoembed.php'); -} -else -{ - $PAGE->requires->yui_module('moodle-local_kaltura-ltiservice', 'M.local_kaltura.init', array($params)); - $PAGE->set_pagelayout('embedded'); - echo $OUTPUT->header(); - echo $OUTPUT->footer(); -} +$PAGE->requires->yui_module('moodle-local_kaltura-ltiservice', 'M.local_kaltura.init', array($params)); + +echo $OUTPUT->header(); +echo $OUTPUT->footer(); + diff --git a/local/kaltura/settings.php b/local/kaltura/settings.php index d89b926f..4ba28690 100644 --- a/local/kaltura/settings.php +++ b/local/kaltura/settings.php @@ -116,6 +116,10 @@ $adminsetting = new admin_setting_configcheckbox('enable_submission', get_string('enable_submission', 'local_kaltura'), get_string('enable_submission_desc', 'local_kaltura'), 0); $adminsetting->plugin = KALTURA_PLUGIN_NAME; + $settings->add($adminsetting); + + $adminsetting = new admin_setting_configcheckbox('guest_support', get_string('guest_support', 'local_kaltura'), get_string('guest_support_desc', 'local_kaltura'), 1); + $adminsetting->plugin = KALTURA_PLUGIN_NAME; $settings->add($adminsetting); $settings->hide_if(KALTURA_PLUGIN_NAME.'/adminsecret', KALTURA_PLUGIN_NAME .'/lti_version', 'eq', LTI_VERSION_1P3); diff --git a/local/kaltura/version.php b/local/kaltura/version.php index c3cec288..ce261b76 100644 --- a/local/kaltura/version.php +++ b/local/kaltura/version.php @@ -25,10 +25,10 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2024042202; +$plugin->version = 2026060700; $plugin->component = 'local_kaltura'; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->maturity = MATURITY_STABLE; try { @@ -52,7 +52,7 @@ } if (!empty($updatedVersion)) { - $pluginsRecords = $DB->get_records_select('config_plugins', "plugin in ('local_kaltura', 'local_kalturamediagallery', 'local_mymedia', 'atto_kalturamedia','block_kalturamediagallery','filter_kaltura','tinymce_kalturamedia','mod_kalvidassign','mod_kalvidres', 'tiny_kalturamedia') AND name = 'version' AND value = '$kalturaPluginVersion'"); + $pluginsRecords = $DB->get_records_select('config_plugins', "plugin in ('local_kaltura', 'local_kalturamediagallery', 'local_mymedia', 'block_kalturamediagallery','filter_kaltura','tinymce_kalturamedia','mod_kalvidassign','mod_kalvidres', 'tiny_kalturamedia') AND name = 'version' AND value = '$kalturaPluginVersion'"); foreach ($pluginsRecords as $record) { $record->value = $updatedVersion; diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js index fe9a0df2..a7b47b0a 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-debug.js @@ -74,7 +74,7 @@ Y.extend(LTITINYMCEPANEL, Y.Base, { this.contextid = Y.one('#lti_launch_context_id').get('value'); } - var content = ''; + var content = ''; Y.one('#'+iframeid).setContent(content); }, diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js index 60b17a61..479b32ee 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel-min.js @@ -1 +1 @@ -YUI.add("moodle-local_kaltura-ltitinymcepanel",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{contextid:0,init:function(t){if(""===t.ltilaunchurl||""===t.objecttagheight||""===t.objecttagid||""===t.previewiframeid){alert("Some parameters were not initialized.");return}this.load_lti_content(t.ltilaunchurl,t.objecttagid,t.objecttagheight),e.one("#closeltipanel").on("click",this.user_selected_video_callback,this,t.objecttagid,t.previewiframeid,t.objecttagheight),null!==e.one("#page-footer")&&e.one("#page-footer").setStyle("display","none")},load_lti_content:function(t,n,r){0===this.contextid&&(this.contextid=e.one("#lti_launch_context_id").get("value"));var i='';e.one("#"+n).setContent(i)},user_selected_video_callback:function(t,n,r,i){e.one("#"+n).setContent("");var s=e.Node.create("
"),o=e.Node.create("");o.setAttribute("allowfullscreen",""),o.setAttribute("width",e.one("#width").get("value")+"px"),o.setAttribute("height",i+"px"),o.setAttribute("src",e.one("#video_preview_frame").getAttribute("src")),s.append(o),e.one("#"+r).append(s)}},{NAME:"moodle-local_kaltura-ltitinymcepanel",ATTRS:{ltilaunchurl:{value:""},objecttagheight:{value:""},objecttagid:{value:""},previewiframeid:{value:""}}}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","panel","node-event-simulate"]}); +YUI.add("moodle-local_kaltura-ltitinymcepanel",function(e,t){var n=function(){n.superclass.constructor.apply(this,arguments)};e.extend(n,e.Base,{contextid:0,init:function(t){if(""===t.ltilaunchurl||""===t.objecttagheight||""===t.objecttagid||""===t.previewiframeid){alert("Some parameters were not initialized.");return}this.load_lti_content(t.ltilaunchurl,t.objecttagid,t.objecttagheight),e.one("#closeltipanel").on("click",this.user_selected_video_callback,this,t.objecttagid,t.previewiframeid,t.objecttagheight),null!==e.one("#page-footer")&&e.one("#page-footer").setStyle("display","none")},load_lti_content:function(t,n,r){0===this.contextid&&(this.contextid=e.one("#lti_launch_context_id").get("value"));var i='';e.one("#"+n).setContent(i)},user_selected_video_callback:function(t,n,r,i){e.one("#"+n).setContent("");var s=e.Node.create("
"),o=e.Node.create("");o.setAttribute("allowfullscreen",""),o.setAttribute("width",e.one("#width").get("value")+"px"),o.setAttribute("height",i+"px"),o.setAttribute("src",e.one("#video_preview_frame").getAttribute("src")),s.append(o),e.one("#"+r).append(s)}},{NAME:"moodle-local_kaltura-ltitinymcepanel",ATTRS:{ltilaunchurl:{value:""},objecttagheight:{value:""},objecttagid:{value:""},previewiframeid:{value:""}}}),M.local_kaltura=M.local_kaltura||{},M.local_kaltura.init=function(e){return new n(e)}},"@VERSION@",{requires:["base","node","panel","node-event-simulate"]}); diff --git a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js index fe9a0df2..a7b47b0a 100644 --- a/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js +++ b/local/kaltura/yui/build/moodle-local_kaltura-ltitinymcepanel/moodle-local_kaltura-ltitinymcepanel.js @@ -74,7 +74,7 @@ Y.extend(LTITINYMCEPANEL, Y.Base, { this.contextid = Y.one('#lti_launch_context_id').get('value'); } - var content = ''; + var content = ''; Y.one('#'+iframeid).setContent(content); }, diff --git a/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js b/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js index 91c3a9af..4a50c10c 100644 --- a/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js +++ b/local/kaltura/yui/src/ltitinymcepanel/js/ltitinymcepanel.js @@ -72,7 +72,7 @@ Y.extend(LTITINYMCEPANEL, Y.Base, { this.contextid = Y.one('#lti_launch_context_id').get('value'); } - var content = ''; + var content = ''; Y.one('#'+iframeid).setContent(content); }, diff --git a/local/kalturamediagallery/index.php b/local/kalturamediagallery/index.php index 54748664..3c244f7f 100644 --- a/local/kalturamediagallery/index.php +++ b/local/kalturamediagallery/index.php @@ -56,7 +56,7 @@ 'width' => '100%', 'allowfullscreen' => 'true', 'src' => 'lti_launch.php?courseid='.$courseid, - 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *;', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', ); echo html_writer::tag('iframe', '', $attr); diff --git a/local/kalturamediagallery/lib.php b/local/kalturamediagallery/lib.php index bb093993..4ed7a229 100644 --- a/local/kalturamediagallery/lib.php +++ b/local/kalturamediagallery/lib.php @@ -114,8 +114,8 @@ function local_kalturamediagallery_extend_navigation_course(navigation_node $par $parent->add($name, $url, navigation_node::NODETYPE_LEAF, $name, 'kalturamediagallery-settings', getMediaGalleryIcon()); } -function isNodeNotEmpty(navigation_node $node) { - return $node !== false && $node->has_children(); +function isNodeNotEmpty($node) { + return $node instanceof navigation_node && $node->has_children(); } function getMediaGalleryIcon() { diff --git a/local/kalturamediagallery/version.php b/local/kalturamediagallery/version.php index dd7e6d38..b9f93b91 100644 --- a/local/kalturamediagallery/version.php +++ b/local/kalturamediagallery/version.php @@ -26,11 +26,11 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2024042202; +$plugin->version = 2026060700; $plugin->component = 'local_kalturamediagallery'; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2024042202 + 'local_kaltura' => 2026060700 ); diff --git a/local/mymedia/mymedia.php b/local/mymedia/mymedia.php index 7038f2c3..7aac8995 100644 --- a/local/mymedia/mymedia.php +++ b/local/mymedia/mymedia.php @@ -52,7 +52,7 @@ 'width' => '100%', 'allowfullscreen' => 'true', 'src' => 'lti_launch.php', - 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *;', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', ); echo html_writer::tag('iframe', '', $attr); diff --git a/local/mymedia/version.php b/local/mymedia/version.php index 04a72dd8..967a3618 100644 --- a/local/mymedia/version.php +++ b/local/mymedia/version.php @@ -25,11 +25,11 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2024042202; +$plugin->version = 2026060700; $plugin->component = 'local_mymedia'; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2024042202 + 'local_kaltura' => 2026060700 ); diff --git a/mod/assign/submission/kalvid/backup/moodle2/backup_assignsubmission_kalvid_subplugin.class.php b/mod/assign/submission/kalvid/backup/moodle2/backup_assignsubmission_kalvid_subplugin.class.php new file mode 100644 index 00000000..bcb8b1f7 --- /dev/null +++ b/mod/assign/submission/kalvid/backup/moodle2/backup_assignsubmission_kalvid_subplugin.class.php @@ -0,0 +1,61 @@ +. + +/** + * This file contains the class for backup of this submission plugin + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * Provides the information to backup kalvid submissions + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class backup_assignsubmission_kalvid_subplugin extends backup_subplugin { + + /** + * Returns the subplugin information to attach to submission element + * + * @return backup_subplugin_element + */ + protected function define_submission_subplugin_structure() { + + // Create XML elements. + $subplugin = $this->get_subplugin_element(); + $subpluginwrapper = new backup_nested_element($this->get_recommended_name()); + $subpluginelement = new backup_nested_element('submission_kalvid', + null, + array('entry_id', 'source', 'width', 'height', 'submission')); + + // Connect XML elements into the tree. + $subplugin->add_child($subpluginwrapper); + $subpluginwrapper->add_child($subpluginelement); + + // Set source to populate the data. + $subpluginelement->set_source_table('assignsubmission_kalvid', + array('submission' => backup::VAR_PARENTID)); + + return $subplugin; + } + +} diff --git a/mod/assign/submission/kalvid/backup/moodle2/restore_assignsubmission_kalvid_subplugin.class.php b/mod/assign/submission/kalvid/backup/moodle2/restore_assignsubmission_kalvid_subplugin.class.php new file mode 100644 index 00000000..9231e698 --- /dev/null +++ b/mod/assign/submission/kalvid/backup/moodle2/restore_assignsubmission_kalvid_subplugin.class.php @@ -0,0 +1,69 @@ +. + +/** + * This file contains the class for restore of this submission plugin + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +/** + * Restore subplugin class. + * + * Provides the necessary information needed to restore + * one assign_submission subplugin. + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class restore_assignsubmission_kalvid_subplugin extends restore_subplugin { + + /** + * Returns array the paths to be handled by the subplugin at assignment level + * @return array + */ + protected function define_submission_subplugin_structure() { + + $paths = array(); + + $elename = $this->get_namefor('submission'); + $elepath = $this->get_pathfor('/submission_kalvid'); + $paths[] = new restore_path_element($elename, $elepath); + + return $paths; + } + + /** + * Processes one assignsubmission_kalvid element + * + * @param mixed $data + */ + public function process_assignsubmission_kalvid_submission($data) { + global $DB; + + $data = (object)$data; + $data->assignment = $this->get_new_parentid('assign'); + // The mapping is set in the restore for the core assign activity + // when a submission node is processed. + $data->submission = $this->get_mappingid('submission', $data->submission); + + $DB->insert_record('assignsubmission_kalvid', $data); + } + +} diff --git a/mod/assign/submission/kalvid/classes/event/assessable_uploaded.php b/mod/assign/submission/kalvid/classes/event/assessable_uploaded.php new file mode 100644 index 00000000..b6a33b43 --- /dev/null +++ b/mod/assign/submission/kalvid/classes/event/assessable_uploaded.php @@ -0,0 +1,78 @@ +. + +/** + * The assignsubmission_kalvid assessable uploaded event. + * + * @package assignsubmission_kalvid + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace assignsubmission_kalvid\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The assignsubmission_kalvid assessable uploaded event class. + * + * @package assignsubmission_kalvid + * @since Moodle 2.6 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class assessable_uploaded extends \core\event\assessable_uploaded { + + /** + * Returns description of what happened. + * + * @return string + */ + public function get_description() { + return "The user with id '$this->userid' has saved a Kaltura media submission with id '$this->objectid' " . + "in the assignment activity with course module id '$this->contextinstanceid'."; + } + + /** + * Return localised event name. + * + * @return string + */ + public static function get_name() { + return get_string('eventassessableuploaded', 'assignsubmission_kalvid'); + } + + /** + * Get URL related to the action. + * + * @return \moodle_url + */ + public function get_url() { + return new \moodle_url('/mod/assign/view.php', array('id' => $this->contextinstanceid)); + } + + /** + * Init method. + * + * @return void + */ + protected function init() { + parent::init(); + $this->data['objecttable'] = 'assign_submission'; + } + + public static function get_objectid_mapping() { + return array('db' => 'assign_submission', 'restore' => 'submission'); + } +} diff --git a/mod/assign/submission/kalvid/classes/event/submission_created.php b/mod/assign/submission/kalvid/classes/event/submission_created.php new file mode 100644 index 00000000..38498fad --- /dev/null +++ b/mod/assign/submission/kalvid/classes/event/submission_created.php @@ -0,0 +1,66 @@ +. + +/** + * The assignsubmission_kalvid submission_created event. + * + * @package assignsubmission_kalvid + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace assignsubmission_kalvid\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The assignsubmission_kalvid submission_created event class. + * + * @package assignsubmission_kalvid + * @since Moodle 2.7 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class submission_created extends \mod_assign\event\submission_created { + + /** + * Init method. + */ + protected function init() { + parent::init(); + $this->data['objecttable'] = 'assignsubmission_kalvid'; + } + + /** + * Returns non-localised description of what happened. + * + * @return string + */ + public function get_description() { + $descriptionstring = "The user with id '$this->userid' created a Kaltura media submission with " . + "id '$this->objectid' in the assignment with course module id '$this->contextinstanceid'"; + if (!empty($this->other['groupid'])) { + $descriptionstring .= " for the group with id '{$this->other['groupid']}'."; + } else { + $descriptionstring .= "."; + } + + return $descriptionstring; + } + + public static function get_objectid_mapping() { + // No mapping available for 'assignsubmission_kalvid'. + return array('db' => 'assignsubmission_kalvid', 'restore' => \core\event\base::NOT_MAPPED); + } +} diff --git a/mod/assign/submission/kalvid/classes/event/submission_updated.php b/mod/assign/submission/kalvid/classes/event/submission_updated.php new file mode 100644 index 00000000..d6128617 --- /dev/null +++ b/mod/assign/submission/kalvid/classes/event/submission_updated.php @@ -0,0 +1,66 @@ +. + +/** + * The assignsubmission_kalvid submission_updated event. + * + * @package assignsubmission_kalvid + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace assignsubmission_kalvid\event; + +defined('MOODLE_INTERNAL') || die(); + +/** + * The assignsubmission_kalvid submission_updated event class. + * + * @package assignsubmission_kalvid + * @since Moodle 2.7 + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class submission_updated extends \mod_assign\event\submission_updated { + + /** + * Init method. + */ + protected function init() { + parent::init(); + $this->data['objecttable'] = 'assignsubmission_kalvid'; + } + + /** + * Returns non-localised description of what happened. + * + * @return string + */ + public function get_description() { + $descriptionstring = "The user with id '$this->userid' updated a Kaltura media submission with " . + "id '$this->objectid' in the assignment with course module id '$this->contextinstanceid'"; + if (!empty($this->other['groupid'])) { + $descriptionstring .= " for the group with id '{$this->other['groupid']}'."; + } else { + $descriptionstring .= "."; + } + + return $descriptionstring; + } + + public static function get_objectid_mapping() { + // No mapping available for 'assignsubmission_kalvid'. + return array('db' => 'assignsubmission_kalvid', 'restore' => \core\event\base::NOT_MAPPED); + } +} diff --git a/mod/assign/submission/kalvid/classes/privacy/provider.php b/mod/assign/submission/kalvid/classes/privacy/provider.php new file mode 100644 index 00000000..26da05d6 --- /dev/null +++ b/mod/assign/submission/kalvid/classes/privacy/provider.php @@ -0,0 +1,137 @@ +. + +/** + * Privacy class for requesting user data. + * + * @package assignsubmission_kalvid + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace assignsubmission_kalvid\privacy; + +defined('MOODLE_INTERNAL') || die(); + +use \core_privacy\local\metadata\collection; +use \core_privacy\local\request\writer; +use \core_privacy\local\request\contextlist; +use \mod_assign\privacy\assign_plugin_request_data; + +/** + * Privacy class for requesting user data. + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class provider implements + \core_privacy\local\metadata\provider, + \mod_assign\privacy\assignsubmission_provider, + \mod_assign\privacy\assignsubmission_user_provider { + + /** + * Return meta data about this plugin. + * + * @param collection $collection A list of information to add to. + * @return collection Return the collection after adding to it. + */ + public static function get_metadata(collection $collection): collection { + $detail = [ + 'assignment' => 'privacy:metadata:assignmentid', + 'submission' => 'privacy:metadata:submissionpurpose', + 'entry_id' => 'privacy:metadata:entryid', + 'source' => 'privacy:metadata:source', + ]; + $collection->add_database_table('assignsubmission_kalvid', $detail, 'privacy:metadata:kalvid_tablepurpose'); + return $collection; + } + + /** + * This is covered by mod_assign provider and the query on assign_submissions. + * + * @param int $userid The user ID that we are finding contexts for. + * @param contextlist $contextlist A context list to add sql and params to for contexts. + */ + public static function get_context_for_userid_within_submission(int $userid, contextlist $contextlist) { + // This is already fetched from mod_assign. + } + + /** + * This is also covered by the mod_assign provider and it's queries. + * + * @param \mod_assign\privacy\useridlist $useridlist An object for obtaining user IDs of students. + */ + public static function get_student_user_ids(\mod_assign\privacy\useridlist $useridlist) { + // No need. + } + + /** + * If you have tables that contain userids and you can generate entries in your tables without creating an + * entry in the assign_submission table then please fill in this method. + * + * @param \core_privacy\local\request\userlist $userlist The userlist object + */ + public static function get_userids_from_context(\core_privacy\local\request\userlist $userlist) { + // Not required. + } + + /** + * Export all user data for this plugin. + * + * @param assign_plugin_request_data $exportdata Data used to determine which context and user to export and other useful + * information to help with exporting. + */ + public static function export_submission_user_data(assign_plugin_request_data $exportdata) { + global $DB; + // We currently don't show submissions to teachers when exporting their data. + if ($exportdata->get_user() != null) { + return null; + } + $context = $exportdata->get_context(); + $currentpath = $exportdata->get_subcontext(); + $currentpath[] = get_string('privacy:path', 'assignsubmission_kalvid'); + $submission = $exportdata->get_pluginobject(); + $kalvidsubmission = $DB->get_record('assignsubmission_kalvid', ['submission' => $submission->id]); + if (!empty($kalvidsubmission)) { + writer::with_context($context)->export_data($currentpath, $kalvidsubmission); + } + } + + /** + * Any call to this method should delete all user data for the context defined in the deletion_criteria. + * + * @param assign_plugin_request_data $requestdata Data useful for deleting user data from this sub-plugin. + */ + public static function delete_submission_for_context(assign_plugin_request_data $requestdata) { + global $DB; + $DB->delete_records('assignsubmission_kalvid', ['assignment' => $requestdata->get_assignid()]); + } + + /** + * A call to this method should delete user data (where practicle) from the userid and context. + * + * @param assign_plugin_request_data $deletedata Details about the user and context to focus the deletion. + */ + public static function delete_submission_for_userid(assign_plugin_request_data $deletedata) { + global $DB; + + $submissionid = $deletedata->get_pluginobject()->id; + + // Delete the records in the table. + $DB->delete_records('assignsubmission_kalvid', ['assignment' => $deletedata->get_assignid(), + 'submission' => $submissionid]); + } +} diff --git a/mod/assign/submission/kalvid/db/access.php b/mod/assign/submission/kalvid/db/access.php new file mode 100644 index 00000000..83f79fc8 --- /dev/null +++ b/mod/assign/submission/kalvid/db/access.php @@ -0,0 +1,29 @@ +. + +/** + * Capability definitions for this module. + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$capabilities = array( + + + +); diff --git a/mod/assign/submission/kalvid/db/install.xml b/mod/assign/submission/kalvid/db/install.xml new file mode 100644 index 00000000..61c629ac --- /dev/null +++ b/mod/assign/submission/kalvid/db/install.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + +
+
+
diff --git a/lib/editor/atto/plugins/kalturamedia/lang/en/atto_kalturamedia.php b/mod/assign/submission/kalvid/db/upgrade.php similarity index 65% rename from lib/editor/atto/plugins/kalturamedia/lang/en/atto_kalturamedia.php rename to mod/assign/submission/kalvid/db/upgrade.php index 9021aef7..e03d8dab 100644 --- a/lib/editor/atto/plugins/kalturamedia/lang/en/atto_kalturamedia.php +++ b/mod/assign/submission/kalvid/db/upgrade.php @@ -15,15 +15,20 @@ // along with Moodle. If not, see . /** - * Strings for component 'atto_kalturamedia', language 'en'. + * Upgrade code for install * - * @package atto_media - * @copyright 2013 Damyon Wiese + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['pluginname'] = 'Embed Kaltura Media'; -$string['popuptitle'] = 'Select Media'; -$string['embedbuttontext'] = 'Embed'; -$string['browse_and_embed'] = 'Browse and Embed'; -$string['privacy:metadata'] = 'The atto_kalturamedia plugin does not store any personal data.'; +/** + * Stub for upgrade code + * @param int $oldversion + * @return bool + */ +function xmldb_assignsubmission_kalvid_upgrade($oldversion) { + // Put any upgrade step following this. + + return true; +} diff --git a/mod/assign/submission/kalvid/lang/en/assignsubmission_kalvid.php b/mod/assign/submission/kalvid/lang/en/assignsubmission_kalvid.php new file mode 100644 index 00000000..7e9bf8db --- /dev/null +++ b/mod/assign/submission/kalvid/lang/en/assignsubmission_kalvid.php @@ -0,0 +1,42 @@ +. + +/** + * Strings for component 'assignsubmission_kalvid', language 'en' + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$string['default'] = 'Enabled by default'; +$string['default_help'] = 'If set, this submission method will be enabled by default for all new assignments.'; +$string['enabled'] = 'Kaltura media'; +$string['enabled_help'] = 'If enabled, students are able to upload and submit Kaltura media for their submission.'; +$string['eventassessableuploaded'] = 'A Kaltura media has been submitted.'; +$string['kalvid'] = 'Kaltura media'; +$string['pluginname'] = 'Kaltura media submissions'; +$string['privacy:metadata:assignmentid'] = 'Assignment ID'; +$string['privacy:metadata:submissionpurpose'] = 'The submission ID that links to submissions for the user.'; +$string['privacy:metadata:entryid'] = 'Kaltura entry id'; +$string['privacy:metadata:source'] = 'The source URL of the media entry'; +$string['privacy:metadata:kalvid_tablepurpose'] = 'Stores the Kaltura media submission for each attempt'; +$string['privacy:path'] = 'Submission Kaltura media'; +$string['addmedia'] = 'Add media submission'; +$string['invalid_source_parameter'] = 'Invalid source parameter'; +$string['invalid_launch_parameters'] = 'Invalid launch parameters'; +$string['video_thumbnail'] = 'Video thumbnail'; + diff --git a/mod/assign/submission/kalvid/locallib.php b/mod/assign/submission/kalvid/locallib.php new file mode 100644 index 00000000..93700a31 --- /dev/null +++ b/mod/assign/submission/kalvid/locallib.php @@ -0,0 +1,387 @@ +. + +/** + * This file contains the definition for the library class for kalvid submission plugin + * + * This class provides all the functionality for the new assign module. + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +/** + * library class for kalvid submission plugin extending submission plugin base class + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class assign_submission_kalvid extends assign_submission_plugin { + + /** + * Get the name of the kaltura video submission plugin + * @return string + */ + public function get_name() { + return get_string('kalvid', 'assignsubmission_kalvid'); + } + + /** + * Get kalvid submission information from the database + * + * @param int $submissionid + * @return mixed + */ + private function get_kalvid_submission($submissionid) { + global $DB; + + return $DB->get_record('assignsubmission_kalvid', array('submission'=>$submissionid)); + } + + /** + * Remove a submission. + * + * @param stdClass $submission The submission + * @return boolean + */ + public function remove(stdClass $submission) { + global $DB; + + $submissionid = $submission ? $submission->id : 0; + if ($submissionid) { + $DB->delete_records('assignsubmission_kalvid', array('submission' => $submissionid)); + } + return true; + } + + /** + * Add elements to user submission form + * + * @param mixed $submission can be null + * @param MoodleQuickForm $mform + * @param stdClass $data + * @return true if elements were added to the form + */ + public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) { + global $COURSE, $PAGE; + $submissionrec = null; + if ($submission) { + $submissionrec = $this->get_kalvid_submission($submission->id); + } + + $entryid = $submissionrec->entry_id ?? ''; + + $PAGE->requires->css('/mod/assign/submission/kalvid/styles.css'); + // include replace_video string from kalvidres + // it is hardcoded in ltipanel.js and used here + $PAGE->requires->string_for_js('replace_video', 'kalvidres'); + + $pageclass = 'kaltura-kalvid-body'; + $PAGE->add_body_class($pageclass); + + $mform->addElement('hidden', 'entry_id', $entryid, array('id' => 'entry_id')); + $mform->setType('entry_id', PARAM_NOTAGS); + $mform->addElement('hidden', 'source', '', array('id' => 'source')); + $mform->setType('source', PARAM_URL); + $mform->addElement('hidden', 'width', '', array('id' => 'width')); + $mform->setType('width', PARAM_TEXT); + $mform->addElement('hidden', 'height', '', array('id' => 'height')); + $mform->setType('height', PARAM_TEXT); + + $html = html_writer::start_tag('center', ['class' => 'm-t-2 m-b-1']); + + $source = new moodle_url('/local/kaltura/pix/vidThumb.png'); + $imgattr = [ + 'id' => 'video_thumbnail', + 'src' => $source->out(), + 'alt' => get_string('video_thumbnail', 'assignsubmission_kalvid'), + 'title' => get_string('video_thumbnail', 'assignsubmission_kalvid'), + 'style' => empty($submissionrec->source) ? '' : 'display:none' + ]; + + // If the submission object contains a source URL then display the video as part of an LTI launch. + if (!empty($submissionrec->source)) { + $imgattr['style'] = 'display: none'; + + $params = array( + 'courseid' => $COURSE->id, + 'height' => $submissionrec->height, + 'width' => $submissionrec->width, + 'withblocks' => 0, + 'source' => local_kaltura_add_kaf_uri_token($submissionrec->source), + 'cmid' => $this->assignment->get_course_module()->id + ); + $url = new moodle_url('/mod/assign/submission/kalvid/lti_launch.php', $params); + } + + $html .= html_writer::empty_tag('img', $imgattr); + + $iframeattr = [ + 'id' => 'contentframe', + 'class' => 'kaltura-player-iframe', + 'src' => ($url instanceof moodle_url) ? $url->out(false) : '', + 'allowfullscreen' => 'true', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', + 'height' => '100%', + 'width' => !empty($submissionrec->width) ? $submissionrec->width : '' + ]; + + if (empty($submissionrec->source)) { + $iframeattr['style'] = 'display: none'; + } + + $iframe = html_writer::tag('iframe', '', $iframeattr); + $html .= html_writer::tag('div', $iframe, ['class' => 'kaltura-player-container']); + + $attr = array( + 'class' => 'btn btn-primary mr-2', + 'type' => 'button', + 'id' => 'id_add_video', + 'name' => 'add_video', + 'value' => empty($submissionrec->source) ? get_string('addmedia', 'assignsubmission_kalvid') : get_string('replace_video', 'kalvidres') + ); + + $html .= html_writer::empty_tag('input', $attr); + + $html .= html_writer::end_tag('center'); + + $mform->addElement('static', 'kalvid', $this->get_name(), html_writer::tag('div', $html)); + + $params = array( + 'withblocks' => 0, + 'courseid' => $COURSE->id, + 'width' => KALTURA_PANEL_WIDTH, + 'height' => KALTURA_PANEL_HEIGHT, + 'cmid' => $this->assignment->get_course_module()->id + ); + + $url = new moodle_url('/mod/assign/submission/kalvid/lti_launch.php', $params); + + $params = array( + 'addvidbtnid' => 'id_add_video', + 'ltilaunchurl' => $url->out(false), + 'height' => KALTURA_PANEL_HEIGHT, + 'width' => KALTURA_PANEL_WIDTH, + // provide kalvidres as the modulename for ltipanel.js + // to update the button text to 'Replace video' after media is added + // see lti_panel_change_add_media_button_caption() + 'modulename' => 'kalvidres' + ); + + $PAGE->requires->yui_module('moodle-local_kaltura-ltipanel', 'M.local_kaltura.init', array($params), null, true); + + // Require a YUI module to make the object tag be as large as possible. + $params = array( + 'bodyclass' => $pageclass, + 'lastheight' => null, + 'padding' => 15 + ); + + if (isset($submissionrec->width) && isset($submissionrec->height)) + { + $params['width'] = $submissionrec->width; + $params['height'] = $submissionrec->height; + } + + $PAGE->requires->yui_module('moodle-local_kaltura-lticontainer', 'M.local_kaltura.init', array($params), null, true); + + return true; + } + + /** + * Save submission data to the database + * + * @param stdClass $submission + * @param stdClass $data + * @return bool + */ + public function save(stdClass $submission, stdClass $data) { + global $USER, $DB; + + $submissionrec = $this->get_kalvid_submission($submission->id); + + if (empty($data->entry_id) || empty($data->source)) { + return true; + } + + $params = array( + 'context' => context_module::instance($this->assignment->get_course_module()->id), + 'courseid' => $this->assignment->get_course()->id, + 'objectid' => $submission->id, + 'other' => array( + 'pathnamehashes' => [], + 'content' => '', + ) + ); + if (!empty($submission->userid) && ($submission->userid != $USER->id)) { + $params['relateduserid'] = $submission->userid; + } + if ($this->assignment->is_blind_marking()) { + $params['anonymous'] = 1; + } + $event = \assignsubmission_kalvid\event\assessable_uploaded::create($params); + $event->trigger(); + + $groupname = null; + $groupid = 0; + // Get the group name as other fields are not transcribed in the logs and this information is important. + if (empty($submission->userid) && !empty($submission->groupid)) { + $groupname = $DB->get_field('groups', 'name', array('id' => $submission->groupid), MUST_EXIST); + $groupid = $submission->groupid; + } else { + $params['relateduserid'] = $submission->userid; + } + + // Unset the objectid and other field from params for use in submission events. + unset($params['objectid']); + unset($params['other']); + $params['other'] = array( + 'submissionid' => $submission->id, + 'submissionattempt' => $submission->attemptnumber, + 'submissionstatus' => $submission->status, + 'groupid' => $groupid, + 'groupname' => $groupname + ); + + if ($submissionrec) { + $submissionrec->entry_id = $data->entry_id; + $submissionrec->source = $data->source; + $submissionrec->width = $data->width; + $submissionrec->height = $data->height; + $params['objectid'] = $submissionrec->id; + $updatestatus = $DB->update_record('assignsubmission_kalvid', $submissionrec); + $event = \assignsubmission_kalvid\event\submission_updated::create($params); + $event->set_assign($this->assignment); + $event->trigger(); + return $updatestatus; + } else { + $submissionrec = new stdClass(); + $submissionrec->entry_id = $data->entry_id; + $submissionrec->source = $data->source; + $submissionrec->width = $data->width; + $submissionrec->height = $data->height; + + $submissionrec->submission = $submission->id; + $submissionrec->assignment = $this->assignment->get_instance()->id; + $submissionrec->id = $DB->insert_record('assignsubmission_kalvid', $submissionrec); + $params['objectid'] = $submissionrec->id; + $event = \assignsubmission_kalvid\event\submission_created::create($params); + $event->set_assign($this->assignment); + $event->trigger(); + return $submissionrec->id > 0; + } + } + + /** + * View summary. + * + * @param stdClass $submission + * @param bool $showviewlink (Mutable) + * @return string + */ + public function view_summary(stdClass $submission, &$showviewlink) { + return $this->view($submission); + } + + /** + * Display the media in the view table + * + * @param stdClass $submission + * @return string + */ + public function view(stdClass $submission) { + global $COURSE; + $result = ''; + + $submissionrec = $this->get_kalvid_submission($submission->id); + + if ($submissionrec) { + $params = array( + 'courseid' => $COURSE->id, + 'height' => $submissionrec->height, + 'width' => $submissionrec->width, + 'withblocks' => 0, + 'source' => local_kaltura_add_kaf_uri_token($submissionrec->source), + 'cmid' => $this->assignment->get_course_module()->id + ); + $url = new moodle_url('/mod/assign/submission/kalvid/lti_launch.php', $params); + + $iframeattr = [ + 'id' => 'contentframe', + 'class' => 'kaltura-player-iframe', + 'src' => $url->out(false), + 'allowfullscreen' => 'true', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', + 'height' => '203px', + 'width' => '360px' + ]; + + $result = html_writer::start_tag('center', ['class' => 'm-t-2 m-b-1']); + $iframe = html_writer::tag('iframe', '', $iframeattr); + $result .= html_writer::tag('div', $iframe, ['class' => 'kaltura-player-container']); + $result .= html_writer::end_tag('center'); + } + + return $result; + } + + /** + * The assignment has been deleted - cleanup + * + * @return bool + */ + public function delete_instance() { + global $DB; + $DB->delete_records('assignsubmission_kalvid', + array('assignment'=>$this->assignment->get_instance()->id)); + + return true; + } + + /** + * Check if submission has been made + * + * @param stdClass $submission + * @return bool + */ + public function is_empty(stdClass $submission) { + $submissionrec = $this->get_kalvid_submission($submission->id); + return empty($submissionrec); + } + + /** + * Copy the student's submission from a previous submission. Used when a student opts to base their resubmission + * on the last submission. + * @param stdClass $sourcesubmission + * @param stdClass $destsubmission + */ + public function copy_submission(stdClass $sourcesubmission, stdClass $destsubmission) { + global $DB; + + // Copy the assignsubmission_kalvid record. + $submissionrec = $this->get_kalvid_submission($sourcesubmission->id); + if ($submissionrec) { + unset($submissionrec->id); + $submissionrec->submission = $destsubmission->id; + $DB->insert_record('assignsubmission_kalvid', $submissionrec); + } + return true; + } +} \ No newline at end of file diff --git a/mod/assign/submission/kalvid/lti_launch.php b/mod/assign/submission/kalvid/lti_launch.php new file mode 100644 index 00000000..fde90e17 --- /dev/null +++ b/mod/assign/submission/kalvid/lti_launch.php @@ -0,0 +1,80 @@ +. + +/** + * Kaltura video submission LTI launch script. + * + * @package assignsubmission_kalvid + * @author Remote-Learner.net Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + * @copyright 2025 Kaltura Inc + */ + +require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/config.php'); +require_once(dirname(dirname(dirname(dirname(dirname(__FILE__))))).'/local/kaltura/locallib.php'); + +global $USER; + +require_login(); +$courseid = required_param('courseid', PARAM_INT); +$cmid = required_param('cmid', PARAM_INT); +$height = required_param('height', PARAM_INT); +$width = required_param('width', PARAM_INT); +$withblocks = optional_param('withblocks', 0, PARAM_INT); +$source = optional_param('source', '', PARAM_URL); + +$context = context_course::instance($courseid); +$course = get_course($courseid); + +$launch = array(); +$launch['id'] = 1; +$launch['cmid'] = $cmid; +$launch['title'] = 'Kaltura video submission'; +$launch['module'] = KAF_BROWSE_EMBED_MODULE; +$launch['course'] = $course; +$launch['width'] = $width; +$launch['height'] = $height; +$launch['custom_publishdata'] = ''; + +$source = local_kaltura_add_kaf_uri_token($source); + +if (!$cm = get_coursemodule_from_id('assign', $cmid)) { + throw new \moodle_exception('invalidcoursemodule'); +} + +if (!$kalvidassignobj = $DB->get_record('assign', array('id' => $cm->instance))) { + throw new \moodle_exception('invalidid', 'assignsubmission_kalvid'); +} + +$submissionParams = array('vidassignid' => $kalvidassignobj->id, 'userid' => $USER->id); +$submission = $DB->get_record('kalvidassign_submission', $submissionParams); + +if (false === local_kaltura_url_contains_configured_hostname($source) && !empty($source)) { + echo get_string('invalid_source_parameter', 'assignsubmission_kalvid'); + die; +} else { + $launch['source'] = urldecode($source); +} + +if (!empty(get_config(KALTURA_PLUGIN_NAME, 'enable_submission'))) { + $launch['submission'] = 'yes'; +} +if (local_kaltura_validate_browseembed_required_params($launch)) { + $content = local_kaltura_request_lti_launch($launch, $withblocks); + echo $content; +} else { + echo get_string('invalid_launch_parameters', 'assignsubmission_kalvid'); +} diff --git a/mod/assign/submission/kalvid/settings.php b/mod/assign/submission/kalvid/settings.php new file mode 100644 index 00000000..00bb9b16 --- /dev/null +++ b/mod/assign/submission/kalvid/settings.php @@ -0,0 +1,28 @@ +. + +/** + * This file defines the admin settings for this plugin + * + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +$settings->add(new admin_setting_configcheckbox('assignsubmission_kalvid/default', + new lang_string('default', 'assignsubmission_kalvid'), + new lang_string('default_help', 'assignsubmission_kalvid'), 0)); + diff --git a/mod/assign/submission/kalvid/styles.css b/mod/assign/submission/kalvid/styles.css new file mode 100644 index 00000000..d17ab460 --- /dev/null +++ b/mod/assign/submission/kalvid/styles.css @@ -0,0 +1,7 @@ +#id_add_video { + float: none; +} + +#fitem_id_kalvid .flex-wrap { + justify-content: center; +} \ No newline at end of file diff --git a/lib/editor/atto/plugins/kalturamedia/version.php b/mod/assign/submission/kalvid/version.php similarity index 60% rename from lib/editor/atto/plugins/kalturamedia/version.php rename to mod/assign/submission/kalvid/version.php index 999e7ef6..77daa448 100644 --- a/lib/editor/atto/plugins/kalturamedia/version.php +++ b/mod/assign/submission/kalvid/version.php @@ -1,6 +1,4 @@ . /** - * Atto text editor integration version file. + * Kaltura version script * - * @package atto_media - * @copyright 2013 Damyon Wiese + * @package assignsubmission_kalvid + * @copyright 2025 Kaltura Inc * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2024042202; // The current plugin version (Date: YYYYMMDDXX). -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; // Requires this Moodle version. -$plugin->component = 'atto_kalturamedia'; // Full name of the plugin (used for diagnostics). +$plugin->version = 2026060700; +$plugin->component = 'assignsubmission_kalvid'; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; +$plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2024042202 + 'local_kaltura' => 2026060700, ); diff --git a/mod/kalvidassign/backup/moodle2/backup_kalvidassign_stepslib.php b/mod/kalvidassign/backup/moodle2/backup_kalvidassign_stepslib.php index f7f5380c..fc98a26c 100644 --- a/mod/kalvidassign/backup/moodle2/backup_kalvidassign_stepslib.php +++ b/mod/kalvidassign/backup/moodle2/backup_kalvidassign_stepslib.php @@ -93,6 +93,7 @@ protected function define_structure() { // Annotate the file areas in use. $issue->annotate_files('mod_kalvidassign', 'submission', 'id'); + $issue->annotate_files('mod_kalvidassign', 'intro', null); // Return the root element, wrapped into standard activity structure. return $this->prepare_activity_structure($kalvidassign); diff --git a/mod/kalvidassign/backup/moodle2/restore_kalvidassign_stepslib.php b/mod/kalvidassign/backup/moodle2/restore_kalvidassign_stepslib.php index a32272af..e0392fdb 100644 --- a/mod/kalvidassign/backup/moodle2/restore_kalvidassign_stepslib.php +++ b/mod/kalvidassign/backup/moodle2/restore_kalvidassign_stepslib.php @@ -78,5 +78,6 @@ protected function process_kalvidassign_submission($data) { protected function after_execute() { // Add kalvidassign related files, no need to match by itemname (just internally handled context). $this->add_related_files('mod_kalvidassign', 'submission', 'kalvidassign_submission'); + $this->add_related_files('mod_kalvidassign', 'intro', null); } } diff --git a/mod/kalvidassign/db/install.xml b/mod/kalvidassign/db/install.xml index 9097fd72..8b131ce6 100755 --- a/mod/kalvidassign/db/install.xml +++ b/mod/kalvidassign/db/install.xml @@ -1,5 +1,5 @@ - diff --git a/mod/kalvidassign/db/upgrade.php b/mod/kalvidassign/db/upgrade.php index 4eafeb02..82ab7e1c 100644 --- a/mod/kalvidassign/db/upgrade.php +++ b/mod/kalvidassign/db/upgrade.php @@ -85,7 +85,7 @@ function xmldb_kalvidassign_upgrade($oldversion) { upgrade_mod_savepoint(true, 2014023000.01, 'kalvidassign'); } - if ($oldversion < 2023100903) { + if ($oldversion < 2024042202) { // Define field completionsubmit to be added to kalvidassign $table = new xmldb_table('kalvidassign'); @@ -97,7 +97,7 @@ function xmldb_kalvidassign_upgrade($oldversion) { } // kalvidassign savepoint reached - upgrade_mod_savepoint(true, 2023100903, 'kalvidassign'); + upgrade_mod_savepoint(true, 2024042202, 'kalvidassign'); } return true; diff --git a/mod/kalvidassign/grade_submissions.php b/mod/kalvidassign/grade_submissions.php index 1acc8cd3..83b29b0b 100644 --- a/mod/kalvidassign/grade_submissions.php +++ b/mod/kalvidassign/grade_submissions.php @@ -38,7 +38,7 @@ if (!empty($mode)) { if (!confirm_sesskey()) { - print_error('confirmsesskeybad', 'error'); + throw new \moodle_exception('confirmsesskeybad', 'error'); } } @@ -218,7 +218,7 @@ } } -$renderer->display_submissions_table($cm, $data->group_filter, $data->filter, $data->perpage, $data->quickgrade, $tifirst, $tilast, $page); +$renderer->display_submissions_table($cm, $data->perpage, $data->group_filter, $data->filter, $data->quickgrade, $tifirst, $tilast, $page); $prefform->set_data($data); $prefform->display(); diff --git a/mod/kalvidassign/lang/en/kalvidassign.php b/mod/kalvidassign/lang/en/kalvidassign.php index 2fe1956f..70542471 100644 --- a/mod/kalvidassign/lang/en/kalvidassign.php +++ b/mod/kalvidassign/lang/en/kalvidassign.php @@ -48,7 +48,6 @@ $string['emptyentryid'] = 'Video assignment was not submitted correctly. Please try to resubmit.'; $string['deleteallsubmissions'] = 'Delete all video submissions'; $string['fullname'] = 'Name'; -$string['grade'] = 'Grade'; $string['submissioncomment'] = 'Comment'; $string['timemodified'] = 'Last modified (Submission)'; $string['grademodified'] = 'Last modified (Grade)'; @@ -144,4 +143,5 @@ $string['completionsubmit'] = 'Make a submission'; $string['completiondetail:submit'] = 'Make a submission'; $string['addsubmission'] = 'Add submission'; -$string['calendardue'] = '{$a} is due'; \ No newline at end of file +$string['calendardue'] = '{$a} is due'; +$string['kalvidassign_deprecated'] = 'Note: This is a legacy activity. Please use the Kaltura media submission in the Moodle Assignment instead.'; \ No newline at end of file diff --git a/mod/kalvidassign/locallib.php b/mod/kalvidassign/locallib.php index 7d71ff25..f56ee045 100644 --- a/mod/kalvidassign/locallib.php +++ b/mod/kalvidassign/locallib.php @@ -148,15 +148,15 @@ function kalvidassign_validate_cmid ($cmid) { global $DB; if (!$cm = get_coursemodule_from_id('kalvidassign', $cmid)) { - print_error('invalidcoursemodule'); + throw new \moodle_exception('invalidcoursemodule'); } if (!$course = $DB->get_record('course', array('id' => $cm->course))) { - print_error('coursemisconf'); + throw new \moodle_exception('coursemisconf'); } if (!$kalvidassignobj = $DB->get_record('kalvidassign', array('id' => $cm->instance))) { - print_error('invalidid', 'kalvidassign'); + throw new \moodle_exception('invalidid', 'kalvidassign'); } return array($cm, $course, $kalvidassignobj); diff --git a/mod/kalvidassign/lti_launch.php b/mod/kalvidassign/lti_launch.php index 298b7df8..e2d8e3b1 100644 --- a/mod/kalvidassign/lti_launch.php +++ b/mod/kalvidassign/lti_launch.php @@ -54,11 +54,11 @@ $source = $source = local_kaltura_add_kaf_uri_token($source); if (!$cm = get_coursemodule_from_id('kalvidassign', $cmid)) { - print_error('invalidcoursemodule'); + throw new \moodle_exception('invalidcoursemodule'); } if (!$kalvidassignobj = $DB->get_record('kalvidassign', array('id' => $cm->instance))) { - print_error('invalidid', 'kalvidassign'); + throw new \moodle_exception('invalidid', 'kalvidassign'); } $submissionParams = array('vidassignid' => $kalvidassignobj->id, 'userid' => $USER->id); diff --git a/mod/kalvidassign/mod_form.php b/mod/kalvidassign/mod_form.php index 8108acb4..443a6184 100644 --- a/mod/kalvidassign/mod_form.php +++ b/mod/kalvidassign/mod_form.php @@ -40,6 +40,13 @@ public function definition() { $mform->addElement('header', 'general', get_string('general', 'form')); + $mform->addElement('html', + html_writer::div( + get_string('kalvidassign_deprecated', 'kalvidassign'), + 'alert alert-info' + ) + ); + $mform->addElement('text', 'name', get_string('name', 'kalvidassign'), array('size' => '64')); if (!empty($CFG->formatstringstriptags)) { diff --git a/mod/kalvidassign/renderer.php b/mod/kalvidassign/renderer.php index 7b71c906..4c89f338 100644 --- a/mod/kalvidassign/renderer.php +++ b/mod/kalvidassign/renderer.php @@ -366,7 +366,7 @@ public function col_status($data) { $buttontext = get_string('update'); } else { $class = 's0'; - $buttontext = get_string('grade'); + $buttontext = get_string('gradeverb'); } if (!$submitted) { @@ -706,17 +706,18 @@ public function display_instructor_buttons($cm, $userid) { /** * This function returns HTML markup to render a the submissions table + * * @param object $cm A course module object. + * @param int $perpage The number of submissions to display on a page. * @param int $groupfilter The group id to filter against. * @param string $filter Filter users who have submitted, submitted and graded or everyone. - * @param int $perpage The number of submissions to display on a page. * @param bool $quickgrade True if the quick grade table needs to be rendered, otherwsie false. * @param string $tifirst The first initial of the first name. * @param string $tilast The first initial of the last name. * @param int $page The current page to render. * @return string Returns HTML markup. */ - public function display_submissions_table($cm, $groupfilter = 0, $filter = 'all', $perpage, $quickgrade = false, $tifirst = '', $tilast = '', $page = 0) { + public function display_submissions_table($cm, $perpage, $groupfilter = 0, $filter = 'all', $quickgrade = false, $tifirst = '', $tilast = '', $page = 0) { global $DB, $COURSE, $USER; @@ -873,7 +874,7 @@ public function display_submissions_table($cm, $groupfilter = 0, $filter = 'all' $baseurl = new moodle_url('/mod/kalvidassign/grade_submissions.php', array('cmid' => $cm->id)); $col1 = get_string('fullname', 'kalvidassign'); - $col2 = get_string('grade', 'kalvidassign'); + $col2 = get_string('gradenoun'); $col3 = get_string('submissioncomment', 'kalvidassign'); $col4 = get_string('timemodified', 'kalvidassign'); $col5 = get_string('grademodified', 'kalvidassign'); @@ -1034,7 +1035,7 @@ public function display_video_container_markup($submission, $courseid, $cmid) { 'class' => 'kaltura-player-iframe', 'src' => ($url instanceof moodle_url) ? $url->out(false) : '', 'allowfullscreen' => 'true', - 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *;', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', 'height' => '100%', 'width' => !empty($submission->width) ? $submission->width : '' ); @@ -1098,7 +1099,7 @@ public function display_grade_feedback($kalvidassign, $context) { // We need the teacher info if (!$teacher = $DB->get_record('user', array('id'=>$gradeby))) { - print_error('cannotfindteacher'); + throw new \moodle_exception('cannotfindteacher'); } // Print the feedback @@ -1126,7 +1127,7 @@ public function display_grade_feedback($kalvidassign, $context) { echo ' '; echo ''; echo '
'; - echo get_string("grade").': '.$grade->str_long_grade; + echo get_string('gradenoun').': '.$grade->str_long_grade; echo '
'; echo '
'; @@ -1149,7 +1150,7 @@ public function render_kalvidassign_course_index_summary(kalvidassign_course_ind $strsectionname = $indexsummary->courseformatname; $strduedate = get_string('duedate', 'kalvidassign'); $strsubmission = get_string('submission', 'kalvidassign'); - $strgrade = get_string('grade'); + $strgrade = get_string('gradenoun'); $table = new html_table(); if ($indexsummary->usesections) { diff --git a/mod/kalvidassign/single_submission.php b/mod/kalvidassign/single_submission.php index 5aa931a4..b646e6b0 100644 --- a/mod/kalvidassign/single_submission.php +++ b/mod/kalvidassign/single_submission.php @@ -39,7 +39,7 @@ require_login($course->id, false, $cm); if (!confirm_sesskey()) { - print_error('confirmsesskeybad', 'error'); + throw new \moodle_exception('confirmsesskeybad', 'error'); } global $CFG, $PAGE, $OUTPUT, $USER; diff --git a/mod/kalvidassign/single_submission_form.php b/mod/kalvidassign/single_submission_form.php index 8a9afe72..45a15bfd 100644 --- a/mod/kalvidassign/single_submission_form.php +++ b/mod/kalvidassign/single_submission_form.php @@ -70,7 +70,7 @@ public function definition() { 'height' => $submission->height, 'width' => $submission->width, 'allowfullscreen' => 'true', - 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *;', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', ); $mform->addElement('html', html_writer::tag('iframe', '', $attr)); } @@ -87,7 +87,7 @@ public function definition() { $grademenu = make_grades_menu($this->_customdata->cminstance->grade); $grademenu['-1'] = get_string('nograde'); - $mform->addElement('select', 'xgrade', get_string('grade').':', $grademenu, $attributes); + $mform->addElement('select', 'xgrade', get_string('gradenoun').':', $grademenu, $attributes); if (isset($submission->grade)) { $mform->setDefault('xgrade', $this->_customdata->submission->grade ); diff --git a/mod/kalvidassign/submission.php b/mod/kalvidassign/submission.php index f108547a..96808e3c 100644 --- a/mod/kalvidassign/submission.php +++ b/mod/kalvidassign/submission.php @@ -25,7 +25,7 @@ require_once(dirname(__FILE__).'/locallib.php'); if (!confirm_sesskey()) { - print_error('confirmsesskeybad', 'error'); + throw new \moodle_exception('confirmsesskeybad', 'error'); } $entryid = required_param('entry_id', PARAM_TEXT); @@ -40,15 +40,15 @@ $source = local_kaltura_build_kaf_uri($source); if (! $cm = get_coursemodule_from_id('kalvidassign', $cmid)) { - print_error('invalidcoursemodule'); + throw new \moodle_exception('invalidcoursemodule'); } if (! $course = $DB->get_record('course', array('id' => $cm->course))) { - print_error('coursemisconf'); + throw new \moodle_exception('coursemisconf'); } if (! $kalvidassignobj = $DB->get_record('kalvidassign', array('id' => $cm->instance))) { - print_error('invalidid', 'kalvidassign'); + throw new \moodle_exception('invalidid', 'kalvidassign'); } require_course_login($course->id, true, $cm); @@ -59,18 +59,18 @@ if (kalvidassign_assignemnt_submission_expired($kalvidassignobj)) { - print_error('assignmentexpired', 'kalvidassign', 'course/view.php?id='.$course->id); + throw new \moodle_exception('assignmentexpired', 'kalvidassign', 'course/view.php?id='.$course->id); } echo $OUTPUT->header(); if (empty($entryid)) { - print_error('emptyentryid', 'kalvidassign', new moodle_url('/mod/kalvidassign/view.php', array('id' => $cm->id))); + throw new \moodle_exception('emptyentryid', 'kalvidassign', new moodle_url('/mod/kalvidassign/view.php', array('id' => $cm->id))); } // If the entry_id field is not empty but the source field is empty, then the data for this activity has not yet been migrated. if (empty($source)) { - print_error('activity_not_migrated', 'kalvidassign', new moodle_url('/mod/kalvidassign/view.php', array('id' => $cm->id))); + throw new \moodle_exception('activity_not_migrated', 'kalvidassign', new moodle_url('/mod/kalvidassign/view.php', array('id' => $cm->id))); } $param = array('vidassignid' => $kalvidassignobj->id, 'userid' => $USER->id); diff --git a/mod/kalvidassign/version.php b/mod/kalvidassign/version.php index 436c8ea8..b16d8af5 100644 --- a/mod/kalvidassign/version.php +++ b/mod/kalvidassign/version.php @@ -25,12 +25,12 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2024042202; +$plugin->version = 2026060700; $plugin->component = 'mod_kalvidassign'; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->cron = 0; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2024042202, + 'local_kaltura' => 2026060700, ); diff --git a/mod/kalvidassign/view.php b/mod/kalvidassign/view.php index cf3f4f18..d8de3bb9 100644 --- a/mod/kalvidassign/view.php +++ b/mod/kalvidassign/view.php @@ -29,7 +29,7 @@ // Retrieve module instance. if (empty($id)) { - print_error('invalidid', 'kalvidassign'); + throw new \moodle_exception('invalidid', 'kalvidassign'); } if (!empty($id)) { diff --git a/mod/kalvidres/mod_form.php b/mod/kalvidres/mod_form.php index 7eb75cf9..ce9d7013 100644 --- a/mod/kalvidres/mod_form.php +++ b/mod/kalvidres/mod_form.php @@ -195,7 +195,7 @@ private function get_iframe_video_preview_markup($hide = true) { 'height' => $height, 'width' => $width, 'allowfullscreen' => 'true', - 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *;', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', ); if ($hide) { diff --git a/mod/kalvidres/renderer.php b/mod/kalvidres/renderer.php index 93e92056..b2e29f21 100644 --- a/mod/kalvidres/renderer.php +++ b/mod/kalvidres/renderer.php @@ -68,7 +68,7 @@ public function display_iframe($kalvidres, $courseid) { 'width' => $kalvidres->width, 'src' => $url->out(false), 'allowfullscreen' => 'true', - 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *;', + 'allow' => 'autoplay *; fullscreen *; encrypted-media *; camera *; microphone *; display-capture *; clipboard-write *; local-network-access *;', ); $iframe = html_writer::tag('iframe', '', $attr); diff --git a/mod/kalvidres/version.php b/mod/kalvidres/version.php index f025a08f..e3b7f206 100644 --- a/mod/kalvidres/version.php +++ b/mod/kalvidres/version.php @@ -25,12 +25,12 @@ die('Direct access to this script is forbidden.'); } -$plugin->version = 2024042202; +$plugin->version = 2026060700; $plugin->component = 'mod_kalvidres'; -$plugin->release = 'Kaltura release 4.5.0'; -$plugin->requires = 2024042200; +$plugin->release = 'Kaltura release 4.5.4'; +$plugin->requires = 2026042000; $plugin->cron = 0; $plugin->maturity = MATURITY_STABLE; $plugin->dependencies = array( - 'local_kaltura' => 2024042202 + 'local_kaltura' => 2026060700 ); diff --git a/mod/kalvidres/view.php b/mod/kalvidres/view.php index 08475715..baa002af 100644 --- a/mod/kalvidres/view.php +++ b/mod/kalvidres/view.php @@ -27,21 +27,21 @@ // Retrieve module instance. if (empty($id)) { - print_error('invalidid', 'kalvidres'); + throw new \moodle_exception('invalidid', 'kalvidres'); } if (!empty($id)) { if (!$cm = get_coursemodule_from_id('kalvidres', $id)) { - print_error('invalidcoursemodule'); + throw new \moodle_exception('invalidcoursemodule'); } if (!$course = $DB->get_record('course', array('id' => $cm->course))) { - print_error('coursemisconf'); + throw new \moodle_exception('coursemisconf'); } if (!$kalvidres = $DB->get_record('kalvidres', array("id" => $cm->instance))) { - print_error('invalidid', 'kalvidres'); + throw new \moodle_exception('invalidid', 'kalvidres'); } }