Compare commits
106 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
5e3d610451 | ||
|
6b707cc595 | ||
|
108a612e8c | ||
|
9988ed1a3d | ||
|
8c1be03e5d | ||
|
95fabecc60 | ||
|
9737398629 | ||
|
bc774533f4 | ||
|
6518e00a31 | ||
|
d5b8d8993a | ||
|
1eb862a3ea | ||
|
b0a61d018c | ||
|
a00af55f66 | ||
|
b5e8033680 | ||
|
65c9537bd3 | ||
|
9c89038baa | ||
|
de57dc063c | ||
|
1e4f399baf | ||
|
743cb82cc9 | ||
|
fd9d50873e | ||
|
13523670cb | ||
|
a9595974bb | ||
|
b1c6ddd665 | ||
|
073e8e0b28 | ||
|
8299d4c9d1 | ||
|
53be9d3cce | ||
|
0f8d6d8a59 | ||
|
fbe34189f6 | ||
|
30fb9dd149 | ||
|
c2c5383e10 | ||
|
3bef1118b2 | ||
|
1b89bb87a6 | ||
|
ae8f2b6841 | ||
|
31c4e758ea | ||
|
8adaf04cd3 | ||
|
4cc04371a0 | ||
|
675455630d | ||
|
9b4ead935e | ||
|
e6307a9308 | ||
|
aaa8c79df4 | ||
|
ba9d58c01d | ||
|
6b9826934f | ||
|
b60e5065f0 | ||
|
46f8575291 | ||
|
5c1f21cee0 | ||
|
e999fdb125 | ||
|
dbb1386b7d | ||
|
2268aba9d5 | ||
|
520034bb5f | ||
|
64c821bbe9 | ||
|
e72be595aa | ||
|
4c669ff08c | ||
|
ebdb39c5ca | ||
|
3d53966b5a | ||
|
8b5cad01f8 | ||
|
742f9ef772 | ||
|
3d48f290d6 | ||
|
de8e8199ca | ||
|
ee0a9c3d3a | ||
|
4fd1e3a547 | ||
|
c88f132201 | ||
|
582db40016 | ||
|
09c6e4b029 | ||
|
3dd1682f5a | ||
|
ebc3632788 | ||
|
5dc94a7525 | ||
|
ff9044ae9a | ||
|
3ba4d4d4c5 | ||
|
5bd10de529 | ||
|
39d184c2e9 | ||
|
50110a3e0f | ||
|
9caf652ff5 | ||
|
bcb288bac8 | ||
|
9a1b32855f | ||
|
c938b994a1 | ||
|
97ce14fe20 | ||
|
be0141eb7b | ||
|
12efb061f1 | ||
|
886a11d99e | ||
|
82838c57c5 | ||
|
2369610903 | ||
|
88744c2b66 | ||
|
d225d82038 | ||
|
0163471a92 | ||
|
383c07becd | ||
|
310f042772 | ||
|
3002a866bb | ||
|
747e1decd1 | ||
|
f2fac43139 | ||
|
7dbcb437c3 | ||
|
6bb13de5cf | ||
|
500555e785 | ||
|
25a5ff8398 | ||
|
c480c20098 | ||
|
a57ee3d884 | ||
|
35afe06a91 | ||
|
d713e24e32 | ||
|
079e2f77cc | ||
|
8938facdef | ||
|
f20a724c52 | ||
|
d07e6170f3 | ||
|
8382c4a117 | ||
|
61256207be | ||
|
7ea7576ac8 | ||
|
1fe4db6328 | ||
|
9619fd17de |
10
.vscode/settings.json
vendored
10
.vscode/settings.json
vendored
|
@ -2,5 +2,13 @@
|
|||
"intelephense.environment.includePaths": [
|
||||
"/srv/moodle4/moodle"
|
||||
],
|
||||
"intelephense.diagnostics.undefinedProperties": false
|
||||
"intelephense.diagnostics.undefinedProperties": false,
|
||||
"spellright.language": [
|
||||
"en"
|
||||
],
|
||||
"spellright.documentTypes": [
|
||||
"markdown",
|
||||
"latex",
|
||||
"plaintext"
|
||||
]
|
||||
}
|
46
Gruntfile.js
46
Gruntfile.js
|
@ -1,3 +1,4 @@
|
|||
/* eslint no-console: "off" */
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
|
@ -16,13 +17,16 @@
|
|||
/* eslint-env node */
|
||||
|
||||
/**
|
||||
* Grunt configuration for local_treestudyplan
|
||||
* Grunt configuration for local_treestudyplan.
|
||||
* Note that currently on the 4.1 developement environment, the method described
|
||||
* on https://moodledev.io/general/development/tools/nodejs#using-grunt-in-additional-plugins
|
||||
* is not working as expected. Once development environment is changed to 4.3 or 4.4 I will
|
||||
* try this again.
|
||||
*
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Grunt configuration.
|
||||
*
|
||||
|
@ -34,48 +38,48 @@ module.exports = function(grunt) {
|
|||
const sass = require('sass');
|
||||
|
||||
// Import grunt configuration for moodle base
|
||||
process.chdir("../.."); // change dir to moodle base
|
||||
process.chdir("../.."); // Change dir to moodle base
|
||||
require(path.resolve(`./Gruntfile.js`))(grunt); // Run Gruntfile module from moodle base
|
||||
|
||||
grunt.registerTask('scssplugin','Compile scss/*.sccs into styles.css and css/devstyles.css', () => {
|
||||
grunt.registerTask('scssplugin', 'Compile scss/styles.sccs into styles.css and css/devstyles.css', () => {
|
||||
|
||||
const devoutput = 'css/devstyles.css';
|
||||
const prodoutput = 'styles.css';
|
||||
|
||||
// Get full path of compenent and scss folder
|
||||
const componentPath = path.join(grunt.moodleEnv.gruntFilePath,grunt.moodleEnv.componentDirectory);
|
||||
const scssPath = path.join(componentPath, 'scss','styles.scss');
|
||||
const componentPath = path.join(grunt.moodleEnv.gruntFilePath, grunt.moodleEnv.componentDirectory);
|
||||
const scssPath = path.join(componentPath, 'scss', 'styles.scss');
|
||||
console.log(`Compiling ${scssPath} including any imported files therein`);
|
||||
|
||||
process.chdir(path.join(componentPath, 'scss'));
|
||||
const result = sass.compile(scssPath);
|
||||
if ( result ) {
|
||||
if (result) {
|
||||
console.info("got result");
|
||||
|
||||
// Some regex processing to match moodle stylelint styles
|
||||
|
||||
// change tab indent to 4 instead of 2
|
||||
let css = result.css.replace(/^ ([^ ])/gm ," $1");
|
||||
// Change tab indent to 4 instead of 2
|
||||
let css = result.css.replace(/^ {2}([^ ])/gm, " $1");
|
||||
|
||||
// insert a newline after every comma in a css selector
|
||||
// Insert a newline after every comma in a css selector
|
||||
// (only combined selectors will get that long)
|
||||
css = css.replace(/^[^ ].*[\{,]$/gm , (m) => { // Find CSS selector lines
|
||||
return m.replace(/, /g,",\n"); // replace comma followed by space with comma newline
|
||||
css = css.replace(/^[^ ].*[{,]$/gm, (m) => { // Find CSS selector lines
|
||||
return m.replace(/, /g, ",\n"); // Replace comma followed by space with comma newline
|
||||
});
|
||||
|
||||
// replace hex color codes with lowercase (convenience function since I don't really care for the hex codes lowercase only rule)
|
||||
// Replace hex color codes with lowercase.
|
||||
const hexCodeToLower = (match, m1, m2) => {
|
||||
return '#'+m1.toLowerCase()+m2;
|
||||
}
|
||||
css = css.replace(/#([A-F0-9a-f]{3})([^A-F0-9a-f]?)/gm , hexCodeToLower); // 3 digit color codes
|
||||
css = css.replace(/#([A-F0-9a-f]{6})([^A-F0-9a-f]?)/gm , hexCodeToLower); // 6 digit color codes
|
||||
css = css.replace(/#([A-F0-9a-f]{8})([^A-F0-9a-f]?)/gm , hexCodeToLower); // 8 digit color codes (with alpha)
|
||||
return '#' + m1.toLowerCase() + m2;
|
||||
};
|
||||
css = css.replace(/#([A-F0-9a-f]{3})([^A-F0-9a-f]?)/gm, hexCodeToLower); // 3 digit color codes
|
||||
css = css.replace(/#([A-F0-9a-f]{6})([^A-F0-9a-f]?)/gm, hexCodeToLower); // 6 digit color codes
|
||||
css = css.replace(/#([A-F0-9a-f]{8})([^A-F0-9a-f]?)/gm, hexCodeToLower); // 8 digit color codes (with alpha)
|
||||
|
||||
// All other errors should really be fixed in the scss files :)
|
||||
|
||||
[devoutput,prodoutput].forEach((output) => {
|
||||
[devoutput, prodoutput].forEach((output) => {
|
||||
console.info(`Storing ${output}`);
|
||||
grunt.file.write(path.join(componentPath, output),css);
|
||||
grunt.file.write(path.join(componentPath, output), css);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -92,7 +96,7 @@ module.exports = function(grunt) {
|
|||
});
|
||||
|
||||
// Remove gherkinlint from the startup list, since it exits with an error because of errors in moodle's own code
|
||||
grunt.moodleEnv.startupTasks.splice(grunt.moodleEnv.startupTasks.indexOf("gherkinlint"),1);
|
||||
grunt.moodleEnv.startupTasks.splice(grunt.moodleEnv.startupTasks.indexOf("gherkinlint"), 1);
|
||||
|
||||
// Add the 'scssplugin' task as a startup task.
|
||||
grunt.moodleEnv.startupTasks.push('scssplugin');
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
# Moodle studyplan plugin
|
||||
|
||||
Plugin to organize a curriculum into an easy to read graphical respresentation of courses and student progress therein.
|
||||
Plugin to organize a curriculum into an easy to read graphical representation of courses and student progress therein.
|
||||
|
||||
The studyplan plugin extends Moodle with the ability to show students and teachers an overview of their curriculum and results therein.
|
||||
By showing students an easy to read graphical overview of their progress over multiple courses, students are more in control of their own
|
||||
learning process than by just listing results alone
|
||||
|
||||
## Installing
|
||||
Install the plugin by adding the zip file manually to the installed plugins in your moodle version
|
||||
Install the plugin by adding the zip file manually to the installed plugins in your Moodle version
|
||||
|
||||
## Configuration post install
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
2
amd/build/cfg-grades.min.js
vendored
2
amd/build/cfg-grades.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/cfg-grades",["exports","core/str","core/ajax","./debugger","./string-helper"],(function(_exports,_str,_ajax,_debugger,_stringHelper){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){{const intRx=/\d/,integerChange=event=>{event.key.length>1||intRx.test(event.key)||event.preventDefault()};for(let input of document.querySelectorAll('input[type="number"][step="1"][min="0"]'))input.addEventListener("keydown",integerChange)}{const decimal=/^[0-9]*?\.[0-9]*?$/,intRx=/\d/,floatChange=event=>{event.key.length>1||"."===event.key&&!event.currentTarget.value.match(decimal)||intRx.test(event.key)||event.preventDefault()};for(let input of document.querySelectorAll('input[type="number"][min="0"]:not([step])'))input.addEventListener("keydown",floatChange);for(let input of document.querySelectorAll('input[type="text"].float'))input.addEventListener("keydown",floatChange)}};new(_debugger=(obj=_debugger)&&obj.__esModule?obj:{default:obj}).default("treestudyplan-config-grades")}));
|
||||
define("local_treestudyplan/cfg-grades",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){{const intRx=/\d/,integerChange=event=>{event.key.length>1||intRx.test(event.key)||event.preventDefault()};for(let input of document.querySelectorAll('input[type="number"][step="1"][min="0"]'))input.addEventListener("keydown",integerChange)}{const decimal=/^[0-9]*?\.[0-9]*?$/,intRx=/\d/,floatChange=event=>{event.key.length>1||"."===event.key&&!event.currentTarget.value.match(decimal)||intRx.test(event.key)||event.preventDefault()};for(let input of document.querySelectorAll('input[type="number"][min="0"]:not([step])'))input.addEventListener("keydown",floatChange);for(let input of document.querySelectorAll('input[type="text"].float'))input.addEventListener("keydown",floatChange)}}}));
|
||||
|
||||
//# sourceMappingURL=cfg-grades.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"cfg-grades.min.js","sources":["../src/cfg-grades.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport {get_string,get_strings} from 'core/str';\nimport {call} from 'core/ajax';\nimport Debugger from './debugger';\n\nimport {load_strings} from './string-helper';\n\nlet debug = new Debugger(\"treestudyplan-config-grades\");\n\n/*\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n*/\n\n/**\n * Initialize grade cfg page\n */\nexport function init() {\n { const\n intRx = /\\d/,\n integerChange = (event) => {\n if ( (event.key.length > 1) || intRx.test(event.key)\n ) {\n return;\n }\n event.preventDefault();\n };\n\n for (let input of document.querySelectorAll( 'input[type=\"number\"][step=\"1\"][min=\"0\"]' )){\n input.addEventListener(\"keydown\", integerChange);\n }\n\n }\n\n { const\n decimal= /^[0-9]*?\\.[0-9]*?$/,\n intRx = /\\d/,\n floatChange = (event) => {\n if ( (event.key.length > 1) || ( (event.key === \".\") && (!event.currentTarget.value.match(decimal)) )\n || intRx.test(event.key)\n ) {\n return;\n }\n event.preventDefault();\n };\n\n for (let input of document.querySelectorAll( 'input[type=\"number\"][min=\"0\"]:not([step])' )){\n input.addEventListener(\"keydown\", floatChange);\n }\n for (let input of document.querySelectorAll( 'input[type=\"text\"].float' )){\n input.addEventListener(\"keydown\", floatChange);\n }\n\n }\n\n\n}\n\n"],"names":["intRx","integerChange","event","key","length","test","preventDefault","input","document","querySelectorAll","addEventListener","decimal","floatChange","currentTarget","value","match"],"mappings":"iQA6BQA,MAAQ,KACRC,cAAiBC,QACTA,MAAMC,IAAIC,OAAS,GAAMJ,MAAMK,KAAKH,MAAMC,MAIhDD,MAAMI,sBAGL,IAAIC,SAASC,SAASC,iBAAkB,2CAC3CF,MAAMG,iBAAiB,UAAWT,sBAMlCU,QAAS,qBACTX,MAAQ,KACRY,YAAeV,QACPA,MAAMC,IAAIC,OAAS,GAAuB,MAAdF,MAAMC,MAAkBD,MAAMW,cAAcC,MAAMC,MAAMJ,UACjFX,MAAMK,KAAKH,MAAMC,MAI1BD,MAAMI,sBAGL,IAAIC,SAASC,SAASC,iBAAkB,6CAC3CF,MAAMG,iBAAiB,UAAWE,iBAE/B,IAAIL,SAASC,SAASC,iBAAkB,4BAC3CF,MAAMG,iBAAiB,UAAWE,eA9C9B,yEAAa"}
|
||||
{"version":3,"file":"cfg-grades.min.js","sources":["../src/cfg-grades.js"],"sourcesContent":["/* eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\n/**\n * Initialize grade cfg page\n */\nexport function init() {\n { const\n intRx = /\\d/,\n integerChange = (event) => {\n if ((event.key.length > 1) || intRx.test(event.key)\n ) {\n return;\n }\n event.preventDefault();\n };\n\n for (let input of document.querySelectorAll('input[type=\"number\"][step=\"1\"][min=\"0\"]')) {\n input.addEventListener(\"keydown\", integerChange);\n }\n\n }\n\n { const\n decimal = /^[0-9]*?\\.[0-9]*?$/,\n intRx = /\\d/,\n floatChange = (event) => {\n if ((event.key.length > 1) || ((event.key === \".\") && (!event.currentTarget.value.match(decimal)))\n || intRx.test(event.key)\n ) {\n return;\n }\n event.preventDefault();\n };\n\n for (let input of document.querySelectorAll('input[type=\"number\"][min=\"0\"]:not([step])')) {\n input.addEventListener(\"keydown\", floatChange);\n }\n for (let input of document.querySelectorAll('input[type=\"text\"].float')) {\n input.addEventListener(\"keydown\", floatChange);\n }\n\n }\n\n\n}\n\n"],"names":["intRx","integerChange","event","key","length","test","preventDefault","input","document","querySelectorAll","addEventListener","decimal","floatChange","currentTarget","value","match"],"mappings":"gKASQA,MAAQ,KACRC,cAAiBC,QACVA,MAAMC,IAAIC,OAAS,GAAMJ,MAAMK,KAAKH,MAAMC,MAI/CD,MAAMI,sBAGL,IAAIC,SAASC,SAASC,iBAAiB,2CAC1CF,MAAMG,iBAAiB,UAAWT,sBAMlCU,QAAU,qBACVX,MAAQ,KACRY,YAAeV,QACRA,MAAMC,IAAIC,OAAS,GAAsB,MAAdF,MAAMC,MAAkBD,MAAMW,cAAcC,MAAMC,MAAMJ,UAC/EX,MAAMK,KAAKH,MAAMC,MAI1BD,MAAMI,sBAGL,IAAIC,SAASC,SAASC,iBAAiB,6CAC1CF,MAAMG,iBAAiB,UAAWE,iBAE/B,IAAIL,SAASC,SAASC,iBAAiB,4BAC1CF,MAAMG,iBAAiB,UAAWE"}
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"downloader.min.js","sources":["../src/downloader.js"],"sourcesContent":["/*eslint no-console: \"off\"*/\n\n/**\n * Save a piece of text to file as if it was downloaded\n * @param {string} filename\n * @param {string} text\n * @param {string} type\n */\nexport function download(filename, text, type) {\n if(undefined == type) { type = \"text/plain\"; }\n var pom = document.createElement('a');\n pom.setAttribute('href', 'data:'+type+';charset=utf-8,' + encodeURIComponent(text));\n pom.setAttribute('download', filename);\n\n if (document.createEvent) {\n var event = document.createEvent('MouseEvents');\n event.initEvent('click', true, true);\n pom.dispatchEvent(event);\n }\n else {\n pom.click();\n }\n}\n\n/**\n * This callback type is called `requestCallback` and is displayed as a global symbol.\n *\n * @callback fileOpenedCallback\n * @param {File} file File name\n * @param {string} content File Contents\n */\n\n/**\n * Open a file from disk and read its contents\n * @param {fileOpenedCallback} onready Callback to run when file is opened\n * @param {Array} accept Array of mime types that the file dialog will accept\n */\nexport function upload(onready,accept) {\n let input = document.createElement('input');\n input.type = 'file';\n if(Array.isArray(accept)){\n if(accept.count > 0){\n input.accept = accept.join(\", \");\n }\n } else if (undefined !== accept){\n input.accept = accept;\n }\n input.onchange = () => {\n let files = Array.from(input.files);\n if(files.length > 0){\n let file = files[0];\n var reader = new FileReader();\n reader.onload = function(e) {\n var contents = e.target.result;\n if(onready instanceof Function){\n onready(file,contents);\n }\n };\n reader.readAsText(file);\n }\n };\n\n if (document.createEvent) {\n var event = document.createEvent('MouseEvents');\n event.initEvent('click', true, true);\n input.dispatchEvent(event);\n }\n else {\n input.click();\n }\n}"],"names":["filename","text","type","undefined","pom","document","createElement","setAttribute","encodeURIComponent","createEvent","event","initEvent","dispatchEvent","click","onready","accept","input","Array","isArray","count","join","onchange","files","from","length","file","reader","FileReader","onload","e","contents","target","result","Function","readAsText"],"mappings":"2JAQyBA,SAAUC,KAAMC,MAClCC,MAAaD,OAAQA,KAAO,kBAC3BE,IAAMC,SAASC,cAAc,QACjCF,IAAIG,aAAa,OAAQ,QAAQL,KAAK,kBAAoBM,mBAAmBP,OAC7EG,IAAIG,aAAa,WAAYP,UAEzBK,SAASI,YAAa,KAClBC,MAAQL,SAASI,YAAY,eACjCC,MAAMC,UAAU,SAAS,GAAM,GAC/BP,IAAIQ,cAAcF,YAGlBN,IAAIS,kCAiBWC,QAAQC,YACvBC,MAAQX,SAASC,cAAc,SACnCU,MAAMd,KAAO,OACVe,MAAMC,QAAQH,QACVA,OAAOI,MAAQ,IACdH,MAAMD,OAASA,OAAOK,KAAK,YAExBjB,IAAcY,SACrBC,MAAMD,OAASA,WAEnBC,MAAMK,SAAW,SACLC,MAAUL,MAAMM,KAAKP,MAAMM,UAC5BA,MAAME,OAAS,EAAE,KACZC,KAAOH,MAAM,OACbI,OAAS,IAAIC,WACjBD,OAAOE,OAAS,SAASC,OACjBC,SAAWD,EAAEE,OAAOC,OACrBlB,mBAAmBmB,UAClBnB,QAAQW,KAAKK,WAGrBJ,OAAOQ,WAAWT,QAI1BpB,SAASI,YAAa,KAClBC,MAAQL,SAASI,YAAY,eACjCC,MAAMC,UAAU,SAAS,GAAM,GAC/BK,MAAMJ,cAAcF,YAGpBM,MAAMH"}
|
||||
{"version":3,"file":"downloader.min.js","sources":["../src/downloader.js"],"sourcesContent":["/**\n * Save a piece of text to file as if it was downloaded\n * @param {string} filename\n * @param {string} text\n * @param {string} type\n */\nexport function download(filename, text, type) {\n if (undefined == type) {\n type = \"text/plain\";\n }\n var pom = document.createElement('a');\n pom.setAttribute('href', 'data:' + type + ';charset=utf-8,' + encodeURIComponent(text));\n pom.setAttribute('download', filename);\n\n if (document.createEvent) {\n var event = document.createEvent('MouseEvents');\n event.initEvent('click', true, true);\n pom.dispatchEvent(event);\n } else {\n pom.click();\n }\n}\n\n/**\n * This callback type is called `requestCallback` and is displayed as a global symbol.\n *\n * @callback fileOpenedCallback\n * @param {File} file File name\n * @param {string} content File Contents\n */\n\n/**\n * Open a file from disk and read its contents\n * @param {fileOpenedCallback} onready Callback to run when file is opened\n * @param {Array} accept Array of mime types that the file dialog will accept\n */\nexport function upload(onready, accept) {\n let input = document.createElement('input');\n input.type = 'file';\n if (Array.isArray(accept)) {\n if (accept.count > 0) {\n input.accept = accept.join(\", \");\n }\n } else if (undefined !== accept) {\n input.accept = accept;\n }\n input.onchange = () => {\n let files = Array.from(input.files);\n if (files.length > 0) {\n let file = files[0];\n var reader = new FileReader();\n reader.onload = function(e) {\n var contents = e.target.result;\n if (onready instanceof Function) {\n onready(file, contents);\n }\n };\n reader.readAsText(file);\n }\n };\n\n if (document.createEvent) {\n var event = document.createEvent('MouseEvents');\n event.initEvent('click', true, true);\n input.dispatchEvent(event);\n } else {\n input.click();\n }\n}"],"names":["filename","text","type","undefined","pom","document","createElement","setAttribute","encodeURIComponent","createEvent","event","initEvent","dispatchEvent","click","onready","accept","input","Array","isArray","count","join","onchange","files","from","length","file","reader","FileReader","onload","e","contents","target","result","Function","readAsText"],"mappings":"2JAMyBA,SAAUC,KAAMC,MACjCC,MAAaD,OACbA,KAAO,kBAEPE,IAAMC,SAASC,cAAc,QACjCF,IAAIG,aAAa,OAAQ,QAAUL,KAAO,kBAAoBM,mBAAmBP,OACjFG,IAAIG,aAAa,WAAYP,UAEzBK,SAASI,YAAa,KAClBC,MAAQL,SAASI,YAAY,eACjCC,MAAMC,UAAU,SAAS,GAAM,GAC/BP,IAAIQ,cAAcF,YAElBN,IAAIS,kCAiBWC,QAASC,YACxBC,MAAQX,SAASC,cAAc,SACnCU,MAAMd,KAAO,OACTe,MAAMC,QAAQH,QACVA,OAAOI,MAAQ,IACfH,MAAMD,OAASA,OAAOK,KAAK,YAExBjB,IAAcY,SACrBC,MAAMD,OAASA,WAEnBC,MAAMK,SAAW,SACLC,MAAQL,MAAMM,KAAKP,MAAMM,UACzBA,MAAME,OAAS,EAAG,KACdC,KAAOH,MAAM,OACbI,OAAS,IAAIC,WACjBD,OAAOE,OAAS,SAASC,OACjBC,SAAWD,EAAEE,OAAOC,OACpBlB,mBAAmBmB,UACnBnB,QAAQW,KAAMK,WAGtBJ,OAAOQ,WAAWT,QAI1BpB,SAASI,YAAa,KAClBC,MAAQL,SAASI,YAAY,eACjCC,MAAMC,UAAU,SAAS,GAAM,GAC/BK,MAAMJ,cAAcF,YAEpBM,MAAMH"}
|
2
amd/build/modedit-modal.min.js
vendored
2
amd/build/modedit-modal.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/modedit-modal",["exports","core/fragment","./util/string-helper","core/ajax","core/notification","core/templates"],(function(_exports,_fragment,_stringHelper,_ajax,_notification,_templates){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};var _default={install(Vue){let strings=(0,_stringHelper.load_strings)({editmod:{save$core:"save$core",cancel$core:"cancel$core"}});Vue.component("s-edit-mod",{props:{cmid:{type:Number},coursectxid:{type:Number},title:{type:String,default:""},genericonly:{type:Boolean,default:!1}},data:()=>({content:"",text:strings.editmod}),computed:{},methods:{openForm(){this.$refs.editormodal.show()},onShown(){const self=this;let params={cmid:this.cmid};console.info("Loading form"),(0,_fragment.loadFragment)("local_treestudyplan","mod_edit_form",this.coursectxid,params).then(((html,js)=>{(0,_templates.replaceNodeContents)(self.$refs.content,html,js)})).catch(_notification.default.exception)},onSave(){const self=this;let form=this.$refs.content.getElementsByTagName("form")[0];form.dispatchEvent(new Event("save-form-state"));const formdata=new FormData(form),data=new URLSearchParams(formdata).toString();(0,_ajax.call)([{methodname:"local_treestudyplan_submit_cm_editform",args:{cmid:this.cmid,formdata:data}}])[0].then((()=>{self.$emit("saved",formdata)})).catch(_notification.default.exception)}},template:'\n <span class=\'s-edit-mod\'><a href=\'#\' @click.prevent="openForm"><slot><i class="fa fa-cog"></i></slot></a>\n <b-modal\n ref="editormodal"\n scrollable\n centered\n size="xl"\n id="\'modal-cm-\'+cmid"\n @shown="onShown"\n @ok="onSave"\n :title="title"\n :ok-title="text.save$core"\n ><div :class="\'s-edit-mod-form \'+ (genericonly?\'genericonly\':\'\')" ref="content"\n ><div class="d-flex justify-content-center mb-3"><b-spinner variant="primary"></b-spinner></div\n ></div\n ></b-modal>\n </span>\n '})}};return _exports.default=_default,_exports.default}));
|
||||
define("local_treestudyplan/modedit-modal",["exports","core/fragment","./util/string-helper","core/ajax","core/notification","core/templates"],(function(_exports,_fragment,_stringHelper,_ajax,_notification,_templates){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};var _default={install(Vue){let strings=(0,_stringHelper.loadStrings)({editmod:{save$core:"save$core",cancel$core:"cancel$core"}});Vue.component("s-edit-mod",{props:{cmid:{type:Number},coursectxid:{type:Number},title:{type:String,default:""},genericonly:{type:Boolean,default:!1}},data:()=>({content:"",text:strings.editmod}),computed:{},methods:{openForm(){this.$refs.editormodal.show()},onShown(){const self=this;let params={cmid:this.cmid};(0,_fragment.loadFragment)("local_treestudyplan","mod_edit_form",this.coursectxid,params).then(((html,js)=>((0,_templates.replaceNodeContents)(self.$refs.content,html,js),null))).catch(_notification.default.exception)},onSave(){const self=this;let form=this.$refs.content.getElementsByTagName("form")[0];form.dispatchEvent(new Event("save-form-state"));const formdata=new FormData(form),data=new URLSearchParams(formdata).toString();(0,_ajax.call)([{methodname:"local_treestudyplan_submit_cm_editform",args:{cmid:this.cmid,formdata:data}}])[0].then((()=>(self.$emit("saved",formdata),null))).catch(_notification.default.exception)}},template:'\n <span class=\'s-edit-mod\'><a href=\'#\' @click.prevent="openForm"><slot><i class="fa fa-cog"></i></slot></a>\n <b-modal\n ref="editormodal"\n scrollable\n centered\n size="xl"\n id="\'modal-cm-\'+cmid"\n @shown="onShown"\n @ok="onSave"\n :title="title"\n :ok-title="text.save$core"\n ><div :class="\'s-edit-mod-form \'+ (genericonly?\'genericonly\':\'\')" ref="content"\n ><div class="d-flex justify-content-center mb-3"><b-spinner variant="primary"></b-spinner></div\n ></div\n ></b-modal>\n </span>\n '})}};return _exports.default=_default,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=modedit-modal.min.js.map
|
File diff suppressed because one or more lines are too long
3
amd/build/page-coach.min.js
vendored
Normal file
3
amd/build/page-coach.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
amd/build/page-coach.min.js.map
Normal file
1
amd/build/page-coach.min.js.map
Normal file
File diff suppressed because one or more lines are too long
2
amd/build/page-edit-plan.min.js
vendored
2
amd/build/page-edit-plan.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/page-invitemanager.min.js
vendored
2
amd/build/page-invitemanager.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/page-invitemanager",["exports","./util/debugger","core/str","core/modal_factory","core/modal_events"],(function(_exports,_debugger,_str,_modal_factory,_modal_events){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){getstr_func([{key:"ok",component:"core"},{key:"confirm",component:"core"}]).then((s=>{const strOk=s[0],strConfirm=s[1];document.querySelectorAll(".path-local-treestudyplan a.m-action-confirm").forEach((el=>{el.addEventListener("click",(e=>{e.preventDefault();const link=e.currentTarget;let href=link.getAttribute("data-actionhref"),text=link.getAttribute("data-confirmtext"),oktext=link.getAttribute("data-confirmbtn");null==oktext&&(oktext=strOk);let title=link.getAttribute("data-confirmtitle");null==title&&(title=strConfirm),_modal_factory.default.create({type:_modal_factory.default.types.SAVE_CANCEL,title:title,body:text}).then((function(modal){return modal.setSaveButtonText(oktext),modal.getRoot().on(_modal_events.default.save,(function(){window.location=href})),modal.modal[0].style["max-width"]="345px",modal.show(),modal}))}))}))}))},_debugger=_interopRequireDefault(_debugger),_modal_factory=_interopRequireDefault(_modal_factory),_modal_events=_interopRequireDefault(_modal_events);const getstr_func=void 0!==_str.getStrings?_str.getStrings:_str.get_strings;new _debugger.default("treestudyplan")}));
|
||||
define("local_treestudyplan/page-invitemanager",["exports","./util/debugger","core/str","core/modal_factory","core/modal_events"],(function(_exports,_debugger,_str,_modal_factory,_modal_events){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){getstrFunc([{key:"ok",component:"core"},{key:"confirm",component:"core"}]).then((s=>{const strOk=s[0],strConfirm=s[1];document.querySelectorAll(".path-local-treestudyplan a.m-action-confirm").forEach((el=>{el.addEventListener("click",(e=>{e.preventDefault();const link=e.currentTarget;let href=link.getAttribute("data-actionhref"),text=link.getAttribute("data-confirmtext"),oktext=link.getAttribute("data-confirmbtn");null==oktext&&(oktext=strOk);let title=link.getAttribute("data-confirmtitle");null==title&&(title=strConfirm),_modal_factory.default.create({type:_modal_factory.default.types.SAVE_CANCEL,title:title,body:text}).then((modal=>(modal.setSaveButtonText(oktext),modal.getRoot().on(_modal_events.default.save,(()=>{window.location=href})),modal.modal[0].style["max-width"]="345px",modal.show(),modal))).catch((x=>{debug.warn(x)}))}))}))})).catch((x=>{debug.warn(x)}))},_debugger=_interopRequireDefault(_debugger),_modal_factory=_interopRequireDefault(_modal_factory),_modal_events=_interopRequireDefault(_modal_events);const getstrFunc=void 0!==_str.getStrings?_str.getStrings:_str.get_strings;let debug=new _debugger.default("treestudyplan-invitemanager")}));
|
||||
|
||||
//# sourceMappingURL=page-invitemanager.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"page-invitemanager.min.js","sources":["../src/page-invitemanager.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport Debugger from './util/debugger';\nimport {get_strings} from 'core/str';\nimport {getStrings} from 'core/str';\nimport ModalFactory from 'core/modal_factory';\nimport ModalEvents from 'core/modal_events';\n\n/* Determine the proper getstrings function to use (MDL4.3+ recommends use of getStrings, which is jquery independent) */\nconst getstr_func = (getStrings !== undefined)?getStrings:get_strings;\n\nlet debug = new Debugger(\"treestudyplan\");\n\n /**\n * Init function for page-invitemanager\n * @return undefined\n */\nexport function init() {\n getstr_func([\n { key: 'ok', component: 'core'},\n { key: 'confirm', component: 'core'},\n ]).then((s) => {\n const strOk = s[0];\n const strConfirm = s[1];\n\n const els = document.querySelectorAll('.path-local-treestudyplan a.m-action-confirm');\n els.forEach((el) => {\n el.addEventListener('click', (e) => {\n e.preventDefault();\n const link = e.currentTarget;\n let href = link.getAttribute('data-actionhref');\n let text = link.getAttribute('data-confirmtext');\n let oktext = link.getAttribute('data-confirmbtn');\n if (undefined == oktext) {\n oktext = strOk;\n }\n let title = link.getAttribute('data-confirmtitle');\n if (undefined == title) {\n title = strConfirm;\n }\n\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: title,\n body: text,\n }).then(function (modal) {\n modal.setSaveButtonText(oktext);\n\n let root = modal.getRoot();\n root.on(ModalEvents.save, function () {\n window.location = href;\n });\n modal.modal[0].style[\"max-width\"] = \"345px\";\n modal.show();\n return modal;\n });\n });\n });\n });\n}\n"],"names":["getstr_func","key","component","then","s","strOk","strConfirm","document","querySelectorAll","forEach","el","addEventListener","e","preventDefault","link","currentTarget","href","getAttribute","text","oktext","undefined","title","create","type","ModalFactory","types","SAVE_CANCEL","body","modal","setSaveButtonText","getRoot","on","ModalEvents","save","window","location","style","show","getStrings","get_strings","Debugger"],"mappings":"qWAuBIA,YAAY,CACR,CAAEC,IAAK,KAAMC,UAAW,QACxB,CAAED,IAAK,UAAWC,UAAW,UAC9BC,MAAMC,UACCC,MAAQD,EAAE,GACVE,WAAaF,EAAE,GAETG,SAASC,iBAAiB,gDAClCC,SAASC,KACTA,GAAGC,iBAAiB,SAAUC,IAC1BA,EAAEC,uBACIC,KAAOF,EAAEG,kBACXC,KAAOF,KAAKG,aAAa,mBACzBC,KAAOJ,KAAKG,aAAa,oBACzBE,OAASL,KAAKG,aAAa,mBAC3BG,MAAaD,SACbA,OAASd,WAETgB,MAAQP,KAAKG,aAAa,qBAC1BG,MAAaC,QACbA,MAAQf,mCAGCgB,OAAO,CAChBC,KAAMC,uBAAaC,MAAMC,YACzBL,MAAOA,MACPM,KAAMT,OACPf,MAAK,SAAUyB,cACdA,MAAMC,kBAAkBV,QAEbS,MAAME,UACZC,GAAGC,sBAAYC,MAAM,WACtBC,OAAOC,SAAWnB,QAEtBY,MAAMA,MAAM,GAAGQ,MAAM,aAAe,QACpCR,MAAMS,OACCT,+KA7CrB5B,iBAA8BoB,IAAfkB,gBAA0BA,gBAAWC,iBAE9C,IAAIC,kBAAS"}
|
||||
{"version":3,"file":"page-invitemanager.min.js","sources":["../src/page-invitemanager.js"],"sourcesContent":["/* eslint no-var: \"error\" */\n/* eslint no-unused-vars: \"off\" */\n/* eslint linebreak-style: \"off\" */\n/* eslint promise/no-nesting: \"off\" */\n/* eslint-env es6*/\n/* eslint camelcase: \"off\" */\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport Debugger from './util/debugger';\nimport {get_strings} from 'core/str';\nimport {getStrings} from 'core/str';\nimport ModalFactory from 'core/modal_factory';\nimport ModalEvents from 'core/modal_events';\n\n/* Determine the proper getstrings function to use (MDL4.3+ recommends use of getStrings, which is jquery independent) */\nconst getstrFunc = (getStrings !== undefined) ? getStrings : get_strings;\n\nlet debug = new Debugger(\"treestudyplan-invitemanager\");\n\n /**\n * Init function for page-invitemanager\n */\nexport function init() {\n getstrFunc([\n {key: 'ok', component: 'core'},\n {key: 'confirm', component: 'core'},\n ]).then((s) => {\n const strOk = s[0];\n const strConfirm = s[1];\n\n const els = document.querySelectorAll('.path-local-treestudyplan a.m-action-confirm');\n els.forEach((el) => {\n el.addEventListener('click', (e) => {\n e.preventDefault();\n const link = e.currentTarget;\n let href = link.getAttribute('data-actionhref');\n let text = link.getAttribute('data-confirmtext');\n let oktext = link.getAttribute('data-confirmbtn');\n if (undefined == oktext) {\n oktext = strOk;\n }\n let title = link.getAttribute('data-confirmtitle');\n if (undefined == title) {\n title = strConfirm;\n }\n\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: title,\n body: text,\n }).then((modal) => {\n modal.setSaveButtonText(oktext);\n\n let root = modal.getRoot();\n root.on(ModalEvents.save, () => {\n window.location = href;\n });\n modal.modal[0].style[\"max-width\"] = \"345px\";\n modal.show();\n return modal;\n }).catch((x) => {\n debug.warn(x);\n });\n });\n });\n return;\n }).catch((x) => {\n debug.warn(x);\n });\n}\n"],"names":["getstrFunc","key","component","then","s","strOk","strConfirm","document","querySelectorAll","forEach","el","addEventListener","e","preventDefault","link","currentTarget","href","getAttribute","text","oktext","undefined","title","create","type","ModalFactory","types","SAVE_CANCEL","body","modal","setSaveButtonText","getRoot","on","ModalEvents","save","window","location","style","show","catch","x","debug","warn","getStrings","get_strings","Debugger"],"mappings":"qWAwBIA,WAAW,CACP,CAACC,IAAK,KAAMC,UAAW,QACvB,CAACD,IAAK,UAAWC,UAAW,UAC7BC,MAAMC,UACCC,MAAQD,EAAE,GACVE,WAAaF,EAAE,GAETG,SAASC,iBAAiB,gDAClCC,SAASC,KACTA,GAAGC,iBAAiB,SAAUC,IAC1BA,EAAEC,uBACIC,KAAOF,EAAEG,kBACXC,KAAOF,KAAKG,aAAa,mBACzBC,KAAOJ,KAAKG,aAAa,oBACzBE,OAASL,KAAKG,aAAa,mBAC3BG,MAAaD,SACbA,OAASd,WAETgB,MAAQP,KAAKG,aAAa,qBAC1BG,MAAaC,QACbA,MAAQf,mCAGCgB,OAAO,CAChBC,KAAMC,uBAAaC,MAAMC,YACzBL,MAAOA,MACPM,KAAMT,OACPf,MAAMyB,QACLA,MAAMC,kBAAkBV,QAEbS,MAAME,UACZC,GAAGC,sBAAYC,MAAM,KACtBC,OAAOC,SAAWnB,IAAlB,IAEJY,MAAMA,MAAM,GAAGQ,MAAM,aAAe,QACpCR,MAAMS,OACCT,SACRU,OAAOC,IACNC,MAAMC,KAAKF,eAKxBD,OAAOC,IACNC,MAAMC,KAAKF,mKApDbvC,gBAA6BoB,IAAfsB,gBAA4BA,gBAAaC,qBAEzDH,MAAQ,IAAII,kBAAS"}
|
2
amd/build/page-myreport.min.js
vendored
2
amd/build/page-myreport.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/page-myreport",["exports","./vue/vue","./report-viewer-components","./util/debugger","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue"],(function(_exports,_vue,_reportViewerComponents,_debugger,_portalVue,_bootstrapVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){let type=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"own",arg1=arguments.length>1?arguments[1]:void 0;new _vue.default({el:"#root",data:{studyplans:[],type:type,invitekey:"invited"==type?arg1:null,userid:"other"==type?arg1:null},methods:{}})},_vue=_interopRequireDefault(_vue),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_debugger=_interopRequireDefault(_debugger),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default);new _debugger.default("treestudyplan-report")}));
|
||||
define("local_treestudyplan/page-myreport",["exports","./vue/vue","./report-viewer-components","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue"],(function(_exports,_vue,_reportViewerComponents,_portalVue,_bootstrapVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(){let type=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"own",arg1=arguments.length>1?arguments[1]:void 0;new _vue.default({el:"#root",data:{studyplans:[],type:type,invitekey:"invited"==type?arg1:null,userid:"other"==type?arg1:null},methods:{}})},_vue=_interopRequireDefault(_vue),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default)}));
|
||||
|
||||
//# sourceMappingURL=page-myreport.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"page-myreport.min.js","sources":["../src/page-myreport.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint no-console: \"off\" */\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport Vue from './vue/vue';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\n\nimport Debugger from './util/debugger';\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\nlet debug = new Debugger(\"treestudyplan-report\");\n\n/**\n * Initialize the Page\n * @param {string} type Type of page to show\n * @param {Object} arg1 Argument1 as passed\n */\n export function init(type=\"own\",arg1) {\n let app = new Vue({\n el: '#root',\n data: {\n \"studyplans\": [],\n \"type\": type,\n \"invitekey\": (type==\"invited\")?arg1:null,\n \"userid\": (type==\"other\")?arg1:null,\n },\n methods: {\n\n },\n });\n\n}\n\n"],"names":["type","arg1","Vue","el","data","methods","use","RVComponents","PortalVue","BootstrapVue","Debugger"],"mappings":"2aA4BsBA,4DAAK,MAAMC,4CACnB,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,YACY,QACNJ,eACY,WAANA,KAAiBC,KAAK,YACnB,SAAND,KAAeC,KAAK,MAEnCI,QAAS,2QAzBbC,IAAIC,8CAKJD,IAAIE,iCAEJF,IAAIG,uBAEI,IAAIC,kBAAS"}
|
||||
{"version":3,"file":"page-myreport.min.js","sources":["../src/page-myreport.js"],"sourcesContent":["/* eslint no-unused-vars: \"off\" */\n/* eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\nimport Vue from './vue/vue';\n\nimport RVComponents from './report-viewer-components';\nVue.use(RVComponents);\n\nimport PortalVue from './portal-vue/portal-vue.esm';\nVue.use(PortalVue);\nimport BootstrapVue from './bootstrap-vue/bootstrap-vue';\nVue.use(BootstrapVue);\n\n/**\n * Initialize the Page\n * @param {string} type Type of page to show\n * @param {Object} arg1 Argument1 as passed\n */\n export function init(type = \"own\", arg1) {\n let app = new Vue({\n el: '#root',\n data: {\n \"studyplans\": [],\n \"type\": type,\n \"invitekey\": (type == \"invited\") ? arg1 : null,\n \"userid\": (type == \"other\") ? arg1 : null,\n },\n methods: {\n\n },\n });\n\n}\n\n"],"names":["type","arg1","Vue","el","data","methods","use","RVComponents","PortalVue","BootstrapVue"],"mappings":"+YAoBsBA,4DAAO,MAAOC,4CACtB,IAAIC,aAAI,CACdC,GAAI,QACJC,KAAM,YACY,QACNJ,eACc,WAARA,KAAqBC,KAAO,YACvB,SAARD,KAAmBC,KAAO,MAEzCI,QAAS,+NArBbC,IAAIC,8CAGJD,IAAIE,iCAEJF,IAAIG"}
|
2
amd/build/page-result-overview.min.js
vendored
2
amd/build/page-result-overview.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/page-result-overview",["exports","core/ajax","core/notification","./vue/vue","./util/debugger","./util/string-helper","./studyplan-report-components","./report-viewer-components","./modedit-modal","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue"],(function(_exports,_ajax,_notification,_vue,_debugger,_stringHelper,_studyplanReportComponents,_reportViewerComponents,_modeditModal,_portalVue,_bootstrapVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(studyplanid,pageid,firstperiod,lastperiod){if(void 0===pageid||!Number.isInteger(Number(pageid))||void 0===studyplanid||!Number.isInteger(Number(studyplanid)))return void debug.error("Error: studyplan id and page id not provided as integer numbers to script.",studyplanid,pageid,firstperiod,lastperiod);studyplanid=Number(studyplanid),pageid=Number(pageid);new _vue.default({el:"#root",data:{structure:null,studyplan:null,page:null,text:strings.studyplan_report},async mounted(){},created(){this.loadStructure(pageid,firstperiod,lastperiod)},computed:{},methods:{loadStructure(pageid,firstperiod,lastperiod){const self=this;this.structure=null,(0,_ajax.call)([{methodname:"local_treestudyplan_get_report_structure",args:{pageid:pageid,firstperiod:firstperiod,lastperiod:lastperiod}}])[0].then((function(response){self.structure=response,self.studyplan=response.studyplan,self.page=response.page})).catch(_notification.default.exception)},selectedPage(e){debug.info("SelectedPage",e);const pageid=e.target.value;this.loadStructure(pageid)},selectedFirstPeriod(e){debug.info("selectedFirstPeriod",e);let f=e.target.value,l=this.structure.lastperiod;l<f&&(l=f),this.loadStructure(this.page.id,f,l)},selectedLastPeriod(e){debug.info("selectedLastPeriod",e);let f=this.structure.firstperiod,l=e.target.value;l<f&&(l=f),this.loadStructure(this.page.id,f,l)}}})},_notification=_interopRequireDefault(_notification),_vue=_interopRequireDefault(_vue),_debugger=_interopRequireDefault(_debugger),_studyplanReportComponents=_interopRequireDefault(_studyplanReportComponents),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_modeditModal=_interopRequireDefault(_modeditModal),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_studyplanReportComponents.default),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_modeditModal.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default);let debug=new _debugger.default("treestudyplanviewer"),strings=(0,_stringHelper.load_strings)({studyplan_report:{studyplan_select_placeholder:"studyplan_select_placeholder",studyplan:"studyplan",page:"studyplanpage",periods:"periods",period:"period",loading:"loading@core",all:"all@core",from:"from@core",to:"to@core"}})}));
|
||||
define("local_treestudyplan/page-result-overview",["exports","core/ajax","core/notification","./vue/vue","./util/debugger","./util/string-helper","./studyplan-report-components","./report-viewer-components","./modedit-modal","./portal-vue/portal-vue.esm","./bootstrap-vue/bootstrap-vue"],(function(_exports,_ajax,_notification,_vue,_debugger,_stringHelper,_studyplanReportComponents,_reportViewerComponents,_modeditModal,_portalVue,_bootstrapVue){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=function(studyplanid,pageid,firstperiod,lastperiod){if(void 0===pageid||!Number.isInteger(Number(pageid))||void 0===studyplanid||!Number.isInteger(Number(studyplanid)))return void debug.error("Error: studyplan id and page id not provided as integer numbers to script.",studyplanid,pageid,firstperiod,lastperiod);studyplanid=Number(studyplanid),pageid=Number(pageid);new _vue.default({el:"#root",data:{structure:null,studyplan:null,page:null,text:strings.studyplanReport},created(){this.loadStructure(pageid,firstperiod,lastperiod)},computed:{},methods:{loadStructure(pageid,firstperiod,lastperiod){const self=this;this.structure=null,(0,_ajax.call)([{methodname:"local_treestudyplan_get_report_structure",args:{pageid:pageid,firstperiod:firstperiod,lastperiod:lastperiod}}])[0].then((response=>{self.structure=response,self.studyplan=response.studyplan,self.page=response.page})).catch(_notification.default.exception)},selectedPage(e){debug.info("SelectedPage",e);const pageid=e.target.value;this.loadStructure(pageid)},selectedFirstPeriod(e){debug.info("selectedFirstPeriod",e);let f=e.target.value,l=this.structure.lastperiod;l<f&&(l=f),this.loadStructure(this.page.id,f,l)},selectedLastPeriod(e){debug.info("selectedLastPeriod",e);let f=this.structure.firstperiod,l=e.target.value;l<f&&(l=f),this.loadStructure(this.page.id,f,l)}}})},_notification=_interopRequireDefault(_notification),_vue=_interopRequireDefault(_vue),_debugger=_interopRequireDefault(_debugger),_studyplanReportComponents=_interopRequireDefault(_studyplanReportComponents),_reportViewerComponents=_interopRequireDefault(_reportViewerComponents),_modeditModal=_interopRequireDefault(_modeditModal),_portalVue=_interopRequireDefault(_portalVue),_bootstrapVue=_interopRequireDefault(_bootstrapVue),_vue.default.use(_studyplanReportComponents.default),_vue.default.use(_reportViewerComponents.default),_vue.default.use(_modeditModal.default),_vue.default.use(_portalVue.default),_vue.default.use(_bootstrapVue.default);let debug=new _debugger.default("treestudyplanviewer"),strings=(0,_stringHelper.loadStrings)({studyplanReport:{studyplan:"studyplan",page:"studyplanpage",periods:"periods",period:"period",loading:"loading@core",all:"all@core",from:"from@core",to:"to@core"}})}));
|
||||
|
||||
//# sourceMappingURL=page-result-overview.min.js.map
|
File diff suppressed because one or more lines are too long
2
amd/build/page-view-plan.min.js
vendored
2
amd/build/page-view-plan.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/primary-nav-tools.min.js
vendored
2
amd/build/primary-nav-tools.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/primary-nav-tools",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.hide_primary=function(hrefs){("string"==typeof hrefs||hrefs instanceof String)&&(hrefs=[hrefs]);if("object"==typeof hrefs&&Array.isArray(hrefs)){let css="";for(const ix in hrefs){const href=hrefs[ix];css+=`\n li > a[href*="${href}"] {\n display: none !important; \n }\n `,css+=`\n #usernavigation a[href*="${href}"] {\n display: none !important;\n }\n `}const element=document.createElement("style");element.setAttribute("type","text/css"),"textContent"in element?element.textContent=css:element.styleSheet.cssText=css,document.head.appendChild(element)}}}));
|
||||
define("local_treestudyplan/primary-nav-tools",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.hidePrimary=function(hrefs){("string"==typeof hrefs||hrefs instanceof String)&&(hrefs=[hrefs]);if("object"==typeof hrefs&&Array.isArray(hrefs)){let css="";for(const ix in hrefs){const href=hrefs[ix];css+=`\n .primary-navigation a[href*="${href}"],\n #usernavigation a[href*="${href}"],\n .drawer-primary a[href*="${href}"] {\n display: none !important;\n }\n `}const element=document.createElement("style");element.setAttribute("type","text/css"),"textContent"in element?element.textContent=css:element.styleSheet.cssText=css,document.head.appendChild(element)}}}));
|
||||
|
||||
//# sourceMappingURL=primary-nav-tools.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"primary-nav-tools.min.js","sources":["../src/primary-nav-tools.js"],"sourcesContent":["/*eslint-env es6*/\n/*eslint no-console: \"off\"*/\n\n/**\n * Hide a primary navigation item by href\n * @param {string|Array} hrefs The link that should be hidden\n */\nexport function hide_primary(hrefs) {\n if(typeof hrefs === 'string' || hrefs instanceof String){\n hrefs = [hrefs];\n }\n\n if(typeof hrefs === 'object' && Array.isArray(hrefs)){\n let css = '' ;\n for(const ix in hrefs){\n const href = hrefs[ix];\n css += `\n li > a[href*=\"${href}\"] {\n display: none !important; \n }\n `;\n css += `\n #usernavigation a[href*=\"${href}\"] {\n display: none !important;\n }\n `;\n }\n\n\n const element = document.createElement('style');\n element.setAttribute('type', 'text/css');\n\n if ('textContent' in element) {\n element.textContent = css;\n } else {\n element.styleSheet.cssText = css;\n }\n\n document.head.appendChild(element);\n\n }\n}\n"],"names":["hrefs","String","Array","isArray","css","ix","href","element","document","createElement","setAttribute","textContent","styleSheet","cssText","head","appendChild"],"mappings":"sKAO6BA,QACL,iBAAVA,OAAsBA,iBAAiBC,UAC7CD,MAAQ,CAACA,WAGO,iBAAVA,OAAsBE,MAAMC,QAAQH,OAAO,KAC7CI,IAAM,OACN,MAAMC,MAAML,MAAM,OACZM,KAAON,MAAMK,IACnBD,KAAQ,mCACYE,4FAIpBF,KAAQ,8CACuBE,iGAO7BC,QAAUC,SAASC,cAAc,SACvCF,QAAQG,aAAa,OAAQ,YAEzB,gBAAiBH,QACjBA,QAAQI,YAAcP,IAEtBG,QAAQK,WAAWC,QAAUT,IAGjCI,SAASM,KAAKC,YAAYR"}
|
||||
{"version":3,"file":"primary-nav-tools.min.js","sources":["../src/primary-nav-tools.js"],"sourcesContent":["/* eslint-env es6*/\n/* eslint no-console: \"off\"*/\n\n/**\n * Hide a primary navigation item by href\n * @param {string|Array} hrefs The link that should be hidden\n */\nexport function hidePrimary(hrefs) {\n if (typeof hrefs === 'string' || hrefs instanceof String) {\n hrefs = [hrefs];\n }\n\n if (typeof hrefs === 'object' && Array.isArray(hrefs)) {\n let css = '';\n for (const ix in hrefs) {\n const href = hrefs[ix];\n css += `\n .primary-navigation a[href*=\"${href}\"],\n #usernavigation a[href*=\"${href}\"],\n .drawer-primary a[href*=\"${href}\"] {\n display: none !important;\n }\n `;\n }\n\n\n const element = document.createElement('style');\n element.setAttribute('type', 'text/css');\n\n if ('textContent' in element) {\n element.textContent = css;\n } else {\n element.styleSheet.cssText = css;\n }\n\n document.head.appendChild(element);\n\n }\n}\n"],"names":["hrefs","String","Array","isArray","css","ix","href","element","document","createElement","setAttribute","textContent","styleSheet","cssText","head","appendChild"],"mappings":"qKAO4BA,QACH,iBAAVA,OAAsBA,iBAAiBC,UAC9CD,MAAQ,CAACA,WAGQ,iBAAVA,OAAsBE,MAAMC,QAAQH,OAAQ,KAC/CI,IAAM,OACL,MAAMC,MAAML,MAAO,OACdM,KAAON,MAAMK,IACnBD,KAAQ,kDAC2BE,qDACJA,qDACAA,iGAO7BC,QAAUC,SAASC,cAAc,SACvCF,QAAQG,aAAa,OAAQ,YAEzB,gBAAiBH,QACjBA,QAAQI,YAAcP,IAEtBG,QAAQK,WAAWC,QAAUT,IAGjCI,SAASM,KAAKC,YAAYR"}
|
2
amd/build/report-viewer-components.min.js
vendored
2
amd/build/report-viewer-components.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/studyplan-editor-components.min.js
vendored
2
amd/build/studyplan-editor-components.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/studyplan-processor.min.js
vendored
2
amd/build/studyplan-processor.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/studyplan-processor",["exports"],(function(_exports){function ProcessStudyplan(studyplan){for(const ip in studyplan.pages){ProcessStudyplanPage(studyplan.pages[ip])}return studyplan}function ProcessStudyplanPage(page){let connections={};for(const il in page.studylines){const line=page.studylines[il];for(const is in line.slots){const slot=line.slots[is];if(void 0!==slot.courses)for(const ic in slot.courses){const itm=slot.courses[ic];for(const idx in itm.connections.in){const conn=itm.connections.in[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}for(const idx in itm.connections.out){const conn=itm.connections.out[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}}if(void 0!==slot.filters)for(const ix in slot.filters){const itm=slot.filters[ix];for(const idx in itm.connections.in){const conn=itm.connections.in[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}for(const idx in itm.connections.out){const conn=itm.connections.out[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}}}}return page}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.ProcessStudyplan=ProcessStudyplan,_exports.ProcessStudyplanPage=ProcessStudyplanPage,_exports.ProcessStudyplans=function(studyplans){for(const isx in studyplans){ProcessStudyplan(studyplans[isx])}return studyplans},_exports.objCopy=function(target,source,fields){null==fields&&(fields=Object.getOwnPropertyNames(source));for(const ix in fields){const field=fields[ix];target[field]=source[field]}return target},_exports.transportItem=function(target,source,identifier,param){param||(param="value");let item,itemindex;for(const ix in source)if(source[ix][param]==identifier){item=source[ix],itemindex=ix;break}item&&(target.push(item),source.splice(itemindex,1))}}));
|
||||
define("local_treestudyplan/studyplan-processor",["exports"],(function(_exports){function processStudyplan(studyplan){for(const ip in studyplan.pages){processStudyplanPage(studyplan.pages[ip])}return studyplan}function processStudyplanPage(page){let connections={};for(const il in page.studylines){const line=page.studylines[il];for(const is in line.slots){const slot=line.slots[is];if(void 0!==slot.courses)for(const ic in slot.courses){const itm=slot.courses[ic];for(const idx in itm.connections.in){const conn=itm.connections.in[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}for(const idx in itm.connections.out){const conn=itm.connections.out[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}}if(void 0!==slot.filters)for(const ix in slot.filters){const itm=slot.filters[ix];for(const idx in itm.connections.in){const conn=itm.connections.in[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}for(const idx in itm.connections.out){const conn=itm.connections.out[idx];conn.id in connections?itm.connections[idx]=connections[conn.id]:connections[conn.id]=conn}}}}return page}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.objCopy=function(target,source,fields){null==fields&&(fields=Object.getOwnPropertyNames(source));for(const ix in fields){const field=fields[ix];target[field]=source[field]}return target},_exports.processStudyplan=processStudyplan,_exports.processStudyplanPage=processStudyplanPage,_exports.processStudyplans=function(studyplans){for(const isx in studyplans){processStudyplan(studyplans[isx])}return studyplans},_exports.transportItem=function(target,source,identifier,param){param||(param="value");let item,itemindex;for(const ix in source)if(source[ix][param]==identifier){item=source[ix],itemindex=ix;break}item&&(target.push(item),source.splice(itemindex,1))}}));
|
||||
|
||||
//# sourceMappingURL=studyplan-processor.min.js.map
|
File diff suppressed because one or more lines are too long
2
amd/build/studyplan-report-components.min.js
vendored
2
amd/build/studyplan-report-components.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
amd/build/treestudyplan-components.min.js
vendored
2
amd/build/treestudyplan-components.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
3
amd/build/util/browserbuttonevents.min.js
vendored
Normal file
3
amd/build/util/browserbuttonevents.min.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
define("local_treestudyplan/util/browserbuttonevents",["exports","./debugger"],(function(_exports,_debugger){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.addBrowserButtonEvent=function(backwardCB){let forwardCB=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,reloadCB=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;debug.log("Registering navigation events",backwardCB,forwardCB,reloadCB);addEventListener("popstate",(e=>{const positionLastShown=Number(sessionStorage.getItem("positionLastShown"));let position=history.state;null===position&&(position=positionLastShown+1,history.replaceState(position,"")),sessionStorage.setItem("positionLastShown",String(position));const direction=Math.sign(position-positionLastShown);debug.log("Travel direction is "+direction),-1==direction&&backwardCB&&backwardCB(),1==direction&&forwardCB&&forwardCB(),0==direction&&reloadCB&&reloadCB()}))};const debug=new(_debugger=(obj=_debugger)&&obj.__esModule?obj:{default:obj}).default("browserbuttonevents")}));
|
||||
|
||||
//# sourceMappingURL=browserbuttonevents.min.js.map
|
1
amd/build/util/browserbuttonevents.min.js.map
Normal file
1
amd/build/util/browserbuttonevents.min.js.map
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"browserbuttonevents.min.js","sources":["../../src/util/browserbuttonevents.js"],"sourcesContent":["/* eslint no-var: \"error\" */\n/* eslint no-unused-vars: \"off\" */\n/* eslint linebreak-style: \"off\" */\n/* eslint no-trailing-spaces: \"off\" */\n/* eslint capitalized-comments: \"off\" */\n/* eslint-env es6 */\n\nimport Debugger from './debugger';\nconst debug = new Debugger(\"browserbuttonevents\");\n\n/**\n * \n * @param {function} backwardCB \n * @param {function} forwardCB \n * @param {function} reloadCB \n */\nexport function addBrowserButtonEvent(backwardCB, forwardCB = null, reloadCB = null) {\n debug.log(\"Registering navigation events\", backwardCB, forwardCB, reloadCB);\n const reorient = (e) => { // After travelling in the history stack\n const positionLastShown = Number( // If none, then zero\n sessionStorage.getItem('positionLastShown'));\n // debug.log(\"Popstate event\",e,positionLastShown,history);\n let position = history.state; // Absolute position in stack\n if (position === null) { // Meaning a new entry on the stack\n position = positionLastShown + 1; // Top of stack\n \n // (1) Stamp the entry with its own position in the stack\n history.replaceState(position, /* no title */''); \n }\n \n // (2) Keep track of the last position shown\n sessionStorage.setItem('positionLastShown', String(position));\n \n // (3) Discover the direction of travel by comparing the two\n const direction = Math.sign(position - positionLastShown);\n debug.log('Travel direction is ' + direction); \n // One of backward (-1), reload (0) and forward (1)\n if (direction == -1 && backwardCB) {\n backwardCB();\n }\n if (direction == 1 && forwardCB) {\n forwardCB();\n }\n if (direction == 0 && reloadCB) {\n reloadCB();\n }\n };\n // addEventListener( 'pageshow', reorient );\n addEventListener('popstate', reorient); // Travel in same page\n}"],"names":["backwardCB","forwardCB","reloadCB","debug","log","addEventListener","e","positionLastShown","Number","sessionStorage","getItem","position","history","state","replaceState","setItem","String","direction","Math","sign"],"mappings":"qNAgBsCA,gBAAYC,iEAAY,KAAMC,gEAAW,KAC3EC,MAAMC,IAAI,gCAAiCJ,WAAYC,UAAWC,UA+BlEG,iBAAiB,YA9BCC,UACRC,kBAAoBC,OACxBC,eAAeC,QAAQ,0BAErBC,SAAWC,QAAQC,MACN,OAAbF,WACAA,SAAWJ,kBAAoB,EAG/BK,QAAQE,aAAaH,SAAwB,KAIjDF,eAAeM,QAAQ,oBAAqBC,OAAOL,iBAG7CM,UAAYC,KAAKC,KAAKR,SAAWJ,mBACvCJ,MAAMC,IAAI,uBAAyBa,YAEjB,GAAdA,WAAmBjB,YACnBA,aAEa,GAAbiB,WAAkBhB,WAClBA,YAEa,GAAbgB,WAAkBf,UAClBA,qBApCNC,MAAQ,yEAAa"}
|
File diff suppressed because one or more lines are too long
2
amd/build/util/date-helper.min.js
vendored
2
amd/build/util/date-helper.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/util/date-helper",["exports"],(function(_exports){function format_date(d,short){d instanceof Date||(d=new Date(d));let monthformat="short";return!0===short?monthformat="numeric":!1===short&&(monthformat="long"),d.toLocaleDateString(document.documentElement.lang,{year:"numeric",month:monthformat,day:"numeric"})}function studyplanDates(plan){let earliestStart=null,latestEnd=null,openEnded=!1;for(const ix in plan.pages){const page=plan.pages[ix],s=new Date(page.startdate);if(page.enddate||(openEnded=!0),(!earliestStart||s<earliestStart)&&(earliestStart=s),page.enddate){const e=new Date(page.enddate);(!latestEnd||e>latestEnd)&&(latestEnd=e)}}return{start:earliestStart,end:openEnded?null:latestEnd}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.add_days=function(datestr,days){const date=new Date(datestr);return function(date){const d=new Date(date);let month=""+(d.getMonth()+1),day=""+d.getDate();const year=d.getFullYear();month.length<2&&(month="0"+month);day.length<2&&(day="0"+day);return[year,month,day].join("-")}(new Date(date.getTime()+864e5*days))},_exports.datespaninfo=function(first,last){first instanceof Date||(first=new Date(first));last instanceof Date||(last=new Date(last));first.setHours(0),first.setMinutes(0),first.setSeconds(0),first.setMilliseconds(0),last.setHours(23),last.setMinutes(59),last.setSeconds(59),last.setMilliseconds(999);const dayspan=Math.round((last-first+1)/864e5),years=Math.floor(dayspan/365),ydaysleft=dayspan%365,weeks=Math.floor(ydaysleft/7);return{first:first,last:last,totaldays:dayspan,years:years,weeks:weeks,days:ydaysleft%7,formatted:{first:format_date(first),last:format_date(last)}}},_exports.format_date=format_date,_exports.format_datetime=function(d,short){d instanceof Date||(d=new Date(d));let monthformat="short";!0===short?monthformat="numeric":!1===short&&(monthformat="long");return d.toLocaleDateString(document.documentElement.lang,{year:"numeric",month:monthformat,day:"numeric"})+" "+d.toLocaleTimeString(document.documentElement.lang,{timeStyle:"short"})},_exports.studyplanDates=studyplanDates,_exports.studyplanPageTiming=function(page){const now=(new Date).getTime(),start=new Date(page.startdate),end=page.enddate?new Date(page.enddate):null;return start<now?end&&now>end?"past":"present":"future"},_exports.studyplanTiming=function(plan){const now=(new Date).getTime(),dates=studyplanDates(plan);return dates.start<now?dates.end&&now>dates.end?"past":"present":"future"}}));
|
||||
define("local_treestudyplan/util/date-helper",["exports"],(function(_exports){function formatDate(d,short){d instanceof Date||("number"==typeof d&&(d*=1e3),d=new Date(d));let monthformat="short";return!0===short?monthformat="numeric":!1===short&&(monthformat="long"),d.toLocaleDateString(document.documentElement.lang,{year:"numeric",month:monthformat,day:"numeric"})}function studyplanDates(plan){let earliestStart=null,latestEnd=null,openEnded=!1;for(const ix in plan.pages){const page=plan.pages[ix],s=new Date(page.startdate);if(page.enddate||(openEnded=!0),(!earliestStart||s<earliestStart)&&(earliestStart=s),page.enddate){const e=new Date(page.enddate);(!latestEnd||e>latestEnd)&&(latestEnd=e)}}return{start:earliestStart,end:openEnded?null:latestEnd}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.addDays=function(datestr,days){const date=new Date(datestr);return function(date){const d=new Date(date);let month=""+(d.getMonth()+1),day=""+d.getDate();const year=d.getFullYear();month.length<2&&(month="0"+month);day.length<2&&(day="0"+day);return[year,month,day].join("-")}(new Date(date.getTime()+864e5*days))},_exports.datespaninfo=function(first,last){first instanceof Date||(first=new Date(first));last instanceof Date||(last=new Date(last));first.setHours(0),first.setMinutes(0),first.setSeconds(0),first.setMilliseconds(0),last.setHours(23),last.setMinutes(59),last.setSeconds(59),last.setMilliseconds(999);const dayspan=Math.round((last-first+1)/864e5),years=Math.floor(dayspan/365),ydaysleft=dayspan%365,weeks=Math.floor(ydaysleft/7);return{first:first,last:last,totaldays:dayspan,years:years,weeks:weeks,days:ydaysleft%7,formatted:{first:formatDate(first),last:formatDate(last)}}},_exports.formatDate=formatDate,_exports.formatDatetime=function(d,short){d instanceof Date||("number"==typeof d&&(d*=1e3),d=new Date(d));let monthformat="short";!0===short?monthformat="numeric":!1===short&&(monthformat="long");return d.toLocaleDateString(document.documentElement.lang,{year:"numeric",month:monthformat,day:"numeric"})+" "+d.toLocaleTimeString(document.documentElement.lang,{timeStyle:"short"})},_exports.studyplanDates=studyplanDates,_exports.studyplanPageTiming=function(page){const now=(new Date).getTime();if(page.timeless)return"present";const start=new Date(page.startdate),end=page.enddate?new Date(page.enddate):null;return start<now?end&&now>end?"past":"present":"future"},_exports.studyplanTiming=function(plan){const now=(new Date).getTime();if(!plan.pages&&0==plan.pages.length||plan.pages[0]&&plan.pages[0].timeless)return"present";const dates=studyplanDates(plan);return dates.start<now?dates.end&&now>dates.end?"past":"present":"future"}}));
|
||||
|
||||
//# sourceMappingURL=date-helper.min.js.map
|
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
{"version":3,"file":"debounce.min.js","sources":["../../src/util/debounce.js"],"sourcesContent":["/*eslint no-var: \"error\"*/\n/*eslint no-console: \"off\"*/\n/*eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\n/**\n * Limits consecutive function calls.\n * @param {function} func The function to wrap.\n * @param {int} wait The time limit between function calls.\n * @param {bool} immediate perform the actual function call first rather than after the timout passed.\n * @returns {function} a new function that wraps the debounce.\n */\nfunction debounce(func, wait, immediate) {\n let timeout;\n return function() {\n let context = this, args = arguments;\n let later = function() {\n timeout = null;\n if (!immediate){ func.apply(context, args); }\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow){ func.apply(context, args); }\n };\n}\n\nexport {debounce};"],"names":["func","wait","immediate","timeout","context","this","args","arguments","callNow","clearTimeout","setTimeout","apply"],"mappings":"8JAakBA,KAAMC,KAAMC,eACtBC,eACG,eACCC,QAAUC,KAAMC,KAAOC,UAKvBC,QAAUN,YAAcC,QAC5BM,aAAaN,SACbA,QAAUO,YANE,WACRP,QAAU,KACLD,WAAYF,KAAKW,MAAMP,QAASE,QAIbL,MACxBO,SAAUR,KAAKW,MAAMP,QAASE"}
|
||||
{"version":3,"file":"debounce.min.js","sources":["../../src/util/debounce.js"],"sourcesContent":["/* eslint no-var: \"error\"*/\n/* eslint no-console: \"off\"*/\n/* eslint-env es6*/\n// Put this file in path/to/plugin/amd/src\n// You can call it anything you like\n\n/**\n * Limits consecutive function calls.\n * @param {function} func The function to wrap.\n * @param {int} wait The time limit between function calls.\n * @param {bool} immediate perform the actual function call first rather than after the timout passed.\n * @returns {function} a new function that wraps the debounce.\n */\nfunction debounce(func, wait, immediate) {\n let timeout;\n return function() {\n let context = this;\n let args = arguments;\n let later = function() {\n timeout = null;\n if (!immediate) {\n func.apply(context, args);\n }\n };\n let callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) {\n func.apply(context, args);\n }\n };\n}\n\nexport {debounce};"],"names":["func","wait","immediate","timeout","context","this","args","arguments","callNow","clearTimeout","setTimeout","apply"],"mappings":"8JAakBA,KAAMC,KAAMC,eACtBC,eACG,eACCC,QAAUC,KACVC,KAAOC,UAOPC,QAAUN,YAAcC,QAC5BM,aAAaN,SACbA,QAAUO,YARE,WACRP,QAAU,KACLD,WACDF,KAAKW,MAAMP,QAASE,QAKAL,MACxBO,SACAR,KAAKW,MAAMP,QAASE"}
|
2
amd/build/util/debugger.min.js
vendored
2
amd/build/util/debugger.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/util/debugger",["exports","core/config"],(function(_exports,_config){var obj;return Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=function(handle){let output_enabled=_config.default.developerdebug;output_enabled?console.warn(`In development environment. Debugger output enabled for ${handle}`):console.warn(`In production environment. Debugger output disabled for ${handle}`);return{write(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.info.apply(console,args)}},info(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.info.apply(console,args)}},warn(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.warn.apply(console,args)}},error(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.error.apply(console,args)}},time(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.time.apply(console,args)}},timeEnd(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.timeEnd.apply(console,args)}},timeLog(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.timeLog.apply(console,args)}},timeStamp(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.timeStamp.apply(console,args)}},enable:function(){output_enabled=!0},disable:function(){output_enabled=!1}}},_config=(obj=_config)&&obj.__esModule?obj:{default:obj},_exports.default}));
|
||||
define("local_treestudyplan/util/debugger",["exports","core/config"],(function(_exports,_config){var obj;return Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=function(handle){let outputEnabled=_config.default.developerdebug;outputEnabled?console.warn(`In development environment. Debugger output enabled for ${handle}`):console.warn(`In production environment. Debugger output disabled for ${handle}`);return{write(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.info.apply(console,args)}},log(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.log.apply(console,args)}},info(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.info.apply(console,args)}},warn(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.warn.apply(console,args)}},error(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.error.apply(console,args)}},time(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.time.apply(console,args)}},timeEnd(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.timeEnd.apply(console,args)}},timeLog(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.timeLog.apply(console,args)}},timeStamp(){if(outputEnabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.timeStamp.apply(console,args)}},enable(){outputEnabled=!0},disable(){outputEnabled=!1}}},_config=(obj=_config)&&obj.__esModule?obj:{default:obj},_exports.default}));
|
||||
|
||||
//# sourceMappingURL=debugger.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"debugger.min.js","sources":["../../src/util/debugger.js"],"sourcesContent":["/*eslint no-var: \"error\"*/\n/*eslint no-console: \"off\"*/\n/*eslint-env es6*/\n\nimport Config from \"core/config\";\n\n/**\n * Start a new debugger\n * @param {*} handle The string to attach to all messages from this debugger\n * @returns Debugger object\n */\nexport default function (handle) {\n let output_enabled = Config.developerdebug;\n if(output_enabled){\n console.warn(`In development environment. Debugger output enabled for ${handle}`);\n } else {\n console.warn(`In production environment. Debugger output disabled for ${handle}`);\n }\n\n return {\n write() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.info.apply(console, args);\n }\n },\n info() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.info.apply(console, args);\n }\n },\n warn() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.warn.apply(console, args);\n }\n },\n error() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.error.apply(console, args);\n }\n },\n time() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.time.apply(console, args);\n }\n },\n timeEnd() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.timeEnd.apply(console, args);\n }\n },\n timeLog() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.timeLog.apply(console, args);\n }\n },\n timeStamp() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.timeStamp.apply(console, args);\n }\n },\n enable: function debugger_enable() {\n output_enabled = true;\n },\n\n disable: function debugger_disable() {\n output_enabled = false;\n }\n };\n\n}\n"],"names":["handle","output_enabled","Config","developerdebug","console","warn","write","args","Array","prototype","slice","call","arguments","unshift","info","apply","error","time","timeEnd","timeLog","timeStamp","enable","disable"],"mappings":"kMAWyBA,YACjBC,eAAiBC,gBAAOC,eACzBF,eACCG,QAAQC,KAAM,2DAA0DL,UAExEI,QAAQC,KAAM,2DAA0DL,gBAGrE,CACHM,WACQL,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQU,KAAKC,MAAMX,QAASG,QAGpCO,UACQb,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQU,KAAKC,MAAMX,QAASG,QAGpCF,UACQJ,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQC,KAAKU,MAAMX,QAASG,QAGpCS,WACQf,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQY,MAAMD,MAAMX,QAASG,QAGrCU,UACQhB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQa,KAAKF,MAAMX,QAASG,QAGpCW,aACQjB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQc,QAAQH,MAAMX,QAASG,QAGvCY,aACQlB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQe,QAAQJ,MAAMX,QAASG,QAGvCa,eACQnB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQgB,UAAUL,MAAMX,QAASG,QAGzCc,OAAQ,WACJpB,gBAAiB,GAGrBqB,QAAS,WACLrB,gBAAiB"}
|
||||
{"version":3,"file":"debugger.min.js","sources":["../../src/util/debugger.js"],"sourcesContent":["/* eslint no-var: \"error\"*/\n/* eslint no-console: \"off\"*/\n/* eslint-env es6*/\n\nimport Config from \"core/config\";\n\n/**\n * Start a new debugger\n * @param {*} handle The string to attach to all messages from this debugger\n * @returns {object} Debugger object\n */\nexport default function(handle) {\n let outputEnabled = Config.developerdebug;\n if (outputEnabled) {\n console.warn(`In development environment. Debugger output enabled for ${handle}`);\n } else {\n console.warn(`In production environment. Debugger output disabled for ${handle}`);\n }\n\n return {\n write() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.info.apply(console, args);\n }\n },\n log() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.log.apply(console, args);\n }\n },\n info() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.info.apply(console, args);\n }\n },\n warn() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.warn.apply(console, args);\n }\n },\n error() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.error.apply(console, args);\n }\n },\n time() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.time.apply(console, args);\n }\n },\n timeEnd() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.timeEnd.apply(console, args);\n }\n },\n timeLog() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.timeLog.apply(console, args);\n }\n },\n timeStamp() {\n if (outputEnabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.timeStamp.apply(console, args);\n }\n },\n enable() {\n outputEnabled = true;\n },\n disable() {\n outputEnabled = false;\n }\n };\n\n}\n"],"names":["handle","outputEnabled","Config","developerdebug","console","warn","write","args","Array","prototype","slice","call","arguments","unshift","info","apply","log","error","time","timeEnd","timeLog","timeStamp","enable","disable"],"mappings":"kMAWwBA,YAChBC,cAAgBC,gBAAOC,eACvBF,cACAG,QAAQC,KAAM,2DAA0DL,UAExEI,QAAQC,KAAM,2DAA0DL,gBAGrE,CACHM,WACQL,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQU,KAAKC,MAAMX,QAASG,QAGpCS,SACQf,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQY,IAAID,MAAMX,QAASG,QAGnCO,UACQb,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQU,KAAKC,MAAMX,QAASG,QAGpCF,UACQJ,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQC,KAAKU,MAAMX,QAASG,QAGpCU,WACQhB,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQa,MAAMF,MAAMX,QAASG,QAGrCW,UACQjB,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQc,KAAKH,MAAMX,QAASG,QAGpCY,aACQlB,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQe,QAAQJ,MAAMX,QAASG,QAGvCa,aACQnB,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQgB,QAAQL,MAAMX,QAASG,QAGvCc,eACQpB,cAAe,KACXM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQiB,UAAUN,MAAMX,QAASG,QAGzCe,SACIrB,eAAgB,GAEpBsB,UACItB,eAAgB"}
|
2
amd/build/util/fittext-vue.min.js
vendored
2
amd/build/util/fittext-vue.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/util/fittext-vue",["exports","./css-calc","./fitty","./textfit"],(function(_exports,_cssCalc,_fitty,_textfit){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_fitty=(obj=_fitty)&&obj.__esModule?obj:{default:obj};var _default={install(Vue){Vue.component("fittext",{props:{maxsize:{type:String,default:"512px"},minsize:{type:String,default:"10px"},vertical:Boolean,singleline:Boolean,dynamic:Boolean},data:()=>({resizeObserver:null,mutationObserver:null}),computed:{rootStyle(){return this.vertical?"height: 100%;":"width: 100%;"}},methods:{},mounted(){(0,_fitty.default)(this.$refs.text,{minSize:(0,_cssCalc.calc)(this.minsize),maxSize:(0,_cssCalc.calc)(this.maxsize),vertical:this.vertical,multiline:!this.singleline})},unmounted(){this.mutationObserver&&this.mutationObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect()},template:"\n <div class='q-fittext' ref='container' :style=\"rootStyle\">\n <span :style=\"'display:block; white-space:'+ ((singleline)?'nowrap':'normal')+';'\" class='q-fittext-text' ref='text'><slot></slot>\n </span\n ></div>\n "})}};return _exports.default=_default,_exports.default}));
|
||||
define("local_treestudyplan/util/fittext-vue",["exports","./css-calc","./fitty"],(function(_exports,_cssCalc,_fitty){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_fitty=(obj=_fitty)&&obj.__esModule?obj:{default:obj};var _default={install(Vue){Vue.component("fittext",{props:{maxsize:{type:String,default:"512px"},minsize:{type:String,default:"10px"},vertical:Boolean,singleline:Boolean,dynamic:Boolean},data:()=>({resizeObserver:null,mutationObserver:null}),computed:{rootStyle(){return this.vertical?"height: 100%;":"width: 100%;"}},methods:{},mounted(){(0,_fitty.default)(this.$refs.text,{minSize:(0,_cssCalc.calc)(this.minsize),maxSize:(0,_cssCalc.calc)(this.maxsize),vertical:this.vertical,multiline:!this.singleline})},unmounted(){this.mutationObserver&&this.mutationObserver.disconnect(),this.resizeObserver&&this.resizeObserver.disconnect()},template:"\n <div class='q-fittext' ref='container' :style=\"rootStyle + ';min-height:0;min-width:0;'\">\n <span :style=\"'display:block; white-space:'+ ((singleline)?'nowrap':'normal')+';' + rootStyle\" class='q-fittext-text' ref='text'><slot></slot>\n </span\n ></div>\n "})}};return _exports.default=_default,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=fittext-vue.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"fittext-vue.min.js","sources":["../../src/util/fittext-vue.js"],"sourcesContent":["/*eslint no-unused-vars: warn */\n/*eslint max-len: [\"error\", { \"code\": 160 }] */\n/*eslint-disable no-trailing-spaces */\n/*eslint-env es6*/\n\nimport {calc} from \"./css-calc\";\nimport fitty from \"./fitty\";\nimport {textFit} from \"./textfit\";\n\nexport default {\n install(Vue/*,options*/){\n Vue.component('fittext',{\n props: {\n maxsize: {\n type: String,\n default: \"512px\",\n },\n minsize: {\n type: String,\n default: \"10px\",\n },\n vertical: Boolean,\n singleline: Boolean,\n dynamic: Boolean,\n },\n data() {\n return {\n resizeObserver: null,\n mutationObserver: null,\n };\n },\n computed: {\n rootStyle() {\n if (this.vertical) {\n return `height: 100%;`;\n } else {\n return `width: 100%;`;\n }\n }\n },\n methods: {\n },\n mounted() {\n const self = this;\n // If the content could change after initial presentation,\n // Use the fitty method. It is slightly worse on multiline horizontal text,\n // but better supports content that can change later on.\n fitty(self.$refs.text,\n {\n minSize: calc(self.minsize),\n maxSize: calc(self.maxsize),\n vertical: self.vertical,\n multiline: !self.singleline,\n });\n },\n unmounted() {\n if(this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n if(this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n },\n template: `\n <div class='q-fittext' ref='container' :style=\"rootStyle\">\n <span :style=\"'display:block; white-space:'+ ((singleline)?'nowrap':'normal')+';'\" class='q-fittext-text' ref='text'><slot></slot>\n </span\n ></div>\n `,\n });\n },\n};"],"names":["install","Vue","component","props","maxsize","type","String","default","minsize","vertical","Boolean","singleline","dynamic","data","resizeObserver","mutationObserver","computed","rootStyle","this","methods","mounted","$refs","text","minSize","maxSize","multiline","unmounted","disconnect","template"],"mappings":"qSASe,CACXA,QAAQC,KACJA,IAAIC,UAAU,UAAU,CACxBC,MAAO,CACHC,QAAS,CACLC,KAAMC,OACNC,QAAS,SAEbC,QAAS,CACLH,KAAMC,OACNC,QAAS,QAEbE,SAAUC,QACVC,WAAYD,QACZE,QAASF,SAEbG,KAAI,KACO,CACHC,eAAgB,KAChBC,iBAAkB,OAG1BC,SAAU,CACNC,mBACQC,KAAKT,SACG,gBAEA,iBAIpBU,QAAS,GAETC,6BACiBF,KAIFG,MAAMC,KACb,CACAC,SAAS,iBANAL,KAMUV,SACnBgB,SAAS,iBAPAN,KAOUd,SACnBK,SARSS,KAQMT,SACfgB,WATSP,KASQP,cAGzBe,YACOR,KAAKH,uBACCA,iBAAiBY,aAEvBT,KAAKJ,qBACCA,eAAea,cAG5BC,SAAW"}
|
||||
{"version":3,"file":"fittext-vue.min.js","sources":["../../src/util/fittext-vue.js"],"sourcesContent":["/* eslint no-unused-vars: warn */\n/* eslint max-len: [\"error\", { \"code\": 160 }] */\n/* eslint capitalized-comments: \"off\" */\n/* eslint-env es6*/\n\nimport {calc} from \"./css-calc\";\nimport fitty from \"./fitty\";\n\nexport default {\n install(Vue/* ,options */) {\n Vue.component('fittext', {\n props: {\n maxsize: {\n type: String,\n 'default': \"512px\",\n },\n minsize: {\n type: String,\n 'default': \"10px\",\n },\n vertical: Boolean,\n singleline: Boolean,\n dynamic: Boolean,\n },\n data() {\n return {\n resizeObserver: null,\n mutationObserver: null,\n };\n },\n computed: {\n rootStyle() {\n if (this.vertical) {\n return `height: 100%;`;\n } else {\n return `width: 100%;`;\n }\n }\n },\n methods: {\n },\n mounted() {\n const self = this;\n // If the content could change after initial presentation,\n // Use the fitty method. It is slightly worse on multiline horizontal text,\n // but better supports content that can change later on.\n fitty(self.$refs.text,\n {\n minSize: calc(self.minsize),\n maxSize: calc(self.maxsize),\n vertical: self.vertical,\n multiline: !self.singleline,\n });\n },\n unmounted() {\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n }\n if (this.resizeObserver) {\n this.resizeObserver.disconnect();\n }\n },\n template: `\n <div class='q-fittext' ref='container' :style=\"rootStyle + ';min-height:0;min-width:0;'\">\n <span :style=\"'display:block; white-space:'+ ((singleline)?'nowrap':'normal')+';' + rootStyle\" class='q-fittext-text' ref='text'><slot></slot>\n </span\n ></div>\n `,\n });\n },\n};"],"names":["install","Vue","component","props","maxsize","type","String","minsize","vertical","Boolean","singleline","dynamic","data","resizeObserver","mutationObserver","computed","rootStyle","this","methods","mounted","$refs","text","minSize","maxSize","multiline","unmounted","disconnect","template"],"mappings":"gRAQe,CACXA,QAAQC,KACJA,IAAIC,UAAU,UAAW,CACzBC,MAAO,CACHC,QAAS,CACLC,KAAMC,eACK,SAEfC,QAAS,CACLF,KAAMC,eACK,QAEfE,SAAUC,QACVC,WAAYD,QACZE,QAASF,SAEbG,KAAI,KACO,CACHC,eAAgB,KAChBC,iBAAkB,OAG1BC,SAAU,CACNC,mBACQC,KAAKT,SACG,gBAEA,iBAIpBU,QAAS,GAETC,6BACiBF,KAIFG,MAAMC,KACb,CACAC,SAAS,iBANAL,KAMUV,SACnBgB,SAAS,iBAPAN,KAOUb,SACnBI,SARSS,KAQMT,SACfgB,WATSP,KASQP,cAGzBe,YACQR,KAAKH,uBACAA,iBAAiBY,aAEtBT,KAAKJ,qBACAA,eAAea,cAG5BC,SAAW"}
|
File diff suppressed because one or more lines are too long
2
amd/build/util/formfields.min.js
vendored
2
amd/build/util/formfields.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/util/formfields",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.text_integer=function(id){let unsigned=arguments.length>1&&void 0!==arguments[1]&&arguments[1],nonzero=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const element=document.getElementById(id);element&&element.addEventListener("input",(()=>{var val=element.value;if(""!=val)return!(isNaN(val)&&(unsigned||"-"!=val)||unsigned&&val<0||nonzero&&0==val)||(unsigned?(element.value=val.replace(/[^0-9]/g,""),nonzero&&0==val&&(element.value="")):element.value=val.replace(/[^0-9-]/g,"").replace(/(.{1})(-)/g,"$1"),!1)}))}}));
|
||||
define("local_treestudyplan/util/formfields",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.textInteger=function(id){let unsigned=arguments.length>1&&void 0!==arguments[1]&&arguments[1],nonzero=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const element=document.getElementById(id);element&&element.addEventListener("input",(()=>{var val=element.value;return""!=val?!(isNaN(val)&&(unsigned||"-"!=val)||unsigned&&val<0||nonzero&&0==val)||(unsigned?(element.value=val.replace(/[^0-9]/g,""),nonzero&&0==val&&(element.value="")):element.value=val.replace(/[^0-9-]/g,"").replace(/(.{1})(-)/g,"$1"),!1):null}))}}));
|
||||
|
||||
//# sourceMappingURL=formfields.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"formfields.min.js","sources":["../../src/util/formfields.js"],"sourcesContent":["/**\n * convert a text field into an integer only text field\n * @param {string} id The Id of the form field\n * @param {bool} unsigned Allow only unsigned values\n * @param {bool} nonzero Do not allow zero values\n */\nexport function text_integer(id,unsigned=false,nonzero=false){\n const element = document.getElementById(id);\n\n if (element) {\n element.addEventListener(\"input\",() => {\n var val = element.value;\n if (val != '') {\n if ((isNaN(val) && !(!unsigned && val == '-')) || (unsigned && val < 0) || (nonzero && val == 0)) {\n // Set input value empty\n if (unsigned) {\n element.value = val.replace(/[^0-9]/g,'');\n if (nonzero && val == 0) {\n element.value = '';\n }\n } else {\n element.value = val.replace(/[^0-9-]/g,'').replace(/(.{1})(-)/g,'$1');\n }\n return false;\n } else {\n return true;\n }\n }\n });\n }\n}"],"names":["id","unsigned","nonzero","element","document","getElementById","addEventListener","val","value","isNaN","replace"],"mappings":"oKAM6BA,QAAGC,iEAAeC,sEACrCC,QAAUC,SAASC,eAAeL,IAEpCG,SACAA,QAAQG,iBAAiB,SAAQ,SACzBC,IAAMJ,QAAQK,SACP,IAAPD,YACKE,MAAMF,OAAWN,UAAmB,KAAPM,MAAiBN,UAAYM,IAAM,GAAOL,SAAkB,GAAPK,OAE/EN,UACAE,QAAQK,MAAQD,IAAIG,QAAQ,UAAU,IAClCR,SAAkB,GAAPK,MACXJ,QAAQK,MAAQ,KAGpBL,QAAQK,MAAQD,IAAIG,QAAQ,WAAW,IAAIA,QAAQ,aAAa,OAE7D"}
|
||||
{"version":3,"file":"formfields.min.js","sources":["../../src/util/formfields.js"],"sourcesContent":["/**\n * Convert a text field into an integer only text field\n * @param {string} id The Id of the form field\n * @param {bool} unsigned Allow only unsigned values\n * @param {bool} nonzero Do not allow zero values\n */\nexport function textInteger(id, unsigned = false, nonzero = false) {\n const element = document.getElementById(id);\n\n if (element) {\n element.addEventListener(\"input\", () => {\n var val = element.value;\n if (val != '') {\n if ((isNaN(val) && !(!unsigned && val == '-')) || (unsigned && val < 0) || (nonzero && val == 0)) {\n // Set input value empty\n if (unsigned) {\n element.value = val.replace(/[^0-9]/g, '');\n if (nonzero && val == 0) {\n element.value = '';\n }\n } else {\n element.value = val.replace(/[^0-9-]/g, '').replace(/(.{1})(-)/g, '$1');\n }\n return false;\n } else {\n return true;\n }\n }\n return null;\n });\n }\n}"],"names":["id","unsigned","nonzero","element","document","getElementById","addEventListener","val","value","isNaN","replace"],"mappings":"mKAM4BA,QAAIC,iEAAkBC,sEACxCC,QAAUC,SAASC,eAAeL,IAEpCG,SACAA,QAAQG,iBAAiB,SAAS,SAC1BC,IAAMJ,QAAQK,YACP,IAAPD,MACKE,MAAMF,OAAWN,UAAmB,KAAPM,MAAiBN,UAAYM,IAAM,GAAOL,SAAkB,GAAPK,OAE/EN,UACAE,QAAQK,MAAQD,IAAIG,QAAQ,UAAW,IACnCR,SAAkB,GAAPK,MACXJ,QAAQK,MAAQ,KAGpBL,QAAQK,MAAQD,IAAIG,QAAQ,WAAY,IAAIA,QAAQ,aAAc,OAE/D,GAKR,IAAP"}
|
2
amd/build/util/mform-helper.min.js
vendored
2
amd/build/util/mform-helper.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/util/mform-helper",["exports","core/ajax","core/fragment","core/templates","core/notification","./string-helper","./debugger"],(function(_exports,_ajax,_fragment,_templates,_notification,_stringHelper,_debugger){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=_interopRequireDefault(_notification),_debugger=_interopRequireDefault(_debugger);var _default={install(Vue){let debug=new _debugger.default("treestudyplan-mform-helper"),strings=(0,_stringHelper.load_strings)({editmod:{save$core:"save$core",cancel$core:"cancel$core"}});Vue.component("mform",{props:{name:{type:String},params:{type:Object},title:{type:String,default:""},variant:{type:String,default:"primary"},type:{type:String,default:"link"}},data:()=>({content:"",loading:!0,uuid:void 0!==crypto.randomUUID?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(c=>(c^crypto.getRandomValues(new Uint8Array(1))[0]&15>>c/4).toString(16))),text:strings,submitok:!1,observer:null,inputs:[]}),computed:{},methods:{openForm(){this.$refs.editormodal.show()},onShown(){const self=this;debug.info(`Loading form "${self.name}" with params`,self.params),self.loading=!1,(0,_ajax.call)([{methodname:"local_treestudyplan_get_mform",args:{formname:self.name,params:JSON.stringify(self.params)}}])[0].then((data=>{const html=data.html;self.loading=!1;const js=(0,_fragment.processCollectedJavascript)(data.javascript);(0,_templates.replaceNodeContents)(self.$refs.content,html,js),self.initListenChanges()})).catch(_notification.default.exception)},onSave(){const self=this;let form=this.$refs.content.getElementsByTagName("form")[0];form.dispatchEvent(new Event("save-form-state"));const formdata=new FormData(form),data=new URLSearchParams(formdata).toString();this.checkSave()&&(0,_ajax.call)([{methodname:"local_treestudyplan_submit_mform",args:{formname:self.name,params:JSON.stringify(self.params),formdata:data}}])[0].then((response=>{const updatedplan=JSON.parse(response.data);self.$emit("saved",updatedplan,formdata)})).catch(_notification.default.exception)},checkSave(){let canSave=!0;return this.inputs.forEach((el=>{el.focus(),el.blur(),el.classList.contains("is-invalid")&&(canSave=!1)}),this),this.submitok=canSave,canSave},initListenChanges(){const content=this.$refs.content;this.inputs=content.querySelectorAll("input.form-control"),setTimeout(this.checkSave,100),this.observer&&this.observer.disconnect(),this.observer=new MutationObserver((mutationList=>{for(const mix in mutationList){const mutation=mutationList[mix];"attributes"===mutation.type&&"class"===mutation.attributeName&&this.checkSave()}})),this.inputs.forEach((el=>{this.observer.observe(el,{attributes:!0})}),this)}},unmount(){this.observer&&this.observer.disconnect()},template:'\n <span class=\'mform-container\'>\n <b-button :variant="variant" v-if=\'type == "button"\' @click.prevent=\'openForm\'\n ><slot><i class=\'fa fa-gear\'></i></slot></b-button>\n <a variant="variant" v-else href=\'#\' @click.prevent=\'openForm\'\n ><slot><i class=\'fa fa-gear\'></i></slot></a>\n <b-modal\n ref="editormodal"\n scrollable\n centered\n size="xl"\n id="\'modal-\'+uuid"\n @shown="onShown"\n @ok="onSave"\n :ok-disabled="!submitok"\n :title="title"\n :ok-title="text.save$core"\n ><div :class="\'s-mform-content\'" ref="content"\n ><div class="d-flex justify-content-center mb-3"\n ><b-spinner variant="primary"></b-spinner\n ></div\n ></div\n ></b-modal>\n </span>\n '})}};return _exports.default=_default,_exports.default}));
|
||||
define("local_treestudyplan/util/mform-helper",["exports","core/ajax","core/fragment","core/templates","core/notification","./string-helper","./debugger"],(function(_exports,_ajax,_fragment,_templates,_notification,_stringHelper,_debugger){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_notification=_interopRequireDefault(_notification),_debugger=_interopRequireDefault(_debugger);var _default={install(Vue){let debug=new _debugger.default("treestudyplan-mform-helper"),strings=(0,_stringHelper.loadStrings)({editmod:{save$core:"save$core",cancel$core:"cancel$core"}});Vue.component("mform",{props:{name:{type:String},params:{type:Object},title:{type:String,default:""},variant:{type:String,default:"primary"},type:{type:String,default:"link"}},data:()=>({content:"",loading:!0,uuid:void 0!==crypto.randomUUID?crypto.randomUUID():"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(c=>(c^crypto.getRandomValues(new Uint8Array(1))[0]&15>>c/4).toString(16))),text:strings,submitok:!1,observer:null,inputs:[]}),computed:{},methods:{openForm(){this.$refs.editormodal.show()},onShown(){const self=this;debug.info(`Loading form "${self.name}" with params`,self.params),self.loading=!1,(0,_ajax.call)([{methodname:"local_treestudyplan_get_mform",args:{formname:self.name,params:JSON.stringify(self.params)}}])[0].then((data=>{const html=data.html;self.loading=!1;const js=(0,_fragment.processCollectedJavascript)(data.javascript);(0,_templates.replaceNodeContents)(self.$refs.content,html,js),self.initListenChanges()})).catch(_notification.default.exception)},onSave(){const self=this;let form=this.$refs.content.getElementsByTagName("form")[0];form.dispatchEvent(new Event("save-form-state"));const formdata=new FormData(form),data=new URLSearchParams(formdata).toString();this.checkSave()&&(0,_ajax.call)([{methodname:"local_treestudyplan_submit_mform",args:{formname:self.name,params:JSON.stringify(self.params),formdata:data}}])[0].then((response=>{const updatedplan=JSON.parse(response.data);self.$emit("saved",updatedplan,formdata)})).catch(_notification.default.exception)},checkSave(){let canSave=!0;return this.inputs.forEach((el=>{el.focus(),el.blur(),el.classList.contains("is-invalid")&&(canSave=!1)}),this),this.submitok=canSave,canSave},initListenChanges(){const content=this.$refs.content;this.inputs=content.querySelectorAll("input.form-control"),setTimeout(this.checkSave,100),this.observer&&this.observer.disconnect(),this.observer=new MutationObserver((mutationList=>{for(const mix in mutationList){const mutation=mutationList[mix];"attributes"===mutation.type&&"class"===mutation.attributeName&&this.checkSave()}})),this.inputs.forEach((el=>{this.observer.observe(el,{attributes:!0})}),this)}},unmount(){this.observer&&this.observer.disconnect()},template:'\n <span class=\'mform-container\'>\n <b-button :variant="variant" v-if=\'type == "button"\' @click.prevent=\'openForm\'\n ><slot><i class=\'fa fa-gear\'></i></slot></b-button>\n <a variant="variant" v-else href=\'#\' @click.prevent=\'openForm\'\n ><slot><i class=\'fa fa-gear\'></i></slot></a>\n <b-modal\n ref="editormodal"\n scrollable\n centered\n size="xl"\n id="\'modal-\'+uuid"\n @shown="onShown"\n @ok="onSave"\n :ok-disabled="!submitok"\n :title="title"\n :ok-title="text.save$core"\n ><div :class="\'s-mform-content\'" ref="content"\n ><div class="d-flex justify-content-center mb-3"\n ><b-spinner variant="primary"></b-spinner\n ></div\n ></div\n ></b-modal>\n </span>\n '})}};return _exports.default=_default,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=mform-helper.min.js.map
|
File diff suppressed because one or more lines are too long
3
amd/build/util/premium.min.js
vendored
3
amd/build/util/premium.min.js
vendored
|
@ -1,3 +0,0 @@
|
|||
define("local_treestudyplan/util/premium",["exports","core/ajax"],(function(_exports,_ajax){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.enabled=function(){return!!premiumstatus.enabled};let premiumstatus={enabled:!1,website:"",name:"",expires:""}}));
|
||||
|
||||
//# sourceMappingURL=premium.min.js.map
|
|
@ -1 +0,0 @@
|
|||
{"version":3,"file":"premium.min.js","sources":["../../src/util/premium.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint no-unused-vars: \"off\" */\n/*eslint linebreak-style: \"off\" */\n/*eslint no-trailing-spaces: \"off\" */\n/*eslint-env es6*/\n\nimport {call} from 'core/ajax';\n\n// Prepare default value.\nlet premiumstatus = {\n enabled: false,\n website: \"\",\n name: \"\",\n expires: \"\",\n};\n\n/**\n * Check if premium status is enabled.\n * @returns {Object} The map with strings loaded in\n */\nexport function enabled (){\n return !!premiumstatus.enabled;\n}\n"],"names":["premiumstatus","enabled","website","name","expires"],"mappings":"wLAqBaA,cAAcC,aAZvBD,cAAgB,CAChBC,SAAS,EACTC,QAAS,GACTC,KAAM,GACNC,QAAS"}
|
3
amd/build/util/psidebar-vue.min.js
vendored
Normal file
3
amd/build/util/psidebar-vue.min.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
define("local_treestudyplan/util/psidebar-vue",["exports","../portal-vue/portal-vue.esm","./debugger"],(function(_exports,_portalVue,_debugger){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_portalVue=_interopRequireDefault(_portalVue);let wrapper,contentwrapper,resizeObserver,debug=new((_debugger=_interopRequireDefault(_debugger)).default)("p-sidebar");function createPortalTarget(target,offsetref){let initializeWrapperContent=!1;if(debug.info("Creating portal target"),wrapper=document.querySelector("#p-sidebar-wrapper"),wrapper||(initializeWrapperContent=!0,wrapper=document.createElement("div"),wrapper.setAttribute("id","p-sidebar-wrapper")),contentwrapper=document.querySelector("#p-sidebar-contentwrapper"),contentwrapper||(initializeWrapperContent=!0,contentwrapper=document.createElement("div"),contentwrapper.setAttribute("id","p-sidebar-contentwrapper"),wrapper.appendChild(contentwrapper)),initializeWrapperContent){let targetEl=document.querySelector(target);for(targetEl&&"HTML"!=targetEl.nodeType||(targetEl=document.querySelector("body")),console.info(`Targeting '${target}' to `,targetEl);targetEl.childNodes.length>0;)contentwrapper.appendChild(targetEl.childNodes[0]);targetEl.appendChild(wrapper)}rePosition(!1),setOffset(offsetref)}function rePosition(right){let el=document.querySelector("#p-sidebar-mount");el||(el=document.createElement("div"),el.setAttribute("id","p-sidebar-mount"),resizeObserver=new ResizeObserver((()=>{let wx=0-el.getBoundingClientRect().width;wx+=0!=wx?"px":"",el.style.setProperty("--p-sidebar-hideoffset",wx)})),resizeObserver.observe(el)),right?wrapper.insertBefore(el,contentwrapper.nextSibling):wrapper.insertBefore(el,contentwrapper)}function setOffset(reference){const ref=reference?document.querySelector(reference):null;if(ref){let offsetTop=ref?ref.offsetTop:0;offsetTop+=0!=offsetTop?"px":"";const el=document.querySelector("#p-sidebar-mount");el&&(el.style.height=`calc( 100vh - ${offsetTop})`,el.style.marginTop=offsetTop)}}var _default={install(Vue){Vue.use(_portalVue.default),"ready"===document.readyState||"complete"===document.readyState?(debug.info("Page already loaded"),createPortalTarget()):window.addEventListener("load",(()=>{debug.info("Page not yet loaded"),createPortalTarget()})),Vue.component("p-easeinout",{template:'\n <transition name="p-easeinout"\n ><slot></slot>\n </transition>'}),Vue.component("p-sidebar",{props:{value:{type:Boolean,default:!0},right:{type:Boolean,default:!1},shadow:{type:Boolean,default:!1},target:{type:String,default:"body"},offsetRef:{type:String,default:""}},data:()=>({wrapper:null,contentwrapper:null,resizeobserver:null}),computed:{},methods:{},watch:{right(newVal){rePosition(newVal)},offsetRef(reference){setOffset(reference,this.$refs.portal)}},mounted(){debug.info("OffsetRef",this.offsetRef),setOffset(this.offsetRef),debug.info("Right",this.right),rePosition(this.right)},template:"\n <div\n ><mounting-portal ref='portal'\n mount-to=\"#p-sidebar-mount\"\n class=\"(right?'p-sidebar-right ':'')\"\n append\n transition=\"p-easeinout\"\n ><div ref='container' v-if=\"value\"\n :class=\"'p-sidebar ' + (right?'p-sidebar-right ':'') + (shadow?'p-sidebar-shadow ':'')\"\n ><slot></slot></div\n ></mounting-portal>\n </div>\n "})}};return _exports.default=_default,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=psidebar-vue.min.js.map
|
1
amd/build/util/psidebar-vue.min.js.map
Normal file
1
amd/build/util/psidebar-vue.min.js.map
Normal file
File diff suppressed because one or more lines are too long
3
amd/build/util/settings.min.js
vendored
Normal file
3
amd/build/util/settings.min.js
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
define("local_treestudyplan/util/settings",["exports","core/ajax","core/notification"],(function(_exports,_ajax,_notification){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.settings=function(key){const settings=loadsettings();return key in settings?settings[key]:null},_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};let settingcache=null;function loadsettings(){return settingcache||(0,_ajax.call)([{methodname:"local_treestudyplan_getsettings",args:{}}])[0].then((response=>{settingcache=response})).catch(_notification.default.exception),settingcache}loadsettings()}));
|
||||
|
||||
//# sourceMappingURL=settings.min.js.map
|
1
amd/build/util/settings.min.js.map
Normal file
1
amd/build/util/settings.min.js.map
Normal file
|
@ -0,0 +1 @@
|
|||
{"version":3,"file":"settings.min.js","sources":["../../src/util/settings.js"],"sourcesContent":["/* eslint no-var: \"error\" */\n/* eslint-env es6*/\n\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\n// Prepare default value.\nlet settingcache = null;\n\n/**\n * Retrieve settings.\n * @param {String} key\n * @returns {*}\n */\nexport function settings(key) {\n const settings = loadsettings();\n if (key in settings) {\n return settings[key];\n } else {\n return null;\n }\n}\n\n/**\n * Get settings from server or cache\n * @returns {Object} The settings object\n */\nfunction loadsettings() {\n if (!settingcache) {\n // Retrieve setting cache if needed.\n call([{\n methodname: 'local_treestudyplan_getsettings',\n args: {}\n }])[0].then((response) => {\n settingcache = response;\n return;\n }).catch(notification.exception);\n }\n return settingcache;\n}\n\n// Preload settings.\nloadsettings();"],"names":["key","settings","loadsettings","settingcache","methodname","args","then","response","catch","notification","exception"],"mappings":"0NAcyBA,WACfC,SAAWC,sBACbF,OAAOC,SACAA,SAASD,KAET,8EAZXG,aAAe,cAoBVD,sBACAC,6BAEI,CAAC,CACFC,WAAY,kCACZC,KAAM,MACN,GAAGC,MAAMC,WACTJ,aAAeI,YAEhBC,MAAMC,sBAAaC,WAEnBP,aAIXD"}
|
2
amd/build/util/string-helper.min.js
vendored
2
amd/build/util/string-helper.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/util/string-helper",["exports","core/str"],(function(_exports,_str){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.load_stringkeys=function(string_keys){for(let idx in string_keys){let stringkeys=[];for(const i in string_keys[idx]){let parts=string_keys[idx][i].textkey.split("$"),identifier=parts[0],component=parts.length>1?parts[1]:"local_treestudyplan";stringkeys.push({key:identifier,component:component})}getstr_func(stringkeys).then((function(strings){for(const i in strings){const s=strings[i];string_keys[idx][i].text=s}}))}return string_keys},_exports.load_strings=function(strings){for(let idx in strings){let stringkeys=[];for(const handle in strings[idx]){let parts=strings[idx][handle].split(/[$@]/),identifier=parts[0],component=parts.length>1?parts[1]:"local_treestudyplan";stringkeys.push({key:identifier,component:component})}getstr_func(stringkeys).then((function(str){let i=0;for(const handle in strings[idx])strings[idx][handle]=str[i],i++}))}return strings},_exports.strformat=function(str,values){return str.replace(/\{(\w+)\}/g,((m,m1)=>m1&&values.hasOwnProperty(m1)?values[m1]:m))};const getstr_func=void 0!==_str.getStrings?_str.getStrings:_str.get_strings}));
|
||||
define("local_treestudyplan/util/string-helper",["exports","core/str","./debugger"],(function(_exports,_str,_debugger){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.loadStringKeys=function(string_keys,plugin){void 0===plugin&&(plugin="local_treestudyplan");for(let idx in string_keys){let stringkeys=[];for(const i in string_keys[idx]){let parts=string_keys[idx][i].textkey.split("$"),identifier=parts[0],component=parts.length>1?parts[1]:plugin;stringkeys.push({key:identifier,component:component})}getstrFunc(stringkeys).then((function(strings){for(const i in strings){const s=strings[i];string_keys[idx][i].text=s}})).catch((x=>{debug.warn(x)}))}return string_keys},_exports.loadStrings=function(strings,plugin){void 0===plugin&&(plugin="local_treestudyplan");for(let idx in strings){let stringkeys=[];for(const handle in strings[idx]){let parts=strings[idx][handle].split(/[$@]/),identifier=parts[0],component=parts.length>1?parts[1]:plugin;stringkeys.push({key:identifier,component:component})}getstrFunc(stringkeys).then((function(str){let i=0;for(const handle in strings[idx])strings[idx][handle]=str[i],i++})).catch((x=>{debug.warn(x)}))}return strings},_exports.strformat=function(str,values){return str.replace(/\{(\w+)\}/g,((m,m1)=>m1&&values.hasOwnProperty(m1)?values[m1]:m))};let debug=new(_debugger=(obj=_debugger)&&obj.__esModule?obj:{default:obj}).default("string-helper");const getstrFunc=void 0!==_str.getStrings?_str.getStrings:_str.get_strings}));
|
||||
|
||||
//# sourceMappingURL=string-helper.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"string-helper.min.js","sources":["../../src/util/string-helper.js"],"sourcesContent":["import {get_strings} from 'core/str';\nimport {getStrings} from 'core/str';\n\n/* Determine the proper getstrings function to use (MDL4.3+ recommends use of getStrings, which is jquery independent) */\nconst getstr_func = (getStrings !== undefined)?getStrings:get_strings;\n\n/**\n * Load the translation of strings from a strings object\n * @param {Object} strings The map of strings\n * @returns {Object} The map with strings loaded in\n */\nexport function load_strings(strings){\n for(let idx in strings){\n let stringkeys = [];\n for(const handle in strings[idx]){\n const key = strings[idx][handle];\n let parts = key.split(/[$@]/);\n let identifier = parts[0];\n let component = (parts.length > 1)?parts[1]:'local_treestudyplan';\n stringkeys.push({ key: identifier, component: component});\n }\n getstr_func(stringkeys).then(function(str){\n let i = 0;\n for(const handle in strings[idx]){\n strings[idx][handle] = str[i];\n i++;\n }\n });\n }\n\n return strings;\n}\n\n/**\n * Load the translation of strings from a strings object based on keys\n * Used for loading values for a drop down menu or the like\n * @param {Object} string_keys The map of stringkeys\n * @returns {Object} The map with strings loaded in\n */\nexport function load_stringkeys(string_keys){\n for(let idx in string_keys){\n // Get text strings for condition settings\n let stringkeys = [];\n for(const i in string_keys[idx]){\n const key = string_keys[idx][i].textkey;\n let parts = key.split(\"$\");\n let identifier = parts[0];\n let component = (parts.length > 1)?parts[1]:'local_treestudyplan';\n stringkeys.push({ key: identifier, component: component});\n }\n getstr_func(stringkeys).then(function(strings){\n for(const i in strings) {\n const s = strings[i];\n const l = string_keys[idx][i];\n l.text = s;\n }\n });\n }\n return string_keys;\n}\n\n/**\n * String formatting function - replaces {name} in string by value of same key in values parameter\n * @param {string} str String t\n * @param {object} values Object containing keys to replace {key} strings with\n * @returns Formatted string\n */\nexport function strformat(str,values) {\n return str.replace(/\\{(\\w+)\\}/g, (m, m1) => {\n if (m1 && values.hasOwnProperty(m1)) {\n return values[m1];\n } else {\n return m;\n }\n });\n}"],"names":["string_keys","idx","stringkeys","i","parts","textkey","split","identifier","component","length","push","key","getstr_func","then","strings","s","text","handle","str","values","replace","m","m1","hasOwnProperty","undefined","getStrings","get_strings"],"mappings":"0LAuCgCA,iBACxB,IAAIC,OAAOD,YAAY,KAEnBE,WAAa,OACb,MAAMC,KAAMH,YAAYC,KAAK,KAEzBG,MADQJ,YAAYC,KAAKE,GAAGE,QAChBC,MAAM,KAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAGL,MAAM,GAAG,sBAC5CF,WAAWQ,KAAK,CAAEC,IAAKJ,WAAYC,UAAWA,YAElDI,YAAYV,YAAYW,MAAK,SAASC,aAC9B,MAAMX,KAAKW,QAAS,OACdC,EAAID,QAAQX,GACRH,YAAYC,KAAKE,GACzBa,KAAOD,aAIdf,4CA/CkBc,aACrB,IAAIb,OAAOa,QAAQ,KACfZ,WAAa,OACb,MAAMe,UAAWH,QAAQb,KAAK,KAE1BG,MADQU,QAAQb,KAAKgB,QACTX,MAAM,QAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAGL,MAAM,GAAG,sBAC5CF,WAAWQ,KAAK,CAAEC,IAAKJ,WAAYC,UAAWA,YAElDI,YAAYV,YAAYW,MAAK,SAASK,SAC9Bf,EAAI,MACJ,MAAMc,UAAUH,QAAQb,KACxBa,QAAQb,KAAKgB,QAAUC,IAAIf,GAC3BA,cAKLW,qCAqCeI,IAAIC,eACnBD,IAAIE,QAAQ,cAAc,CAACC,EAAGC,KAC7BA,IAAMH,OAAOI,eAAeD,IACrBH,OAAOG,IAEPD,WApEbT,iBAA8BY,IAAfC,gBAA0BA,gBAAWC"}
|
||||
{"version":3,"file":"string-helper.min.js","sources":["../../src/util/string-helper.js"],"sourcesContent":["/* eslint camelcase: \"off\" */\nimport {get_strings} from 'core/str';\nimport {getStrings} from 'core/str';\nimport Debugger from './debugger';\nlet debug = new Debugger(\"string-helper\");\n\n/* Determine the proper getstrings function to use (MDL4.3+ recommends use of getStrings, which is jquery independent) */\nconst getstrFunc = (getStrings !== undefined) ? getStrings : get_strings;\n\n/**\n * Load the translation of strings from a strings object\n * @param {Object} strings The map of strings\n * @param {String} plugin Name of plugin to load for by default (leave empty for 'local_treestudyplan')\n * @returns {Object} The map with strings loaded in\n */\nexport function loadStrings(strings, plugin) {\n if (plugin === undefined) {\n plugin = 'local_treestudyplan';\n }\n for (let idx in strings) {\n let stringkeys = [];\n for (const handle in strings[idx]) {\n const key = strings[idx][handle];\n let parts = key.split(/[$@]/);\n let identifier = parts[0];\n let component = (parts.length > 1) ? parts[1] : plugin;\n stringkeys.push({key: identifier, component: component});\n }\n getstrFunc(stringkeys).then(function(str) {\n let i = 0;\n for (const handle in strings[idx]) {\n strings[idx][handle] = str[i];\n i++;\n }\n return;\n }).catch((x) => {\n debug.warn(x);\n });\n }\n\n return strings;\n}\n\n/**\n * Load the translation of strings from a strings object based on keys\n * Used for loading values for a drop down menu or the like\n * @param {Object} string_keys The map of stringkeys\n * @param {String} plugin Name of plugin to load for by default (leave empty for 'local_treestudyplan')\n * @returns {Object} The map with strings loaded in\n */\nexport function loadStringKeys(string_keys, plugin) {\n if (plugin === undefined) {\n plugin = 'local_treestudyplan';\n }\n for (let idx in string_keys) {\n // Get text strings for condition settings\n let stringkeys = [];\n for (const i in string_keys[idx]) {\n const key = string_keys[idx][i].textkey;\n let parts = key.split(\"$\");\n let identifier = parts[0];\n let component = (parts.length > 1) ? parts[1] : plugin;\n stringkeys.push({key: identifier, component: component});\n }\n getstrFunc(stringkeys).then(function(strings) {\n for (const i in strings) {\n const s = strings[i];\n const l = string_keys[idx][i];\n l.text = s;\n }\n return;\n }).catch((x) => {\n debug.warn(x);\n });\n }\n return string_keys;\n}\n\n/**\n * String formatting function - replaces {name} in string by value of same key in values parameter\n * @param {string} str String t\n * @param {object} values Object containing keys to replace {key} strings with\n * @returns {string} Formatted string\n */\nexport function strformat(str, values) {\n return str.replace(/\\{(\\w+)\\}/g, (m, m1) => {\n if (m1 && values.hasOwnProperty(m1)) {\n return values[m1];\n } else {\n return m;\n }\n });\n}"],"names":["string_keys","plugin","undefined","idx","stringkeys","i","parts","textkey","split","identifier","component","length","push","key","getstrFunc","then","strings","s","text","catch","x","debug","warn","handle","str","values","replace","m","m1","hasOwnProperty","getStrings","get_strings"],"mappings":"wNAkD+BA,YAAaC,aACzBC,IAAXD,SACAA,OAAS,2BAER,IAAIE,OAAOH,YAAa,KAErBI,WAAa,OACZ,MAAMC,KAAKL,YAAYG,KAAM,KAE1BG,MADQN,YAAYG,KAAKE,GAAGE,QAChBC,MAAM,KAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAKL,MAAM,GAAKL,OAChDG,WAAWQ,KAAK,CAACC,IAAKJ,WAAYC,UAAWA,YAEjDI,WAAWV,YAAYW,MAAK,SAASC,aAC5B,MAAMX,KAAKW,QAAS,OACfC,EAAID,QAAQX,GACRL,YAAYG,KAAKE,GACzBa,KAAOD,MAGdE,OAAOC,IACNC,MAAMC,KAAKF,aAGZpB,2CA5DiBgB,QAASf,aAClBC,IAAXD,SACAA,OAAS,2BAER,IAAIE,OAAOa,QAAS,KACjBZ,WAAa,OACZ,MAAMmB,UAAUP,QAAQb,KAAM,KAE3BG,MADQU,QAAQb,KAAKoB,QACTf,MAAM,QAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAKL,MAAM,GAAKL,OAChDG,WAAWQ,KAAK,CAACC,IAAKJ,WAAYC,UAAWA,YAEjDI,WAAWV,YAAYW,MAAK,SAASS,SAC7BnB,EAAI,MACH,MAAMkB,UAAUP,QAAQb,KACzBa,QAAQb,KAAKoB,QAAUC,IAAInB,GAC3BA,OAGLc,OAAOC,IACNC,MAAMC,KAAKF,aAIZJ,qCA4CeQ,IAAKC,eACpBD,IAAIE,QAAQ,cAAc,CAACC,EAAGC,KAC7BA,IAAMH,OAAOI,eAAeD,IACrBH,OAAOG,IAEPD,SArFfN,MAAQ,yEAAa,uBAGnBP,gBAA6BZ,IAAf4B,gBAA4BA,gBAAaC"}
|
2
amd/build/util/svgarc.min.js
vendored
2
amd/build/util/svgarc.min.js
vendored
|
@ -1,3 +1,3 @@
|
|||
define("local_treestudyplan/util/svgarc",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.svgarcpath=_exports.svgarc=void 0;const cos=Math.cos,sin=Math.sin,π=Math.PI,f_matrix_times=(_ref,_ref2)=>{let[[a,b],[c,d]]=_ref,[x,y]=_ref2;return[a*x+b*y,c*x+d*y]},f_vec_add=(_ref3,_ref4)=>{let[a1,a2]=_ref3,[b1,b2]=_ref4;return[a1+b1,a2+b2]},svgarcpath=(_ref5,_ref6,_ref7,φ)=>{let[cx,cy]=_ref5,[rx,ry]=_ref6,[t1,Δ]=_ref7;Δ%=2*π;const rotMatrix=[[cos(x=φ),-sin(x)],[sin(x),cos(x)]];var x;const[sX,sY]=f_vec_add(f_matrix_times(rotMatrix,[rx*cos(t1),ry*sin(t1)]),[cx,cy]),[eX,eY]=f_vec_add(f_matrix_times(rotMatrix,[rx*cos(t1+Δ),ry*sin(t1+Δ)]),[cx,cy]);return"M "+sX+" "+sY+" A "+[rx,ry,φ/(2*π)*360,Δ>π?1:0,Δ>0?1:0,eX,eY].join(" ")};_exports.svgarcpath=svgarcpath;_exports.svgarc=(_ref8,_ref9,_ref10,φ)=>{let[cx,cy]=_ref8,[rx,ry]=_ref9,[t1,Δ]=_ref10;const path_2wk2r=document.createElementNS("http://www.w3.org/2000/svg","path"),d=svgarcpath([cx,cy],[rx,ry],[t1,Δ],φ);return path_2wk2r.setAttribute("d",d),path_2wk2r}}));
|
||||
define("local_treestudyplan/util/svgarc",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.svgarcpath=_exports.svgarc=void 0;const cos=Math.cos,sin=Math.sin,π=Math.PI,fMatrixTimes=(_ref,_ref2)=>{let[[a,b],[c,d]]=_ref,[x,y]=_ref2;return[a*x+b*y,c*x+d*y]},fVecAdd=(_ref3,_ref4)=>{let[a1,a2]=_ref3,[b1,b2]=_ref4;return[a1+b1,a2+b2]},svgarcpath=(_ref5,_ref6,_ref7,φ)=>{let[cx,cy]=_ref5,[rx,ry]=_ref6,[t1,Δ]=_ref7;Δ%=2*π;const rotMatrix=[[cos(x=φ),-sin(x)],[sin(x),cos(x)]];var x;const[sX,sY]=fVecAdd(fMatrixTimes(rotMatrix,[rx*cos(t1),ry*sin(t1)]),[cx,cy]),[eX,eY]=fVecAdd(fMatrixTimes(rotMatrix,[rx*cos(t1+Δ),ry*sin(t1+Δ)]),[cx,cy]),fA=Δ>π?1:0,fS=Δ>0?1:0;return isNaN(eY)||isNaN(eX)?"":"M "+sX+" "+sY+" A "+[rx,ry,φ/(2*π)*360,fA,fS,eX,eY].join(" ")};_exports.svgarcpath=svgarcpath;_exports.svgarc=(_ref8,_ref9,_ref10,φ)=>{let[cx,cy]=_ref8,[rx,ry]=_ref9,[t1,Δ]=_ref10;const path2wk2r=document.createElementNS("http://www.w3.org/2000/svg","path"),d=svgarcpath([cx,cy],[rx,ry],[t1,Δ],φ);return path2wk2r.setAttribute("d",d),path2wk2r}}));
|
||||
|
||||
//# sourceMappingURL=svgarc.min.js.map
|
|
@ -1 +1 @@
|
|||
{"version":3,"file":"svgarc.min.js","sources":["../../src/util/svgarc.js"],"sourcesContent":["/*\nCopyright © 2020 Xah Lee, © 2023 P.M Kuipers\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the “Software”),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\nURL: SVG Circle Arc http://xahlee.info/js/svg_circle_arc.html\n*/\n\nconst cos = Math.cos;\nconst sin = Math.sin;\nconst π = Math.PI;\n\nconst f_matrix_times = (( [[a,b], [c,d]], [x,y]) => [ a * x + b * y, c * x + d * y]);\nconst f_rotate_matrix = (x => [[cos(x),-sin(x)], [sin(x), cos(x)]]);\nconst f_vec_add = (([a1, a2], [b1, b2]) => [a1 + b1, a2 + b2]);\n\n// function modified by pmkuipers for text params\n/**\n * Create svg path text for an arc\n * @param {*} center [cx,cy] center of ellipse\n * @param {*} radius [rx,ry] major minor radius\n * @param {*} angle [t1, Δ] start angle, in radian, angle to sweep, in radian. positive.\n * @param {*} φ rotation on the whole, in radian\n * @returns a SVG path element that represent a ellipse. Text describing the arc path in an svg path element\n */\nconst svgarcpath = (([cx,cy],[rx,ry], [t1, Δ], φ ) => {\n Δ = Δ % (2*π);\n const rotMatrix = f_rotate_matrix (φ);\n const [sX, sY] = ( f_vec_add ( f_matrix_times ( rotMatrix, [rx * cos(t1), ry * sin(t1)] ), [cx,cy] ) );\n const [eX, eY] = ( f_vec_add ( f_matrix_times ( rotMatrix, [rx * cos(t1+Δ), ry * sin(t1+Δ)] ), [cx,cy] ) );\n const fA = ( ( Δ > π ) ? 1 : 0 );\n const fS = ( ( Δ > 0 ) ? 1 : 0 );\n return \"M \" + sX + \" \" + sY + \" A \" + [ rx , ry , φ / (2*π) *360, fA, fS, eX, eY ].join(\" \");\n});\n\n/**\n * Create an svg arc element\n * @param {*} center [cx,cy] center of ellipse\n * @param {*} radius [rx,ry] major minor radius\n * @param {*} angle [t1, Δ] start angle, in radian, angle to sweep, in radian. positive.\n * @param {*} φ rotation on the whole, in radian\n * @returns a SVG path element that represent a ellipse.\n */\nconst svgarc = (([cx,cy],[rx,ry], [t1, Δ], φ ) => {\n const path_2wk2r = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n const d = svgarcpath([cx,cy],[rx,ry], [t1, Δ], φ );\n path_2wk2r.setAttribute(\"d\", d);\n return path_2wk2r;\n});\n\nexport {svgarc, svgarcpath};"],"names":["cos","Math","sin","π","PI","f_matrix_times","a","b","c","d","x","y","f_vec_add","a1","a2","b1","b2","svgarcpath","φ","cx","cy","rx","ry","t1","Δ","rotMatrix","sX","sY","eX","eY","join","path_2wk2r","document","createElementNS","setAttribute"],"mappings":"kLAoBMA,IAAMC,KAAKD,IACXE,IAAMD,KAAKC,IACXC,EAAIF,KAAKG,GAETC,eAAkB,oBAAIC,EAAEC,IAAKC,EAAEC,UAAMC,EAAEC,eAAO,CAAEL,EAAII,EAAIH,EAAII,EAAGH,EAAIE,EAAID,EAAIE,EAAzD,EAElBC,UAAa,oBAAEC,GAAIC,WAAMC,GAAIC,gBAAQ,CAACH,GAAKE,GAAID,GAAKE,GAAvC,EAWbC,WAAc,mBAA2BC,SAAzBC,GAAGC,WAAKC,GAAGC,WAAMC,GAAIC,SACvCA,GAAS,EAAErB,QACLsB,UAdoB,CAAC,CAACzB,IAAPU,EAccQ,IAdChB,IAAIQ,IAAK,CAACR,IAAIQ,GAAIV,IAAIU,KAArCA,YAedgB,GAAIC,IAAQf,UAAYP,eAAiBoB,UAAW,CAACJ,GAAKrB,IAAIuB,IAAKD,GAAKpB,IAAIqB,MAAQ,CAACJ,GAAGC,MACxFQ,GAAIC,IAAQjB,UAAYP,eAAiBoB,UAAW,CAACJ,GAAKrB,IAAIuB,GAAGC,GAAIF,GAAKpB,IAAIqB,GAAGC,KAAO,CAACL,GAAGC,WAG5F,KAAOM,GAAK,IAAMC,GAAK,MAAQ,CAAEN,GAAKC,GAAKJ,GAAK,EAAEf,GAAI,IAF7CqB,EAAIrB,EAAM,EAAI,EACdqB,EAAI,EAAM,EAAI,EAC4CI,GAAIC,IAAKC,KAAK,IAAxF,iDAWY,oBAA2BZ,SAAzBC,GAAGC,WAAKC,GAAGC,WAAMC,GAAIC,gBAC7BO,WAAaC,SAASC,gBAAgB,6BAA8B,QACpExB,EAAIQ,WAAW,CAACE,GAAGC,IAAI,CAACC,GAAGC,IAAK,CAACC,GAAIC,GAAIN,UAC/Ca,WAAWG,aAAa,IAAKzB,GACtBsB,UAAP"}
|
||||
{"version":3,"file":"svgarc.min.js","sources":["../../src/util/svgarc.js"],"sourcesContent":["/*\nCopyright © 2020 Xah Lee, © 2023 P.M Kuipers\nPermission is hereby granted, free of charge, to any person obtaining a\ncopy of this software and associated documentation files (the “Software”),\nto deal in the Software without restriction, including without limitation\nthe rights to use, copy, modify, merge, publish, distribute, sublicense,\nand/or sell copies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following conditions:\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\nTHE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\nDEALINGS IN THE SOFTWARE.\nURL: SVG Circle Arc http://xahlee.info/js/svg_circle_arc.html\n*/\n\nconst cos = Math.cos;\nconst sin = Math.sin;\nconst π = Math.PI;\n\nconst fMatrixTimes = (([[a, b], [c, d]], [x, y]) => [a * x + b * y, c * x + d * y]);\nconst fRotateMatrix = (x => [[cos(x), -sin(x)], [sin(x), cos(x)]]);\nconst fVecAdd = (([a1, a2], [b1, b2]) => [a1 + b1, a2 + b2]);\n\n// Function modified by pmkuipers for text params\n/**\n * Create svg path text for an arc\n * @param {*} center [cx,cy] center of ellipse\n * @param {*} radius [rx,ry] major minor radius\n * @param {*} angle [t1, Δ] start angle, in radian, angle to sweep, in radian. positive.\n * @param {*} φ rotation on the whole, in radian\n * @returns {string} a SVG path description that represent a ellipse. Text describing the arc path in an svg path element\n */\nconst svgarcpath = (([cx, cy], [rx, ry], [t1, Δ], φ) => {\n Δ = Δ % (2 * π);\n const rotMatrix = fRotateMatrix(φ);\n const [sX, sY] = (fVecAdd(fMatrixTimes(rotMatrix, [rx * cos(t1), ry * sin(t1)]), [cx, cy]));\n const [eX, eY] = (fVecAdd(fMatrixTimes(rotMatrix, [rx * cos(t1 + Δ), ry * sin(t1 + Δ)]), [cx, cy]));\n const fA = ((Δ > π) ? 1 : 0);\n const fS = ((Δ > 0) ? 1 : 0);\n if (isNaN(eY) || isNaN(eX)) {\n return \"\";\n } else {\n return \"M \" + sX + \" \" + sY + \" A \" + [rx, ry, φ / (2 * π) * 360, fA, fS, eX, eY].join(\" \");\n }\n});\n\n/**\n * Create an svg arc element\n * @param {*} center [cx,cy] center of ellipse\n * @param {*} radius [rx,ry] major minor radius\n * @param {*} angle [t1, Δ] start angle, in radian, angle to sweep, in radian. positive.\n * @param {*} φ rotation on the whole, in radian\n * @returns {string} a SVG path element that represent a ellipse.\n */\nconst svgarc = (([cx, cy], [rx, ry], [t1, Δ], φ) => {\n const path2wk2r = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n const d = svgarcpath([cx, cy], [rx, ry], [t1, Δ], φ);\n path2wk2r.setAttribute(\"d\", d);\n return path2wk2r;\n});\n\nexport {svgarc, svgarcpath};"],"names":["cos","Math","sin","π","PI","fMatrixTimes","a","b","c","d","x","y","fVecAdd","a1","a2","b1","b2","svgarcpath","φ","cx","cy","rx","ry","t1","Δ","rotMatrix","sX","sY","eX","eY","fA","fS","isNaN","join","path2wk2r","document","createElementNS","setAttribute"],"mappings":"kLAoBMA,IAAMC,KAAKD,IACXE,IAAMD,KAAKC,IACXC,EAAIF,KAAKG,GAETC,aAAgB,oBAAGC,EAAGC,IAAKC,EAAGC,UAAMC,EAAGC,eAAO,CAACL,EAAII,EAAIH,EAAII,EAAGH,EAAIE,EAAID,EAAIE,EAA1D,EAEhBC,QAAW,oBAAEC,GAAIC,WAAMC,GAAIC,gBAAQ,CAACH,GAAKE,GAAID,GAAKE,GAAvC,EAWXC,WAAc,mBAA8BC,SAA5BC,GAAIC,WAAMC,GAAIC,WAAMC,GAAIC,SAC1CA,GAAS,EAAIrB,QACPsB,UAdkB,CAAC,CAACzB,IAAPU,EAcaQ,IAdGhB,IAAIQ,IAAK,CAACR,IAAIQ,GAAIV,IAAIU,KAAtCA,YAeZgB,GAAIC,IAAOf,QAAQP,aAAaoB,UAAW,CAACJ,GAAKrB,IAAIuB,IAAKD,GAAKpB,IAAIqB,MAAO,CAACJ,GAAIC,MAC/EQ,GAAIC,IAAOjB,QAAQP,aAAaoB,UAAW,CAACJ,GAAKrB,IAAIuB,GAAKC,GAAIF,GAAKpB,IAAIqB,GAAKC,KAAM,CAACL,GAAIC,KACxFU,GAAON,EAAIrB,EAAK,EAAI,EACpB4B,GAAOP,EAAI,EAAK,EAAI,SACtBQ,MAAMH,KAAOG,MAAMJ,IACZ,GAEA,KAAOF,GAAK,IAAMC,GAAK,MAAQ,CAACN,GAAIC,GAAIJ,GAAK,EAAIf,GAAK,IAAK2B,GAAIC,GAAIH,GAAIC,IAAII,KAAK,qDAY/E,oBAA8Bf,SAA5BC,GAAIC,WAAMC,GAAIC,WAAMC,GAAIC,gBAChCU,UAAYC,SAASC,gBAAgB,6BAA8B,QACnE3B,EAAIQ,WAAW,CAACE,GAAIC,IAAK,CAACC,GAAIC,IAAK,CAACC,GAAIC,GAAIN,UAClDgB,UAAUG,aAAa,IAAK5B,GACrByB,SAAP"}
|
3
amd/build/util/textfit.min.js
vendored
3
amd/build/util/textfit.min.js
vendored
|
@ -1,3 +0,0 @@
|
|||
define("local_treestudyplan/util/textfit",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.textFit=function(els,options){options||(options={});var settings={};for(var key in defaultSettings)options.hasOwnProperty(key)?settings[key]=options[key]:settings[key]=defaultSettings[key];"function"==typeof els.toArray&&(els=els.toArray());var elType=Object.prototype.toString.call(els);"[object Array]"!==elType&&"[object NodeList]"!==elType&&"[object HTMLCollection]"!==elType&&(els=[els]);for(var i=0;i<els.length;i++)processItem(els[i],settings)};var defaultSettings={alignVert:!1,alignHoriz:!1,multiLine:!1,detectMultiLine:!0,minFontSize:6,maxFontSize:80,reProcess:!0,widthOnly:!1,alignVertWithFlexbox:!1};function processItem(el,settings){if(o=el,!("object"==typeof HTMLElement?o instanceof HTMLElement:o&&"object"==typeof o&&null!==o&&1===o.nodeType&&"string"==typeof o.nodeName)||!settings.reProcess&&el.getAttribute("textFitted"))return!1;var o,innerSpan,originalHeight,originalHTML,originalWidth,low,mid,high;if(settings.reProcess||el.setAttribute("textFitted",1),originalHTML=el.innerHTML,originalWidth=function(el){var style=window.getComputedStyle(el,null);return el.getBoundingClientRect().width-parseInt(style.getPropertyValue("padding-left"),10)-parseInt(style.getPropertyValue("padding-right"),10)}(el),originalHeight=function(el){var style=window.getComputedStyle(el,null);return el.getBoundingClientRect().height-parseInt(style.getPropertyValue("padding-top"),10)-parseInt(style.getPropertyValue("padding-bottom"),10)}(el),!originalWidth||!settings.widthOnly&&!originalHeight)throw settings.widthOnly?new Error("Set a static width on the target element "+el.outerHTML+" before using textFit!"):new Error("Set a static height and width on the target element "+el.outerHTML+" before using textFit!");-1===originalHTML.indexOf("textFitted")?((innerSpan=document.createElement("span")).className="textFitted",innerSpan.style.display="inline-block",innerSpan.innerHTML=originalHTML,el.innerHTML="",el.appendChild(innerSpan)):hasClass(innerSpan=el.querySelector("span.textFitted"),"textFitAlignVert")&&(innerSpan.className=innerSpan.className.replace("textFitAlignVert",""),innerSpan.style.height="",el.className.replace("textFitAlignVertFlex","")),settings.alignHoriz&&(el.style["text-align"]="center",innerSpan.style["text-align"]="center");var multiLine=settings.multiLine;settings.detectMultiLine&&!multiLine&&innerSpan.getBoundingClientRect().height>=2*parseInt(window.getComputedStyle(innerSpan)["font-size"],10)&&(multiLine=!0),multiLine||(el.style["white-space"]="nowrap"),low=settings.minFontSize,high=settings.maxFontSize;for(var size=low;low<=high;){mid=(high+low)/2,innerSpan.style.fontSize=mid+"px";var innerSpanBoundingClientRect=innerSpan.getBoundingClientRect();innerSpanBoundingClientRect.width<=originalWidth&&(settings.widthOnly||innerSpanBoundingClientRect.height<=originalHeight)?(size=mid,low=mid+1):high=mid-1}if(innerSpan.style.fontSize!=size+"px"&&(innerSpan.style.fontSize=size+"px"),settings.alignVert){!function(){if(document.getElementById("textFitStyleSheet"))return;var style=[".textFitAlignVert{","position: absolute;","top: 0; right: 0; bottom: 0; left: 0;","margin: auto;","display: flex;","justify-content: center;","flex-direction: column;","}",".textFitAlignVertFlex{","display: flex;","}",".textFitAlignVertFlex .textFitAlignVert{","position: static;","}"].join(""),css=document.createElement("style");css.type="text/css",css.id="textFitStyleSheet",css.innerHTML=style,document.body.appendChild(css)}();var height=innerSpan.scrollHeight;"static"===window.getComputedStyle(el).position&&(el.style.position="relative"),hasClass(innerSpan,"textFitAlignVert")||(innerSpan.className=innerSpan.className+" textFitAlignVert"),innerSpan.style.height=height+"px",settings.alignVertWithFlexbox&&!hasClass(el,"textFitAlignVertFlex")&&(el.className=el.className+" textFitAlignVertFlex")}}function hasClass(element,cls){return(" "+element.className+" ").indexOf(" "+cls+" ")>-1}}));
|
||||
|
||||
//# sourceMappingURL=textfit.min.js.map
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
1
amd/src/bootstrap-vue/bootstrap-vue.js
vendored
1
amd/src/bootstrap-vue/bootstrap-vue.js
vendored
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable */
|
||||
/*!
|
||||
* BootstrapVue 2.23.1
|
||||
*
|
||||
|
|
|
@ -1,52 +1,32 @@
|
|||
/*eslint no-var: "error" */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/*eslint linebreak-style: "off" */
|
||||
/*eslint no-trailing-spaces: "off" */
|
||||
/*eslint-env es6*/
|
||||
/* eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
// You can call it anything you like
|
||||
|
||||
import {get_string,get_strings} from 'core/str';
|
||||
import {call} from 'core/ajax';
|
||||
import Debugger from './debugger';
|
||||
|
||||
import {load_strings} from './string-helper';
|
||||
|
||||
let debug = new Debugger("treestudyplan-config-grades");
|
||||
|
||||
/*
|
||||
let strings = load_strings({
|
||||
studyplan: {
|
||||
studyplan_select_placeholder: 'studyplan_select_placeholder',
|
||||
},
|
||||
});
|
||||
*/
|
||||
|
||||
/**
|
||||
* Initialize grade cfg page
|
||||
*/
|
||||
export function init() {
|
||||
{ const
|
||||
{ const
|
||||
intRx = /\d/,
|
||||
integerChange = (event) => {
|
||||
if ( (event.key.length > 1) || intRx.test(event.key)
|
||||
if ((event.key.length > 1) || intRx.test(event.key)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
event.preventDefault();
|
||||
};
|
||||
|
||||
for (let input of document.querySelectorAll( 'input[type="number"][step="1"][min="0"]' )){
|
||||
for (let input of document.querySelectorAll('input[type="number"][step="1"][min="0"]')) {
|
||||
input.addEventListener("keydown", integerChange);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
{ const
|
||||
decimal= /^[0-9]*?\.[0-9]*?$/,
|
||||
{ const
|
||||
decimal = /^[0-9]*?\.[0-9]*?$/,
|
||||
intRx = /\d/,
|
||||
floatChange = (event) => {
|
||||
if ( (event.key.length > 1) || ( (event.key === ".") && (!event.currentTarget.value.match(decimal)) )
|
||||
if ((event.key.length > 1) || ((event.key === ".") && (!event.currentTarget.value.match(decimal)))
|
||||
|| intRx.test(event.key)
|
||||
) {
|
||||
return;
|
||||
|
@ -54,10 +34,10 @@ export function init() {
|
|||
event.preventDefault();
|
||||
};
|
||||
|
||||
for (let input of document.querySelectorAll( 'input[type="number"][min="0"]:not([step])' )){
|
||||
for (let input of document.querySelectorAll('input[type="number"][min="0"]:not([step])')) {
|
||||
input.addEventListener("keydown", floatChange);
|
||||
}
|
||||
for (let input of document.querySelectorAll( 'input[type="text"].float' )){
|
||||
for (let input of document.querySelectorAll('input[type="text"].float')) {
|
||||
input.addEventListener("keydown", floatChange);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
/*eslint no-console: "off"*/
|
||||
|
||||
/**
|
||||
* Save a piece of text to file as if it was downloaded
|
||||
* @param {string} filename
|
||||
|
@ -7,17 +5,18 @@
|
|||
* @param {string} type
|
||||
*/
|
||||
export function download(filename, text, type) {
|
||||
if(undefined == type) { type = "text/plain"; }
|
||||
if (undefined == type) {
|
||||
type = "text/plain";
|
||||
}
|
||||
var pom = document.createElement('a');
|
||||
pom.setAttribute('href', 'data:'+type+';charset=utf-8,' + encodeURIComponent(text));
|
||||
pom.setAttribute('href', 'data:' + type + ';charset=utf-8,' + encodeURIComponent(text));
|
||||
pom.setAttribute('download', filename);
|
||||
|
||||
if (document.createEvent) {
|
||||
var event = document.createEvent('MouseEvents');
|
||||
event.initEvent('click', true, true);
|
||||
pom.dispatchEvent(event);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
pom.click();
|
||||
}
|
||||
}
|
||||
|
@ -35,25 +34,25 @@ export function download(filename, text, type) {
|
|||
* @param {fileOpenedCallback} onready Callback to run when file is opened
|
||||
* @param {Array} accept Array of mime types that the file dialog will accept
|
||||
*/
|
||||
export function upload(onready,accept) {
|
||||
export function upload(onready, accept) {
|
||||
let input = document.createElement('input');
|
||||
input.type = 'file';
|
||||
if(Array.isArray(accept)){
|
||||
if(accept.count > 0){
|
||||
if (Array.isArray(accept)) {
|
||||
if (accept.count > 0) {
|
||||
input.accept = accept.join(", ");
|
||||
}
|
||||
} else if (undefined !== accept){
|
||||
} else if (undefined !== accept) {
|
||||
input.accept = accept;
|
||||
}
|
||||
input.onchange = () => {
|
||||
let files = Array.from(input.files);
|
||||
if(files.length > 0){
|
||||
let files = Array.from(input.files);
|
||||
if (files.length > 0) {
|
||||
let file = files[0];
|
||||
var reader = new FileReader();
|
||||
reader.onload = function(e) {
|
||||
var contents = e.target.result;
|
||||
if(onready instanceof Function){
|
||||
onready(file,contents);
|
||||
if (onready instanceof Function) {
|
||||
onready(file, contents);
|
||||
}
|
||||
};
|
||||
reader.readAsText(file);
|
||||
|
@ -64,8 +63,7 @@ export function upload(onready,accept) {
|
|||
var event = document.createEvent('MouseEvents');
|
||||
event.initEvent('click', true, true);
|
||||
input.dispatchEvent(event);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
input.click();
|
||||
}
|
||||
}
|
|
@ -1,21 +1,34 @@
|
|||
/*eslint no-var: "error"*/
|
||||
/*eslint no-console: "off"*/
|
||||
/*eslint-disable no-trailing-spaces */
|
||||
/*eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
/* eslint no-var: "error" */
|
||||
/* eslint capitalized-comments: "off" */
|
||||
/* eslint-env es6 */
|
||||
|
||||
import {loadFragment} from 'core/fragment';
|
||||
import {load_strings} from './util/string-helper';
|
||||
import {loadStrings} from './util/string-helper';
|
||||
import {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
import {replaceNodeContents} from 'core/templates';
|
||||
//import {markFormSubmitted} from 'core_form/changechecker'; // Moodle 4.00+ only
|
||||
//import {notifyFormSubmittedByJavascript} from 'core_form/events'; // Moodle 4.00+ only
|
||||
// import {markFormSubmitted} from 'core_form/changechecker'; // Moodle 4.00+ only
|
||||
// import {notifyFormSubmittedByJavascript} from 'core_form/events'; // Moodle 4.00+ only
|
||||
|
||||
/* Moodle 3.11 safe import for when needed
|
||||
let markFormSubmitted = () => {};
|
||||
let notifyFormSubmittedByJavascript = () => {};
|
||||
|
||||
import('core_form/changechecker').then((ns) => {
|
||||
debug.info(ns);
|
||||
if(ns.markFormSubmitted) {
|
||||
markFormSubmitted = ns.markFormSubmitted;
|
||||
}
|
||||
if(ns.notifyFormSubmittedByJavascript) {
|
||||
notifyFormSubmittedByJavascript = ns.notifyFormSubmittedByJavascript;
|
||||
}
|
||||
}).catch(()=>{});
|
||||
*/
|
||||
|
||||
export default {
|
||||
install(Vue/*,options*/){
|
||||
install(Vue/* ,options */) {
|
||||
|
||||
let strings = load_strings({
|
||||
let strings = loadStrings({
|
||||
editmod: {
|
||||
save$core: "save$core",
|
||||
cancel$core: "cancel$core",
|
||||
|
@ -27,16 +40,16 @@ export default {
|
|||
cmid: {
|
||||
type: Number,
|
||||
},
|
||||
coursectxid:{
|
||||
coursectxid: {
|
||||
type: Number,
|
||||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: "",
|
||||
'default': "",
|
||||
},
|
||||
genericonly: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
'default': false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -48,22 +61,22 @@ export default {
|
|||
computed: {
|
||||
},
|
||||
methods: {
|
||||
openForm(){
|
||||
openForm() {
|
||||
const self = this;
|
||||
self.$refs["editormodal"].show();
|
||||
self.$refs.editormodal.show();
|
||||
},
|
||||
onShown(){
|
||||
onShown() {
|
||||
const self = this;
|
||||
let params = {cmid: this.cmid};
|
||||
console.info("Loading form");
|
||||
loadFragment('local_treestudyplan', 'mod_edit_form', this.coursectxid, params).then((html,js) =>{
|
||||
replaceNodeContents(self.$refs["content"], html, js);
|
||||
loadFragment('local_treestudyplan', 'mod_edit_form', this.coursectxid, params).then((html, js) => {
|
||||
replaceNodeContents(self.$refs.content, html, js);
|
||||
return null;
|
||||
}).catch(notification.exception);
|
||||
|
||||
},
|
||||
onSave(){
|
||||
onSave() {
|
||||
const self = this;
|
||||
let form = this.$refs["content"].getElementsByTagName("form")[0];
|
||||
let form = this.$refs.content.getElementsByTagName("form")[0];
|
||||
|
||||
// markFormSubmitted(form); // Moodle 4.00+ only
|
||||
// We call this, so other modules can update the form with the latest state.
|
||||
|
@ -73,17 +86,17 @@ export default {
|
|||
|
||||
const formdata = new FormData(form);
|
||||
const data = new URLSearchParams(formdata).toString();
|
||||
//const formdata = new FormData(form);
|
||||
//const data = {};
|
||||
//formdata.forEach((value, key) => (data[key] = value));
|
||||
// const formdata = new FormData(form);
|
||||
// const data = {};
|
||||
// formdata.forEach((value, key) => (data[key] = value));
|
||||
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_submit_cm_editform',
|
||||
args: {cmid: this.cmid, formdata: data}
|
||||
}])[0].then(()=>{
|
||||
self.$emit("saved",formdata);
|
||||
}])[0].then(() => {
|
||||
self.$emit("saved", formdata);
|
||||
return null;
|
||||
}).catch(notification.exception);
|
||||
|
||||
}
|
||||
},
|
||||
template: `
|
||||
|
|
261
amd/src/page-coach.js
Normal file
261
amd/src/page-coach.js
Normal file
|
@ -0,0 +1,261 @@
|
|||
/* eslint no-var: "error" */
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/* eslint linebreak-style: "off" */
|
||||
/* eslint no-trailing-spaces: "off" */
|
||||
/* eslint promise/no-nesting: "off" */
|
||||
/* eslint max-depth: ["error", 6]*/
|
||||
/* eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
// You can call it anything you like
|
||||
|
||||
import {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
|
||||
import Vue from './vue/vue';
|
||||
|
||||
import Debugger from './util/debugger';
|
||||
import {loadStrings} from './util/string-helper';
|
||||
import {processStudyplan} from './studyplan-processor';
|
||||
import {studyplanTiming} from './util/date-helper';
|
||||
import {addBrowserButtonEvent} from './util/browserbuttonevents';
|
||||
|
||||
import EditorComponents from './studyplan-editor-components';
|
||||
Vue.use(EditorComponents);
|
||||
|
||||
import TSComponents from './treestudyplan-components';
|
||||
Vue.use(TSComponents);
|
||||
|
||||
import RVComponents from './report-viewer-components';
|
||||
Vue.use(RVComponents);
|
||||
|
||||
import ModalComponents from './modedit-modal';
|
||||
Vue.use(ModalComponents);
|
||||
|
||||
import PortalVue from './portal-vue/portal-vue.esm';
|
||||
Vue.use(PortalVue);
|
||||
import BootstrapVue from './bootstrap-vue/bootstrap-vue';
|
||||
Vue.use(BootstrapVue);
|
||||
|
||||
|
||||
let debug = new Debugger("treestudyplancoach");
|
||||
|
||||
let strings = loadStrings({
|
||||
coach: {
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialize the Page
|
||||
*/
|
||||
export function init() {
|
||||
let app = new Vue({
|
||||
el: '#root',
|
||||
data: {
|
||||
selected: {
|
||||
planid: 0,
|
||||
studentid: 0,
|
||||
},
|
||||
displayedstudyplan: null,
|
||||
activestudyplan: null,
|
||||
associatedstudents: [],
|
||||
selectedstudent: null,
|
||||
studentstudyplan: null,
|
||||
loadingstudyplan: false,
|
||||
studyplans: [],
|
||||
text: strings.coach,
|
||||
toolbox: {
|
||||
right: true,
|
||||
},
|
||||
usedcontexts: [],
|
||||
editmode: false,
|
||||
},
|
||||
async mounted() {
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_list_coaching_studyplans',
|
||||
args: {}
|
||||
}])[0].then(function(response) {
|
||||
const timingval = {present: 0, past: 1, future: 2};
|
||||
response.sort((a, b) => {
|
||||
const timinga = studyplanTiming(a);
|
||||
const timingb = studyplanTiming(b);
|
||||
|
||||
const t = timingval[timinga] - timingval[timingb];
|
||||
if (t == 0) {
|
||||
// Sort by name if timing is equal
|
||||
return a.name.localeCompare(b.name);
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
});
|
||||
app.studyplans = response;
|
||||
// Load studyplan from hash if applicable
|
||||
const hash = window.location.hash.replace('#', '');
|
||||
const parts = hash.split("-");
|
||||
|
||||
if (!!parts && parts.length > 0 && parts[0] != '') {
|
||||
for (let idx in app.studyplans) {
|
||||
if (app.studyplans[idx].id == parts[0]) {
|
||||
app.selectStudyplan(app.studyplans[idx], parts[1], false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
addBrowserButtonEvent(this.navChanged, this.navChanged);
|
||||
},
|
||||
computed: {
|
||||
studentcount() {
|
||||
let count = 0;
|
||||
for (const group of app.associatedstudents) {
|
||||
count += group.users.length;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
navChanged() {
|
||||
const hash = window.location.hash.replace('#', '');
|
||||
const parts = hash.split("-");
|
||||
debug.log("Navigation changed", hash, parts);
|
||||
|
||||
if (!!parts && parts.length > 0) {
|
||||
const planid = Number(parts[0]);
|
||||
const studentid = (parts.length > 1) ? Number(parts[1]) : 0;
|
||||
|
||||
debug.log("Selected ids", planid, studentid, this.selected.planid, this.selected.studentid);
|
||||
if (planid == 0) {
|
||||
if (planid != this.selected.planid) {
|
||||
this.closeStudyplan(false);
|
||||
}
|
||||
} else if (this.selected.planid != planid || (studentid == 0 && this.selected.studentid != 0)) {
|
||||
debug.info("Requested plan changed - loading studyplan");
|
||||
for (let idx in app.studyplans) {
|
||||
const plan = this.studyplans[idx];
|
||||
if (Number(plan.id) == planid) {
|
||||
this.selectStudyplan(plan, studentid, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (this.selected.studentid != studentid) {
|
||||
for (const group of app.associatedstudents) {
|
||||
for (const student of group.users) {
|
||||
if (Number(student.id) == studentid) {
|
||||
app.showStudentView(student, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
closeStudyplan(updatehash = true) {
|
||||
app.selected.planid = 0;
|
||||
app.selected.studentid = 0;
|
||||
app.activestudyplan = null;
|
||||
app.associatedstudents = [];
|
||||
app.studentstudyplan = [];
|
||||
app.displayedstudyplan = null;
|
||||
if (updatehash) {
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
|
||||
selectStudyplan(studyplan, studentid, updatehash = true) {
|
||||
app.selected.planid = Number(studyplan.id);
|
||||
app.selected.studentid = studentid ? Number(studentid) : 0;
|
||||
// Fetch studyplan
|
||||
const self = this;
|
||||
self.loadingstudyplan = true;
|
||||
self.associatedstudents = [];
|
||||
self.selectedstudent = null;
|
||||
self.studentstudyplan = null;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_studyplan_map',
|
||||
args: {id: studyplan.id}
|
||||
}])[0].then((response) => {
|
||||
self.activestudyplan = processStudyplan(response, true);
|
||||
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_all_associated_grouped',
|
||||
args: {'studyplan_id': studyplan.id}
|
||||
}])[0].then(function(response) {
|
||||
self.associatedstudents = response;
|
||||
let foundstudent = false;
|
||||
if (studentid) {
|
||||
for (const group of self.associatedstudents) {
|
||||
for (const student of group.users) {
|
||||
if (student.id == studentid) {
|
||||
foundstudent = true;
|
||||
self.showStudentView(student);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundstudent) {
|
||||
// Select first student available.
|
||||
for (const group of self.associatedstudents) {
|
||||
for (const student of group.users) {
|
||||
foundstudent = true;
|
||||
self.showStudentView(student);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundstudent) {
|
||||
// Update hash with just the studyplan if no student was available for display
|
||||
app.selected.studentid = 0;
|
||||
if (updatehash) {
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
}
|
||||
self.displayedstudyplan = self.activestudyplan;
|
||||
self.loadingstudyplan = false;
|
||||
}
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
return;
|
||||
}).catch(function(error) {
|
||||
notification.exception(error);
|
||||
app.loadingstudyplan = false;
|
||||
});
|
||||
},
|
||||
showStudentView(student, updatehash = true) {
|
||||
app.selected.studentid = student ? Number(student.id) : 0;
|
||||
if (student) {
|
||||
app.selectedstudent = student;
|
||||
app.studentstudyplan = null;
|
||||
app.loadingstudyplan = true;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_user_studyplan',
|
||||
args: {userid: student.id, studyplanid: app.activestudyplan.id}
|
||||
}])[0].then((response) => {
|
||||
app.studentstudyplan = processStudyplan(response, false);
|
||||
app.displayedstudyplan = app.studentstudyplan;
|
||||
app.loadingstudyplan = false;
|
||||
if (updatehash) {
|
||||
window.location.hash = app.activestudyplan.id + "-" + student.id;
|
||||
}
|
||||
return;
|
||||
}).catch(function(error) {
|
||||
notification.exception(error);
|
||||
app.loadingstudyplan = false;
|
||||
});
|
||||
} else {
|
||||
this.showOverview(updatehash);
|
||||
}
|
||||
},
|
||||
showOverview(updatehash = true) {
|
||||
debug.info("Switch to overview", updatehash);
|
||||
app.selected.studentid = 0;
|
||||
app.selectedstudent = null;
|
||||
app.studentstudyplan = null;
|
||||
app.displayedstudyplan = app.activestudyplan;
|
||||
if (updatehash) {
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
}
|
|
@ -1,20 +1,19 @@
|
|||
/*eslint no-var: "error" */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/*eslint linebreak-style: "off" */
|
||||
/*eslint no-trailing-spaces: "off" */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-var: "error" */
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/* eslint linebreak-style: "off" */
|
||||
/* eslint no-trailing-spaces: "off" */
|
||||
/* eslint no-empty-function: "off" */
|
||||
/* eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
// You can call it anything you like
|
||||
|
||||
import {get_string,get_strings} from 'core/str';
|
||||
import {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
import {resetAllFormDirtyStates} from 'core_form/changechecker';
|
||||
|
||||
// Commented out: import {resetAllFormDirtyStates} from 'core_form/changechecker'; // Moodle 4.00+ only
|
||||
|
||||
import Vue from './vue/vue';
|
||||
|
||||
|
||||
import EditorComponents from './studyplan-editor-components';
|
||||
Vue.use(EditorComponents);
|
||||
|
||||
|
@ -24,27 +23,38 @@ Vue.use(TSComponents);
|
|||
import ModalComponents from './modedit-modal';
|
||||
Vue.use(ModalComponents);
|
||||
import Debugger from './util/debugger';
|
||||
import {addBrowserButtonEvent} from './util/browserbuttonevents';
|
||||
|
||||
import {load_strings} from './util/string-helper';
|
||||
import {ProcessStudyplan} from './studyplan-processor';
|
||||
import {download,upload} from './downloader';
|
||||
import {loadStrings} from './util/string-helper';
|
||||
import {processStudyplan} from './studyplan-processor';
|
||||
import {download, upload} from './downloader';
|
||||
import {studyplanTiming} from './util/date-helper';
|
||||
import mFormComponents from "./util/mform-helper";
|
||||
Vue.use(mFormComponents);
|
||||
|
||||
import PortalVue from './portal-vue/portal-vue.esm';
|
||||
Vue.use(PortalVue);
|
||||
import BootstrapVue from './bootstrap-vue/bootstrap-vue';
|
||||
Vue.use(BootstrapVue);
|
||||
|
||||
import {Drag, Drop, DropList} from './vue-easy-dnd/vue-easy-dnd.esm';
|
||||
Vue.component('drag',Drag);
|
||||
Vue.component('drop',Drop);
|
||||
Vue.component('drop-list',DropList);
|
||||
|
||||
const debug = new Debugger("treestudyplan");
|
||||
|
||||
let strings = load_strings({
|
||||
let resetAllFormDirtyStates = () => { };
|
||||
import('core_form/changechecker').then((ns) => {
|
||||
debug.info(ns);
|
||||
if (ns.resetAllFormDirtyStates) {
|
||||
resetAllFormDirtyStates = ns.resetAllFormDirtyStates;
|
||||
}
|
||||
return;
|
||||
}).catch(()=>{});
|
||||
|
||||
let strings = loadStrings({
|
||||
studyplan: {
|
||||
studyplan_select_placeholder: 'studyplan_select_placeholder',
|
||||
'studyplan_select_placeholder': 'studyplan_select_placeholder',
|
||||
'advanced_import_from_file': 'advanced_import_from_file',
|
||||
'advanced_create_from_template': 'advanced_create_from_template',
|
||||
'studyplan_add': "studyplan_add",
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -54,21 +64,27 @@ let strings = load_strings({
|
|||
* @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)
|
||||
* @param {object} options Options to be passed to this script
|
||||
*/
|
||||
export function init(contextid,categoryid,options) {
|
||||
export function init(contextid, categoryid, options) {
|
||||
// Make sure the id's are numeric and integer
|
||||
if(undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1 ){ contextid = 1;}
|
||||
else { contextid = Number(contextid);} // ensure a numeric value instead of string
|
||||
if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}
|
||||
else { categoryid = Number(categoryid);} // ensure a numeric value instead of string
|
||||
if (undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1) {
|
||||
contextid = 1;
|
||||
} else {
|
||||
contextid = Number(contextid); // Ensure a numeric value instead of string
|
||||
}
|
||||
if (undefined === categoryid || !Number.isInteger(Number(categoryid))) {
|
||||
categoryid = 0;
|
||||
} else {
|
||||
categoryid = Number(categoryid); // Ensure a numeric value instead of string
|
||||
}
|
||||
|
||||
debug.info("options",options);
|
||||
if ( options !== null && typeof options === 'object' && !Array.isArray(options) ) {
|
||||
if ( !options.defaultAggregation ) {
|
||||
debug.info("options", options);
|
||||
if (options !== null && typeof options === 'object' && !Array.isArray(options)) {
|
||||
if (!options.defaultAggregation) {
|
||||
options.defaultAggregation = "core";
|
||||
}
|
||||
|
||||
} else {
|
||||
options = { defaultAggregation: "core"};
|
||||
options = {defaultAggregation: "core"};
|
||||
}
|
||||
|
||||
// Setup the initial Vue app for this page
|
||||
|
@ -81,49 +97,40 @@ export function init(contextid,categoryid,options) {
|
|||
shortname: '',
|
||||
description: '',
|
||||
idnumber: '',
|
||||
slots : 4,
|
||||
slots: 4,
|
||||
startdate: '2020-08-01',
|
||||
enddate: '',
|
||||
context: contextid,
|
||||
aggregation: options.defaultAggregation,
|
||||
aggregation_config: '',
|
||||
'aggregation_config': '',
|
||||
}
|
||||
},
|
||||
toolbox: {
|
||||
shown: false,
|
||||
right: true,
|
||||
},
|
||||
filters: {
|
||||
systembadges: "",
|
||||
relatedbadges: "",
|
||||
},
|
||||
|
||||
activestudyplan: null,
|
||||
activepage: null,
|
||||
loadingstudyplan: false,
|
||||
studyplans: [],
|
||||
frameworks: [],
|
||||
relatedbadges: [],
|
||||
systembadges: [],
|
||||
courses: [],
|
||||
templatecount: 0,
|
||||
|
||||
text: strings.studyplan,
|
||||
usedcontexts: [],
|
||||
},
|
||||
created() {
|
||||
this.$root.$on('studyplanRemoved',(studyplan)=>{
|
||||
this.$root.$on('studyplanRemoved', (studyplan)=>{
|
||||
|
||||
if(app.activestudyplan == studyplan){
|
||||
if (app.activestudyplan == studyplan) {
|
||||
app.activestudyplan = null;
|
||||
}
|
||||
|
||||
// remove studyplan from index list
|
||||
// Remove studyplan from index list
|
||||
let index = null;
|
||||
for(let idx in app.studyplans){
|
||||
if(app.studyplans[idx].id == studyplan.id){
|
||||
for (let idx in app.studyplans) {
|
||||
if (app.studyplans[idx].id == studyplan.id) {
|
||||
index = idx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(index){
|
||||
if (index) {
|
||||
app.studyplans.splice(index, 1);
|
||||
}
|
||||
|
||||
|
@ -131,46 +138,49 @@ export function init(contextid,categoryid,options) {
|
|||
},
|
||||
mounted() {
|
||||
this.initialize();
|
||||
addBrowserButtonEvent(this.backPressed);
|
||||
},
|
||||
beforeunmount() {
|
||||
|
||||
},
|
||||
computed: {
|
||||
dropdown_title(){
|
||||
if(this.activestudyplan && this.activestudyplan.name){
|
||||
dropdownTitle() {
|
||||
if (this.activestudyplan && this.activestudyplan.name) {
|
||||
return this.activestudyplan.name;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
return this.text.studyplan_select_placeholder;
|
||||
}
|
||||
},
|
||||
contextid(){
|
||||
contextid() {
|
||||
return contextid;
|
||||
},
|
||||
filterComponentType(){
|
||||
return {
|
||||
item: false,
|
||||
component: true,
|
||||
span: 1,
|
||||
type: 'filter',
|
||||
};
|
||||
},
|
||||
|
||||
},
|
||||
methods: {
|
||||
backPressed() {
|
||||
debug.log("Back button pressed");
|
||||
if (app.activestudyplan) {
|
||||
debug.log("Closing studyplan");
|
||||
this.closeStudyplan();
|
||||
}
|
||||
},
|
||||
initialize() {
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_list_studyplans',
|
||||
args: { context_id: contextid}
|
||||
}])[0].then(function(response){
|
||||
const timingval = { future: 0, present: 1, past: 2, };
|
||||
response.sort((a,b) => {
|
||||
args: {'context_id': contextid}
|
||||
}])[0].then(function(response) {
|
||||
const timingval = {future: 0, present: 1, past: 2};
|
||||
response.sort((a, b) => {
|
||||
const timinga = studyplanTiming(a);
|
||||
const timingb = studyplanTiming(b);
|
||||
|
||||
let t = timingval[timinga] - timingval[timingb];
|
||||
if(t == 0){
|
||||
// sort by start date if timing is equal
|
||||
if (t == 0) {
|
||||
// Sort by start date if timing is equal
|
||||
t = new Date(b.startdate).getTime() - new Date(a.startdate).getTime();
|
||||
|
||||
if (t == 0) {
|
||||
// sort by name if timing is equal
|
||||
// Sort by name if timing is equal
|
||||
t = a.name.localeCompare(b.name);
|
||||
}
|
||||
}
|
||||
|
@ -178,42 +188,54 @@ export function init(contextid,categoryid,options) {
|
|||
});
|
||||
app.studyplans = response;
|
||||
|
||||
// load studyplan from hash if applicable
|
||||
const hash = location.hash.replace('#','');
|
||||
if(hash){
|
||||
// Load studyplan from hash if applicable
|
||||
const hash = location.hash.replace('#', '');
|
||||
if (hash) {
|
||||
const id = hash;
|
||||
app.selectStudyplan(id);
|
||||
for (const p of app.studyplans) {
|
||||
if (p.id == id) {
|
||||
app.selectStudyplan(id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_map_categories',
|
||||
args: { }
|
||||
}])[0].then(function(response){
|
||||
app.courses = response;
|
||||
}).catch(notification.exception);
|
||||
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_list_available_categories',
|
||||
args: { operation: 'edit', refcontext_id: contextid}
|
||||
}])[0].then(function(response){
|
||||
args: {operation: 'edit', 'refcontext_id': contextid}
|
||||
}])[0].then(function(response) {
|
||||
app.usedcontexts = response;
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
|
||||
this.refreshTemplateCount();
|
||||
},
|
||||
refreshTemplateCount() {
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_count_templates',
|
||||
args: { }
|
||||
}])[0].then(function(response) {
|
||||
app.templatecount = response;
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
this.filter_systembadges();
|
||||
},
|
||||
closeStudyplan() {
|
||||
app.activestudyplan = null;
|
||||
window.location.hash = '';
|
||||
},
|
||||
movedStudyplan(plan,from,to) {
|
||||
// reload the page in the new context (needed, since a number of links are not reactive in the page)
|
||||
movedStudyplan(plan, from, to) {
|
||||
// Reload the page in the new context (needed, since a number of links are not reactive in the page)
|
||||
const params = new URLSearchParams(location.search);
|
||||
params.delete('categoryid');
|
||||
params.set("contextid", to);
|
||||
setTimeout(() => {
|
||||
// Reload page in a timeout to give other form javasccript the change to remove the beforeunload handler.
|
||||
window.location.search = params.toString();
|
||||
},50);
|
||||
}, 50);
|
||||
},
|
||||
onStudyPlanCreated(newstudyplan){
|
||||
onStudyPlanCreated(newstudyplan) {
|
||||
if (newstudyplan.context_id != contextid) {
|
||||
// Study plan has changed context id - reload page into new context id and show the plan
|
||||
const params = new URLSearchParams(location.search);
|
||||
|
@ -227,109 +249,53 @@ export function init(contextid,categoryid,options) {
|
|||
app.selectStudyplan(newstudyplan.id);
|
||||
}
|
||||
},
|
||||
switchContext(ctxid){
|
||||
switchContext(ctxid) {
|
||||
const params = new URLSearchParams(location.search);
|
||||
params.delete('categoryid');
|
||||
params.set('contextid', ctxid);
|
||||
setTimeout(() => {
|
||||
// Reload page in a timeout to give other form javasccript the change to remove the beforeunload handler.
|
||||
window.location.href = window.location.pathname + "?" + params.toString();
|
||||
},50);
|
||||
}, 50);
|
||||
},
|
||||
selectStudyplan(studyplanid){
|
||||
// fetch studyplan
|
||||
selectStudyplan(studyplanid) {
|
||||
// Fetch studyplan
|
||||
app.loadingstudyplan = true;
|
||||
app.activestudyplan = null;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_studyplan_map',
|
||||
args: { id: studyplanid}
|
||||
}])[0].then(function(response){
|
||||
app.activestudyplan = ProcessStudyplan(response);
|
||||
args: {id: studyplanid}
|
||||
}])[0].then(function(response) {
|
||||
app.activestudyplan = processStudyplan(response);
|
||||
debug.info('studyplan processed');
|
||||
app.loadingstudyplan = false;
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
}).catch(function(error){
|
||||
return;
|
||||
}).catch(function(error) {
|
||||
notification.exception(error);
|
||||
app.loadingstudyplan = false;
|
||||
});
|
||||
},
|
||||
onPageChange(page) {
|
||||
this.activepage = page;
|
||||
this.filter_relatedbadges();
|
||||
},
|
||||
import_studyplan(){
|
||||
importStudyplan() {
|
||||
const self = this;
|
||||
upload((filename,content)=>{
|
||||
upload((filename, content)=>{
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_import_plan',
|
||||
args: {
|
||||
content: content,
|
||||
format: "application/json",
|
||||
context_id: contextid,
|
||||
'context_id': contextid,
|
||||
},
|
||||
}])[0].then(function(response){
|
||||
if(response.success){
|
||||
}])[0].then(function(response) {
|
||||
if (response.success) {
|
||||
self.initialize();
|
||||
} else {
|
||||
debug.error("Import failed: ",response.msg);
|
||||
debug.error("Import failed: ", response.msg);
|
||||
}
|
||||
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
}, "application/json");
|
||||
},
|
||||
export_plan(plan,format){
|
||||
let self = this;
|
||||
if(format == undefined || !["json","csv"].includes(format)){
|
||||
format = "json";
|
||||
}
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_export_plan',
|
||||
args: {
|
||||
studyplan_id: plan.id,
|
||||
format: format
|
||||
},
|
||||
}])[0].then(function(response){
|
||||
|
||||
download(plan.shortname+".json",response.content,response.format);
|
||||
}).catch(notification.exception);
|
||||
},
|
||||
toggletoolbox(event) {
|
||||
debug.info(event);
|
||||
this.toolbox.shown = event;
|
||||
},
|
||||
filter_systembadges() {
|
||||
const self = this;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_search_badges',
|
||||
args: {
|
||||
search: this.filters.systembadges || ""
|
||||
}
|
||||
}])[0].then(function(response){
|
||||
self.systembadges = response;
|
||||
}).catch(notification.exception);
|
||||
},
|
||||
filter_relatedbadges() {
|
||||
const self = this;
|
||||
if (this.activepage) {
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_search_related_badges',
|
||||
args: {
|
||||
page_id: this.activepage.id,
|
||||
search: this.filters.relatedbadges || ""
|
||||
}
|
||||
}])[0].then(function(response){
|
||||
self.relatedbadges = response;
|
||||
}).catch(notification.exception);
|
||||
}
|
||||
},
|
||||
reset_systembadges() {
|
||||
this.filters.systembadges = "";
|
||||
this.filter_systembadges();
|
||||
},
|
||||
reset_relatedbadges() {
|
||||
this.filters.relatedbadges = "";
|
||||
this.filter_relatedbadges();
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
/*eslint no-var: "error" */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/*eslint linebreak-style: "off" */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-var: "error" */
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/* eslint linebreak-style: "off" */
|
||||
/* eslint promise/no-nesting: "off" */
|
||||
/* eslint-env es6*/
|
||||
/* eslint camelcase: "off" */
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
// You can call it anything you like
|
||||
|
||||
|
@ -12,18 +14,17 @@ import ModalFactory from 'core/modal_factory';
|
|||
import ModalEvents from 'core/modal_events';
|
||||
|
||||
/* Determine the proper getstrings function to use (MDL4.3+ recommends use of getStrings, which is jquery independent) */
|
||||
const getstr_func = (getStrings !== undefined)?getStrings:get_strings;
|
||||
const getstrFunc = (getStrings !== undefined) ? getStrings : get_strings;
|
||||
|
||||
let debug = new Debugger("treestudyplan");
|
||||
let debug = new Debugger("treestudyplan-invitemanager");
|
||||
|
||||
/**
|
||||
* Init function for page-invitemanager
|
||||
* @return undefined
|
||||
*/
|
||||
export function init() {
|
||||
getstr_func([
|
||||
{ key: 'ok', component: 'core'},
|
||||
{ key: 'confirm', component: 'core'},
|
||||
getstrFunc([
|
||||
{key: 'ok', component: 'core'},
|
||||
{key: 'confirm', component: 'core'},
|
||||
]).then((s) => {
|
||||
const strOk = s[0];
|
||||
const strConfirm = s[1];
|
||||
|
@ -48,18 +49,23 @@ export function init() {
|
|||
type: ModalFactory.types.SAVE_CANCEL,
|
||||
title: title,
|
||||
body: text,
|
||||
}).then(function (modal) {
|
||||
}).then((modal) => {
|
||||
modal.setSaveButtonText(oktext);
|
||||
|
||||
let root = modal.getRoot();
|
||||
root.on(ModalEvents.save, function () {
|
||||
root.on(ModalEvents.save, () => {
|
||||
window.location = href;
|
||||
});
|
||||
modal.modal[0].style["max-width"] = "345px";
|
||||
modal.show();
|
||||
return modal;
|
||||
}).catch((x) => {
|
||||
debug.warn(x);
|
||||
});
|
||||
});
|
||||
});
|
||||
return;
|
||||
}).catch((x) => {
|
||||
debug.warn(x);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
/*eslint no-var: "error" */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/*eslint linebreak-style: "off" */
|
||||
/*eslint no-trailing-spaces: "off" */
|
||||
/*eslint no-console: "off" */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/* eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
// You can call it anything you like
|
||||
|
||||
|
@ -12,28 +8,24 @@ import Vue from './vue/vue';
|
|||
import RVComponents from './report-viewer-components';
|
||||
Vue.use(RVComponents);
|
||||
|
||||
import Debugger from './util/debugger';
|
||||
|
||||
import PortalVue from './portal-vue/portal-vue.esm';
|
||||
Vue.use(PortalVue);
|
||||
import BootstrapVue from './bootstrap-vue/bootstrap-vue';
|
||||
Vue.use(BootstrapVue);
|
||||
|
||||
let debug = new Debugger("treestudyplan-report");
|
||||
|
||||
/**
|
||||
* Initialize the Page
|
||||
* @param {string} type Type of page to show
|
||||
* @param {Object} arg1 Argument1 as passed
|
||||
*/
|
||||
export function init(type="own",arg1) {
|
||||
export function init(type = "own", arg1) {
|
||||
let app = new Vue({
|
||||
el: '#root',
|
||||
data: {
|
||||
"studyplans": [],
|
||||
"type": type,
|
||||
"invitekey": (type=="invited")?arg1:null,
|
||||
"userid": (type=="other")?arg1:null,
|
||||
"invitekey": (type == "invited") ? arg1 : null,
|
||||
"userid": (type == "other") ? arg1 : null,
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*eslint no-var: "error" */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/*eslint linebreak-style: "off" */
|
||||
/*eslint no-trailing-spaces: "off" */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-var: "error" */
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/* eslint linebreak-style: "off" */
|
||||
/* eslint no-trailing-spaces: "off" */
|
||||
/* eslint-env es6*/
|
||||
|
||||
import {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
|
@ -10,7 +10,7 @@ import notification from 'core/notification';
|
|||
import Vue from './vue/vue';
|
||||
|
||||
import Debugger from './util/debugger';
|
||||
import {load_strings} from './util/string-helper';
|
||||
import {loadStrings} from './util/string-helper';
|
||||
|
||||
import SRComponents from './studyplan-report-components';
|
||||
Vue.use(SRComponents);
|
||||
|
@ -28,9 +28,8 @@ Vue.use(BootstrapVue);
|
|||
|
||||
let debug = new Debugger("treestudyplanviewer");
|
||||
|
||||
let strings = load_strings({
|
||||
studyplan_report: {
|
||||
studyplan_select_placeholder: 'studyplan_select_placeholder',
|
||||
let strings = loadStrings({
|
||||
studyplanReport: {
|
||||
studyplan: 'studyplan',
|
||||
page: 'studyplanpage',
|
||||
periods: 'periods',
|
||||
|
@ -67,56 +66,54 @@ export function init(studyplanid, pageid, firstperiod, lastperiod) {
|
|||
structure: null,
|
||||
studyplan: null,
|
||||
page: null,
|
||||
text: strings.studyplan_report,
|
||||
text: strings.studyplanReport,
|
||||
},
|
||||
async mounted() {
|
||||
|
||||
},
|
||||
created() {
|
||||
// On creation, load the page as specified
|
||||
this.loadStructure(pageid,firstperiod,lastperiod);
|
||||
this.loadStructure(pageid, firstperiod, lastperiod);
|
||||
},
|
||||
computed: {
|
||||
|
||||
},
|
||||
methods: {
|
||||
loadStructure(pageid,firstperiod,lastperiod) {
|
||||
loadStructure(pageid, firstperiod, lastperiod) {
|
||||
const self = this;
|
||||
this.structure = null; // Starts loading icon. Hides old data.
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_report_structure',
|
||||
args: { pageid: pageid,
|
||||
args: {pageid: pageid,
|
||||
firstperiod: firstperiod,
|
||||
lastperiod: lastperiod
|
||||
}
|
||||
}])[0].then(function(response){
|
||||
}])[0].then((response) => {
|
||||
self.structure = response;
|
||||
self.studyplan = response.studyplan;
|
||||
self.page = response.page;
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
},
|
||||
selectedPage(e) {
|
||||
debug.info("SelectedPage",e);
|
||||
debug.info("SelectedPage", e);
|
||||
const pageid = e.target.value;
|
||||
this.loadStructure(pageid);
|
||||
},
|
||||
selectedFirstPeriod(e) {
|
||||
debug.info("selectedFirstPeriod",e);
|
||||
debug.info("selectedFirstPeriod", e);
|
||||
let f = e.target.value;
|
||||
let l = this.structure.lastperiod;
|
||||
if ( l < f) {
|
||||
if (l < f) {
|
||||
l = f;
|
||||
}
|
||||
this.loadStructure(this.page.id,f,l);
|
||||
this.loadStructure(this.page.id, f, l);
|
||||
},
|
||||
selectedLastPeriod(e) {
|
||||
debug.info("selectedLastPeriod",e);
|
||||
debug.info("selectedLastPeriod", e);
|
||||
let f = this.structure.firstperiod;
|
||||
let l = e.target.value;
|
||||
if ( l < f) {
|
||||
if (l < f) {
|
||||
l = f;
|
||||
}
|
||||
this.loadStructure(this.page.id,f,l);
|
||||
this.loadStructure(this.page.id, f, l);
|
||||
|
||||
},
|
||||
},
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/*eslint no-var: "error" */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/*eslint linebreak-style: "off" */
|
||||
/*eslint no-trailing-spaces: "off" */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/* eslint no-trailing-spaces: "off" */
|
||||
/* eslint promise/no-nesting: "off" */
|
||||
/* eslint max-depth: ["error", 5] */
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
// You can call it anything you like
|
||||
|
||||
|
@ -12,13 +11,13 @@ import notification from 'core/notification';
|
|||
import Vue from './vue/vue';
|
||||
|
||||
import Debugger from './util/debugger';
|
||||
import {load_strings} from './util/string-helper';
|
||||
import {ProcessStudyplan} from './studyplan-processor';
|
||||
import {loadStrings} from './util/string-helper';
|
||||
import {processStudyplan} from './studyplan-processor';
|
||||
import {studyplanTiming} from './util/date-helper';
|
||||
import {addBrowserButtonEvent} from './util/browserbuttonevents';
|
||||
|
||||
import RVComponents from './report-viewer-components';
|
||||
Vue.use(RVComponents);
|
||||
import TSComponents from './treestudyplan-components';
|
||||
import ModalComponents from './modedit-modal';
|
||||
Vue.use(ModalComponents);
|
||||
|
||||
|
@ -30,29 +29,37 @@ Vue.use(BootstrapVue);
|
|||
|
||||
let debug = new Debugger("treestudyplanviewer");
|
||||
|
||||
let strings = load_strings({
|
||||
let strings = loadStrings({
|
||||
studyplan: {
|
||||
studyplan_select_placeholder: 'studyplan_select_placeholder',
|
||||
studyplanSelectPlaceholder: 'studyplan_select_placeholder',
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Initialize the Page
|
||||
* @param {int} contextid The context we should attempt to work in (1:1 related to the category)
|
||||
* @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)
|
||||
* @param {number} contextid The context we should attempt to work in (1:1 related to the category)
|
||||
* @param {number} categoryid The category we shoud attempt to work in (1:1 related to the context)
|
||||
*/
|
||||
export function init(contextid,categoryid) {
|
||||
export function init(contextid, categoryid) {
|
||||
// Make sure the id's are numeric and integer
|
||||
if(undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1 ){ contextid = 1;}
|
||||
else { contextid = Number(contextid);} // ensure a numeric value instead of string
|
||||
if(undefined === categoryid || !Number.isInteger(Number(categoryid))){ categoryid = 0;}
|
||||
else { categoryid = Number(categoryid);} // ensure a numeric value instead of string
|
||||
|
||||
const in_systemcontext = (contextid <= 1);
|
||||
if (undefined === contextid || !Number.isInteger(Number(contextid)) || contextid < 1) {
|
||||
contextid = 1;
|
||||
} else { // Ensure a numeric value instead of string
|
||||
contextid = Number(contextid);
|
||||
}
|
||||
if (undefined === categoryid || !Number.isInteger(Number(categoryid))) {
|
||||
categoryid = 0;
|
||||
} else { // Ensure a numeric value instead of string
|
||||
categoryid = Number(categoryid);
|
||||
}
|
||||
|
||||
let app = new Vue({
|
||||
el: '#root',
|
||||
data: {
|
||||
selected: {
|
||||
planid: 0,
|
||||
studentid: 0,
|
||||
},
|
||||
displayedstudyplan: null,
|
||||
activestudyplan: null,
|
||||
associatedstudents: [],
|
||||
|
@ -69,143 +76,201 @@ export function init(contextid,categoryid) {
|
|||
async mounted() {
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_list_studyplans',
|
||||
args: {context_id: contextid}
|
||||
}])[0].then(function(response){
|
||||
const timingval = { present: 0, past: 1, future: 2};
|
||||
response.sort((a,b) => {
|
||||
args: {'context_id': contextid}
|
||||
}])[0].then((response) => {
|
||||
const timingval = {present: 0, past: 1, future: 2};
|
||||
response.sort((a, b) => {
|
||||
const timinga = studyplanTiming(a);
|
||||
const timingb = studyplanTiming(b);
|
||||
|
||||
const t = timingval[timinga] - timingval[timingb];
|
||||
if(t == 0){
|
||||
// sort by name if timing is equal
|
||||
if (t == 0) {
|
||||
// Sort by name if timing is equal
|
||||
return a.name.localeCompare(b.name);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return t;
|
||||
}
|
||||
});
|
||||
app.studyplans = response;
|
||||
// load studyplan from hash if applicable
|
||||
const hash = window.location.hash.replace('#','');
|
||||
// Load studyplan from hash if applicable
|
||||
const hash = window.location.hash.replace('#', '');
|
||||
const parts = hash.split("-");
|
||||
|
||||
if(!!parts && parts.length > 0){
|
||||
for(let idx in app.studyplans){
|
||||
if(app.studyplans[idx].id == parts[0]){
|
||||
app.selectStudyplan(app.studyplans[idx],parts[1]);
|
||||
if (!!parts && parts.length > 0 && parts[0] != '') {
|
||||
for (let idx in app.studyplans) {
|
||||
if (app.studyplans[idx].id == parts[0]) {
|
||||
app.selectStudyplan(app.studyplans[idx], parts[1]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_list_available_categories',
|
||||
args: { operation: 'view', refcontext_id: contextid}
|
||||
}])[0].then(function(response){
|
||||
args: {operation: 'view', 'refcontext_id': contextid}
|
||||
}])[0].then((response) => {
|
||||
const contexts = [];
|
||||
for(const ix in response){
|
||||
for (const ix in response) {
|
||||
const cat = response[ix];
|
||||
if(cat.studyplancount > 0 || cat.context_id == contextid){
|
||||
if (cat.studyplancount > 0 || cat.context_id == contextid) {
|
||||
contexts.push(cat);
|
||||
}
|
||||
}
|
||||
app.usedcontexts = contexts;
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
addBrowserButtonEvent(this.navChanged, this.navChanged);
|
||||
},
|
||||
computed: {
|
||||
dropdown_title(){
|
||||
if(this.activestudyplan && this.activestudyplan.name){
|
||||
dropdownTitle() {
|
||||
if (this.activestudyplan && this.activestudyplan.name) {
|
||||
return this.activestudyplan.name;
|
||||
}
|
||||
else{
|
||||
return this.text.studyplan_select_placeholder;
|
||||
} else {
|
||||
return this.text.studyplanSelectPlaceholder;
|
||||
}
|
||||
},
|
||||
contextid(){
|
||||
contextid() {
|
||||
return contextid;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
switchContext(ctxid){
|
||||
navChanged() {
|
||||
const hash = window.location.hash.replace('#', '');
|
||||
const parts = hash.split("-");
|
||||
debug.log("Navigation changed", hash, parts);
|
||||
|
||||
if (!!parts && parts.length > 0) {
|
||||
const planid = Number(parts[0]);
|
||||
const studentid = (parts.length > 1) ? Number(parts[1]) : 0;
|
||||
|
||||
debug.log("Selected ids", planid, studentid, this.selected.planid, this.selected.studentid);
|
||||
if (planid == 0) {
|
||||
if (planid != this.selected.planid) {
|
||||
this.closeStudyplan(false);
|
||||
}
|
||||
} else if (this.selected.planid != planid || (studentid == 0 && this.selected.studentid != 0)) {
|
||||
debug.info("Requested plan changed - loading studyplan");
|
||||
for (let idx in app.studyplans) {
|
||||
const plan = this.studyplans[idx];
|
||||
if (Number(plan.id) == planid) {
|
||||
this.selectStudyplan(plan, studentid, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (this.selected.studentid != studentid) {
|
||||
for (const group of app.associatedstudents) {
|
||||
for (const student of group.users) {
|
||||
if (Number(student.id) == studentid) {
|
||||
app.showStudentView(student, false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
switchContext(ctxid) {
|
||||
const params = new URLSearchParams(location.search);
|
||||
params.delete('categoryid');
|
||||
params.set('contextid', ctxid);
|
||||
setTimeout(() => {
|
||||
// Reload page in a timeout to give other form javasccript the change to remove the beforeunload handler.
|
||||
window.location.href = window.location.pathname + "?" + params.toString();
|
||||
},50);
|
||||
}, 50);
|
||||
},
|
||||
closeStudyplan() {
|
||||
closeStudyplan(updatehash = true) {
|
||||
app.selected.planid = 0;
|
||||
app.selected.studentid = 0;
|
||||
app.activestudyplan = null;
|
||||
app.associatedstudents = [];
|
||||
app.studentstudyplan = [];
|
||||
app.displayedstudyplan = null;
|
||||
window.location.hash = '';
|
||||
if (updatehash) {
|
||||
window.location.hash = '';
|
||||
}
|
||||
},
|
||||
|
||||
selectStudyplan(studyplan,studentid){
|
||||
// fetch studyplan
|
||||
selectStudyplan(studyplan, studentid, updatehash = true) {
|
||||
app.selected.planid = Number(studyplan.id);
|
||||
app.selected.studentid = studentid ? Number(studentid) : 0;
|
||||
// Fetch studyplan
|
||||
app.loadingstudyplan = true;
|
||||
app.activestudyplan = null;
|
||||
app.associatedstudents = [];
|
||||
app.selectedstudent = null;
|
||||
app.studentstudyplan = null;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_studyplan_map',
|
||||
args: { id: studyplan.id}
|
||||
}])[0].then(function(response){
|
||||
app.activestudyplan = ProcessStudyplan(response,true);
|
||||
app.displayedstudyplan = app.activestudyplan;
|
||||
app.loadingstudyplan = false;
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
args: {id: studyplan.id}
|
||||
}])[0].then((response) => {
|
||||
app.activestudyplan = processStudyplan(response, true);
|
||||
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_all_associated_grouped',
|
||||
args: { studyplan_id: studyplan.id}
|
||||
}])[0].then(function(response){
|
||||
args: {'studyplan_id': studyplan.id}
|
||||
}])[0].then((response) => {
|
||||
app.associatedstudents = response;
|
||||
if(studentid){
|
||||
for(const group of app.associatedstudents) {
|
||||
for(const student of group.users){
|
||||
if(student.id == studentid){
|
||||
app.showStudentView(student);
|
||||
let foundstudent = false;
|
||||
if (studentid) {
|
||||
for (const group of app.associatedstudents) {
|
||||
for (const student of group.users) {
|
||||
if (student.id == studentid) {
|
||||
foundstudent = true;
|
||||
app.showStudentView(student, updatehash);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!foundstudent) {
|
||||
app.selected.studentid = 0;
|
||||
if (updatehash) {
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
}
|
||||
app.displayedstudyplan = app.activestudyplan;
|
||||
app.loadingstudyplan = false;
|
||||
}
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
|
||||
}).catch(function(error){
|
||||
return;
|
||||
}).catch(function(error) {
|
||||
notification.exception(error);
|
||||
app.loadingstudyplan = false;
|
||||
});
|
||||
},
|
||||
showStudentView(student){
|
||||
app.selectedstudent = student;
|
||||
app.studentstudyplan = null;
|
||||
showStudentView(student, updatehash = true) {
|
||||
app.selected.studentid = student ? Number(student.id) : 0;
|
||||
if (student) {
|
||||
app.selectedstudent = student;
|
||||
app.studentstudyplan = null;
|
||||
app.loadingstudyplan = true;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_user_studyplan',
|
||||
args: { userid: student.id, studyplanid: app.activestudyplan.id}
|
||||
}])[0].then(function(response){
|
||||
app.studentstudyplan = ProcessStudyplan(response,false);
|
||||
args: {userid: student.id, studyplanid: app.selected.planid}
|
||||
}])[0].then((response) => {
|
||||
app.studentstudyplan = processStudyplan(response, false);
|
||||
app.displayedstudyplan = app.studentstudyplan;
|
||||
app.loadingstudyplan = false;
|
||||
window.location.hash = app.activestudyplan.id + "-" + student.id;
|
||||
}).catch(function(error){
|
||||
if (updatehash) {
|
||||
window.location.hash = app.activestudyplan.id + "-" + student.id;
|
||||
}
|
||||
return;
|
||||
}).catch((error) => {
|
||||
notification.exception(error);
|
||||
app.loadingstudyplan = false;
|
||||
});
|
||||
} else {
|
||||
this.showOverview(updatehash);
|
||||
}
|
||||
|
||||
},
|
||||
showOverview(){
|
||||
showOverview(updatehash = true) {
|
||||
app.selected.studentid = 0;
|
||||
app.selectedstudent = null;
|
||||
app.studentstudyplan = null;
|
||||
app.displayedstudyplan = app.activestudyplan;
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
if (updatehash) {
|
||||
window.location.hash = app.activestudyplan.id;
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
|
|
@ -1,26 +1,23 @@
|
|||
/*eslint-env es6*/
|
||||
/*eslint no-console: "off"*/
|
||||
/* eslint-env es6*/
|
||||
/* eslint no-console: "off"*/
|
||||
|
||||
/**
|
||||
* Hide a primary navigation item by href
|
||||
* @param {string|Array} hrefs The link that should be hidden
|
||||
*/
|
||||
export function hide_primary(hrefs) {
|
||||
if(typeof hrefs === 'string' || hrefs instanceof String){
|
||||
export function hidePrimary(hrefs) {
|
||||
if (typeof hrefs === 'string' || hrefs instanceof String) {
|
||||
hrefs = [hrefs];
|
||||
}
|
||||
|
||||
if(typeof hrefs === 'object' && Array.isArray(hrefs)){
|
||||
let css = '' ;
|
||||
for(const ix in hrefs){
|
||||
if (typeof hrefs === 'object' && Array.isArray(hrefs)) {
|
||||
let css = '';
|
||||
for (const ix in hrefs) {
|
||||
const href = hrefs[ix];
|
||||
css += `
|
||||
li > a[href*="${href}"] {
|
||||
display: none !important;
|
||||
}
|
||||
`;
|
||||
css += `
|
||||
#usernavigation a[href*="${href}"] {
|
||||
.primary-navigation a[href*="${href}"],
|
||||
#usernavigation a[href*="${href}"],
|
||||
.drawer-primary a[href*="${href}"] {
|
||||
display: none !important;
|
||||
}
|
||||
`;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
/*eslint no-trailing-spaces: "off"*/
|
||||
/*eslint no-eval: "off"*/
|
||||
/* eslint no-trailing-spaces: "off"*/
|
||||
/* eslint no-eval: "off"*/
|
||||
|
||||
/***********************************
|
||||
* Licence: MIT
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*eslint no-console: "off"*/
|
||||
/*eslint no-trailing-spaces: "off"*/
|
||||
/* eslint no-console: "off"*/
|
||||
/* eslint no-trailing-spaces: "off"*/
|
||||
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,5 @@
|
|||
/*eslint no-console: "off"*/
|
||||
/* eslint no-console: "off"*/
|
||||
/* eslint max-depth: ["error", 6]*/
|
||||
/**
|
||||
* Copy fields from one object to another
|
||||
* @param {Object} target The target to copy to
|
||||
|
@ -6,11 +7,11 @@
|
|||
* @param {Array} fields The field names to copy
|
||||
* @returns {Object} Reference to target
|
||||
*/
|
||||
export function objCopy(target,source,fields){
|
||||
if ( fields === undefined || fields === null) {
|
||||
export function objCopy(target, source, fields) {
|
||||
if (fields === undefined || fields === null) {
|
||||
fields = Object.getOwnPropertyNames(source);
|
||||
}
|
||||
for(const ix in fields) {
|
||||
for (const ix in fields) {
|
||||
const field = fields[ix];
|
||||
target[field] = source[field];
|
||||
}
|
||||
|
@ -24,23 +25,23 @@ export function objCopy(target,source,fields){
|
|||
* @param {*} identifier The value used to match the item
|
||||
* @param {string} param The field name to match on (default: 'value')
|
||||
*/
|
||||
export function transportItem(target,source,identifier,param){
|
||||
if(!param){
|
||||
export function transportItem(target, source, identifier, param) {
|
||||
if (!param) {
|
||||
param = 'value';
|
||||
}
|
||||
// find item
|
||||
// Find item
|
||||
let item;
|
||||
let itemindex;
|
||||
for(const ix in source){
|
||||
if(source[ix][param] == identifier){
|
||||
for (const ix in source) {
|
||||
if (source[ix][param] == identifier) {
|
||||
item = source[ix];
|
||||
itemindex = ix;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(item){
|
||||
if (item) {
|
||||
target.push(item);
|
||||
source.splice(itemindex,1);
|
||||
source.splice(itemindex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,14 +50,12 @@ export function transportItem(target,source,identifier,param){
|
|||
* @param {Array} studyplans The list of studyplans to load
|
||||
* @returns {Array} List of updated studyplans
|
||||
*/
|
||||
export function ProcessStudyplans(studyplans){
|
||||
export function processStudyplans(studyplans) {
|
||||
// Unify object references to connections between items, so there are no duplicates
|
||||
for(const isx in studyplans)
|
||||
{
|
||||
for (const isx in studyplans) {
|
||||
const studyplan = studyplans[isx];
|
||||
ProcessStudyplan(studyplan);
|
||||
processStudyplan(studyplan);
|
||||
}
|
||||
|
||||
return studyplans;
|
||||
}
|
||||
|
||||
|
@ -64,12 +63,12 @@ export function ProcessStudyplans(studyplans){
|
|||
* Perform initial processing on a downloaded studyplan
|
||||
* Mainly used to create the proper references between items
|
||||
* @param {Object} studyplan The studyplan to process
|
||||
* @returns Processed studyplan
|
||||
* @returns {object} Processed studyplan
|
||||
*/
|
||||
export function ProcessStudyplan(studyplan){
|
||||
for(const ip in studyplan.pages){
|
||||
export function processStudyplan(studyplan) {
|
||||
for (const ip in studyplan.pages) {
|
||||
const page = studyplan.pages[ip];
|
||||
ProcessStudyplanPage(page);
|
||||
processStudyplanPage(page);
|
||||
}
|
||||
return studyplan;
|
||||
}
|
||||
|
@ -78,33 +77,33 @@ export function ProcessStudyplan(studyplan){
|
|||
* Perform initial processing on a downloaded studyplan'page
|
||||
* Mainly used to create the proper references between items
|
||||
* @param {Object} page The studyplan page to process
|
||||
* @returns Processed studyplan
|
||||
* @returns {object} Processed studyplan
|
||||
*/
|
||||
export function ProcessStudyplanPage(page){
|
||||
export function processStudyplanPage(page) {
|
||||
let connections = {};
|
||||
for(const il in page.studylines) {
|
||||
for (const il in page.studylines) {
|
||||
const line = page.studylines[il];
|
||||
|
||||
for(const is in line.slots ) {
|
||||
for (const is in line.slots) {
|
||||
const slot = line.slots[is];
|
||||
|
||||
if(slot.courses !== undefined){
|
||||
for(const ic in slot.courses){
|
||||
if (slot.courses !== undefined) {
|
||||
for (const ic in slot.courses) {
|
||||
const itm = slot.courses[ic];
|
||||
|
||||
for(const idx in itm.connections.in) {
|
||||
for (const idx in itm.connections.in) {
|
||||
const conn = itm.connections.in[idx];
|
||||
|
||||
if(conn.id in connections){
|
||||
if (conn.id in connections) {
|
||||
itm.connections[idx] = connections[conn.id];
|
||||
} else {
|
||||
connections[conn.id] = conn;
|
||||
}
|
||||
}
|
||||
for(const idx in itm.connections.out) {
|
||||
for (const idx in itm.connections.out) {
|
||||
const conn = itm.connections.out[idx];
|
||||
|
||||
if(conn.id in connections){
|
||||
if (conn.id in connections) {
|
||||
itm.connections[idx] = connections[conn.id];
|
||||
} else {
|
||||
connections[conn.id] = conn;
|
||||
|
@ -113,23 +112,23 @@ export function ProcessStudyplanPage(page){
|
|||
}
|
||||
}
|
||||
|
||||
if(slot.filters !== undefined){
|
||||
for(const ix in slot.filters){
|
||||
if (slot.filters !== undefined) {
|
||||
for (const ix in slot.filters) {
|
||||
const itm = slot.filters[ix];
|
||||
|
||||
for(const idx in itm.connections.in) {
|
||||
for (const idx in itm.connections.in) {
|
||||
const conn = itm.connections.in[idx];
|
||||
|
||||
if(conn.id in connections){
|
||||
if (conn.id in connections) {
|
||||
itm.connections[idx] = connections[conn.id];
|
||||
} else {
|
||||
connections[conn.id] = conn;
|
||||
}
|
||||
}
|
||||
for(const idx in itm.connections.out) {
|
||||
for (const idx in itm.connections.out) {
|
||||
const conn = itm.connections.out[idx];
|
||||
|
||||
if(conn.id in connections){
|
||||
if (conn.id in connections) {
|
||||
itm.connections[idx] = connections[conn.id];
|
||||
} else {
|
||||
connections[conn.id] = conn;
|
||||
|
|
|
@ -1,32 +1,23 @@
|
|||
/*eslint no-var: "error"*/
|
||||
/*eslint no-console: "off"*/
|
||||
/*eslint no-unused-vars: warn */
|
||||
/*eslint max-len: ["error", { "code": 160 }] */
|
||||
/*eslint-disable no-trailing-spaces */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-var: "error"*/
|
||||
/* eslint no-unused-vars: warn */
|
||||
/* eslint max-depth: ["error", 6] */
|
||||
/* eslint promise/no-nesting: "off" */
|
||||
/* eslint camelcase: "off" */
|
||||
/* eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
|
||||
import {load_strings} from './util/string-helper';
|
||||
import {loadStrings} from './util/string-helper';
|
||||
import {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
import Debugger from './util/debugger';
|
||||
import Config from 'core/config';
|
||||
import TSComponents from './treestudyplan-components';
|
||||
import FitTextVue from './util/fittext-vue';
|
||||
import {format_datetime} from "./util/date-helper";
|
||||
import {formatDatetime} from "./util/date-helper";
|
||||
|
||||
const debug = new Debugger("treestudyplan-viewer");
|
||||
|
||||
|
||||
// Make π available as a constant
|
||||
const π = Math.PI;
|
||||
// Gravity value for arrow lines - determines how much a line is pulled in the direction of the start/end before changing direction
|
||||
const LINE_GRAVITY = 1.3;
|
||||
|
||||
/**
|
||||
* Strip tags from html
|
||||
* @param {*} html
|
||||
* @returns
|
||||
* @param {*} html
|
||||
* @returns {string}
|
||||
*/
|
||||
function striptags(html) {
|
||||
const tmp = document.createElement("DIV");
|
||||
|
@ -39,6 +30,7 @@ function striptags(html) {
|
|||
/**
|
||||
* Retrieve condition headers
|
||||
* @param {Object} item
|
||||
* @returns {Array}
|
||||
*/
|
||||
function conditionHeaders(item) {
|
||||
const course = item.course;
|
||||
|
@ -46,11 +38,11 @@ function conditionHeaders(item) {
|
|||
if (course.competency) {
|
||||
for (const cmp of course.competency.competencies) {
|
||||
list.push({
|
||||
name: (cmp.details?`${cmp.title} - ${cmp.details}`:cmp.title),
|
||||
name: (cmp.details ? (`${cmp.title} - ${cmp.details}`) : cmp.title),
|
||||
tooltip: cmp.description,
|
||||
});
|
||||
}
|
||||
} else if(course.completion) {
|
||||
} else if (course.completion) {
|
||||
for (const cnd of course.completion.conditions) {
|
||||
for (const itm of cnd.items) {
|
||||
list.push({
|
||||
|
@ -59,8 +51,8 @@ function conditionHeaders(item) {
|
|||
});
|
||||
}
|
||||
}
|
||||
} else if(course.grades) {
|
||||
for(const g of course.grades) {
|
||||
} else if (course.grades) {
|
||||
for (const g of course.grades) {
|
||||
if (g.selected) {
|
||||
list.push({
|
||||
name: g.name,
|
||||
|
@ -75,6 +67,7 @@ function conditionHeaders(item) {
|
|||
/**
|
||||
* Retrieve conditions
|
||||
* @param {Object} item
|
||||
* @returns {Array}
|
||||
*/
|
||||
function conditions(item) {
|
||||
const course = item.course;
|
||||
|
@ -83,14 +76,14 @@ function conditions(item) {
|
|||
for (const cmp of course.competency.competencies) {
|
||||
list.push(cmp);
|
||||
}
|
||||
} else if(course.completion) {
|
||||
} else if (course.completion) {
|
||||
for (const cnd of course.completion.conditions) {
|
||||
for (const itm of cnd.items) {
|
||||
list.push(itm);
|
||||
}
|
||||
}
|
||||
} else if(course.grades) {
|
||||
for(const g of course.grades) {
|
||||
} else if (course.grades) {
|
||||
for (const g of course.grades) {
|
||||
if (g.selected) {
|
||||
list.push(g);
|
||||
}
|
||||
|
@ -101,11 +94,11 @@ function conditions(item) {
|
|||
|
||||
|
||||
export default {
|
||||
install(Vue/*,options*/){
|
||||
install(Vue /* ,options */) {
|
||||
Vue.use(TSComponents);
|
||||
Vue.use(FitTextVue);
|
||||
|
||||
let strings = load_strings({
|
||||
let strings = loadStrings({
|
||||
report: {
|
||||
loading: "loadinghelp@core",
|
||||
studyplan_past: "studyplan_past",
|
||||
|
@ -113,7 +106,7 @@ export default {
|
|||
studyplan_future: "studyplan_future",
|
||||
back: "back",
|
||||
},
|
||||
|
||||
|
||||
invalid: {
|
||||
error: 'error',
|
||||
},
|
||||
|
@ -138,11 +131,11 @@ export default {
|
|||
}
|
||||
});
|
||||
|
||||
/************************************
|
||||
/* **********************************
|
||||
* *
|
||||
* Treestudyplan Viewer components *
|
||||
* *
|
||||
************************************/
|
||||
* **********************************/
|
||||
|
||||
Vue.component('q-studyplanreport', {
|
||||
props: {
|
||||
|
@ -168,14 +161,11 @@ export default {
|
|||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
},
|
||||
watch:{
|
||||
watch: {
|
||||
structure: {
|
||||
immediate: true,
|
||||
handler (structure) {
|
||||
this.loadStudents(); // reload the student list
|
||||
|
||||
handler(structure) {
|
||||
this.loadStudents(); // Reload the student list
|
||||
// (Re)build expansion info structure
|
||||
let firstperiod = true;
|
||||
for (const period of structure.periods) {
|
||||
|
@ -183,15 +173,15 @@ export default {
|
|||
if (!this.expansioninfo.periods[pid]) {
|
||||
// Use this.$set to make sure the properties are reactive.
|
||||
this.$set(
|
||||
this.expansioninfo.periods,
|
||||
pid,
|
||||
this.expansioninfo.periods,
|
||||
pid,
|
||||
{
|
||||
expanded: ((firstperiod && period.lines.length > 0)?true:false),
|
||||
expanded: ((firstperiod && period.lines.length > 0) ? true : false),
|
||||
}
|
||||
);
|
||||
this.$set(
|
||||
this.expansioninfo.lines,
|
||||
period.period.id,
|
||||
this.expansioninfo.lines,
|
||||
period.period.id,
|
||||
{}
|
||||
);
|
||||
}
|
||||
|
@ -201,7 +191,7 @@ export default {
|
|||
// Use this.$set to make sure the properties are reactive.
|
||||
this.$set(
|
||||
this.expansioninfo.lines[pid],
|
||||
lid,
|
||||
lid,
|
||||
{
|
||||
expanded: true,
|
||||
}
|
||||
|
@ -226,43 +216,41 @@ export default {
|
|||
}
|
||||
},
|
||||
computed: {
|
||||
sortedstudents(){
|
||||
const self=this;
|
||||
// Probably could make a deep copy for purity's sake, but this works just as well and is probably more efficient.
|
||||
sortedstudents() {
|
||||
// Probably could make a deep copy for purity's sake, but this works just as well.
|
||||
const students = this.students;
|
||||
for (const group of this.students) {
|
||||
group.users.sort((a,b) => {
|
||||
group.users.sort((a, b) => {
|
||||
let d = a;
|
||||
let e = b;
|
||||
if (!this.sorting.asc) {
|
||||
d = b;
|
||||
e = a;
|
||||
}
|
||||
}
|
||||
if (this.sorting.header == "lastaccess") {
|
||||
const dvalue = (d[this.sorting.header]?d[this.sorting.header]:0);
|
||||
const evalue = (e[this.sorting.header]?e[this.sorting.header]:0);
|
||||
const dvalue = (d[this.sorting.header] ? d[this.sorting.header] : 0);
|
||||
const evalue = (e[this.sorting.header] ? e[this.sorting.header] : 0);
|
||||
return dvalue - evalue;
|
||||
} else {
|
||||
return String(d[this.sorting.header]).localeCompare(String(e[this.sorting.header]));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return students;
|
||||
},
|
||||
resultColCount(){
|
||||
resultColCount() {
|
||||
let count = 0;
|
||||
for (const period of this.structure.periods) {
|
||||
const pid = period.period.id;
|
||||
if (!this.expansioninfo.periods[pid].expanded) {
|
||||
// This period is not expanded. Make it 3 units wide
|
||||
// This period is not expanded. Make it 3 units wide
|
||||
count += 2;
|
||||
} else {
|
||||
for (const line of period.lines) {
|
||||
const lid = line.line.id;
|
||||
if (!this.expansioninfo.lines[pid][lid].expanded) {
|
||||
count +=1;
|
||||
} else {
|
||||
count += 1;
|
||||
} else {
|
||||
for (const item of line.items) {
|
||||
if (!this.expansioninfo.items[item.id].expanded) {
|
||||
count += 1;
|
||||
|
@ -274,19 +262,19 @@ export default {
|
|||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
return count;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loadStudents() {
|
||||
const self = this;
|
||||
self.studentsloading=true;
|
||||
self.studentsloading = true;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_all_associated_grouped',
|
||||
args: { studyplan_id: this.structure.studyplan.id}
|
||||
}])[0].then(function(response){
|
||||
args: {'studyplan_id': this.structure.studyplan.id}
|
||||
}])[0].then((response) => {
|
||||
self.students = response;
|
||||
for(const group of self.students) {
|
||||
for (const group of self.students) {
|
||||
self.$set(
|
||||
self.groupinfo,
|
||||
group.id,
|
||||
|
@ -295,10 +283,10 @@ export default {
|
|||
}
|
||||
);
|
||||
|
||||
for(const student of group.users){
|
||||
for (const student of group.users) {
|
||||
self.$set(
|
||||
self.studentresults,
|
||||
student.id,
|
||||
student.id,
|
||||
{
|
||||
loading: true,
|
||||
results: [],
|
||||
|
@ -306,24 +294,27 @@ export default {
|
|||
);
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_report_data',
|
||||
args: { pageid: self.structure.page.id,
|
||||
userid: student.id,
|
||||
firstperiod: self.structure.firstperiod,
|
||||
lastperiod: self.structure.lastperiod,
|
||||
}
|
||||
}])[0].then(function(response){
|
||||
args: {
|
||||
pageid: self.structure.page.id,
|
||||
userid: student.id,
|
||||
firstperiod: self.structure.firstperiod,
|
||||
lastperiod: self.structure.lastperiod,
|
||||
}
|
||||
}])[0].then((response) => {
|
||||
self.studentresults[student.id].loading = false;
|
||||
self.studentresults[student.id].results = response;
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
}
|
||||
}
|
||||
self.studentsloading=false;
|
||||
self.studentsloading = false;
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
},
|
||||
expansionChanged(parm, id, val) {
|
||||
if(parm[0] == 'p') {
|
||||
if (parm[0] == 'p') {
|
||||
parm = 'periods';
|
||||
} else if(parm[0] == 'l') {
|
||||
} else if (parm[0] == 'l') {
|
||||
parm = 'lines';
|
||||
} else {
|
||||
parm = 'items';
|
||||
|
@ -422,14 +413,14 @@ export default {
|
|||
if (this.expansion.periods[pid].expanded) {
|
||||
let sum = 0;
|
||||
for (const l of period.lines) {
|
||||
sum += this.colspanLine(period,l);
|
||||
sum += this.colspanLine(period, l);
|
||||
}
|
||||
return sum;
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
},
|
||||
colspanLine(period,line) {
|
||||
colspanLine(period, line) {
|
||||
const pid = period.period.id;
|
||||
const lid = line.line.id;
|
||||
|
||||
|
@ -446,42 +437,34 @@ export default {
|
|||
colspanItem(item) {
|
||||
if (this.expansion.items[item.id].expanded) {
|
||||
const cs = this.conditions(item);
|
||||
return 1+cs.length;
|
||||
return 1 + cs.length;
|
||||
} else {
|
||||
return 1;
|
||||
}
|
||||
},
|
||||
togglePeriod(period,val) {
|
||||
if ( val === undefined) {
|
||||
togglePeriod(period, val) {
|
||||
if (val === undefined) {
|
||||
val = !(this.expansion.periods[period.id].expanded);
|
||||
}
|
||||
this.$emit('expansion','periods',period.id,val);
|
||||
this.$emit('expansion', 'periods', period.id, val);
|
||||
},
|
||||
toggleLine(period,line,val) {
|
||||
if ( val === undefined) {
|
||||
toggleLine(period, line, val) {
|
||||
if (val === undefined) {
|
||||
val = !(this.expansion.lines[period.id][line.id].expanded);
|
||||
}
|
||||
this.$emit('expansion','lines',[period.id,line.id],val);
|
||||
this.$emit('expansion', 'lines', [period.id, line.id], val);
|
||||
},
|
||||
toggleItem(item,val) {
|
||||
if ( val === undefined) {
|
||||
toggleItem(item, val) {
|
||||
if (val === undefined) {
|
||||
val = !(this.expansion.items[item.id].expanded);
|
||||
}
|
||||
this.$emit('expansion','items',item.id,val);
|
||||
this.$emit('expansion', 'items', item.id, val);
|
||||
},
|
||||
toggleSort(heading) {
|
||||
this.$emit('togglesort',heading);
|
||||
this.$emit('togglesort', heading);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
||||
},
|
||||
updated() {
|
||||
},
|
||||
/* https://css-tricks.com/position-sticky-and-table-headers/ */
|
||||
/* TODO: Rework below to make use of tables. Use <Thead> as main element. Then create multiple <tr> as needed for the headers.
|
||||
This should create a much better view than using divs overal.
|
||||
*/
|
||||
/* TODO: https://css-tricks.com/position-sticky-and-table-headers/ */
|
||||
template: `
|
||||
<thead class='q-header'>
|
||||
<tr> <!-- period heading -->
|
||||
|
@ -502,7 +485,8 @@ export default {
|
|||
<template v-for="p in structure.periods">
|
||||
<template v-if="expansion.periods[p.period.id].expanded">
|
||||
<th v-for="l in p.lines"
|
||||
:class="'q-line-heading ' + ((expansion.lines[p.period.id][l.line.id].expanded)?'expanded':'collapsed')"
|
||||
:class="'q-line-heading '
|
||||
+ ((expansion.lines[p.period.id][l.line.id].expanded)?'expanded':'collapsed')"
|
||||
:colspan="colspanLine(p,l)"
|
||||
:rowspan='(expansion.lines[p.period.id][l.line.id].expanded)?1:4'
|
||||
><span class="q-wrap"><fittext vertical maxsize="18pt"
|
||||
|
@ -524,22 +508,21 @@ export default {
|
|||
:class="'q-item-heading ' + ((expansion.items[item.id].expanded)?'expanded':'collapsed')"
|
||||
:colspan="colspanItem(item)"
|
||||
:rowspan='(expansion.items[item.id].expanded)?1:3'
|
||||
><span class="q-wrap"><a href='#'
|
||||
@click.prevent="toggleItem(item)"
|
||||
><i v-if="expansion.items[item.id].expanded"
|
||||
class='q-chevron fa fa-minus'></i
|
||||
><i v-else
|
||||
class='q-chevron fa fa-plus'></i
|
||||
><a class="q-wrap" href='#' @click.prevent="toggleItem(item)"
|
||||
><div class="q-toggle"
|
||||
><i v-if="expansion.items[item.id].expanded"
|
||||
class='q-chevron fa fa-minus'></i
|
||||
><i v-else
|
||||
class='q-chevron fa fa-plus'></i
|
||||
></div><div class="q-title"
|
||||
><fittext vertical maxsize="12pt" minsize="9pt"
|
||||
><span class='q-label'
|
||||
:title="item.course.displayname"
|
||||
v-html="item.course.displayname"
|
||||
></span
|
||||
></fittext
|
||||
></div
|
||||
></a
|
||||
> <a style="display: inline-block;" href='#'
|
||||
@click.prevent="toggleItem(item)"
|
||||
><fittext vertical maxsize="18pt" singleline
|
||||
><span class='q-label'
|
||||
:title="item.course.displayname"
|
||||
v-html="item.course.displayname"
|
||||
></span
|
||||
></fittext
|
||||
></a></span
|
||||
></th>
|
||||
</template>
|
||||
</template>
|
||||
|
@ -558,7 +541,8 @@ export default {
|
|||
<th v-for="c in conditions(item)"
|
||||
rowspan="2"
|
||||
class='q-condition-heading'
|
||||
><span class="q-wrap"><fittext vertical maxsize="14pt"><a class='q-label q-condition-label'
|
||||
><span class="q-wrap"
|
||||
><fittext vertical maxsize="14pt"><a class='q-label q-condition-label'
|
||||
:title="c.tooltip" href="#" @click.prevent
|
||||
v-b-tooltip.focus
|
||||
v-html="c.name"></a
|
||||
|
@ -601,11 +585,11 @@ export default {
|
|||
},
|
||||
resultcolumns: {
|
||||
type: Number,
|
||||
default: 1
|
||||
'default': 1
|
||||
},
|
||||
studentinfocolumns: {
|
||||
type: Number,
|
||||
default: 1
|
||||
'default': 1
|
||||
},
|
||||
expanded: {
|
||||
type: Boolean,
|
||||
|
@ -619,8 +603,8 @@ export default {
|
|||
computed: {
|
||||
},
|
||||
methods: {
|
||||
toggleGroup(){
|
||||
this.$emit('togglegroup',this.group);
|
||||
toggleGroup() {
|
||||
this.$emit('togglegroup', this.group);
|
||||
}
|
||||
},
|
||||
template: `
|
||||
|
@ -638,11 +622,11 @@ export default {
|
|||
props: {
|
||||
resultcolumns: {
|
||||
type: Number,
|
||||
default: 1
|
||||
'default': 1
|
||||
},
|
||||
studentinfocolumns: {
|
||||
type: Number,
|
||||
default: 1
|
||||
'default': 1
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
@ -675,14 +659,14 @@ export default {
|
|||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
'default': false
|
||||
},
|
||||
expansion: {
|
||||
type: Object,
|
||||
},
|
||||
even: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
'default': false,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -693,7 +677,7 @@ export default {
|
|||
computed: {
|
||||
lastaccess() {
|
||||
if (this.student.lastaccess) {
|
||||
return format_datetime(this.student.lastaccess*1000); // Takes date in milliseconds
|
||||
return formatDatetime(this.student.lastaccess); // Takes date in milliseconds
|
||||
} else {
|
||||
return this.text.never;
|
||||
}
|
||||
|
@ -719,9 +703,6 @@ export default {
|
|||
},
|
||||
},
|
||||
/* https://css-tricks.com/position-sticky-and-table-headers/ */
|
||||
/* TODO: Rework below to make use of tables. Use <Thead> as main element. Then create multiple <tr> as needed for the headers.
|
||||
This should create a much better view than using divs overal.
|
||||
*/
|
||||
template: `
|
||||
<tr :class="'q-student-results userrow ' + (even?'even':'odd')">
|
||||
<td class='q-studentinfo q-name'><fittext maxsize="12pt">{{student.firstname}} {{student.lastname}}</fittext></td>
|
||||
|
@ -770,7 +751,7 @@ export default {
|
|||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
'default': false
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
@ -784,13 +765,13 @@ export default {
|
|||
if (!course.enrolled) {
|
||||
return false;
|
||||
} else {
|
||||
return (course.completion || course.competency || course.grades)?true:false;
|
||||
return (course.completion || course.competency || course.grades) ? true : false;
|
||||
}
|
||||
},
|
||||
completion_icon() {
|
||||
const completion = this.item.completion;
|
||||
switch(completion){
|
||||
default: // case "incomplete"
|
||||
switch (completion) {
|
||||
default: // Case "incomplete"
|
||||
return "circle-o";
|
||||
case "pending":
|
||||
return "question-circle";
|
||||
|
@ -819,7 +800,7 @@ export default {
|
|||
class="fa fa-exclamation-triangle t-not-enrolled-alert"
|
||||
:title="text.student_not_tracked"></i>
|
||||
</template>
|
||||
<template v-else>
|
||||
<template v-else-if="item.lineenrolled" >
|
||||
<i v-b-popover.top
|
||||
:class="'fa fa-'+completion_icon+
|
||||
' r-completion-'+item.completion"
|
||||
|
@ -839,7 +820,7 @@ export default {
|
|||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
'default': false
|
||||
},
|
||||
conditionidx: {
|
||||
type: Number,
|
||||
|
@ -871,8 +852,8 @@ export default {
|
|||
},
|
||||
completion_icon() {
|
||||
const completion = this.condition_completion();
|
||||
switch(completion){
|
||||
default: // case "incomplete"
|
||||
switch (completion) {
|
||||
default: // Case "incomplete"
|
||||
return "circle-o";
|
||||
case "pending":
|
||||
return "question-circle";
|
||||
|
@ -894,13 +875,13 @@ export default {
|
|||
if (this.condition.grade) {
|
||||
// Return grade if possible.
|
||||
return this.condition.grade;
|
||||
}
|
||||
} else if(course.completion) {
|
||||
}
|
||||
} else if (course.completion) {
|
||||
if (this.condition.grade) {
|
||||
// Return grade if possible.
|
||||
return this.condition.grade;
|
||||
}
|
||||
} else if(course.grades) {
|
||||
}
|
||||
} else if (course.grades) {
|
||||
return this.condition.grade;
|
||||
}
|
||||
// Fallback to completion icon.
|
||||
|
@ -923,20 +904,21 @@ export default {
|
|||
} else {
|
||||
return "incomplete";
|
||||
}
|
||||
} else if(course.completion) {
|
||||
} else if (course.completion) {
|
||||
return this.condition.status;
|
||||
} else if(course.grades) {
|
||||
} else if (course.grades) {
|
||||
return this.condition.completion;
|
||||
} else {
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
// TODO: Show actual grades when relevant at all (don;t forget the grade point completion requirement)
|
||||
template: `
|
||||
<span class='q-conditionresult'>
|
||||
<fittext maxsize="10pt" singleline dynamic>
|
||||
<fittext v-if="item.lineenrolled" maxsize="10pt" singleline dynamic>
|
||||
<template v-if="loading">
|
||||
<div class="spinner-border spinner-border-sm text-info" role="status"></div>
|
||||
</template>
|
||||
|
@ -955,8 +937,5 @@ export default {
|
|||
</span>
|
||||
`,
|
||||
});
|
||||
|
||||
|
||||
|
||||
},
|
||||
};
|
|
@ -1,16 +1,21 @@
|
|||
/*eslint no-var: "error"*/
|
||||
/*eslint no-console: "off"*/
|
||||
/*eslint-disable no-trailing-spaces */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-var: "error"*/
|
||||
/* eslint no-console: "off"*/
|
||||
/* eslint camelcase: "off" */
|
||||
/* eslint-disable no-trailing-spaces */
|
||||
/* eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
|
||||
import {load_strings} from './util/string-helper';
|
||||
import {format_date, studyplanDates, studyplanTiming} from './util/date-helper';
|
||||
import {loadStrings} from './util/string-helper';
|
||||
import {formatDate, studyplanDates, studyplanTiming} from './util/date-helper';
|
||||
import FitTextVue from './util/fittext-vue';
|
||||
import {settings} from "./util/settings";
|
||||
|
||||
export default {
|
||||
|
||||
install(Vue/*,options*/){
|
||||
let strings = load_strings({
|
||||
install(Vue /* ,options */) {
|
||||
Vue.use(FitTextVue);
|
||||
|
||||
let strings = loadStrings({
|
||||
studyplancard: {
|
||||
open: "open",
|
||||
noenddate: "noenddate",
|
||||
|
@ -18,6 +23,7 @@ export default {
|
|||
description: "studyplan_description",
|
||||
completed: "completed",
|
||||
details: "studyplan_details",
|
||||
suspended: "suspended",
|
||||
},
|
||||
details: {
|
||||
details: "studyplan_details",
|
||||
|
@ -43,6 +49,10 @@ export default {
|
|||
open: {
|
||||
type: Boolean
|
||||
},
|
||||
ignoresuspend: {
|
||||
type: Boolean,
|
||||
'default': false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
@ -50,26 +60,37 @@ export default {
|
|||
};
|
||||
},
|
||||
computed: {
|
||||
timing(){
|
||||
timeless() {
|
||||
const plan = this.value;
|
||||
if (!plan.pages || plan.pages.length == 0 || plan.pages[0].timeless) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
timing() {
|
||||
return studyplanTiming(this.value);
|
||||
},
|
||||
dates(){
|
||||
dates() {
|
||||
const dates = studyplanDates(this.value);
|
||||
return {
|
||||
start: format_date(dates.start),
|
||||
end: (dates.end)?format_date(dates.end):this.text.noenddate,
|
||||
start: formatDate(dates.start),
|
||||
end: (dates.end) ? formatDate(dates.end) : this.text.noenddate,
|
||||
};
|
||||
},
|
||||
suspended() {
|
||||
return (this.value.suspended && !this.ignoresuspend);
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
onOpenClick(e) {
|
||||
this.$emit('open',e);
|
||||
this.$emit('open', e);
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<b-card
|
||||
:class="'s-studyplan-card timing-' + timing"
|
||||
:class="'s-studyplan-card timing-' + timing + (suspended?' s-suspended':'')"
|
||||
>
|
||||
<template #header></template>
|
||||
|
||||
|
@ -78,8 +99,11 @@ export default {
|
|||
<div class='s-studyplan-card-info'>
|
||||
<div class='s-studyplan-card-titlebar'>
|
||||
<b-card-title>
|
||||
<a class='title' v-if='open' href='#' @click.prevent='onOpenClick($event)'>{{value.name}}</a>
|
||||
<a class='title' v-if='open && !suspended'
|
||||
href='#' @click.prevent='onOpenClick($event)'>{{value.name}}</a>
|
||||
<template v-else>{{value.name}}</template>
|
||||
<div v-if="suspended" class='text-danger'
|
||||
><fittext maxsize="12pt">{{text.suspended}}</fittext></div>
|
||||
</b-card-title>
|
||||
<div class='s-studyplan-card-titleslot'><slot name='title'></slot></div>
|
||||
</div>
|
||||
|
@ -87,7 +111,7 @@ export default {
|
|||
{{ text.idnumber }}: {{ value.idnumber }}
|
||||
</div>
|
||||
<s-progress-bar
|
||||
v-if='value.progress !== undefined && value.progress !== null'
|
||||
v-if='!suspended && value.progress !== undefined && value.progress !== null'
|
||||
v-model="value.progress"
|
||||
></s-progress-bar>
|
||||
</div>
|
||||
|
@ -95,14 +119,14 @@ export default {
|
|||
</div>
|
||||
<slot></slot>
|
||||
<template #footer>
|
||||
<span :class="'t-timing-'+timing" v-html="dates.start + ' - '+ dates.end"></span>
|
||||
<span v-if="!timeless" :class="'t-timing-'+timing" v-html="dates.start + ' - '+ dates.end"></span>
|
||||
<span class="s-studyplan-card-buttons">
|
||||
<slot name='footer'></slot>
|
||||
<s-studyplan-details
|
||||
v-model="value"
|
||||
v-if="value.description"
|
||||
><i class='fa fa-info-circle'></i></s-studyplan-details>
|
||||
<b-button style="float:right;" v-if='open' variant='primary'
|
||||
<b-button style="float:right;" v-if='open && !suspended' variant='primary'
|
||||
@click.prevent='onOpenClick($event)'>{{ text.open }}</b-button>
|
||||
</span>
|
||||
</template>
|
||||
|
@ -117,11 +141,15 @@ export default {
|
|||
},
|
||||
min: {
|
||||
type: Number,
|
||||
default() { return 0;}
|
||||
default() {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
max: {
|
||||
type: Number,
|
||||
default() { return 1;}
|
||||
default() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -131,24 +159,24 @@ export default {
|
|||
},
|
||||
computed: {
|
||||
width_completed() {
|
||||
if(this.value) {
|
||||
const v = ( (this.value - this.min) / (this.max - this.min));
|
||||
if (this.value) {
|
||||
const v = ((this.value - this.min) / (this.max - this.min));
|
||||
return v * 100;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
width_incomplete() {
|
||||
if(this.value) {
|
||||
const v = ( (this.value - this.min) / (this.max - this.min));
|
||||
return (1-v) * 100;
|
||||
if (this.value) {
|
||||
const v = ((this.value - this.min) / (this.max - this.min));
|
||||
return (1 - v) * 100;
|
||||
} else {
|
||||
return 100;
|
||||
}
|
||||
},
|
||||
percentage_complete() {
|
||||
if(this.value) {
|
||||
const v = ( (this.value - this.min) / (this.max - this.min));
|
||||
if (this.value) {
|
||||
const v = ((this.value - this.min) / (this.max - this.min));
|
||||
return Math.round(v * 100) + "%";
|
||||
} else {
|
||||
return "0%";
|
||||
|
@ -173,8 +201,6 @@ export default {
|
|||
`,
|
||||
});
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* S-STUDYLINE-HEADER-HEADING
|
||||
* The only reasing this is not a simple empty div, is the fact that the header height
|
||||
|
@ -184,7 +210,9 @@ export default {
|
|||
props: {
|
||||
identifier: {
|
||||
type: Number, // Page reference.
|
||||
default() { return 0;}
|
||||
default() {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -201,9 +229,9 @@ export default {
|
|||
|
||||
},
|
||||
methods: {
|
||||
onHeaderHeightChange(newheight,identifier){
|
||||
onHeaderHeightChange(newheight, identifier) {
|
||||
if (this.identifier == identifier) {
|
||||
if(this.$refs.main){
|
||||
if (this.$refs.main) {
|
||||
this.$refs.main.style.height = `${newheight}px`;
|
||||
}
|
||||
}
|
||||
|
@ -217,18 +245,24 @@ export default {
|
|||
Vue.component('s-studyline-header-period', {
|
||||
props: {
|
||||
value: {
|
||||
type: Object, // dict with layer as index
|
||||
type: Object, // Dict with layer as index
|
||||
},
|
||||
identifier: {
|
||||
type: Number, // Page reference.
|
||||
default() { return 0;}
|
||||
default() {
|
||||
return 0;
|
||||
}
|
||||
},
|
||||
mode: {
|
||||
type: String,
|
||||
'default': "view",
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const self=this;
|
||||
if(self.value.period == 1){
|
||||
const self = this;
|
||||
if (self.value.period == 1) {
|
||||
self.resizeListener = new ResizeObserver(() => {
|
||||
if(self.$refs.main){
|
||||
if (self.$refs.main) {
|
||||
const size = self.$refs.main.getBoundingClientRect();
|
||||
ItemEventBus.$emit('headerHeightChange', size.height, self.identifier);
|
||||
}
|
||||
|
@ -236,25 +270,24 @@ export default {
|
|||
}
|
||||
},
|
||||
unmounted() {
|
||||
if(this.resizeListener) {
|
||||
if (this.resizeListener) {
|
||||
this.resizeListener.disconnect();
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
startdate(){
|
||||
return format_date(this.value.startdate);
|
||||
startdate() {
|
||||
return formatDate(this.value.startdate);
|
||||
},
|
||||
enddate(){
|
||||
return format_date(this.value.enddate);
|
||||
enddate() {
|
||||
return formatDate(this.value.enddate);
|
||||
},
|
||||
current(){
|
||||
if( this.value && this.value.startdate && this.value.enddate){
|
||||
current() {
|
||||
if (this.value && this.value.startdate && this.value.enddate) {
|
||||
const now = new Date();
|
||||
const pstart = new Date(this.value.startdate);
|
||||
const pend = new Date(this.value.enddate);
|
||||
return (now >= pstart && now < pend);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -275,10 +308,12 @@ export default {
|
|||
</span>
|
||||
</b-tooltip>
|
||||
<slot></slot
|
||||
><p class="s-studyline-header-period-datespan small">
|
||||
<span class="date">{{ startdate }}</span> - <span class="date">{{ enddate }}</span>
|
||||
><p v-if="value.startdate > 0"
|
||||
class="s-studyline-header-period-datespan small">
|
||||
<span class="date">{{ startdate }}</span>
|
||||
- <span class="date" v-if="this.value.enddate > 0">{{ enddate }}</span><span class="date" v-else>∞</span>
|
||||
</p>
|
||||
<div v-if="current" class='s-studyline-period-highlight'></div>
|
||||
<div v-if="current && mode == 'view'" class='s-studyline-period-highlight'></div>
|
||||
</div>
|
||||
`,
|
||||
});
|
||||
|
@ -291,15 +326,21 @@ export default {
|
|||
},
|
||||
variant: {
|
||||
type: String,
|
||||
default() { return "info"; }
|
||||
default() {
|
||||
return "info";
|
||||
}
|
||||
},
|
||||
pill: {
|
||||
type: Boolean,
|
||||
default() { return false; }
|
||||
default() {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default() { return "";}
|
||||
default() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -345,15 +386,21 @@ export default {
|
|||
},
|
||||
variant: {
|
||||
type: String,
|
||||
default() { return "info"; }
|
||||
default() {
|
||||
return "info";
|
||||
}
|
||||
},
|
||||
position: {
|
||||
type: String,
|
||||
default() { return "below"; }
|
||||
default() {
|
||||
return "below";
|
||||
}
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default() { return "";}
|
||||
default() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -375,7 +422,7 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
displaydate(field) {
|
||||
return format_date(field.value,false);
|
||||
return formatDate(field.value, false);
|
||||
},
|
||||
},
|
||||
template: `
|
||||
|
@ -388,7 +435,10 @@ export default {
|
|||
<span v-else-if='field.type == "checkbox"'
|
||||
:class="'value ' + (field.checked?'true':'false')">{{ field.value }}</span>
|
||||
<span v-else-if='field.type == "textarea"'>
|
||||
<a class='text-info' href='#' v-b-modal="field.courseid+'_'+field.fieldname">{{text.show}}...</a>
|
||||
<a class='text-info'
|
||||
@click.prevent.stop=""
|
||||
href='#'
|
||||
v-b-modal="field.courseid+'_'+field.fieldname">{{text.show}}...</a>
|
||||
<b-modal
|
||||
:id="field.courseid+'_'+field.fieldname"
|
||||
:title="field.title""
|
||||
|
@ -410,61 +460,64 @@ export default {
|
|||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default() { return null;}
|
||||
default() {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
options: {
|
||||
type: Array,
|
||||
},
|
||||
grouped: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
'default': false,
|
||||
},
|
||||
titlefield: {
|
||||
type: String,
|
||||
default: "title",
|
||||
'default': "title",
|
||||
},
|
||||
labelfield: {
|
||||
type: String,
|
||||
default: "label",
|
||||
'default': "label",
|
||||
},
|
||||
optionsfield: {
|
||||
type: String,
|
||||
default: "options",
|
||||
'default': "options",
|
||||
},
|
||||
defaultselectable: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
'default': false,
|
||||
},
|
||||
variant: {
|
||||
type: String,
|
||||
default: "",
|
||||
'default': "",
|
||||
},
|
||||
arrows: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
'default': false,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
showarrows: settings("showprevnextarrows"),
|
||||
text: strings.prevnext,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
fields() {
|
||||
const f = [];
|
||||
if(this.defaultselectable) {
|
||||
if (this.defaultselectable) {
|
||||
f.push(null);
|
||||
}
|
||||
if (this.grouped) {
|
||||
for ( const gix in this.options) {
|
||||
for (const gix in this.options) {
|
||||
const group = this.options[gix];
|
||||
for ( const ix in group[this.optionsfield]) {
|
||||
for (const ix in group[this.optionsfield]) {
|
||||
const v = group[this.optionsfield][ix];
|
||||
f.push(v);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for ( const ix in this.options) {
|
||||
for (const ix in this.options) {
|
||||
const v = this.options[ix];
|
||||
f.push(v);
|
||||
}
|
||||
|
@ -472,8 +525,12 @@ export default {
|
|||
return f;
|
||||
},
|
||||
bubblevalue: {
|
||||
get() { return (this.value)?this.value:null;},
|
||||
set(v) { this.$emit('input',(v)?v:null);},
|
||||
get() {
|
||||
return (this.value) ? this.value : null;
|
||||
},
|
||||
set(v) {
|
||||
this.$emit('input', (v) ? v : null);
|
||||
},
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
@ -485,7 +542,7 @@ export default {
|
|||
},
|
||||
atLast() {
|
||||
if (this.fields.length > 0) {
|
||||
const l = this.fields.length -1;
|
||||
const l = this.fields.length - 1;
|
||||
return this.fields[l] == this.value;
|
||||
}
|
||||
return true; // Since it disables the button, do so if pressing it would make no sense.
|
||||
|
@ -494,65 +551,66 @@ export default {
|
|||
if (this.fields.length > 0) {
|
||||
const index = this.fields.indexOf(this.value);
|
||||
if (index > 0) {
|
||||
this.$emit("input",this.fields[index -1]);
|
||||
this.$emit("change",this.fields[index -1]);
|
||||
this.$emit("input", this.fields[index - 1]);
|
||||
this.$emit("change", this.fields[index - 1]);
|
||||
}
|
||||
}
|
||||
},
|
||||
next() {
|
||||
if (this.fields.length > 0) {
|
||||
const index = this.fields.indexOf(this.value);
|
||||
const l = this.fields.length -1;
|
||||
const l = this.fields.length - 1;
|
||||
if (index >= 0 && index < l) {
|
||||
this.$emit("input",this.fields[index + 1]);
|
||||
this.$emit("change",this.fields[index + 1]);
|
||||
this.$emit("input", this.fields[index + 1]);
|
||||
this.$emit("change", this.fields[index + 1]);
|
||||
}
|
||||
}
|
||||
},
|
||||
selectedchanged(value) {
|
||||
this.$emit("change",value);
|
||||
this.$emit("change", value);
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div :class="'s-prevnext-selector '">
|
||||
<b-button :variant='variant' @click="prev" :disabled="atFirst()"
|
||||
<template v-if="showarrows"
|
||||
><b-button :variant='variant' @click="prev" :disabled="atFirst()"
|
||||
><i v-if='arrows' class='fa fa-caret-left s-prevnext-arrow'></i
|
||||
><template v-else>{{text.prev}}</template></b-button>
|
||||
<b-form-select v-model="bubblevalue"
|
||||
><template v-else>{{text.prev}}</template></b-button
|
||||
> </template
|
||||
><b-form-select v-model="bubblevalue"
|
||||
@change='selectedchanged'
|
||||
>
|
||||
<b-form-select-option
|
||||
><b-form-select-option
|
||||
:disabled="!defaultselectable"
|
||||
:value="null"
|
||||
:class="(defaultselectable)?'font-italic text-primary ':'font-italic'"
|
||||
><slot name="defaultlabel">{{text.select}}</slot></b-form-select-option>
|
||||
</b-form-select-option-group>
|
||||
<template v-if="grouped">
|
||||
<template v-for="(g,gi) in this.options">
|
||||
<b-form-select-option-group
|
||||
><slot name="defaultlabel">{{text.select}}</slot></b-form-select-option
|
||||
><template v-if="grouped"
|
||||
><template v-for="(g,gi) in this.options"
|
||||
><b-form-select-option-group
|
||||
v-if="g[optionsfield] && g[optionsfield].length > 0"
|
||||
:label="g[labelfield]"
|
||||
>
|
||||
<b-form-select-option
|
||||
><b-form-select-option
|
||||
v-for="(o,i) in g[optionsfield]"
|
||||
:key="i"
|
||||
:value="o"
|
||||
><slot :value="o">{{o[titlefield]}}</slot></b-form-select-option>
|
||||
</b-form-select-option-group>
|
||||
</template>
|
||||
</template>
|
||||
<template v-else>
|
||||
</b-form-select-option-group
|
||||
></template
|
||||
></template
|
||||
><template v-else>
|
||||
<b-form-select-option
|
||||
v-for="(o,i) in this.options"
|
||||
:key="i"
|
||||
:value="o"
|
||||
><slot :value="o">{{o[titlefield]}}</slot></b-form-select-option>
|
||||
</template>
|
||||
</b-form-select>
|
||||
<b-button :variant='variant' @click="next" :disabled="atLast()"
|
||||
><slot :value="o">{{o[titlefield]}}</slot></b-form-select-option
|
||||
></template
|
||||
></b-form-select
|
||||
><template v-if="showarrows"
|
||||
> <b-button :variant='variant' @click="next" :disabled="atLast()"
|
||||
><i v-if='arrows' class='fa fa-caret-right s-prevnext-arrow'></i
|
||||
><template v-else>{{text.next}}</template></b-button>
|
||||
</div>
|
||||
><template v-else>{{text.next}}</template></b-button
|
||||
></template
|
||||
></div>
|
||||
`,
|
||||
});
|
||||
|
||||
|
|
50
amd/src/util/browserbuttonevents.js
Normal file
50
amd/src/util/browserbuttonevents.js
Normal file
|
@ -0,0 +1,50 @@
|
|||
/* eslint no-var: "error" */
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/* eslint linebreak-style: "off" */
|
||||
/* eslint no-trailing-spaces: "off" */
|
||||
/* eslint capitalized-comments: "off" */
|
||||
/* eslint-env es6 */
|
||||
|
||||
import Debugger from './debugger';
|
||||
const debug = new Debugger("browserbuttonevents");
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {function} backwardCB
|
||||
* @param {function} forwardCB
|
||||
* @param {function} reloadCB
|
||||
*/
|
||||
export function addBrowserButtonEvent(backwardCB, forwardCB = null, reloadCB = null) {
|
||||
debug.log("Registering navigation events", backwardCB, forwardCB, reloadCB);
|
||||
const reorient = (e) => { // After travelling in the history stack
|
||||
const positionLastShown = Number( // If none, then zero
|
||||
sessionStorage.getItem('positionLastShown'));
|
||||
// debug.log("Popstate event",e,positionLastShown,history);
|
||||
let position = history.state; // Absolute position in stack
|
||||
if (position === null) { // Meaning a new entry on the stack
|
||||
position = positionLastShown + 1; // Top of stack
|
||||
|
||||
// (1) Stamp the entry with its own position in the stack
|
||||
history.replaceState(position, /* no title */'');
|
||||
}
|
||||
|
||||
// (2) Keep track of the last position shown
|
||||
sessionStorage.setItem('positionLastShown', String(position));
|
||||
|
||||
// (3) Discover the direction of travel by comparing the two
|
||||
const direction = Math.sign(position - positionLastShown);
|
||||
debug.log('Travel direction is ' + direction);
|
||||
// One of backward (-1), reload (0) and forward (1)
|
||||
if (direction == -1 && backwardCB) {
|
||||
backwardCB();
|
||||
}
|
||||
if (direction == 1 && forwardCB) {
|
||||
forwardCB();
|
||||
}
|
||||
if (direction == 0 && reloadCB) {
|
||||
reloadCB();
|
||||
}
|
||||
};
|
||||
// addEventListener( 'pageshow', reorient );
|
||||
addEventListener('popstate', reorient); // Travel in same page
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
/*eslint no-trailing-spaces: "off"*/
|
||||
/*eslint no-eval: "off"*/
|
||||
/* eslint camelcase: "off" */
|
||||
/* eslint capitalized-comments: "off" */
|
||||
/* eslint no-eval: "off" */
|
||||
|
||||
/***********************************
|
||||
/* **********************************
|
||||
* Licence: MIT
|
||||
* (c) 2023 Morglod/jchnkl
|
||||
* converted from the typescript @ https://github.com/Morglod/csscalc/
|
||||
|
@ -18,7 +19,7 @@ export const Absolute = {
|
|||
/** One quarter of a millimeter. 1Q = 1/40th of 1cm */
|
||||
Q: 96 / 101.6,
|
||||
/** One inch. 1in = 2.54cm = 96px */
|
||||
in: 96,
|
||||
'in': 96,
|
||||
/** One pica. 1pc = 12pt = 1/6th of 1in */
|
||||
pc: 96 / 6,
|
||||
/** One point. 1pt = 1/72nd of 1in */
|
||||
|
@ -31,7 +32,8 @@ export const Absolute = {
|
|||
* Equal to 1% of the height of the viewport
|
||||
* @param {number} count
|
||||
* @param {object} ctx
|
||||
*/
|
||||
* @returns {number}
|
||||
*/
|
||||
vh: (count = 1, ctx) => {
|
||||
return ((ctx ? ctx.viewportHeight : window.innerHeight) / 100) * count;
|
||||
},
|
||||
|
@ -39,7 +41,8 @@ export const Absolute = {
|
|||
* Equal to 1% of the width of the viewport
|
||||
* @param {number} count
|
||||
* @param {object} ctx
|
||||
*/
|
||||
* @returns {number}
|
||||
*/
|
||||
vw: (count = 1, ctx) => {
|
||||
return ((ctx ? ctx.viewportWidth : window.innerWidth) / 100) * count;
|
||||
},
|
||||
|
@ -47,7 +50,8 @@ export const Absolute = {
|
|||
* 1/100th of the smallest viewport side
|
||||
* @param {number} count
|
||||
* @param {object} ctx
|
||||
*/
|
||||
* @returns {number}
|
||||
*/
|
||||
vmin: (count = 1, ctx) => {
|
||||
return (
|
||||
((ctx
|
||||
|
@ -61,7 +65,8 @@ export const Absolute = {
|
|||
* 1/100th of the largest viewport side
|
||||
* @param {number} count
|
||||
* @param {object} ctx
|
||||
*/
|
||||
* @returns {number}
|
||||
*/
|
||||
vmax: (count = 1, ctx) => {
|
||||
return (
|
||||
((ctx
|
||||
|
@ -75,7 +80,8 @@ export const Absolute = {
|
|||
* Represents the font-size of <html> element
|
||||
* @param {number} count
|
||||
* @param {object} ctx
|
||||
*/
|
||||
* @returns {number}
|
||||
*/
|
||||
rem: (count = 1, ctx) => {
|
||||
return (
|
||||
(ctx
|
||||
|
@ -89,7 +95,8 @@ export const Absolute = {
|
|||
* percent of width
|
||||
* @param {number} count
|
||||
* @param {object} ctx
|
||||
*/
|
||||
* @returns {number}
|
||||
*/
|
||||
"%w": (count = 1, ctx) => {
|
||||
return ((ctx ? ctx.width : document.body.clientWidth) / 100) * count;
|
||||
},
|
||||
|
@ -97,7 +104,8 @@ export const Absolute = {
|
|||
* percent of height
|
||||
* @param {number} count
|
||||
* @param {object} ctx
|
||||
*/
|
||||
* @returns {number}
|
||||
*/
|
||||
"%h": (count = 1, ctx) => {
|
||||
return ((ctx ? ctx.height : document.body.clientHeight) / 100) * count;
|
||||
}
|
||||
|
@ -120,7 +128,7 @@ export const Absolute = {
|
|||
* @param {*} fromUnits
|
||||
* @param {*} toUnits
|
||||
* @param {*} ctx
|
||||
* @returns
|
||||
* @returns {number}
|
||||
*/
|
||||
export function convert(count, fromUnits, toUnits, ctx = calcCtx()) {
|
||||
const baseUnit = Units[fromUnits];
|
||||
|
@ -138,7 +146,7 @@ export const Absolute = {
|
|||
* @param {*} expr
|
||||
* @param {*} toUnits
|
||||
* @param {*} ctx
|
||||
* @returns
|
||||
* @returns {String}
|
||||
*/
|
||||
export function convertAllInStr(expr, toUnits, ctx = calcCtx()) {
|
||||
return expr.replace(UnitRegexpGM, (substr, count, unit) => {
|
||||
|
@ -149,7 +157,7 @@ export const Absolute = {
|
|||
/**
|
||||
*
|
||||
* @param {*} el
|
||||
* @returns
|
||||
* @returns {object}
|
||||
*/
|
||||
export function calcCtx(el) {
|
||||
if (el) {
|
||||
|
@ -182,13 +190,16 @@ export const Absolute = {
|
|||
* @param {*} expression
|
||||
* @param {*} el_ctx
|
||||
* @param {*} ctx
|
||||
* @returns
|
||||
* @returns {String}
|
||||
*/
|
||||
export function calc(expression, el_ctx, ctx) {
|
||||
if (el_ctx === undefined) {ctx = calcCtx(); }
|
||||
else {
|
||||
if (el_ctx === undefined) {
|
||||
ctx = calcCtx();
|
||||
} else {
|
||||
if (el_ctx instanceof HTMLElement) {
|
||||
if (!ctx) {ctx = calcCtx(el_ctx); }
|
||||
if (!ctx) {
|
||||
ctx = calcCtx(el_ctx);
|
||||
}
|
||||
} else {
|
||||
ctx = el_ctx;
|
||||
}
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
/* eslint capitalized-comments: "off" */
|
||||
/**
|
||||
* Format a date according to localized custom
|
||||
* @param {Date|string} d The date to convert
|
||||
* @param {boolean} short Short format (default false)
|
||||
* @returns {string}
|
||||
*/
|
||||
export function format_date(d,short){
|
||||
if(!(d instanceof Date)){
|
||||
export function formatDate(d, short) {
|
||||
if (!(d instanceof Date)) {
|
||||
if (typeof d == 'number') {
|
||||
d *= 1000; // Convert from seconds to milliseconds.
|
||||
}
|
||||
d = new Date(d);
|
||||
}
|
||||
|
||||
let monthformat = "short";
|
||||
if(short === true){
|
||||
if (short === true) {
|
||||
monthformat = "numeric";
|
||||
} else if (short === false) {
|
||||
monthformat = "long";
|
||||
}
|
||||
return d.toLocaleDateString(document.documentElement.lang,{
|
||||
return d.toLocaleDateString(document.documentElement.lang, {
|
||||
year: 'numeric', month: monthformat, day: 'numeric'
|
||||
});
|
||||
}
|
||||
|
@ -26,20 +30,23 @@ export function format_date(d,short){
|
|||
* @param {boolean} short Short format (default false)
|
||||
* @returns {string}
|
||||
*/
|
||||
export function format_datetime(d,short){
|
||||
if(!(d instanceof Date)){
|
||||
export function formatDatetime(d, short) {
|
||||
if (!(d instanceof Date)) {
|
||||
if (typeof d == 'number') {
|
||||
d *= 1000; // Convert from seconds to milliseconds.
|
||||
}
|
||||
d = new Date(d);
|
||||
}
|
||||
|
||||
let monthformat = "short";
|
||||
if(short === true){
|
||||
if (short === true) {
|
||||
monthformat = "numeric";
|
||||
} else if (short === false) {
|
||||
monthformat = "long";
|
||||
}
|
||||
return d.toLocaleDateString(document.documentElement.lang,{
|
||||
return d.toLocaleDateString(document.documentElement.lang, {
|
||||
year: 'numeric', month: monthformat, day: 'numeric'
|
||||
})+" "+d.toLocaleTimeString(document.documentElement.lang,{
|
||||
}) + " " + d.toLocaleTimeString(document.documentElement.lang, {
|
||||
timeStyle: "short",
|
||||
});
|
||||
}
|
||||
|
@ -51,9 +58,13 @@ export function format_datetime(d,short){
|
|||
* @param {Date|string} last Last day of the span
|
||||
* @returns {Object} Object containing formatted start and end dates and span information
|
||||
*/
|
||||
export function datespaninfo(first,last){
|
||||
if(!(first instanceof Date)){ first = new Date(first);}
|
||||
if(!(last instanceof Date)){ last = new Date(last);}
|
||||
export function datespaninfo(first, last) {
|
||||
if (!(first instanceof Date)) {
|
||||
first = new Date(first);
|
||||
}
|
||||
if (!(last instanceof Date)) {
|
||||
last = new Date(last);
|
||||
}
|
||||
|
||||
// Make sure the end date is at the very end of the day and the start date at the very beginning
|
||||
first.setHours(0);
|
||||
|
@ -65,11 +76,11 @@ export function datespaninfo(first,last){
|
|||
last.setSeconds(59);
|
||||
last.setMilliseconds(999);
|
||||
|
||||
const dayspan = Math.round(((last - first)+1)/(24*60*60*1000)); // Add one millisecond to offset the 999 ms
|
||||
const years = Math.floor(dayspan/365); // Yes, we ignore leap years/leap days
|
||||
const dayspan = Math.round(((last - first) + 1) / (24 * 60 * 60 * 1000)); // Add one millisecond to offset the 999 ms
|
||||
const years = Math.floor(dayspan / 365); // Yes, we ignore leap years/leap days
|
||||
const ydaysleft = dayspan % 365;
|
||||
|
||||
const weeks = Math.floor(ydaysleft/7);
|
||||
const weeks = Math.floor(ydaysleft / 7);
|
||||
const wdaysleft = ydaysleft % 7;
|
||||
|
||||
return {
|
||||
|
@ -80,8 +91,8 @@ export function datespaninfo(first,last){
|
|||
weeks: weeks,
|
||||
days: wdaysleft,
|
||||
formatted: {
|
||||
first: format_date(first),
|
||||
last: format_date(last),
|
||||
first: formatDate(first),
|
||||
last: formatDate(last),
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -90,7 +101,7 @@ export function datespaninfo(first,last){
|
|||
/**
|
||||
* Format a Date object to YYYY-MM-DD format
|
||||
* @param {Date} date Date object
|
||||
* @returns Date string in YYYY-MM-DD format
|
||||
* @returns {String} Date string in YYYY-MM-DD format
|
||||
*/
|
||||
function dateYYYYMMDD(date) {
|
||||
const d = new Date(date);
|
||||
|
@ -111,27 +122,28 @@ function dateYYYYMMDD(date) {
|
|||
* String formatting function - replaces {name} in string by value of same key in values parameter
|
||||
* @param {string} datestr String containing date format in YYYY-MM-DD
|
||||
* @param {int} days Object containing keys to replace {key} strings with. Make negative to subtract
|
||||
* @returns Date string in YYYY-MM-DD format
|
||||
* @returns {String} Date string in YYYY-MM-DD format
|
||||
*/
|
||||
export function add_days(datestr,days) {
|
||||
export function addDays(datestr, days) {
|
||||
const date = new Date(datestr);
|
||||
const newdate = new Date(date.getTime() + (days * 86400000) ); // Add n days in ms.
|
||||
const newdate = new Date(date.getTime() + (days * 86400000)); // Add n days in ms.
|
||||
return dateYYYYMMDD(newdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine start and end dates of a studyplan
|
||||
* @param {*} plan
|
||||
* @returns
|
||||
* @returns {object}
|
||||
*/
|
||||
export function studyplanDates(plan) {
|
||||
let earliestStart = null;
|
||||
let latestEnd = null;
|
||||
let openEnded = false;
|
||||
for(const ix in plan.pages) {
|
||||
|
||||
for (const ix in plan.pages) {
|
||||
const page = plan.pages[ix];
|
||||
const s = new Date(page.startdate);
|
||||
if (! page.enddate) {
|
||||
if (!page.enddate) {
|
||||
openEnded = true; // One of the pages has no end date set...
|
||||
}
|
||||
|
||||
|
@ -139,7 +151,7 @@ export function studyplanDates(plan) {
|
|||
earliestStart = s;
|
||||
}
|
||||
|
||||
if ( page.enddate ) {
|
||||
if (page.enddate) {
|
||||
const e = new Date(page.enddate);
|
||||
if (!latestEnd || e > latestEnd) {
|
||||
latestEnd = e;
|
||||
|
@ -148,7 +160,7 @@ export function studyplanDates(plan) {
|
|||
}
|
||||
return {
|
||||
start: earliestStart,
|
||||
end: (openEnded)?null:latestEnd,
|
||||
end: (openEnded) ? null : latestEnd,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -159,10 +171,16 @@ export function studyplanDates(plan) {
|
|||
*/
|
||||
export function studyplanTiming(plan) {
|
||||
const now = new Date().getTime();
|
||||
|
||||
// If timeless or no timing info is available, all plans are present
|
||||
if (!plan.pages && plan.pages.length == 0 || (plan.pages[0] && plan.pages[0].timeless)) {
|
||||
return 'present';
|
||||
}
|
||||
|
||||
const dates = studyplanDates(plan);
|
||||
|
||||
if(dates.start < now){
|
||||
if( dates.end && now > dates.end) {
|
||||
if (dates.start < now) {
|
||||
if (dates.end && now > dates.end) {
|
||||
return 'past';
|
||||
} else {
|
||||
return 'present';
|
||||
|
@ -179,11 +197,15 @@ export function studyplanTiming(plan) {
|
|||
*/
|
||||
export function studyplanPageTiming(page) {
|
||||
const now = new Date().getTime();
|
||||
const start = new Date(page.startdate);
|
||||
const end = (page.enddate)?(new Date(page.enddate)):null;
|
||||
|
||||
if(start < now){
|
||||
if( end && now > end) {
|
||||
if (page.timeless) {
|
||||
return "present";
|
||||
}
|
||||
const start = new Date(page.startdate);
|
||||
const end = (page.enddate) ? (new Date(page.enddate)) : null;
|
||||
|
||||
if (start < now) {
|
||||
if (end && now > end) {
|
||||
return 'past';
|
||||
} else {
|
||||
return 'present';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*eslint no-var: "error"*/
|
||||
/*eslint no-console: "off"*/
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-var: "error"*/
|
||||
/* eslint no-console: "off"*/
|
||||
/* eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
// You can call it anything you like
|
||||
|
||||
|
@ -14,15 +14,20 @@
|
|||
function debounce(func, wait, immediate) {
|
||||
let timeout;
|
||||
return function() {
|
||||
let context = this, args = arguments;
|
||||
let context = this;
|
||||
let args = arguments;
|
||||
let later = function() {
|
||||
timeout = null;
|
||||
if (!immediate){ func.apply(context, args); }
|
||||
if (!immediate) {
|
||||
func.apply(context, args);
|
||||
}
|
||||
};
|
||||
let callNow = immediate && !timeout;
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(later, wait);
|
||||
if (callNow){ func.apply(context, args); }
|
||||
if (callNow) {
|
||||
func.apply(context, args);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
/*eslint no-var: "error"*/
|
||||
/*eslint no-console: "off"*/
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-var: "error"*/
|
||||
/* eslint no-console: "off"*/
|
||||
/* eslint-env es6*/
|
||||
|
||||
import Config from "core/config";
|
||||
|
||||
/**
|
||||
* Start a new debugger
|
||||
* @param {*} handle The string to attach to all messages from this debugger
|
||||
* @returns Debugger object
|
||||
* @returns {object} Debugger object
|
||||
*/
|
||||
export default function (handle) {
|
||||
let output_enabled = Config.developerdebug;
|
||||
if(output_enabled){
|
||||
export default function(handle) {
|
||||
let outputEnabled = Config.developerdebug;
|
||||
if (outputEnabled) {
|
||||
console.warn(`In development environment. Debugger output enabled for ${handle}`);
|
||||
} else {
|
||||
console.warn(`In production environment. Debugger output disabled for ${handle}`);
|
||||
|
@ -19,67 +19,73 @@ export default function (handle) {
|
|||
|
||||
return {
|
||||
write() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.info.apply(console, args);
|
||||
}
|
||||
},
|
||||
log() {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.log.apply(console, args);
|
||||
}
|
||||
},
|
||||
info() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.info.apply(console, args);
|
||||
}
|
||||
},
|
||||
warn() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.warn.apply(console, args);
|
||||
}
|
||||
},
|
||||
error() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.error.apply(console, args);
|
||||
}
|
||||
},
|
||||
time() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.time.apply(console, args);
|
||||
}
|
||||
},
|
||||
timeEnd() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.timeEnd.apply(console, args);
|
||||
}
|
||||
},
|
||||
timeLog() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.timeLog.apply(console, args);
|
||||
}
|
||||
},
|
||||
timeStamp() {
|
||||
if (output_enabled) {
|
||||
if (outputEnabled) {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(handle + ": ");
|
||||
console.timeStamp.apply(console, args);
|
||||
}
|
||||
},
|
||||
enable: function debugger_enable() {
|
||||
output_enabled = true;
|
||||
enable() {
|
||||
outputEnabled = true;
|
||||
},
|
||||
|
||||
disable: function debugger_disable() {
|
||||
output_enabled = false;
|
||||
disable() {
|
||||
outputEnabled = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1,23 +1,22 @@
|
|||
/*eslint no-unused-vars: warn */
|
||||
/*eslint max-len: ["error", { "code": 160 }] */
|
||||
/*eslint-disable no-trailing-spaces */
|
||||
/*eslint-env es6*/
|
||||
/* eslint no-unused-vars: warn */
|
||||
/* eslint max-len: ["error", { "code": 160 }] */
|
||||
/* eslint capitalized-comments: "off" */
|
||||
/* eslint-env es6*/
|
||||
|
||||
import {calc} from "./css-calc";
|
||||
import fitty from "./fitty";
|
||||
import {textFit} from "./textfit";
|
||||
|
||||
export default {
|
||||
install(Vue/*,options*/){
|
||||
Vue.component('fittext',{
|
||||
install(Vue/* ,options */) {
|
||||
Vue.component('fittext', {
|
||||
props: {
|
||||
maxsize: {
|
||||
type: String,
|
||||
default: "512px",
|
||||
'default': "512px",
|
||||
},
|
||||
minsize: {
|
||||
type: String,
|
||||
default: "10px",
|
||||
'default': "10px",
|
||||
},
|
||||
vertical: Boolean,
|
||||
singleline: Boolean,
|
||||
|
@ -54,16 +53,16 @@ export default {
|
|||
});
|
||||
},
|
||||
unmounted() {
|
||||
if(this.mutationObserver) {
|
||||
if (this.mutationObserver) {
|
||||
this.mutationObserver.disconnect();
|
||||
}
|
||||
if(this.resizeObserver) {
|
||||
if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect();
|
||||
}
|
||||
},
|
||||
template: `
|
||||
<div class='q-fittext' ref='container' :style="rootStyle">
|
||||
<span :style="'display:block; white-space:'+ ((singleline)?'nowrap':'normal')+';'" class='q-fittext-text' ref='text'><slot></slot>
|
||||
<div class='q-fittext' ref='container' :style="rootStyle + ';min-height:0;min-width:0;'">
|
||||
<span :style="'display:block; white-space:'+ ((singleline)?'nowrap':'normal')+';' + rootStyle" class='q-fittext-text' ref='text'><slot></slot>
|
||||
</span
|
||||
></div>
|
||||
`,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/*eslint no-console: "off"*/
|
||||
/* eslint-disable */
|
||||
/*
|
||||
Copyright (c) 2017-2021 Rik Schennink - All rights reserved.
|
||||
|
||||
|
|
|
@ -1,31 +1,32 @@
|
|||
/**
|
||||
* convert a text field into an integer only text field
|
||||
* Convert a text field into an integer only text field
|
||||
* @param {string} id The Id of the form field
|
||||
* @param {bool} unsigned Allow only unsigned values
|
||||
* @param {bool} nonzero Do not allow zero values
|
||||
*/
|
||||
export function text_integer(id,unsigned=false,nonzero=false){
|
||||
export function textInteger(id, unsigned = false, nonzero = false) {
|
||||
const element = document.getElementById(id);
|
||||
|
||||
if (element) {
|
||||
element.addEventListener("input",() => {
|
||||
element.addEventListener("input", () => {
|
||||
var val = element.value;
|
||||
if (val != '') {
|
||||
if ((isNaN(val) && !(!unsigned && val == '-')) || (unsigned && val < 0) || (nonzero && val == 0)) {
|
||||
// Set input value empty
|
||||
if (unsigned) {
|
||||
element.value = val.replace(/[^0-9]/g,'');
|
||||
element.value = val.replace(/[^0-9]/g, '');
|
||||
if (nonzero && val == 0) {
|
||||
element.value = '';
|
||||
}
|
||||
} else {
|
||||
element.value = val.replace(/[^0-9-]/g,'').replace(/(.{1})(-)/g,'$1');
|
||||
element.value = val.replace(/[^0-9-]/g, '').replace(/(.{1})(-)/g, '$1');
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
});
|
||||
}
|
||||
}
|
|
@ -1,25 +1,41 @@
|
|||
/*eslint no-var: "error"*/
|
||||
/*eslint no-console: "off"*/
|
||||
/*eslint no-bitwise: "off"*/
|
||||
/*eslint-disable no-trailing-spaces*/
|
||||
/*eslint-env es6*/
|
||||
// Put this file in path/to/plugin/amd/src
|
||||
/* eslint no-var: "error" */
|
||||
/* eslint no-console: "off" */
|
||||
/* eslint no-bitwise: "off" */
|
||||
/* eslint-disable no-trailing-spaces */
|
||||
/* eslint camelcase: "off" */
|
||||
/* eslint capitalized-comments: "off" */
|
||||
/* eslint-env es6 */
|
||||
|
||||
import {call} from 'core/ajax';
|
||||
import {processCollectedJavascript} from 'core/fragment';
|
||||
import {replaceNodeContents} from 'core/templates';
|
||||
import notification from 'core/notification';
|
||||
import {load_strings} from './string-helper';
|
||||
import {loadStrings} from './string-helper';
|
||||
import Debugger from './debugger';
|
||||
//import {markFormSubmitted} from 'core_form/changechecker'; // Moodle 4.00+ only
|
||||
//import {notifyFormSubmittedByJavascript} from 'core_form/events'; // Moodle 4.00+ only
|
||||
// import {markFormSubmitted} from 'core_form/changechecker'; // Moodle 4.00+ only
|
||||
// import {notifyFormSubmittedByJavascript} from 'core_form/events'; // Moodle 4.00+ only
|
||||
|
||||
/* Moodle 3.11 safe import for when needed
|
||||
let markFormSubmitted = () => {};
|
||||
let notifyFormSubmittedByJavascript = () => {};
|
||||
|
||||
import('core_form/changechecker').then((ns) => {
|
||||
debug.info(ns);
|
||||
if(ns.markFormSubmitted) {
|
||||
markFormSubmitted = ns.markFormSubmitted;
|
||||
}
|
||||
if(ns.notifyFormSubmittedByJavascript) {
|
||||
notifyFormSubmittedByJavascript = ns.notifyFormSubmittedByJavascript;
|
||||
}
|
||||
}).catch(()=>{});
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create a random UUID in both secure and insecure contexts
|
||||
* @returns UUID
|
||||
* @returns {String} UUID
|
||||
*/
|
||||
function create_uuid() {
|
||||
if (crypto.randomUUID !== undefined ) {
|
||||
if (crypto.randomUUID !== undefined) {
|
||||
return crypto.randomUUID();
|
||||
} else {
|
||||
return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
|
||||
|
@ -29,9 +45,9 @@ function create_uuid() {
|
|||
}
|
||||
|
||||
export default {
|
||||
install(Vue/*,options*/){
|
||||
install(Vue /* ,options */) {
|
||||
let debug = new Debugger("treestudyplan-mform-helper");
|
||||
let strings = load_strings({
|
||||
let strings = loadStrings({
|
||||
editmod: {
|
||||
save$core: "save$core",
|
||||
cancel$core: "cancel$core",
|
||||
|
@ -48,15 +64,15 @@ export default {
|
|||
},
|
||||
title: {
|
||||
type: String,
|
||||
default: "",
|
||||
'default': "",
|
||||
},
|
||||
variant: {
|
||||
type: String,
|
||||
default: "primary",
|
||||
'default': "primary",
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: "link",
|
||||
'default': "link",
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -75,28 +91,29 @@ export default {
|
|||
methods: {
|
||||
openForm() {
|
||||
const self = this;
|
||||
self.$refs["editormodal"].show();
|
||||
self.$refs.editormodal.show();
|
||||
},
|
||||
onShown() {
|
||||
const self = this;
|
||||
debug.info(`Loading form "${self.name}" with params`,self.params);
|
||||
debug.info(`Loading form "${self.name}" with params`, self.params);
|
||||
self.loading = false;
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_get_mform',
|
||||
args: {formname: self.name, params: JSON.stringify(self.params)}
|
||||
}])[0].then((data)=>{
|
||||
}])[0].then((data) => {
|
||||
const html = data.html;
|
||||
self.loading = false;
|
||||
// Process the collected javascript;
|
||||
const js = processCollectedJavascript(data.javascript);
|
||||
replaceNodeContents(self.$refs["content"], html, js);
|
||||
replaceNodeContents(self.$refs.content, html, js);
|
||||
self.initListenChanges();
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
|
||||
},
|
||||
onSave() {
|
||||
const self = this;
|
||||
let form = this.$refs["content"].getElementsByTagName("form")[0];
|
||||
let form = this.$refs.content.getElementsByTagName("form")[0];
|
||||
|
||||
// markFormSubmitted(form); // Moodle 4.00+ only
|
||||
// We call this, so other modules can update the form with the latest state.
|
||||
|
@ -107,13 +124,14 @@ export default {
|
|||
const formdata = new FormData(form);
|
||||
const data = new URLSearchParams(formdata).toString();
|
||||
|
||||
if(this.checkSave()){
|
||||
if (this.checkSave()) {
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_submit_mform',
|
||||
args: {formname: self.name, params: JSON.stringify(self.params), formdata: data}
|
||||
}])[0].then((response)=>{
|
||||
}])[0].then((response) => {
|
||||
const updatedplan = JSON.parse(response.data);
|
||||
self.$emit("saved",updatedplan,formdata);
|
||||
self.$emit("saved", updatedplan, formdata);
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
}
|
||||
/* No error if we cannot save, since it would just be to handle the edge case
|
||||
|
@ -128,24 +146,24 @@ export default {
|
|||
if (el.classList.contains("is-invalid")) {
|
||||
canSave = false;
|
||||
}
|
||||
},this);
|
||||
}, this);
|
||||
this.submitok = canSave;
|
||||
return canSave;
|
||||
},
|
||||
initListenChanges() {
|
||||
const content = this.$refs["content"];
|
||||
const content = this.$refs.content;
|
||||
this.inputs = content.querySelectorAll("input.form-control");
|
||||
|
||||
// Check if save needs to be blocked immediately. (delay call by a few ms)
|
||||
setTimeout(this.checkSave, 100);
|
||||
|
||||
// Disconnect any existing observer.
|
||||
if(this.observer) {
|
||||
if (this.observer) {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
// Initialize new observer and callback.
|
||||
this.observer = new MutationObserver((mutationList) => {
|
||||
for(const mix in mutationList){
|
||||
for (const mix in mutationList) {
|
||||
const mutation = mutationList[mix];
|
||||
if (mutation.type === 'attributes' && mutation.attributeName === 'class') {
|
||||
this.checkSave();
|
||||
|
@ -155,15 +173,15 @@ export default {
|
|||
|
||||
// Connect the observer to the form inputs.
|
||||
this.inputs.forEach(el => {
|
||||
this.observer.observe(el,{ attributes: true });
|
||||
},this);
|
||||
this.observer.observe(el, {attributes: true});
|
||||
}, this);
|
||||
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
unmount() {
|
||||
if(this.observer) {
|
||||
if (this.observer) {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*eslint no-var: "error" */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/*eslint linebreak-style: "off" */
|
||||
/*eslint no-trailing-spaces: "off" */
|
||||
/*eslint-env es6*/
|
||||
|
||||
import {call} from 'core/ajax';
|
||||
|
||||
// Prepare default value.
|
||||
let premiumstatus = {
|
||||
enabled: false,
|
||||
website: "",
|
||||
name: "",
|
||||
expires: "",
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if premium status is enabled.
|
||||
* @returns {Object} The map with strings loaded in
|
||||
*/
|
||||
export function enabled (){
|
||||
return !!premiumstatus.enabled;
|
||||
}
|
195
amd/src/util/psidebar-vue.js
Normal file
195
amd/src/util/psidebar-vue.js
Normal file
|
@ -0,0 +1,195 @@
|
|||
/* eslint no-unused-vars: warn */
|
||||
/* eslint max-len: ["error", { "code": 160 }] */
|
||||
/* eslint-disable no-trailing-spaces */
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-env es6*/
|
||||
import PortalVue from '../portal-vue/portal-vue.esm';
|
||||
import Debugger from './debugger';
|
||||
let debug = new Debugger("p-sidebar");
|
||||
|
||||
|
||||
let wrapper;
|
||||
let contentwrapper;
|
||||
let resizeObserver;
|
||||
/**
|
||||
* Create a new wrapper Around the
|
||||
* @param {String} target Query string to select root element next to which the sidebar will be placed.
|
||||
* Defaults to body
|
||||
* @param {String} offsetref Query string to select element that should appear above the sidebar.
|
||||
* Defaults to none
|
||||
*/
|
||||
function createPortalTarget(target, offsetref) {
|
||||
let initializeWrapperContent = false;
|
||||
debug.info("Creating portal target");
|
||||
// First check if the sidebar wrapper already exists.
|
||||
// Creating the wrappers over and over again is a recipe for disaster.
|
||||
wrapper = document.querySelector("#p-sidebar-wrapper");
|
||||
if (!wrapper) {
|
||||
initializeWrapperContent = true;
|
||||
// Otherwise, create it.
|
||||
wrapper = document.createElement("div");
|
||||
wrapper.setAttribute("id", "p-sidebar-wrapper");
|
||||
}
|
||||
// First check if the contentwrapper already exists
|
||||
contentwrapper = document.querySelector("#p-sidebar-contentwrapper");
|
||||
if (!contentwrapper) {
|
||||
initializeWrapperContent = true;
|
||||
// Otherwise, create it.
|
||||
contentwrapper = document.createElement("div");
|
||||
contentwrapper.setAttribute("id", "p-sidebar-contentwrapper");
|
||||
wrapper.appendChild(contentwrapper);
|
||||
}
|
||||
|
||||
if (initializeWrapperContent) {
|
||||
// Find containing target (otherwise use body)
|
||||
let targetEl = document.querySelector(target);
|
||||
if (!targetEl || targetEl.nodeType == "HTML") {
|
||||
targetEl = document.querySelector("body");
|
||||
}
|
||||
console.info(`Targeting '${target}' to `, targetEl);
|
||||
|
||||
// Move all target content parts to content wrapper....
|
||||
while (targetEl.childNodes.length > 0) {
|
||||
contentwrapper.appendChild(targetEl.childNodes[0]);
|
||||
}
|
||||
// Add sidebar wrapper to target Element
|
||||
targetEl.appendChild(wrapper);
|
||||
}
|
||||
// The actual target is created in a reposition call
|
||||
rePosition(false);
|
||||
// The
|
||||
setOffset(offsetref);
|
||||
}
|
||||
|
||||
/**
|
||||
* Position a (new) sidebar element on the left or right
|
||||
* @param {Boolean} right Set to true to put the sidebar on the right
|
||||
*/
|
||||
function rePosition(right) {
|
||||
// Place the portal target on the right place in the DOM.
|
||||
// Find or create the portal target.
|
||||
let el = document.querySelector(`#p-sidebar-mount`);
|
||||
if (!el) {
|
||||
el = document.createElement("div");
|
||||
el.setAttribute("id", `p-sidebar-mount`);
|
||||
|
||||
// Initialize a resizeObser
|
||||
resizeObserver = new ResizeObserver(() => {
|
||||
let wx = 0 - el.getBoundingClientRect().width;
|
||||
wx += (wx != 0) ? "px" : "";
|
||||
el.style.setProperty("--p-sidebar-hideoffset", wx);
|
||||
});
|
||||
resizeObserver.observe(el);
|
||||
|
||||
}
|
||||
if (right) {
|
||||
wrapper.insertBefore(el, contentwrapper.nextSibling);
|
||||
} else {
|
||||
wrapper.insertBefore(el, contentwrapper);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the proper offset from the top on the sidebar related to the reference element
|
||||
* @param {String} reference Reference target for setting view height
|
||||
*/
|
||||
function setOffset(reference) {
|
||||
const ref = reference ? document.querySelector(reference) : null;
|
||||
if (ref) {
|
||||
let offsetTop = (ref ? ref.offsetTop : 0);
|
||||
offsetTop += (offsetTop != 0) ? "px" : "";
|
||||
const el = document.querySelector(`#p-sidebar-mount`);
|
||||
if (el) {
|
||||
el.style.height = `calc( 100vh - ${offsetTop})`;
|
||||
el.style.marginTop = offsetTop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
install(Vue /* ,options */) {
|
||||
Vue.use(PortalVue);
|
||||
/* Create the portal target on initialization.
|
||||
Defaults to body. Offset and final position set through sidebar parameter.
|
||||
*/
|
||||
if (document.readyState === 'ready' || document.readyState === 'complete') {
|
||||
debug.info("Page already loaded");
|
||||
createPortalTarget();
|
||||
} else {
|
||||
window.addEventListener("load", () => {
|
||||
debug.info("Page not yet loaded");
|
||||
createPortalTarget();
|
||||
});
|
||||
}
|
||||
|
||||
Vue.component('p-easeinout', {
|
||||
template: `
|
||||
<transition name="p-easeinout"
|
||||
><slot></slot>
|
||||
</transition>`
|
||||
});
|
||||
|
||||
Vue.component('p-sidebar', {
|
||||
props: {
|
||||
value: {
|
||||
type: Boolean,
|
||||
'default': true,
|
||||
},
|
||||
right: {
|
||||
type: Boolean,
|
||||
'default': false,
|
||||
},
|
||||
shadow: {
|
||||
type: Boolean,
|
||||
'default': false,
|
||||
},
|
||||
target: {
|
||||
type: String,
|
||||
'default': 'body',
|
||||
},
|
||||
offsetRef: {
|
||||
type: String,
|
||||
'default': '',
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
wrapper: null,
|
||||
contentwrapper: null,
|
||||
resizeobserver: null,
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
},
|
||||
methods: {
|
||||
},
|
||||
watch: {
|
||||
right(newVal) {
|
||||
rePosition(newVal);
|
||||
},
|
||||
offsetRef(reference) {
|
||||
setOffset(reference, this.$refs.portal);
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
debug.info("OffsetRef", this.offsetRef);
|
||||
setOffset(this.offsetRef);
|
||||
debug.info("Right", this.right);
|
||||
rePosition(this.right);
|
||||
},
|
||||
template: `
|
||||
<div
|
||||
><mounting-portal ref='portal'
|
||||
mount-to="#p-sidebar-mount"
|
||||
class="(right?'p-sidebar-right ':'')"
|
||||
append
|
||||
transition="p-easeinout"
|
||||
><div ref='container' v-if="value"
|
||||
:class="'p-sidebar ' + (right?'p-sidebar-right ':'') + (shadow?'p-sidebar-shadow ':'')"
|
||||
><slot></slot></div
|
||||
></mounting-portal>
|
||||
</div>
|
||||
`,
|
||||
});
|
||||
},
|
||||
};
|
43
amd/src/util/settings.js
Normal file
43
amd/src/util/settings.js
Normal file
|
@ -0,0 +1,43 @@
|
|||
/* eslint no-var: "error" */
|
||||
/* eslint-env es6*/
|
||||
|
||||
import {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
|
||||
// Prepare default value.
|
||||
let settingcache = null;
|
||||
|
||||
/**
|
||||
* Retrieve settings.
|
||||
* @param {String} key
|
||||
* @returns {*}
|
||||
*/
|
||||
export function settings(key) {
|
||||
const settings = loadsettings();
|
||||
if (key in settings) {
|
||||
return settings[key];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get settings from server or cache
|
||||
* @returns {Object} The settings object
|
||||
*/
|
||||
function loadsettings() {
|
||||
if (!settingcache) {
|
||||
// Retrieve setting cache if needed.
|
||||
call([{
|
||||
methodname: 'local_treestudyplan_getsettings',
|
||||
args: {}
|
||||
}])[0].then((response) => {
|
||||
settingcache = response;
|
||||
return;
|
||||
}).catch(notification.exception);
|
||||
}
|
||||
return settingcache;
|
||||
}
|
||||
|
||||
// Preload settings.
|
||||
loadsettings();
|
|
@ -1,30 +1,40 @@
|
|||
/* eslint camelcase: "off" */
|
||||
import {get_strings} from 'core/str';
|
||||
import {getStrings} from 'core/str';
|
||||
import Debugger from './debugger';
|
||||
let debug = new Debugger("string-helper");
|
||||
|
||||
/* Determine the proper getstrings function to use (MDL4.3+ recommends use of getStrings, which is jquery independent) */
|
||||
const getstr_func = (getStrings !== undefined)?getStrings:get_strings;
|
||||
const getstrFunc = (getStrings !== undefined) ? getStrings : get_strings;
|
||||
|
||||
/**
|
||||
* Load the translation of strings from a strings object
|
||||
* @param {Object} strings The map of strings
|
||||
* @param {String} plugin Name of plugin to load for by default (leave empty for 'local_treestudyplan')
|
||||
* @returns {Object} The map with strings loaded in
|
||||
*/
|
||||
export function load_strings(strings){
|
||||
for(let idx in strings){
|
||||
export function loadStrings(strings, plugin) {
|
||||
if (plugin === undefined) {
|
||||
plugin = 'local_treestudyplan';
|
||||
}
|
||||
for (let idx in strings) {
|
||||
let stringkeys = [];
|
||||
for(const handle in strings[idx]){
|
||||
for (const handle in strings[idx]) {
|
||||
const key = strings[idx][handle];
|
||||
let parts = key.split(/[$@]/);
|
||||
let identifier = parts[0];
|
||||
let component = (parts.length > 1)?parts[1]:'local_treestudyplan';
|
||||
stringkeys.push({ key: identifier, component: component});
|
||||
let component = (parts.length > 1) ? parts[1] : plugin;
|
||||
stringkeys.push({key: identifier, component: component});
|
||||
}
|
||||
getstr_func(stringkeys).then(function(str){
|
||||
getstrFunc(stringkeys).then(function(str) {
|
||||
let i = 0;
|
||||
for(const handle in strings[idx]){
|
||||
for (const handle in strings[idx]) {
|
||||
strings[idx][handle] = str[i];
|
||||
i++;
|
||||
}
|
||||
return;
|
||||
}).catch((x) => {
|
||||
debug.warn(x);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -35,25 +45,32 @@ export function load_strings(strings){
|
|||
* Load the translation of strings from a strings object based on keys
|
||||
* Used for loading values for a drop down menu or the like
|
||||
* @param {Object} string_keys The map of stringkeys
|
||||
* @param {String} plugin Name of plugin to load for by default (leave empty for 'local_treestudyplan')
|
||||
* @returns {Object} The map with strings loaded in
|
||||
*/
|
||||
export function load_stringkeys(string_keys){
|
||||
for(let idx in string_keys){
|
||||
export function loadStringKeys(string_keys, plugin) {
|
||||
if (plugin === undefined) {
|
||||
plugin = 'local_treestudyplan';
|
||||
}
|
||||
for (let idx in string_keys) {
|
||||
// Get text strings for condition settings
|
||||
let stringkeys = [];
|
||||
for(const i in string_keys[idx]){
|
||||
for (const i in string_keys[idx]) {
|
||||
const key = string_keys[idx][i].textkey;
|
||||
let parts = key.split("$");
|
||||
let identifier = parts[0];
|
||||
let component = (parts.length > 1)?parts[1]:'local_treestudyplan';
|
||||
stringkeys.push({ key: identifier, component: component});
|
||||
let component = (parts.length > 1) ? parts[1] : plugin;
|
||||
stringkeys.push({key: identifier, component: component});
|
||||
}
|
||||
getstr_func(stringkeys).then(function(strings){
|
||||
for(const i in strings) {
|
||||
getstrFunc(stringkeys).then(function(strings) {
|
||||
for (const i in strings) {
|
||||
const s = strings[i];
|
||||
const l = string_keys[idx][i];
|
||||
l.text = s;
|
||||
}
|
||||
return;
|
||||
}).catch((x) => {
|
||||
debug.warn(x);
|
||||
});
|
||||
}
|
||||
return string_keys;
|
||||
|
@ -63,9 +80,9 @@ export function load_stringkeys(string_keys){
|
|||
* String formatting function - replaces {name} in string by value of same key in values parameter
|
||||
* @param {string} str String t
|
||||
* @param {object} values Object containing keys to replace {key} strings with
|
||||
* @returns Formatted string
|
||||
* @returns {string} Formatted string
|
||||
*/
|
||||
export function strformat(str,values) {
|
||||
export function strformat(str, values) {
|
||||
return str.replace(/\{(\w+)\}/g, (m, m1) => {
|
||||
if (m1 && values.hasOwnProperty(m1)) {
|
||||
return values[m1];
|
||||
|
|
|
@ -22,27 +22,31 @@ const cos = Math.cos;
|
|||
const sin = Math.sin;
|
||||
const π = Math.PI;
|
||||
|
||||
const f_matrix_times = (( [[a,b], [c,d]], [x,y]) => [ a * x + b * y, c * x + d * y]);
|
||||
const f_rotate_matrix = (x => [[cos(x),-sin(x)], [sin(x), cos(x)]]);
|
||||
const f_vec_add = (([a1, a2], [b1, b2]) => [a1 + b1, a2 + b2]);
|
||||
const fMatrixTimes = (([[a, b], [c, d]], [x, y]) => [a * x + b * y, c * x + d * y]);
|
||||
const fRotateMatrix = (x => [[cos(x), -sin(x)], [sin(x), cos(x)]]);
|
||||
const fVecAdd = (([a1, a2], [b1, b2]) => [a1 + b1, a2 + b2]);
|
||||
|
||||
// function modified by pmkuipers for text params
|
||||
// Function modified by pmkuipers for text params
|
||||
/**
|
||||
* Create svg path text for an arc
|
||||
* @param {*} center [cx,cy] center of ellipse
|
||||
* @param {*} radius [rx,ry] major minor radius
|
||||
* @param {*} angle [t1, Δ] start angle, in radian, angle to sweep, in radian. positive.
|
||||
* @param {*} φ rotation on the whole, in radian
|
||||
* @returns a SVG path element that represent a ellipse. Text describing the arc path in an svg path element
|
||||
* @returns {string} a SVG path description that represent a ellipse. Text describing the arc path in an svg path element
|
||||
*/
|
||||
const svgarcpath = (([cx,cy],[rx,ry], [t1, Δ], φ ) => {
|
||||
Δ = Δ % (2*π);
|
||||
const rotMatrix = f_rotate_matrix (φ);
|
||||
const [sX, sY] = ( f_vec_add ( f_matrix_times ( rotMatrix, [rx * cos(t1), ry * sin(t1)] ), [cx,cy] ) );
|
||||
const [eX, eY] = ( f_vec_add ( f_matrix_times ( rotMatrix, [rx * cos(t1+Δ), ry * sin(t1+Δ)] ), [cx,cy] ) );
|
||||
const fA = ( ( Δ > π ) ? 1 : 0 );
|
||||
const fS = ( ( Δ > 0 ) ? 1 : 0 );
|
||||
return "M " + sX + " " + sY + " A " + [ rx , ry , φ / (2*π) *360, fA, fS, eX, eY ].join(" ");
|
||||
const svgarcpath = (([cx, cy], [rx, ry], [t1, Δ], φ) => {
|
||||
Δ = Δ % (2 * π);
|
||||
const rotMatrix = fRotateMatrix(φ);
|
||||
const [sX, sY] = (fVecAdd(fMatrixTimes(rotMatrix, [rx * cos(t1), ry * sin(t1)]), [cx, cy]));
|
||||
const [eX, eY] = (fVecAdd(fMatrixTimes(rotMatrix, [rx * cos(t1 + Δ), ry * sin(t1 + Δ)]), [cx, cy]));
|
||||
const fA = ((Δ > π) ? 1 : 0);
|
||||
const fS = ((Δ > 0) ? 1 : 0);
|
||||
if (isNaN(eY) || isNaN(eX)) {
|
||||
return "";
|
||||
} else {
|
||||
return "M " + sX + " " + sY + " A " + [rx, ry, φ / (2 * π) * 360, fA, fS, eX, eY].join(" ");
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -51,13 +55,13 @@ const svgarcpath = (([cx,cy],[rx,ry], [t1, Δ], φ ) => {
|
|||
* @param {*} radius [rx,ry] major minor radius
|
||||
* @param {*} angle [t1, Δ] start angle, in radian, angle to sweep, in radian. positive.
|
||||
* @param {*} φ rotation on the whole, in radian
|
||||
* @returns a SVG path element that represent a ellipse.
|
||||
* @returns {string} a SVG path element that represent a ellipse.
|
||||
*/
|
||||
const svgarc = (([cx,cy],[rx,ry], [t1, Δ], φ ) => {
|
||||
const path_2wk2r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
const d = svgarcpath([cx,cy],[rx,ry], [t1, Δ], φ );
|
||||
path_2wk2r.setAttribute("d", d);
|
||||
return path_2wk2r;
|
||||
const svgarc = (([cx, cy], [rx, ry], [t1, Δ], φ) => {
|
||||
const path2wk2r = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
||||
const d = svgarcpath([cx, cy], [rx, ry], [t1, Δ], φ);
|
||||
path2wk2r.setAttribute("d", d);
|
||||
return path2wk2r;
|
||||
});
|
||||
|
||||
export {svgarc, svgarcpath};
|
|
@ -1,251 +0,0 @@
|
|||
/**
|
||||
* textFit v2.3.1
|
||||
* Previously known as jQuery.textFit
|
||||
* 11/2014 by STRML (strml.github.com)
|
||||
* MIT License
|
||||
*
|
||||
* To use: textFit(document.getElementById('target-div'), options);
|
||||
*
|
||||
* Will make the *text* content inside a container scale to fit the container
|
||||
* The container is required to have a set width and height
|
||||
* Uses binary search to fit text with minimal layout calls.
|
||||
* Version 2.0 does not use jQuery.
|
||||
*/
|
||||
var defaultSettings = {
|
||||
alignVert: false, // if true, textFit will align vertically using css tables
|
||||
alignHoriz: false, // if true, textFit will set text-align: center
|
||||
multiLine: false, // if true, textFit will not set white-space: no-wrap
|
||||
detectMultiLine: true, // disable to turn off automatic multi-line sensing
|
||||
minFontSize: 6,
|
||||
maxFontSize: 80,
|
||||
reProcess: true, // if true, textFit will re-process already-fit nodes. Set to 'false' for better performance
|
||||
widthOnly: false, // if true, textFit will fit text to element width, regardless of text height
|
||||
alignVertWithFlexbox: false, // if true, textFit will use flexbox for vertical alignment
|
||||
};
|
||||
|
||||
/**
|
||||
* Create new textFit element(S)
|
||||
* @param {*} els element or element list
|
||||
* @param {*} options Options (See default settings in textfit.js)
|
||||
*/
|
||||
export function textFit(els, options) {
|
||||
|
||||
if (!options) { options = {}; }
|
||||
|
||||
// Extend options.
|
||||
var settings = {};
|
||||
for(var key in defaultSettings){
|
||||
if(options.hasOwnProperty(key)){
|
||||
settings[key] = options[key];
|
||||
} else {
|
||||
settings[key] = defaultSettings[key];
|
||||
}
|
||||
}
|
||||
|
||||
// Convert jQuery objects into arrays
|
||||
if (typeof els.toArray === "function") {
|
||||
els = els.toArray();
|
||||
}
|
||||
|
||||
// Support passing a single el
|
||||
var elType = Object.prototype.toString.call(els);
|
||||
if (elType !== '[object Array]' && elType !== '[object NodeList]' &&
|
||||
elType !== '[object HTMLCollection]'){
|
||||
els = [els];
|
||||
}
|
||||
|
||||
// Process each el we've passed.
|
||||
for(var i = 0; i < els.length; i++){
|
||||
processItem(els[i], settings);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The meat. Given an el, make the text inside it fit its parent.
|
||||
* @param {DOMElement} el Child el.
|
||||
* @param {Object} settings Options for fit.
|
||||
*/
|
||||
function processItem(el, settings){
|
||||
if (!isElement(el) || (!settings.reProcess && el.getAttribute('textFitted'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set textFitted attribute so we know this was processed.
|
||||
if(!settings.reProcess){
|
||||
el.setAttribute('textFitted', 1);
|
||||
}
|
||||
|
||||
var innerSpan, originalHeight, originalHTML, originalWidth;
|
||||
var low, mid, high;
|
||||
|
||||
// Get element data.
|
||||
originalHTML = el.innerHTML;
|
||||
originalWidth = innerWidth(el);
|
||||
originalHeight = innerHeight(el);
|
||||
|
||||
// Don't process if we can't find box dimensions
|
||||
if (!originalWidth || (!settings.widthOnly && !originalHeight)) {
|
||||
if(!settings.widthOnly) {
|
||||
throw new Error('Set a static height and width on the target element ' + el.outerHTML +
|
||||
' before using textFit!');
|
||||
} else {
|
||||
throw new Error('Set a static width on the target element ' + el.outerHTML +
|
||||
' before using textFit!');
|
||||
}
|
||||
}
|
||||
|
||||
// Add textFitted span inside this container.
|
||||
if (originalHTML.indexOf('textFitted') === -1) {
|
||||
innerSpan = document.createElement('span');
|
||||
innerSpan.className = 'textFitted';
|
||||
// Inline block ensure it takes on the size of its contents, even if they are enclosed
|
||||
// in other tags like <p>
|
||||
innerSpan.style['display'] = 'inline-block';
|
||||
innerSpan.innerHTML = originalHTML;
|
||||
el.innerHTML = '';
|
||||
el.appendChild(innerSpan);
|
||||
} else {
|
||||
// Reprocessing.
|
||||
innerSpan = el.querySelector('span.textFitted');
|
||||
// Remove vertical align if we're reprocessing.
|
||||
if (hasClass(innerSpan, 'textFitAlignVert')){
|
||||
innerSpan.className = innerSpan.className.replace('textFitAlignVert', '');
|
||||
innerSpan.style['height'] = '';
|
||||
el.className.replace('textFitAlignVertFlex', '');
|
||||
}
|
||||
}
|
||||
|
||||
// Prepare & set alignment
|
||||
if (settings.alignHoriz) {
|
||||
el.style['text-align'] = 'center';
|
||||
innerSpan.style['text-align'] = 'center';
|
||||
}
|
||||
|
||||
// Check if this string is multiple lines
|
||||
// Not guaranteed to always work if you use wonky line-heights
|
||||
var multiLine = settings.multiLine;
|
||||
if (settings.detectMultiLine && !multiLine &&
|
||||
innerSpan.getBoundingClientRect().height >= parseInt(window.getComputedStyle(innerSpan)['font-size'], 10) * 2){
|
||||
multiLine = true;
|
||||
}
|
||||
|
||||
// If we're not treating this as a multiline string, don't let it wrap.
|
||||
if (!multiLine) {
|
||||
el.style['white-space'] = 'nowrap';
|
||||
}
|
||||
|
||||
low = settings.minFontSize;
|
||||
high = settings.maxFontSize;
|
||||
|
||||
// Binary search for highest best fit
|
||||
var size = low;
|
||||
while (low <= high) {
|
||||
mid = (high + low) / 2;
|
||||
innerSpan.style.fontSize = mid + 'px';
|
||||
var innerSpanBoundingClientRect = innerSpan.getBoundingClientRect();
|
||||
if (
|
||||
innerSpanBoundingClientRect.width <= originalWidth
|
||||
&& (settings.widthOnly || innerSpanBoundingClientRect.height <= originalHeight)
|
||||
) {
|
||||
size = mid;
|
||||
low = mid + 1;
|
||||
} else {
|
||||
high = mid - 1;
|
||||
}
|
||||
// await injection point
|
||||
}
|
||||
// found, updating font if differs:
|
||||
if( innerSpan.style.fontSize != size + 'px' ) { innerSpan.style.fontSize = size + 'px'; }
|
||||
|
||||
// Our height is finalized. If we are aligning vertically, set that up.
|
||||
if (settings.alignVert) {
|
||||
addStyleSheet();
|
||||
var height = innerSpan.scrollHeight;
|
||||
if (window.getComputedStyle(el)['position'] === "static"){
|
||||
el.style['position'] = 'relative';
|
||||
}
|
||||
if (!hasClass(innerSpan, "textFitAlignVert")){
|
||||
innerSpan.className = innerSpan.className + " textFitAlignVert";
|
||||
}
|
||||
innerSpan.style['height'] = height + "px";
|
||||
if (settings.alignVertWithFlexbox && !hasClass(el, "textFitAlignVertFlex")) {
|
||||
el.className = el.className + " textFitAlignVertFlex";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate height without padding.
|
||||
* @param {*} el
|
||||
* @returns
|
||||
*/
|
||||
function innerHeight(el){
|
||||
var style = window.getComputedStyle(el, null);
|
||||
return el.getBoundingClientRect().height -
|
||||
parseInt(style.getPropertyValue('padding-top'), 10) -
|
||||
parseInt(style.getPropertyValue('padding-bottom'), 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate width without padding.
|
||||
* @param {*} el
|
||||
* @returns
|
||||
*/
|
||||
function innerWidth(el){
|
||||
var style = window.getComputedStyle(el, null);
|
||||
return el.getBoundingClientRect().width -
|
||||
parseInt(style.getPropertyValue('padding-left'), 10) -
|
||||
parseInt(style.getPropertyValue('padding-right'), 10);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if it is a DOM element
|
||||
* @param {*} o
|
||||
* @returns
|
||||
*/
|
||||
function isElement(o){
|
||||
return (
|
||||
typeof HTMLElement === "object" ? o instanceof HTMLElement : //DOM2
|
||||
o && typeof o === "object" && o !== null && o.nodeType === 1 && typeof o.nodeName==="string"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if element has a specific class
|
||||
* @param {*} element
|
||||
* @param {*} cls
|
||||
* @returns
|
||||
*/
|
||||
function hasClass(element, cls) {
|
||||
return (' ' + element.className + ' ').indexOf(' ' + cls + ' ') > -1;
|
||||
}
|
||||
|
||||
// Better than a stylesheet dependency
|
||||
/**
|
||||
* Add stylesheet to the page for this
|
||||
* @returns
|
||||
*/
|
||||
function addStyleSheet() {
|
||||
if (document.getElementById("textFitStyleSheet")) { return; }
|
||||
var style = [
|
||||
".textFitAlignVert{",
|
||||
"position: absolute;",
|
||||
"top: 0; right: 0; bottom: 0; left: 0;",
|
||||
"margin: auto;",
|
||||
"display: flex;",
|
||||
"justify-content: center;",
|
||||
"flex-direction: column;",
|
||||
"}",
|
||||
".textFitAlignVertFlex{",
|
||||
"display: flex;",
|
||||
"}",
|
||||
".textFitAlignVertFlex .textFitAlignVert{",
|
||||
"position: static;",
|
||||
"}",].join("");
|
||||
|
||||
var css = document.createElement("style");
|
||||
css.type = "text/css";
|
||||
css.id = "textFitStyleSheet";
|
||||
css.innerHTML = style;
|
||||
document.body.appendChild(css);
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable */
|
||||
/*eslint no-unused-vars: "off" */
|
||||
/* eslint no-unused-vars: "off" */
|
||||
/*! *****************************************************************************
|
||||
Copyright (C) Microsoft. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user