diff --git a/amd/build/communicator.min.js b/amd/build/communicator.min.js index 25419cf99..121bdbe95 100644 --- a/amd/build/communicator.min.js +++ b/amd/build/communicator.min.js @@ -1 +1,3 @@ -define([],function(){var a=function(){this._actionHandlers={},this.registerEventListeners()};return a.prototype._actionHandlers={},a.prototype.on=function(a,b){this._actionHandlers[a]=b},a.prototype.send=function(a,b){void 0===b&&(b={}),b.context="h5p",b.action=a,window.parent.postMessage(b,"*")},a.prototype.registerEventListeners=function(){var a=this;window.addEventListener("message",function(b){window.parent===b.source&&"h5p"===b.data.context&&void 0!==a._actionHandlers[b.data.action]&&a._actionHandlers[b.data.action](b.data)},!1)},new a}); \ No newline at end of file +define("mod_hvp/communicator",[],(function(){var H5PEmbedCommunicator=function(){this._actionHandlers={},this.registerEventListeners()};return H5PEmbedCommunicator.prototype._actionHandlers={},H5PEmbedCommunicator.prototype.on=function(action,handler){this._actionHandlers[action]=handler},H5PEmbedCommunicator.prototype.send=function(action,data){void 0===data&&(data={}),data.context="h5p",data.action=action,window.parent.postMessage(data,"*")},H5PEmbedCommunicator.prototype.registerEventListeners=function(){var self=this;window.addEventListener("message",(function(event){window.parent===event.source&&"h5p"===event.data.context&&void 0!==self._actionHandlers[event.data.action]&&self._actionHandlers[event.data.action](event.data)}),!1)},new H5PEmbedCommunicator})); + +//# sourceMappingURL=communicator.min.js.map \ No newline at end of file diff --git a/amd/build/communicator.min.js.map b/amd/build/communicator.min.js.map new file mode 100644 index 000000000..57950354d --- /dev/null +++ b/amd/build/communicator.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"communicator.min.js","sources":["../src/communicator.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\ndefine([], function() {\n\n /**\n * When embedded the communicator helps talk to the parent page.\n * This is a copy of the H5P.communicator, which we need to communicate in this context\n */\n var H5PEmbedCommunicator = function() {\n this._actionHandlers = {};\n this.registerEventListeners();\n };\n\n /** @type {Object} Maps actions to functions. */\n H5PEmbedCommunicator.prototype._actionHandlers = {};\n\n /**\n * Register action listener.\n *\n * @param {string} action What you are waiting for\n * @param {function} handler What you want done\n */\n H5PEmbedCommunicator.prototype.on = function(action, handler) {\n this._actionHandlers[action] = handler;\n };\n\n /**\n * Send a message to the all mighty father.\n *\n * @param {string} action\n * @param {Object} [data] payload\n */\n H5PEmbedCommunicator.prototype.send = function(action, data) {\n if (data === undefined) {\n data = {};\n }\n data.context = 'h5p';\n data.action = action;\n\n // Parent origin can be anything.\n window.parent.postMessage(data, '*');\n };\n\n\n /**\n * Register event listeners for the communicator.\n *\n * @method registerEventListeners\n */\n H5PEmbedCommunicator.prototype.registerEventListeners = function() {\n var self = this;\n // Register message listener.\n window.addEventListener('message', function receiveMessage(event) {\n if (window.parent !== event.source || event.data.context !== 'h5p') {\n return; // Only handle messages from parent and in the correct context.\n }\n\n if (self._actionHandlers[event.data.action] !== undefined) {\n self._actionHandlers[event.data.action](event.data);\n }\n }, false);\n };\n\n return new H5PEmbedCommunicator();\n\n});\n"],"names":["define","H5PEmbedCommunicator","_actionHandlers","registerEventListeners","prototype","on","action","handler","send","data","undefined","context","window","parent","postMessage","self","this","addEventListener","event","source"],"mappings":"AAeAA,8BAAO,IAAI,eAMHC,qBAAuB,gBAClBC,gBAAkB,QAClBC,iCAITF,qBAAqBG,UAAUF,gBAAkB,GAQjDD,qBAAqBG,UAAUC,GAAK,SAASC,OAAQC,cAC5CL,gBAAgBI,QAAUC,SASnCN,qBAAqBG,UAAUI,KAAO,SAASF,OAAQG,WACtCC,IAATD,OACAA,KAAO,IAEXA,KAAKE,QAAU,MACfF,KAAKH,OAASA,OAGdM,OAAOC,OAAOC,YAAYL,KAAM,MASpCR,qBAAqBG,UAAUD,uBAAyB,eAChDY,KAAOC,KAEXJ,OAAOK,iBAAiB,WAAW,SAAwBC,OACnDN,OAAOC,SAAWK,MAAMC,QAAiC,QAAvBD,MAAMT,KAAKE,cAIDD,IAA5CK,KAAKb,gBAAgBgB,MAAMT,KAAKH,SAChCS,KAAKb,gBAAgBgB,MAAMT,KAAKH,QAAQY,MAAMT,SAEnD,IAGA,IAAIR"} \ No newline at end of file diff --git a/amd/build/contenthubregistration.min.js b/amd/build/contenthubregistration.min.js index 8facaa975..41eabb452 100644 --- a/amd/build/contenthubregistration.min.js +++ b/amd/build/contenthubregistration.min.js @@ -1,2 +1,3 @@ -define ("mod_hvp/contenthubregistration",[],function(){return{init:function init(){var a=H5PSettings;a.container=document.getElementById("h5p-hub-registration");H5PHub.createRegistrationUI(a)}}}); -//# sourceMappingURL=contenthubregistration.min.js.map +define("mod_hvp/contenthubregistration",[],(function(){return{init:function(){const settings=H5PSettings;settings.container=document.getElementById("h5p-hub-registration"),H5PHub.createRegistrationUI(settings)}}})); + +//# sourceMappingURL=contenthubregistration.min.js.map \ No newline at end of file diff --git a/amd/build/contenthubregistration.min.js.map b/amd/build/contenthubregistration.min.js.map index f21897dd7..9f1e4405f 100644 --- a/amd/build/contenthubregistration.min.js.map +++ b/amd/build/contenthubregistration.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/contenthubregistration.js"],"names":["define","init","settings","H5PSettings","container","document","getElementById","H5PHub","createRegistrationUI"],"mappings":"AAAAA,OAAM,kCAAC,EAAD,CAAK,UAAY,CACrB,MAAO,CACLC,IAAI,CAAE,eAAY,CAEhB,GAAMC,CAAAA,CAAQ,CAAGC,WAAjB,CACAD,CAAQ,CAACE,SAAT,CAAqBC,QAAQ,CAACC,cAAT,CAAwB,sBAAxB,CAArB,CACAC,MAAM,CAACC,oBAAP,CAA4BN,CAA5B,CACD,CANI,CAQR,CATK,CAAN","sourcesContent":["define([], function () {\n return {\n init: function () {\n // Moodle complains if you pass in settings through init (js_call_amd) since they are too large\n const settings = H5PSettings;\n settings.container = document.getElementById('h5p-hub-registration');\n H5PHub.createRegistrationUI(settings);\n },\n };\n});\n"],"file":"contenthubregistration.min.js"} \ No newline at end of file +{"version":3,"file":"contenthubregistration.min.js","sources":["../src/contenthubregistration.js"],"sourcesContent":["define([], function () {\n return {\n init: function () {\n // Moodle complains if you pass in settings through init (js_call_amd) since they are too large\n const settings = H5PSettings;\n settings.container = document.getElementById('h5p-hub-registration');\n H5PHub.createRegistrationUI(settings);\n },\n };\n});\n"],"names":["define","init","settings","H5PSettings","container","document","getElementById","H5PHub","createRegistrationUI"],"mappings":"AAAAA,wCAAO,IAAI,iBACF,CACLC,KAAM,iBAEEC,SAAWC,YACjBD,SAASE,UAAYC,SAASC,eAAe,wBAC7CC,OAAOC,qBAAqBN"} \ No newline at end of file diff --git a/editor b/editor index 53dc7bdc5..80b3b281e 160000 --- a/editor +++ b/editor @@ -1 +1 @@ -Subproject commit 53dc7bdc57b17f5a0d55a8871a36d1b1bd631e70 +Subproject commit 80b3b281ee9d064b563f242e8ee7a0026b5bf205 diff --git a/lang/en/hvp.php b/lang/en/hvp.php index 04c94970a..cdc83efe2 100644 --- a/lang/en/hvp.php +++ b/lang/en/hvp.php @@ -500,6 +500,8 @@ $string['contenthub:licenseagreementtitle'] = 'End User License Agreement (EULA)'; $string['contenthub:licenseagreementdescription'] = 'Please read the following agreement before proceeding with the '; $string['contenthub:licenseagreementmaintext'] = 'TODO'; +$string['contenthubsearchenable'] = 'Enable shared content in H5P Hub'; +$string['contenthubsearchdescription'] = 'Find and download shared content from H5P Hub.'; $string['contenthub:register'] = 'Register an account on the H5P Hub <a href="{$a}">here</a>'; $string['contenthub:changesettings'] = 'Change account settings <a href="{$a}">here</a>'; $string['contenthub:nopermissions'] = 'You do not have permission to register the site with the content hub.'; diff --git a/locallib.php b/locallib.php index 8c4df6133..1586e8214 100644 --- a/locallib.php +++ b/locallib.php @@ -247,9 +247,7 @@ function hvp_add_editor_assets($id = null, $mformid = null) { $editorajaxtoken = \H5PCore::createToken('editorajax'); $interface = \mod_hvp\framework::instance('interface'); - $siteuuid = $interface->getOption('site_uuid', null); - $secret = $interface->getOption('hub_secret', null); - $enablecontenthub = !empty($siteuuid) && !empty($secret); + $enablecontenthub = ($interface->getOption('hub_is_enabled', null) ? $interface->getOption('h5p_search_content_hub', null) : "0") === "1"; $settings['editor'] = array( 'filesPath' => $filespathbase . 'editor', diff --git a/settings.php b/settings.php index 7da313012..8d18501a4 100644 --- a/settings.php +++ b/settings.php @@ -136,6 +136,14 @@ '' )); + // Content Hub on by default for all users + $settings->add( + new admin_setting_configcheckbox( + 'mod_hvp/h5p_search_content_hub', + get_string('contenthubsearchenable', 'hvp'), + get_string('contenthubsearchdescription', 'hvp'), 1)); + + // Register on the Content Hub to allow uploading content $settings->add(new admin_setting_html( 'mod_hvp/content_hub_settings_box', get_string('contenthub:settings:box', 'hvp'), diff --git a/version.php b/version.php index 0e97a1601..95b0535d7 100644 --- a/version.php +++ b/version.php @@ -23,10 +23,10 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2023122503; +$plugin->version = 2024112100; $plugin->requires = 2013051403; $plugin->cron = 0; $plugin->component = 'mod_hvp'; $plugin->maturity = MATURITY_STABLE; -$plugin->release = '1.26.1'; $plugin->supported = [400, 404]; +$plugin->release = '1.27.1';