first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
define("core_h5p/editor_display",["exports","jquery"],(function(_exports,_jquery){var obj;
/**
* This module handles the display of the H5P authoring tool.
*
* @module core_h5p/editor_display
* @copyright 2020 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj};_exports.init=elementId=>{const editorwrapper=(0,_jquery.default)("#"+elementId),editor=(0,_jquery.default)(".h5p-editor"),mform=editor.closest("form"),editorupload=(0,_jquery.default)("h5p-editor-upload"),h5plibrary=(0,_jquery.default)('input[name="h5plibrary"]'),h5pparams=(0,_jquery.default)('input[name="h5pparams"]'),inputname=(0,_jquery.default)('input[name="name"]'),h5paction=(0,_jquery.default)('input[name="h5paction"]');h5paction.val("create"),H5PEditor.init(mform,h5paction,editorupload,editorwrapper,editor,h5plibrary,h5pparams,"",inputname,(function($button){return $button.is('[name="cancel"]')})),document.querySelector("#"+elementId+" iframe").setAttribute("name","h5p-editor")}}));
//# sourceMappingURL=editor_display.min.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"editor_display.min.js","sources":["../src/editor_display.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\n/**\n * This module handles the display of the H5P authoring tool.\n *\n * @module core_h5p/editor_display\n * @copyright 2020 Victor Deniz <victor@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\n/* global H5PEditor */\n\n/**\n * Display the H5P authoring tool.\n *\n * @param {String} elementId Root element.\n */\nexport const init = (elementId) => {\n const editorwrapper = $('#' + elementId);\n const editor = $('.h5p-editor');\n const mform = editor.closest(\"form\");\n const editorupload = $(\"h5p-editor-upload\");\n const h5plibrary = $('input[name=\"h5plibrary\"]');\n const h5pparams = $('input[name=\"h5pparams\"]');\n const inputname = $('input[name=\"name\"]');\n const h5paction = $('input[name=\"h5paction\"]');\n\n // Cancel validation and submission of form if clicking cancel button.\n const cancelSubmitCallback = function($button) {\n return $button.is('[name=\"cancel\"]');\n };\n\n h5paction.val(\"create\");\n\n H5PEditor.init(\n mform,\n h5paction,\n editorupload,\n editorwrapper,\n editor,\n h5plibrary,\n h5pparams,\n '',\n inputname,\n cancelSubmitCallback\n );\n document.querySelector('#' + elementId + ' iframe').setAttribute('name', 'h5p-editor');\n};\n"],"names":["elementId","editorwrapper","editor","mform","closest","editorupload","h5plibrary","h5pparams","inputname","h5paction","val","H5PEditor","init","$button","is","document","querySelector","setAttribute"],"mappings":";;;;;;;wJA+BqBA,kBACXC,eAAgB,mBAAE,IAAMD,WACxBE,QAAS,mBAAE,eACXC,MAAQD,OAAOE,QAAQ,QACvBC,cAAe,mBAAE,qBACjBC,YAAa,mBAAE,4BACfC,WAAY,mBAAE,2BACdC,WAAY,mBAAE,sBACdC,WAAY,mBAAE,2BAOpBA,UAAUC,IAAI,UAEdC,UAAUC,KACNT,MACAM,UACAJ,aACAJ,cACAC,OACAI,WACAC,UACA,GACAC,WAfyB,SAASK,gBAC3BA,QAAQC,GAAG,sBAiBtBC,SAASC,cAAc,IAAMhB,UAAY,WAAWiB,aAAa,OAAQ"}
+10
View File
@@ -0,0 +1,10 @@
define("core_h5p/repository",["exports","core/ajax","core/config"],(function(_exports,_ajax,config){function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.postStatement=_exports.postState=_exports.deleteState=void 0,config=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}
/**
* Module to handle AJAX interactions.
*
* @module core_h5p/repository
* @copyright 2023 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/(config);_exports.postStatement=(component,statements)=>(0,_ajax.call)([{methodname:"core_xapi_statement_post",args:{component:component,requestjson:JSON.stringify(statements)}}])[0];_exports.postState=(component,activityId,agent,stateId,stateData)=>{const requestUrl=new URL("".concat(config.wwwroot,"/lib/ajax/service.php"));requestUrl.searchParams.set("sesskey",config.sesskey),navigator.sendBeacon(requestUrl,JSON.stringify([{index:0,methodname:"core_xapi_post_state",args:{component:component,activityId:activityId,agent:JSON.stringify(agent),stateId:stateId,stateData:stateData}}]))};_exports.deleteState=(component,activityId,agent,stateId)=>(0,_ajax.call)([{methodname:"core_xapi_delete_state",args:{component:component,activityId:activityId,agent:JSON.stringify(agent),stateId:stateId}}])[0]}));
//# sourceMappingURL=repository.min.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"repository.min.js","sources":["../src/repository.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\n/**\n * Module to handle AJAX interactions.\n *\n * @module core_h5p/repository\n * @copyright 2023 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\nimport {call as fetchMany} from 'core/ajax';\nimport * as config from 'core/config';\n\n/**\n * Send a xAPI statement to LMS.\n *\n * @param {string} component\n * @param {Object} statements\n * @returns {Promise}\n */\nexport const postStatement = (component, statements) => fetchMany([{\n methodname: 'core_xapi_statement_post',\n args: {\n component,\n requestjson: JSON.stringify(statements),\n }\n}])[0];\n\n/**\n * Send a xAPI state to LMS.\n *\n * @param {string} component\n * @param {string} activityId\n * @param {Object} agent\n * @param {string} stateId\n * @param {string} stateData\n */\nexport const postState = (\n component,\n activityId,\n agent,\n stateId,\n stateData,\n) => {\n // Please note that we must use a Beacon send here.\n // The XHR is not guaranteed because it will be aborted on page transition.\n // https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API\n // Note: Moodle does not currently have a sendBeacon API endpoint.\n const requestUrl = new URL(`${config.wwwroot}/lib/ajax/service.php`);\n requestUrl.searchParams.set('sesskey', config.sesskey);\n\n navigator.sendBeacon(requestUrl, JSON.stringify([{\n index: 0,\n methodname: 'core_xapi_post_state',\n args: {\n component,\n activityId,\n agent: JSON.stringify(agent),\n stateId,\n stateData,\n }\n }]));\n};\n\n/**\n * Delete a xAPI state from LMS.\n *\n * @param {string} component\n * @param {string} activityId\n * @param {Object} agent\n * @param {string} stateId\n * @returns {Promise}\n */\nexport const deleteState = (\n component,\n activityId,\n agent,\n stateId,\n) => fetchMany([{\n methodname: 'core_xapi_delete_state',\n args: {\n component,\n activityId,\n agent: JSON.stringify(agent),\n stateId,\n },\n}])[0];\n"],"names":["component","statements","methodname","args","requestjson","JSON","stringify","activityId","agent","stateId","stateData","requestUrl","URL","config","wwwroot","searchParams","set","sesskey","navigator","sendBeacon","index"],"mappings":";;;;;;;qCAgC6B,CAACA,UAAWC,cAAe,cAAU,CAAC,CAC/DC,WAAY,2BACZC,KAAM,CACFH,UAAAA,UACAI,YAAaC,KAAKC,UAAUL,gBAEhC,sBAWqB,CACrBD,UACAO,WACAC,MACAC,QACAC,mBAMMC,WAAa,IAAIC,cAAOC,OAAOC,kCACrCH,WAAWI,aAAaC,IAAI,UAAWH,OAAOI,SAE9CC,UAAUC,WAAWR,WAAYN,KAAKC,UAAU,CAAC,CAC7Cc,MAAO,EACPlB,WAAY,uBACZC,KAAM,CACFH,UAAAA,UACAO,WAAAA,WACAC,MAAOH,KAAKC,UAAUE,OACtBC,QAAAA,QACAC,UAAAA,qCAce,CACvBV,UACAO,WACAC,MACAC,WACC,cAAU,CAAC,CACZP,WAAY,yBACZC,KAAM,CACFH,UAAAA,UACAO,WAAAA,WACAC,MAAOH,KAAKC,UAAUE,OACtBC,QAAAA,YAEJ"}
+62
View File
@@ -0,0 +1,62 @@
// 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 <http://www.gnu.org/licenses/>.
/**
* This module handles the display of the H5P authoring tool.
*
* @module core_h5p/editor_display
* @copyright 2020 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import $ from 'jquery';
/* global H5PEditor */
/**
* Display the H5P authoring tool.
*
* @param {String} elementId Root element.
*/
export const init = (elementId) => {
const editorwrapper = $('#' + elementId);
const editor = $('.h5p-editor');
const mform = editor.closest("form");
const editorupload = $("h5p-editor-upload");
const h5plibrary = $('input[name="h5plibrary"]');
const h5pparams = $('input[name="h5pparams"]');
const inputname = $('input[name="name"]');
const h5paction = $('input[name="h5paction"]');
// Cancel validation and submission of form if clicking cancel button.
const cancelSubmitCallback = function($button) {
return $button.is('[name="cancel"]');
};
h5paction.val("create");
H5PEditor.init(
mform,
h5paction,
editorupload,
editorwrapper,
editor,
h5plibrary,
h5pparams,
'',
inputname,
cancelSubmitCallback
);
document.querySelector('#' + elementId + ' iframe').setAttribute('name', 'h5p-editor');
};
+99
View File
@@ -0,0 +1,99 @@
// 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 <http://www.gnu.org/licenses/>.
/**
* Module to handle AJAX interactions.
*
* @module core_h5p/repository
* @copyright 2023 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import {call as fetchMany} from 'core/ajax';
import * as config from 'core/config';
/**
* Send a xAPI statement to LMS.
*
* @param {string} component
* @param {Object} statements
* @returns {Promise}
*/
export const postStatement = (component, statements) => fetchMany([{
methodname: 'core_xapi_statement_post',
args: {
component,
requestjson: JSON.stringify(statements),
}
}])[0];
/**
* Send a xAPI state to LMS.
*
* @param {string} component
* @param {string} activityId
* @param {Object} agent
* @param {string} stateId
* @param {string} stateData
*/
export const postState = (
component,
activityId,
agent,
stateId,
stateData,
) => {
// Please note that we must use a Beacon send here.
// The XHR is not guaranteed because it will be aborted on page transition.
// https://developer.mozilla.org/en-US/docs/Web/API/Beacon_API
// Note: Moodle does not currently have a sendBeacon API endpoint.
const requestUrl = new URL(`${config.wwwroot}/lib/ajax/service.php`);
requestUrl.searchParams.set('sesskey', config.sesskey);
navigator.sendBeacon(requestUrl, JSON.stringify([{
index: 0,
methodname: 'core_xapi_post_state',
args: {
component,
activityId,
agent: JSON.stringify(agent),
stateId,
stateData,
}
}]));
};
/**
* Delete a xAPI state from LMS.
*
* @param {string} component
* @param {string} activityId
* @param {Object} agent
* @param {string} stateId
* @returns {Promise}
*/
export const deleteState = (
component,
activityId,
agent,
stateId,
) => fetchMany([{
methodname: 'core_xapi_delete_state',
args: {
component,
activityId,
agent: JSON.stringify(agent),
stateId,
},
}])[0];