ESLint Code cleanup

This commit is contained in:
PMKuipers 2024-06-03 23:24:16 +02:00
parent e999fdb125
commit 5c1f21cee0
133 changed files with 1170 additions and 13281 deletions

View File

@ -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
@ -22,7 +23,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Grunt configuration.
*
@ -34,7 +34,7 @@ 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/styles.sccs into styles.css and css/devstyles.css', () => {
@ -54,19 +54,19 @@ module.exports = function(grunt) {
// 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)

View File

@ -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

View File

@ -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

View File

@ -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"}

View File

@ -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"}

View File

@ -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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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

View File

@ -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-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":"qWAuBIA,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"}

View File

@ -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

View File

@ -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"}

View File

@ -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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -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 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)}}}));
//# sourceMappingURL=primary-nav-tools.min.js.map

View File

@ -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 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":"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,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"}

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

View File

@ -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

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

View File

@ -1 +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-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":"qNAesCA,gBAAYC,iEAAY,KAAMC,gEAAW,KAC3EC,MAAMC,IAAI,gCAAgCJ,WAAWC,UAAUC,UA+B/DG,iBAAkB,YA9BAC,UACRC,kBAAoBC,OACxBC,eAAeC,QAAS,0BAEtBC,SAAWC,QAAQC,MACN,OAAbF,WACAA,SAAWJ,kBAAoB,EAG/BK,QAAQE,aAAcH,SAAsB,KAIhDF,eAAeM,QAAS,oBAAqBC,OAAOL,iBAG9CM,UAAYC,KAAKC,KAAMR,SAAWJ,mBACxCJ,MAAMC,IAAK,uBAAyBa,YAElB,GAAdA,WAAmBjB,YACnBA,aAEa,GAAbiB,WAAkBhB,WAClBA,YAEa,GAAbgB,WAAkBf,UAClBA,qBApCNC,MAAQ,yEAAa"}
{"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

View File

@ -1,3 +1,3 @@
define("local_treestudyplan/util/date-helper",["exports"],(function(_exports){function format_date(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.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||("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"}}));
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

View File

@ -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"}

View File

@ -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)}},log(){if(output_enabled){let args=Array.prototype.slice.call(arguments);args.unshift(handle+": "),console.log.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

View File

@ -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 log() {\n if (output_enabled) {\n let args = Array.prototype.slice.call(arguments);\n args.unshift(handle + \": \");\n console.log.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","log","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,QAGpCS,SACQf,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQY,IAAID,MAAMX,QAASG,QAGnCO,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,QAGpCU,WACQhB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQa,MAAMF,MAAMX,QAASG,QAGrCW,UACQjB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQc,KAAKH,MAAMX,QAASG,QAGpCY,aACQlB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQe,QAAQJ,MAAMX,QAASG,QAGvCa,aACQnB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQgB,QAAQL,MAAMX,QAASG,QAGvCc,eACQpB,eAAgB,KACZM,KAAOC,MAAMC,UAAUC,MAAMC,KAAKC,WACtCL,KAAKM,QAAQb,OAAS,MACtBI,QAAQiB,UAAUN,MAAMX,QAASG,QAGzCe,OAAQ,WACJrB,gBAAiB,GAGrBsB,QAAS,WACLtB,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"}

View File

@ -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 + ';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}));
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

View File

@ -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 + ';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","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-disable no-trailing-spaces */\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":"gRASe,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

View File

@ -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

View File

@ -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"}

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,3 @@
define("local_treestudyplan/util/premium",["exports","core/ajax","core/notification"],(function(_exports,_ajax,_notification){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.premiumenabled=function(){const premium=premiumstatus();return!premium||!!premium.enabled},_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};let premiumstatus_cache=null;function premiumstatus(){return premiumstatus_cache||(0,_ajax.call)([{methodname:"local_treestudyplan_premiumstatus",args:{}}])[0].then((function(response){premiumstatus_cache=response})).catch(_notification.default.exception),premiumstatus_cache}premiumstatus()}));
define("local_treestudyplan/util/premium",["exports","core/ajax","core/notification"],(function(_exports,_ajax,_notification){var obj;Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.premiumenabled=function(){const premium=premiumstatus();return!premium||!!premium.enabled},_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};let premiumstatusCache=null;function premiumstatus(){return premiumstatusCache||(0,_ajax.call)([{methodname:"local_treestudyplan_premiumstatus",args:{}}])[0].then((response=>{premiumstatusCache=response})).catch(_notification.default.exception),premiumstatusCache}premiumstatus()}));
//# sourceMappingURL=premium.min.js.map

View File

@ -1 +1 @@
{"version":3,"file":"premium.min.js","sources":["../../src/util/premium.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 premiumstatus_cache = null;\n\n/**\n * Check if premium status is enabled.\n * @returns {Bool} True/False\n */\nexport function premiumenabled (){\n const premium = premiumstatus();\n if (premium) {\n return (premium.enabled)?true:false;\n } else {\n return true; // Temporarily return true, that is easier than going full async.\n }\n}\n\n/**\n * Get premium status object\n * @returns {Object} The premium status object\n */\nfunction premiumstatus() {\n if (!premiumstatus_cache) {\n // Retrieve premium status if needed.\n call([{\n methodname: 'local_treestudyplan_premiumstatus',\n args: {}\n }])[0].then(function(response){\n premiumstatus_cache = response;\n }).catch(notification.exception);\n }\n return premiumstatus_cache;\n}\n\n// Preload premium status.\npremiumstatus();"],"names":["premium","premiumstatus","enabled","premiumstatus_cache","methodname","args","then","response","catch","notification","exception"],"mappings":"uOAcUA,QAAUC,uBACZD,WACQA,QAAQE,iFATpBC,oBAAsB,cAmBjBF,uBACAE,oCAEI,CAAC,CACFC,WAAY,oCACZC,KAAM,MACN,GAAGC,MAAK,SAASC,UACjBJ,oBAAsBI,YACvBC,MAAMC,sBAAaC,WAEnBP,oBAIXF"}
{"version":3,"file":"premium.min.js","sources":["../../src/util/premium.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 premiumstatusCache = null;\n\n/**\n * Check if premium status is enabled.\n * @returns {Bool} True/False\n */\nexport function premiumenabled() {\n const premium = premiumstatus();\n if (premium) {\n return (premium.enabled) ? true : false;\n } else {\n return true; // Temporarily return true, that is easier than going full async.\n }\n}\n\n/**\n * Get premium status object\n * @returns {Object} The premium status object\n */\nfunction premiumstatus() {\n if (!premiumstatusCache) {\n // Retrieve premium status if needed.\n call([{\n methodname: 'local_treestudyplan_premiumstatus',\n args: {}\n }])[0].then((response) => {\n premiumstatusCache = response;\n return;\n }).catch(notification.exception);\n }\n return premiumstatusCache;\n}\n\n// Preload premium status.\npremiumstatus();"],"names":["premium","premiumstatus","enabled","premiumstatusCache","methodname","args","then","response","catch","notification","exception"],"mappings":"uOAcUA,QAAUC,uBACZD,WACQA,QAAQE,iFATpBC,mBAAqB,cAmBhBF,uBACAE,mCAEI,CAAC,CACFC,WAAY,oCACZC,KAAM,MACN,GAAGC,MAAMC,WACTJ,mBAAqBI,YAEtBC,MAAMC,sBAAaC,WAEnBP,mBAIXF"}

File diff suppressed because one or more lines are too long

View File

@ -1,3 +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((function(response){settingcache=response})).catch(_notification.default.exception),settingcache}loadsettings()}));
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

View File

@ -1 +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 * Check if premium status is enabled.\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(function(response){\n settingcache = response;\n }).catch(notification.exception);\n }\n return settingcache;\n}\n\n// Preload premium status.\nloadsettings();"],"names":["key","settings","loadsettings","settingcache","methodname","args","then","response","catch","notification","exception"],"mappings":"0NAc2BA,WACjBC,SAAWC,sBACZF,OAAOC,SACDA,SAASD,KAET,8EAZXG,aAAe,cAoBVD,sBACAC,6BAEI,CAAC,CACFC,WAAY,kCACZC,KAAM,MACN,GAAGC,MAAK,SAASC,UACjBJ,aAAeI,YAChBC,MAAMC,sBAAaC,WAEnBP,aAIXD"}
{"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 * Check if premium status is enabled.\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 premium status.\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"}

View File

@ -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,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})}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,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})}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

View File

@ -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 * @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 load_strings(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 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 * @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 load_stringkeys(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 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","plugin","undefined","idx","stringkeys","i","parts","textkey","split","identifier","component","length","push","key","getstr_func","then","strings","s","text","handle","str","values","replace","m","m1","hasOwnProperty","getStrings","get_strings"],"mappings":"0LA4CgCA,YAAYC,aACzBC,IAAXD,SACAA,OAAS,2BAET,IAAIE,OAAOH,YAAY,KAEnBI,WAAa,OACb,MAAMC,KAAML,YAAYG,KAAK,KAEzBG,MADQN,YAAYG,KAAKE,GAAGE,QAChBC,MAAM,KAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAGL,MAAM,GAAGL,OAC5CG,WAAWQ,KAAK,CAAEC,IAAKJ,WAAYC,UAAWA,YAElDI,YAAYV,YAAYW,MAAK,SAASC,aAC9B,MAAMX,KAAKW,QAAS,OACdC,EAAID,QAAQX,GACRL,YAAYG,KAAKE,GACzBa,KAAOD,aAIdjB,4CAtDkBgB,QAAQf,aAClBC,IAAXD,SACAA,OAAS,2BAET,IAAIE,OAAOa,QAAQ,KACfZ,WAAa,OACb,MAAMe,UAAWH,QAAQb,KAAK,KAE1BG,MADQU,QAAQb,KAAKgB,QACTX,MAAM,QAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAGL,MAAM,GAAGL,OAC5CG,WAAWQ,KAAK,CAAEC,IAAKJ,WAAYC,UAAWA,YAElDI,YAAYV,YAAYW,MAAK,SAASK,SAC9Bf,EAAI,MACJ,MAAMc,UAAUH,QAAQb,KACxBa,QAAQb,KAAKgB,QAAUC,IAAIf,GAC3BA,cAKLW,qCAyCeI,IAAIC,eACnBD,IAAIE,QAAQ,cAAc,CAACC,EAAGC,KAC7BA,IAAMH,OAAOI,eAAeD,IACrBH,OAAOG,IAEPD,WA5EbT,iBAA8BZ,IAAfwB,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"}

View File

@ -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]),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 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

View File

@ -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 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 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","fA","fS","isNaN","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,KAC7FU,GAAUN,EAAIrB,EAAM,EAAI,EACxB4B,GAAUP,EAAI,EAAM,EAAI,SACzBQ,MAAMH,KAAOG,MAAMJ,IACb,GAEA,KAAOF,GAAK,IAAMC,GAAK,MAAQ,CAAEN,GAAKC,GAAKJ,GAAK,EAAEf,GAAI,IAAK2B,GAAIC,GAAIH,GAAIC,IAAKI,KAAK,qDAYhF,oBAA2Bf,SAAzBC,GAAGC,WAAKC,GAAGC,WAAMC,GAAIC,gBAC7BU,WAAaC,SAASC,gBAAgB,6BAA8B,QACpE3B,EAAIQ,WAAW,CAACE,GAAGC,IAAI,CAACC,GAAGC,IAAK,CAACC,GAAIC,GAAIN,UAC/CgB,WAAWG,aAAa,IAAK5B,GACtByB,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"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,3 +1,4 @@
/* eslint-disable */
/*!
* BootstrapVue 2.23.1
*

View File

@ -1,27 +1,7 @@
/*eslint no-var: "error" */
/*eslint no-unused-vars: "off" */
/*eslint linebreak-style: "off" */
/*eslint no-trailing-spaces: "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 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
*/

View File

@ -1,5 +1,3 @@
/*eslint no-console: "off"*/
/**
* Save a piece of text to file as if it was downloaded
* @param {string} filename
@ -7,7 +5,9 @@
* @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('download', filename);
@ -16,8 +16,7 @@ export function download(filename, text, type) {
var event = document.createEvent('MouseEvents');
event.initEvent('click', true, true);
pom.dispatchEvent(event);
}
else {
} else {
pom.click();
}
}
@ -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();
}
}

View File

@ -1,11 +1,9 @@
/* eslint no-var: "error" */
/*eslint no-console: "off"*/
/*eslint-disable no-trailing-spaces */
/* eslint capitalized-comments: "off" */
/* eslint-env es6 */
// Put this file in path/to/plugin/amd/src
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';
@ -30,7 +28,7 @@ import('core_form/changechecker').then((ns) => {
export default {
install(Vue/* ,options */) {
let strings = load_strings({
let strings = loadStrings({
editmod: {
save$core: "save$core",
cancel$core: "cancel$core",
@ -47,11 +45,11 @@ export default {
},
title: {
type: String,
default: "",
'default': "",
},
genericonly: {
type: Boolean,
default: false,
'default': false,
}
},
data() {
@ -65,20 +63,20 @@ export default {
methods: {
openForm() {
const self = this;
self.$refs["editormodal"].show();
self.$refs.editormodal.show();
},
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);
replaceNodeContents(self.$refs.content, html, js);
return null;
}).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.
@ -97,8 +95,8 @@ export default {
args: {cmid: this.cmid, formdata: data}
}])[0].then(() => {
self.$emit("saved", formdata);
return null;
}).catch(notification.exception);
}
},
template: `

View File

@ -2,6 +2,7 @@
/* eslint no-unused-vars: "off" */
/* eslint linebreak-style: "off" */
/* eslint no-trailing-spaces: "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
@ -12,8 +13,8 @@ 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';
@ -37,10 +38,8 @@ Vue.use(BootstrapVue);
let debug = new Debugger("treestudyplancoach");
let strings = load_strings({
let strings = loadStrings({
coach: {
studyplan_select_placeholder: 'studyplan_select_placeholder',
switch_coach_editmode: 'switch_coach_editmode',
},
});
@ -81,15 +80,14 @@ export function init() {
const t = timingval[timinga] - timingval[timingb];
if (t == 0) {
// sort by name if timing is equal
// 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
// Load studyplan from hash if applicable
const hash = window.location.hash.replace('#', '');
const parts = hash.split("-");
@ -101,6 +99,7 @@ export function init() {
}
}
}
return;
}).catch(notification.exception);
addBrowserButtonEvent(this.navChanged, this.navChanged);
},
@ -157,7 +156,7 @@ export function init() {
selectStudyplan(studyplan, studentid, updatehash = true) {
app.selected.planid = Number(studyplan.id);
app.selected.studentid = studentid ? Number(studentid) : 0;
// fetch studyplan
// Fetch studyplan
const self = this;
self.loadingstudyplan = true;
self.associatedstudents = [];
@ -166,12 +165,12 @@ export function init() {
call([{
methodname: 'local_treestudyplan_get_studyplan_map',
args: {id: studyplan.id}
}])[0].then(function(response){
self.activestudyplan = ProcessStudyplan(response,true);
}])[0].then((response) => {
self.activestudyplan = processStudyplan(response, true);
call([{
methodname: 'local_treestudyplan_all_associated_grouped',
args: { studyplan_id: studyplan.id}
args: {'studyplan_id': studyplan.id}
}])[0].then(function(response) {
self.associatedstudents = response;
let foundstudent = false;
@ -196,7 +195,8 @@ export function init() {
}
}
}
if (!foundstudent) { // update hash with just the studyplan if no student was available for display
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;
@ -204,8 +204,9 @@ export function init() {
self.displayedstudyplan = self.activestudyplan;
self.loadingstudyplan = false;
}
return;
}).catch(notification.exception);
return;
}).catch(function(error) {
notification.exception(error);
app.loadingstudyplan = false;
@ -220,13 +221,14 @@ export function init() {
call([{
methodname: 'local_treestudyplan_get_user_studyplan',
args: {userid: student.id, studyplanid: app.activestudyplan.id}
}])[0].then(function(response){
app.studentstudyplan = ProcessStudyplan(response,false);
}])[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;

View File

@ -25,8 +25,8 @@ 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 {loadStrings} from './util/string-helper';
import {processStudyplan} from './studyplan-processor';
import {download,upload} from './downloader';
import {studyplanTiming} from './util/date-helper';
import { premiumenabled, premiumstatus } from "./util/premium";
@ -51,7 +51,7 @@ import('core_form/changechecker').then((ns) => {
let strings = load_strings({
let strings = loadStrings({
studyplan: {
studyplan_select_placeholder: 'studyplan_select_placeholder',
advanced_import_from_file: 'advanced_import_from_file',
@ -261,7 +261,7 @@ export function init(contextid,categoryid,options) {
methodname: 'local_treestudyplan_get_studyplan_map',
args: { id: studyplanid}
}])[0].then(function(response){
app.activestudyplan = ProcessStudyplan(response);
app.activestudyplan = processStudyplan(response);
debug.info('studyplan processed');
app.loadingstudyplan = false;
window.location.hash = app.activestudyplan.id;

View File

@ -2,6 +2,7 @@
/* eslint no-unused-vars: "off" */
/* eslint linebreak-style: "off" */
/* eslint-env es6*/
/* eslint camelcase: "off" */
// Put this file in path/to/plugin/amd/src
// You can call it anything you like
@ -12,16 +13,15 @@ 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([
getstrFunc([
{key: 'ok', component: 'core'},
{key: 'confirm', component: 'core'},
]).then((s) => {
@ -48,18 +48,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);
});
}

View File

@ -1,8 +1,4 @@
/*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*/
// Put this file in path/to/plugin/amd/src
// You can call it anything you like
@ -12,15 +8,11 @@ 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

View File

@ -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,10 +66,7 @@ export function init(studyplanid, pageid, firstperiod, lastperiod) {
structure: null,
studyplan: null,
page: null,
text: strings.studyplan_report,
},
async mounted() {
text: strings.studyplanReport,
},
created() {
// On creation, load the page as specified
@ -89,10 +85,11 @@ export function init(studyplanid, pageid, firstperiod, lastperiod) {
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) {

View File

@ -1,8 +1,6 @@
/*eslint no-var: "error" */
/* eslint no-unused-vars: "off" */
/*eslint linebreak-style: "off" */
/* eslint no-trailing-spaces: "off" */
/*eslint-env es6*/
/* eslint max-depth: ["error", 5] */
// Put this file in path/to/plugin/amd/src
// You can call it anything you like
@ -12,14 +10,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);
@ -31,25 +28,29 @@ 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) {
// 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',
@ -74,8 +75,8 @@ export function init(contextid,categoryid) {
async mounted() {
call([{
methodname: 'local_treestudyplan_list_studyplans',
args: {context_id: contextid}
}])[0].then(function(response){
args: {'context_id': contextid}
}])[0].then((response) => {
const timingval = {present: 0, past: 1, future: 2};
response.sort((a, b) => {
const timinga = studyplanTiming(a);
@ -83,15 +84,14 @@ export function init(contextid,categoryid) {
const t = timingval[timinga] - timingval[timingb];
if (t == 0) {
// sort by name if timing is equal
// 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
// Load studyplan from hash if applicable
const hash = window.location.hash.replace('#', '');
const parts = hash.split("-");
@ -103,11 +103,12 @@ export function init(contextid,categoryid) {
}
}
}
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) {
const cat = response[ix];
@ -116,16 +117,16 @@ export function init(contextid,categoryid) {
}
}
app.usedcontexts = contexts;
return;
}).catch(notification.exception);
addBrowserButtonEvent(this.navChanged, this.navChanged);
},
computed: {
dropdown_title(){
dropdownTitle() {
if (this.activestudyplan && this.activestudyplan.name) {
return this.activestudyplan.name;
}
else{
return this.text.studyplan_select_placeholder;
} else {
return this.text.studyplanSelectPlaceholder;
}
},
contextid() {
@ -192,7 +193,7 @@ export function init(contextid,categoryid) {
selectStudyplan(studyplan, studentid, updatehash = true) {
app.selected.planid = Number(studyplan.id);
app.selected.studentid = studentid ? Number(studentid) : 0;
// fetch studyplan
// Fetch studyplan
app.loadingstudyplan = true;
app.associatedstudents = [];
app.selectedstudent = null;
@ -200,13 +201,13 @@ export function init(contextid,categoryid) {
call([{
methodname: 'local_treestudyplan_get_studyplan_map',
args: {id: studyplan.id}
}])[0].then(function(response){
app.activestudyplan = ProcessStudyplan(response,true);
}])[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;
let foundstudent = false;
if (studentid) {
@ -228,8 +229,9 @@ export function init(contextid,categoryid) {
app.displayedstudyplan = app.activestudyplan;
app.loadingstudyplan = false;
}
return;
}).catch(notification.exception);
return;
}).catch(function(error) {
notification.exception(error);
app.loadingstudyplan = false;
@ -244,14 +246,15 @@ export function init(contextid,categoryid) {
call([{
methodname: 'local_treestudyplan_get_user_studyplan',
args: {userid: student.id, studyplanid: app.selected.planid}
}])[0].then(function(response){
app.studentstudyplan = ProcessStudyplan(response,false);
}])[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;
}
}).catch(function(error){
return;
}).catch((error) => {
notification.exception(error);
app.loadingstudyplan = false;
});

View File

@ -5,7 +5,7 @@
* Hide a primary navigation item by href
* @param {string|Array} hrefs The link that should be hidden
*/
export function hide_primary(hrefs) {
export function hidePrimary(hrefs) {
if (typeof hrefs === 'string' || hrefs instanceof String) {
hrefs = [hrefs];
}

View File

@ -8,15 +8,15 @@
import {SimpleLine} from './simpleline/simpleline';
import {get_strings} from 'core/str';
import {load_strings} from './util/string-helper';
import {format_date, format_datetime, studyplanPageTiming,studyplanTiming} from './util/date-helper';
import {loadStrings} from './util/string-helper';
import {formatDate, formatDatetime, studyplanPageTiming,studyplanTiming} from './util/date-helper';
import {addBrowserButtonEvent} from './util/browserbuttonevents';
import {call} from 'core/ajax';
import notification from 'core/notification';
import {svgarcpath} from './util/svgarc';
import Debugger from './util/debugger';
import Config from 'core/config';
import {ProcessStudyplan, ProcessStudyplanPage, objCopy} from './studyplan-processor';
import {processStudyplan, processStudyplanPage, objCopy} from './studyplan-processor';
import TSComponents from './treestudyplan-components';
/*import {eventTypes as editSwEventTypes} from 'core/edit_switch';*/
import { premiumenabled, premiumstatus } from "./util/premium";
@ -78,7 +78,7 @@ export default {
}
}
let strings = load_strings({
let strings = loadStrings({
report: {
loading: "loadinghelp@core",
studyplan_past: "studyplan_past",
@ -254,23 +254,23 @@ export default {
},
max: {
type: Number,
default: 100,
'default': 100,
},
min: {
type: Number,
default: 0,
'default': 0,
},
stroke: {
type: Number,
default: 0.2,
'default': 0.2,
},
bgopacity: {
type: Number,
default: 0.2,
'default': 0.2,
},
title: {
type: String,
default: "",
'default': "",
},
icon: {
type: String,
@ -488,7 +488,7 @@ export default {
studyplanid: plan.id,
}),
}])[0].then(function(response){
self.selectedstudyplan = ProcessStudyplan(response);
self.selectedstudyplan = processStudyplan(response);
self.loadingstudyplan = false;
window.location.hash = self.selectedstudyplan.id;
}).catch(notification.exception);
@ -551,15 +551,15 @@ export default {
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
},
coaching: {
type: Boolean,
default: false,
'default': false,
},
},
data() {
@ -594,7 +594,7 @@ export default {
},
methods: {
pageduration(page){
return format_date(page.startdate,false) + " - " + format_date(page.enddate,false);
return formatDate(page.startdate,false) + " - " + formatDate(page.enddate,false);
},
columns(page) {
return 1+ (page.periods * 2);
@ -824,19 +824,19 @@ export default {
props: {
value : {
type: Object, // Studyline
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
},
layers: {
type: Number,
default: 1,
'default': 1,
},
studentid: {
type: Number,
@ -885,7 +885,7 @@ export default {
return this.text.byname.replace('{$a}','');
},
enrolldate() {
return format_datetime(this.value.enrol.enrolled_time);
return formatDatetime(this.value.enrol.enrolled_time);
},
sorted_students() {
const self =this;
@ -923,7 +923,7 @@ export default {
},
methods: {
premiumenabled,
format_datetime,
formatDatetime,
onLineHeightChange(lineid){
// All layers for this line have the first slot send an update message on layer height change.
// When one of those updates is received, record the height and recalculate the total height of the
@ -1086,7 +1086,7 @@ export default {
<td><span v-if="student.enrol.enrolled" class="text-success">{{text.enrolled}}</span
><span v-else class="text-danger">{{text.notenrolled}}</span></td>
<td><span v-if="student.enrol.enrolled"
>{{format_datetime(student.enrol.enrolled_time)}}</span></td>
>{{formatDatetime(student.enrol.enrolled_time)}}</span></td>
<td><span v-if="student.enrol.enrolled"
>{{student.enrol.enrolled_by}}</span></td>
<td ><b-button v-if="!student.enrol.enrolled && (can_enrol || can_unenrol)"
@ -1166,11 +1166,11 @@ export default {
},
type : {
type: String,
default: 'gradable',
'default': 'gradable',
},
slotindex : {
type: Number,
default: 0,
'default': 0,
},
line : {
type: Object,
@ -1189,11 +1189,11 @@ export default {
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
},
period: {
type: Object,
@ -1265,7 +1265,7 @@ export default {
props: {
value :{
type: Object,
default: function(){ return null;},
'default': function(){ return null;},
},
plan: {
type: Object,
@ -1273,15 +1273,15 @@ export default {
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
},
cloud: {
type: Boolean,
default: false,
'default': false,
}
},
data() {
@ -1437,7 +1437,7 @@ export default {
props: {
'value' :{
type: Object,
default: function(){ return null;},
'default': function(){ return null;},
},
},
data() {
@ -1492,11 +1492,11 @@ export default {
},
computed: {
startdate(){
return format_date(this.value.course.startdate);
return formatDate(this.value.course.startdate);
},
enddate(){
if(this.value.course.enddate > 0){
return format_date(this.value.course.enddate);
return formatDate(this.value.course.enddate);
}
else {
return this.text.noenddate;
@ -1531,7 +1531,7 @@ export default {
methods: {
completion_icon(completion) {
switch(completion){
default: // case "incomplete"
default: // Case "incomplete"
return "circle-o";
case "pending":
return "question-circle";
@ -1549,7 +1549,7 @@ export default {
},
circle_icon(completion) {
switch(completion){
default: // case "incomplete"
default: // Case "incomplete"
return null;
case "failed":
return "times";
@ -1708,11 +1708,11 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
},
data() {
@ -1744,7 +1744,7 @@ export default {
methods: {
completion_icon(completion) {
switch(completion){
default: // case "incomplete"
default: // Case "incomplete"
return "circle-o";
case "pending":
return "question-circle";
@ -1805,15 +1805,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
course: {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -1960,15 +1960,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
item: {
type: Object,
default: function(){ return { id: null};},
'default': function(){ return { id: null};},
}
},
data() {
@ -2270,11 +2270,11 @@ export default {
return status;
},
startdate(){
return format_date(this.value.course.startdate);
return formatDate(this.value.course.startdate);
},
enddate(){
if(this.value.course.enddate > 0){
return format_date(this.value.course.enddate);
return formatDate(this.value.course.enddate);
}
else {
return this.text.noenddate;
@ -2445,7 +2445,7 @@ export default {
props: {
value : {
type: Object, // Item
default: function(){ return {};},
'default': function(){ return {};},
},
useRequiredGrades: {
type: Boolean,
@ -2459,11 +2459,11 @@ export default {
},
computed: {
startdate(){
return format_date(this.value.course.startdate);
return formatDate(this.value.course.startdate);
},
enddate(){
if(this.value.course.enddate > 0){
return format_date(this.value.course.enddate);
return formatDate(this.value.course.enddate);
}
else {
return this.text.noenddate;
@ -2557,11 +2557,11 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
useRequiredGrades: {
type: Boolean,
default: false,
'default': false,
},
},
data() {
@ -2670,15 +2670,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
course: {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -2773,15 +2773,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
item: {
type: Object,
default: function(){ return { id: null};},
'default': function(){ return { id: null};},
}
},
data() {
@ -2963,15 +2963,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
width: {
type: Number,
default: 150,
'default': 150,
},
height: {
type: Number,
default: 15,
'default': 15,
}
},
data() {
@ -3038,7 +3038,7 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {
'default': function(){ return {
students: 0,
completed: 0,
completed_pass: 0,
@ -3048,11 +3048,11 @@ export default {
},
width: {
type: Number,
default: 150,
'default': 150,
},
height: {
type: Number,
default: 15,
'default': 15,
}
},
data() {
@ -3150,7 +3150,7 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {
'default': function(){ return {
students: 10,
completed: 2,
completed_pass: 2,
@ -3160,15 +3160,15 @@ export default {
},
stroke: {
type: Number,
default: 0.2,
'default': 0.2,
},
disabled: {
type: Boolean,
default: false,
'default': false,
},
title: {
type: String,
default: "",
'default': "",
}
},
computed: {
@ -3277,15 +3277,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
}
},
data() {
@ -3318,15 +3318,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
}
},
data() {
@ -3355,15 +3355,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
}
},
data() {
@ -3395,15 +3395,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
teachermode: {
type: Boolean,
default: false,
'default': false,
}
},
data() {
@ -3614,7 +3614,7 @@ export default {
props: {
'value' :{
type: Object,
default: function(){ return null;},
'default': function(){ return null;},
},
},
data() {

View File

@ -10,15 +10,16 @@ import {SimpleLine} from "./simpleline/simpleline";
import {call} from 'core/ajax';
import notification from 'core/notification';
import {get_strings} from 'core/str';
import {load_stringkeys, load_strings, strformat } from './util/string-helper';
import {format_date, add_days, datespaninfo } from './util/date-helper';
import {loadStringKeys, loadStrings, strformat } from './util/string-helper';
import {formatDate, addDays, datespaninfo } from './util/date-helper';
import {objCopy,transportItem} from './studyplan-processor';
import Debugger from './util/debugger';
import Config from 'core/config';
import {download,upload} from './downloader';
import {ProcessStudyplan, ProcessStudyplanPage} from './studyplan-processor';
import {processStudyplan, processStudyplanPage} from './studyplan-processor';
/* import {eventTypes as editSwEventTypes} from 'core/edit_switch'; */
import { premiumenabled } from "./util/premium";
import FitTextVue from './util/fittext-vue';
import { settings } from "./util/settings";
import TSComponents from './treestudyplan-components';
import mFormComponents from "./util/mform-helper";
@ -38,7 +39,7 @@ const PERIOD_EDITOR_FIELDS =
const LINE_GRAVITY = 1.3;
const datechanger_globals = {
default: false,
'default': false,
defaultchoice: false,
hidewarn: false,
};
@ -51,6 +52,7 @@ export default {
Vue.use(TSComponents);
Vue.use(mFormComponents);
Vue.use(pSideBarComponents);
Vue.use(FitTextVue);
let debug = new Debugger("treestudyplan-editor");
/************************************
* *
@ -78,14 +80,14 @@ export default {
});
*/
let string_keys = load_stringkeys({
let string_keys = loadStringKeys({
conditions: [
{ value: 'ALL', textkey: 'condition_all'},
{ value: 'ANY', textkey: 'condition_any'},
],
});
let strings = load_strings({
let strings = loadStrings({
studyplan_text: {
studyline_editmode: 'studyline_editmode',
toolbox_toggle: 'toolbox_toggle',
@ -125,8 +127,8 @@ export default {
advanced_tools: 'advanced_tools',
confirm_cancel: 'confirm_cancel',
confirm_ok: 'confirm_ok',
success$core: 'success$core',
error$core: 'failed$core',
success$core: 'success@core',
error$core: 'failed@completion',
advanced_converted: 'advanced_converted',
advanced_skipped: 'advanced_skipped',
advanced_failed: 'advanced_failed',
@ -628,7 +630,7 @@ export default {
},
'contextid': {
type: Number,
default: 1
'default': 1
},
},
data() {
@ -659,7 +661,7 @@ export default {
methodname: 'local_treestudyplan_get_studyplan_map',
args: { id: self.value.id}
}])[0].then(function(response){
self.value = ProcessStudyplan(response,true);
self.value = processStudyplan(response,true);
debug.info('studyplan processed');
self.$emit('input',self.value);
}).catch(function(error){
@ -733,7 +735,7 @@ export default {
self.$emit("created",updatedpage);
}
else {
const page = ProcessStudyplanPage(updatedpage);
const page = processStudyplanPage(updatedpage);
debug.info('studyplan page processed');
if (self.value.periods < page.periods) {
@ -1282,13 +1284,13 @@ export default {
if( days === undefined ){
days = 1;
}
return add_days(date,days);
return addDays(date,days);
},
sub_day(date,days) {
if( days === undefined ){
days = 1;
}
return add_days(date,0 - days);
return addDays(date,0 - days);
},
}
,
@ -1363,7 +1365,7 @@ export default {
},
'coaching': {
type: Boolean,
default: false,
'default': false,
},
},
data() {
@ -1730,13 +1732,13 @@ export default {
if( days === undefined ){
days = 1;
}
return add_days(date,days);
return addDays(date,days);
},
sub_day(date,days) {
if( days === undefined ){
days = 1;
}
return add_days(date,0 - days);
return addDays(date,0 - days);
},
toolbox_switched(event){
this.$emit('toggletoolbox',event);
@ -2232,11 +2234,11 @@ export default {
props: {
value : {
type: Object, // Studyline
default: function(){ return {};},
'default': function(){ return {};},
},
layers: {
type: Number,
default: 1,
'default': 1,
},
},
data() {
@ -2293,7 +2295,7 @@ export default {
props: {
value : {
type: Object, // Studyline
default: function(){ return {};},
'default': function(){ return {};},
}
},
data() {
@ -2367,11 +2369,11 @@ export default {
props: {
type : {
type: String,
default: 'gradable',
'default': 'gradable',
},
slotindex : {
type: Number,
default: '',
'default': '',
},
line : {
type: Object,
@ -2463,7 +2465,7 @@ export default {
datechanger: {
coursespan: null,
periodspan: null,
default: false,
'default': false,
defaultchoice: false,
hidewarn: false,
}
@ -2696,7 +2698,7 @@ export default {
},
hidden: {
type: Boolean,
default: false,
'default': false,
}
},
computed: {
@ -3464,7 +3466,7 @@ export default {
props: {
'value' :{
type: Object,
default: function(){ return null;},
'default': function(){ return null;},
},
},
data() {
@ -3554,11 +3556,11 @@ export default {
}
},
startdate(){
return format_date(this.value.course.startdate);
return formatDate(this.value.course.startdate);
},
enddate(){
if(this.value.course.enddate > 0){
return format_date(this.value.course.enddate);
return formatDate(this.value.course.enddate);
}
else {
return this.text.noenddate;
@ -3637,7 +3639,7 @@ export default {
:class="'h-100 t-timing-indicator timing-'+value.course.timing"
></div>
<div class="t-item-course-title card-body h-100">
<fittext maxsize="12pt" minsize="9pt"
<fittext maxsize="12pt" minsize="9pt">
<a v-b-modal="'t-item-course-config-'+value.id"
:id="'t-item-course-details-'+value.id"
:href="wwwroot+'/course/view.php?id='+value.course.id"
@ -3821,15 +3823,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
course: {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -3922,15 +3924,15 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
guestmode: {
type: Boolean,
default: false,
'default': false,
},
item: {
type: Object,
default: function(){ return { id: null};},
'default': function(){ return { id: null};},
}
},
data() {
@ -4058,7 +4060,7 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -4080,7 +4082,7 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -4100,7 +4102,7 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -4123,7 +4125,7 @@ export default {
props: {
value : {
type: Object,
default: function(){ return { badge: {}};},
'default': function(){ return { badge: {}};},
},
},
data() {
@ -4193,7 +4195,7 @@ export default {
props: {
value : {
type: Array,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -4216,7 +4218,7 @@ export default {
props: {
value : {
type: Object,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -4282,7 +4284,7 @@ export default {
props: {
value : {
type: Array,
default: function(){ return {};},
'default': function(){ return {};},
},
},
data() {
@ -4321,7 +4323,7 @@ export default {
props: {
value : {
type: Boolean,
default: true,
'default': true,
},
activepage: {
type: Object,
@ -4329,11 +4331,11 @@ export default {
},
coaching: {
type: Boolean,
default: false,
'default': false,
},
studyplanid: {
type: Number,
default: 0,
'default': 0,
}
},
data() {

View File

@ -1,4 +1,5 @@
/* eslint no-console: "off"*/
/* eslint max-depth: ["error", 6]*/
/**
* Copy fields from one object to another
* @param {Object} target The target to copy to
@ -28,7 +29,7 @@ export function transportItem(target,source,identifier,param){
if (!param) {
param = 'value';
}
// find item
// Find item
let item;
let itemindex;
for (const ix in source) {
@ -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){
export function processStudyplan(studyplan) {
for (const ip in studyplan.pages) {
const page = studyplan.pages[ip];
ProcessStudyplanPage(page);
processStudyplanPage(page);
}
return studyplan;
}
@ -78,9 +77,9 @@ 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) {
const line = page.studylines[il];

View File

@ -1,32 +1,22 @@
/* 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 max-depth: ["error", 6] */
/* 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
* @returns {string}
*/
function striptags(html) {
const tmp = document.createElement("DIV");
@ -39,6 +29,7 @@ function striptags(html) {
/**
* Retrieve condition headers
* @param {Object} item
* @returns {Array}
*/
function conditionHeaders(item) {
const course = item.course;
@ -46,7 +37,7 @@ 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,
});
}
@ -75,6 +66,7 @@ function conditionHeaders(item) {
/**
* Retrieve conditions
* @param {Object} item
* @returns {Array}
*/
function conditions(item) {
const course = item.course;
@ -105,7 +97,7 @@ export default {
Vue.use(TSComponents);
Vue.use(FitTextVue);
let strings = load_strings({
let strings = loadStrings({
report: {
loading: "loadinghelp@core",
studyplan_past: "studyplan_past",
@ -138,11 +130,11 @@ export default {
}
});
/************************************
/* **********************************
* *
* Treestudyplan Viewer components *
* *
************************************/
* **********************************/
Vue.component('q-studyplanreport', {
props: {
@ -168,14 +160,11 @@ export default {
}
};
},
created() {
},
watch: {
structure: {
immediate: true,
handler(structure) {
this.loadStudents(); // reload the student list
this.loadStudents(); // Reload the student list
// (Re)build expansion info structure
let firstperiod = true;
for (const period of structure.periods) {
@ -227,8 +216,7 @@ 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.
// 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) => {
@ -247,7 +235,6 @@ export default {
}
});
}
return students;
},
resultColCount() {
@ -283,8 +270,8 @@ export default {
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) {
self.$set(
@ -306,18 +293,21 @@ export default {
);
call([{
methodname: 'local_treestudyplan_get_report_data',
args: { pageid: self.structure.page.id,
args: {
pageid: self.structure.page.id,
userid: student.id,
firstperiod: self.structure.firstperiod,
lastperiod: self.structure.lastperiod,
}
}])[0].then(function(response){
}])[0].then((response) => {
self.studentresults[student.id].loading = false;
self.studentresults[student.id].results = response;
return;
}).catch(notification.exception);
}
}
self.studentsloading = false;
return;
}).catch(notification.exception);
},
expansionChanged(parm, id, val) {
@ -473,11 +463,6 @@ export default {
this.$emit('togglesort', heading);
}
},
mounted() {
},
updated() {
},
/* TODO: https://css-tricks.com/position-sticky-and-table-headers/ */
template: `
<thead class='q-header'>
@ -499,7 +484,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"
@ -554,7 +540,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
@ -597,11 +584,11 @@ export default {
},
resultcolumns: {
type: Number,
default: 1
'default': 1
},
studentinfocolumns: {
type: Number,
default: 1
'default': 1
},
expanded: {
type: Boolean,
@ -634,11 +621,11 @@ export default {
props: {
resultcolumns: {
type: Number,
default: 1
'default': 1
},
studentinfocolumns: {
type: Number,
default: 1
'default': 1
},
},
data() {
@ -671,14 +658,14 @@ export default {
},
loading: {
type: Boolean,
default: false
'default': false
},
expansion: {
type: Object,
},
even: {
type: Boolean,
default: false,
'default': false,
}
},
data() {
@ -689,7 +676,7 @@ export default {
computed: {
lastaccess() {
if (this.student.lastaccess) {
return format_datetime(this.student.lastaccess); // Takes date in milliseconds
return formatDatetime(this.student.lastaccess); // Takes date in milliseconds
} else {
return this.text.never;
}
@ -715,9 +702,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>
@ -766,7 +750,7 @@ export default {
},
loading: {
type: Boolean,
default: false
'default': false
},
},
data() {
@ -786,7 +770,7 @@ export default {
completion_icon() {
const completion = this.item.completion;
switch (completion) {
default: // case "incomplete"
default: // Case "incomplete"
return "circle-o";
case "pending":
return "question-circle";
@ -835,7 +819,7 @@ export default {
},
loading: {
type: Boolean,
default: false
'default': false
},
conditionidx: {
type: Number,
@ -868,7 +852,7 @@ export default {
completion_icon() {
const completion = this.condition_completion();
switch (completion) {
default: // case "incomplete"
default: // Case "incomplete"
return "circle-o";
case "pending":
return "question-circle";
@ -923,13 +907,14 @@ export default {
return this.condition.status;
} 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 v-if="item.lineenrolled" maxsize="10pt" singleline dynamic>
@ -951,8 +936,5 @@ export default {
</span>
`,
});
},
};

View File

@ -1,11 +1,12 @@
/* 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';
@ -14,7 +15,7 @@ export default {
install(Vue /* ,options */) {
Vue.use(FitTextVue);
let strings = load_strings({
let strings = loadStrings({
studyplancard: {
open: "open",
noenddate: "noenddate",
@ -50,7 +51,7 @@ export default {
},
ignoresuspend: {
type: Boolean,
default: false,
'default': false,
},
},
data() {
@ -73,8 +74,8 @@ export default {
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() {
@ -140,11 +141,15 @@ export default {
},
min: {
type: Number,
default() { return 0;}
default() {
return 0;
}
},
max: {
type: Number,
default() { return 1;}
default() {
return 1;
}
}
},
data() {
@ -196,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
@ -207,7 +210,9 @@ export default {
props: {
identifier: {
type: Number, // Page reference.
default() { return 0;}
default() {
return 0;
}
}
},
data() {
@ -240,15 +245,17 @@ 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",
'default': "view",
}
},
mounted() {
@ -269,10 +276,10 @@ export default {
},
computed: {
startdate() {
return format_date(this.value.startdate);
return formatDate(this.value.startdate);
},
enddate() {
return format_date(this.value.enddate);
return formatDate(this.value.enddate);
},
current() {
if (this.value && this.value.startdate && this.value.enddate) {
@ -280,8 +287,7 @@ export default {
const pstart = new Date(this.value.startdate);
const pend = new Date(this.value.enddate);
return (now >= pstart && now < pend);
}
else {
} else {
return false;
}
}
@ -320,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() {
@ -374,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() {
@ -404,7 +422,7 @@ export default {
},
methods: {
displaydate(field) {
return format_date(field.value,false);
return formatDate(field.value, false);
},
},
template: `
@ -439,38 +457,40 @@ 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() {
@ -501,8 +521,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: {

View File

@ -2,6 +2,7 @@
/* 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';

View File

@ -1,4 +1,5 @@
/*eslint no-trailing-spaces: "off"*/
/* eslint camelcase: "off" */
/* eslint capitalized-comments: "off" */
/* eslint no-eval: "off" */
/* **********************************
@ -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,6 +32,7 @@ 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,6 +41,7 @@ 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,6 +50,7 @@ export const Absolute = {
* 1/100th of the smallest viewport side
* @param {number} count
* @param {object} ctx
* @returns {number}
*/
vmin: (count = 1, ctx) => {
return (
@ -61,6 +65,7 @@ export const Absolute = {
* 1/100th of the largest viewport side
* @param {number} count
* @param {object} ctx
* @returns {number}
*/
vmax: (count = 1, ctx) => {
return (
@ -75,6 +80,7 @@ export const Absolute = {
* Represents the font-size of <html> element
* @param {number} count
* @param {object} ctx
* @returns {number}
*/
rem: (count = 1, ctx) => {
return (
@ -89,6 +95,7 @@ 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,6 +104,7 @@ 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;
}

View File

@ -1,10 +1,11 @@
/* 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){
export function formatDate(d, short) {
if (!(d instanceof Date)) {
if (typeof d == 'number') {
d *= 1000; // Convert from seconds to milliseconds.
@ -29,7 +30,7 @@ export function format_date(d,short){
* @param {boolean} short Short format (default false)
* @returns {string}
*/
export function format_datetime(d,short){
export function formatDatetime(d, short) {
if (!(d instanceof Date)) {
if (typeof d == 'number') {
d *= 1000; // Convert from seconds to milliseconds.
@ -58,8 +59,12 @@ export function format_datetime(d,short){
* @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);}
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);
@ -86,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),
}
};
@ -96,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);
@ -117,9 +122,9 @@ 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.
return dateYYYYMMDD(newdate);
@ -128,7 +133,7 @@ export function add_days(datestr,days) {
/**
* Determine start and end dates of a studyplan
* @param {*} plan
* @returns
* @returns {object}
*/
export function studyplanDates(plan) {
let earliestStart = null;

View File

@ -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);
}
};
}

View File

@ -7,11 +7,11 @@ 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){
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,74 +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 (output_enabled) {
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;
}
};

View File

@ -1,11 +1,11 @@
/* eslint no-unused-vars: warn */
/* eslint max-len: ["error", { "code": 160 }] */
/* eslint-disable no-trailing-spaces */
/* 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 */) {
@ -13,11 +13,11 @@ export default {
props: {
maxsize: {
type: String,
default: "512px",
'default': "512px",
},
minsize: {
type: String,
default: "10px",
'default': "10px",
},
vertical: Boolean,
singleline: Boolean,

View File

@ -1,4 +1,4 @@
/*eslint no-console: "off"*/
/* eslint-disable */
/*
Copyright (c) 2017-2021 Rik Schennink - All rights reserved.

View File

@ -1,10 +1,10 @@
/**
* 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) {
@ -26,6 +26,7 @@ export function text_integer(id,unsigned=false,nonzero=false){
return true;
}
}
return null;
});
}
}

View File

@ -2,14 +2,15 @@
/* eslint no-console: "off" */
/* eslint no-bitwise: "off" */
/* eslint-disable no-trailing-spaces */
/* eslint camelcase: "off" */
/* eslint capitalized-comments: "off" */
/* eslint-env es6 */
// Put this file in path/to/plugin/amd/src
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
@ -31,7 +32,7 @@ import('core_form/changechecker').then((ns) => {
/**
* Create a random UUID in both secure and insecure contexts
* @returns UUID
* @returns {String} UUID
*/
function create_uuid() {
if (crypto.randomUUID !== undefined) {
@ -46,7 +47,7 @@ function create_uuid() {
export default {
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",
@ -63,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() {
@ -90,7 +91,7 @@ export default {
methods: {
openForm() {
const self = this;
self.$refs["editormodal"].show();
self.$refs.editormodal.show();
},
onShown() {
const self = this;
@ -104,14 +105,15 @@ export default {
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.
@ -129,6 +131,7 @@ export default {
}])[0].then((response) => {
const updatedplan = JSON.parse(response.data);
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
@ -148,7 +151,7 @@ export default {
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)

View File

@ -5,7 +5,7 @@ import {call} from 'core/ajax';
import notification from 'core/notification';
// Prepare default value.
let premiumstatus_cache = null;
let premiumstatusCache = null;
/**
* Check if premium status is enabled.
@ -25,16 +25,17 @@ export function premiumenabled (){
* @returns {Object} The premium status object
*/
function premiumstatus() {
if (!premiumstatus_cache) {
if (!premiumstatusCache) {
// Retrieve premium status if needed.
call([{
methodname: 'local_treestudyplan_premiumstatus',
args: {}
}])[0].then(function(response){
premiumstatus_cache = response;
}])[0].then((response) => {
premiumstatusCache = response;
return;
}).catch(notification.exception);
}
return premiumstatus_cache;
return premiumstatusCache;
}
// Preload premium status.

View File

@ -13,23 +13,23 @@ export default {
props: {
value: {
type: Boolean,
default: true,
'default': true,
},
right: {
type: Boolean,
default: false,
'default': false,
},
shadow: {
type: Boolean,
default: false,
'default': false,
},
target: {
type: String,
default: 'body',
'default': 'body',
},
offsetRef: {
type: String,
default: '',
'default': '',
}
},
data() {

View File

@ -10,7 +10,7 @@ let settingcache = null;
/**
* Check if premium status is enabled.
* @param {String} key
* @returns {}
* @returns {*}
*/
export function settings(key) {
const settings = loadsettings();
@ -31,8 +31,9 @@ function loadsettings() {
call([{
methodname: 'local_treestudyplan_getsettings',
args: {}
}])[0].then(function(response){
}])[0].then((response) => {
settingcache = response;
return;
}).catch(notification.exception);
}
return settingcache;

View File

@ -1,8 +1,11 @@
/* 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
@ -10,7 +13,7 @@ const getstr_func = (getStrings !== undefined)?getStrings:get_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,plugin){
export function loadStrings(strings, plugin) {
if (plugin === undefined) {
plugin = 'local_treestudyplan';
}
@ -23,12 +26,15 @@ export function load_strings(strings,plugin){
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]) {
strings[idx][handle] = str[i];
i++;
}
return;
}).catch((x) => {
debug.warn(x);
});
}
@ -42,7 +48,7 @@ export function load_strings(strings,plugin){
* @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,plugin){
export function loadStringKeys(string_keys, plugin) {
if (plugin === undefined) {
plugin = 'local_treestudyplan';
}
@ -56,12 +62,15 @@ export function load_stringkeys(string_keys,plugin){
let component = (parts.length > 1) ? parts[1] : plugin;
stringkeys.push({key: identifier, component: component});
}
getstr_func(stringkeys).then(function(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;
@ -71,7 +80,7 @@ export function load_stringkeys(string_keys,plugin){
* 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) {
return str.replace(/\{(\w+)\}/g, (m, m1) => {

View File

@ -22,24 +22,24 @@ 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 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)) {
@ -55,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 path2wk2r = 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;
path2wk2r.setAttribute("d", d);
return path2wk2r;
});
export {svgarc, svgarcpath};

View File

@ -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);
}

File diff suppressed because one or more lines are too long

View File

@ -33,8 +33,6 @@ $excludepaths = [
"build/*",
"build.*",
"vuemode.sh",
"amd/src",
"amd/src/*",
".git",
".git/*",
".gitignore",

View File

@ -585,7 +585,7 @@ class associationservice extends \external_api {
*/
public static function all_associated_grouped_parameters(): \external_function_parameters {
return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan'),
] );
}

View File

@ -166,10 +166,10 @@ class badgeinfo {
/**
* Webservice model for editor info
* @param int[] $studentlist List of user id's to use for checking issueing progress within a study plan
* @param int[]|null $studentlist List of user id's to use for checking issueing progress within a study plan
* @return array Webservice data model
*/
public function editor_model(array $studentlist = null) {
public function editor_model(?array $studentlist = null) {
if ($this->badge->type == BADGE_TYPE_SITE) {
$context = \context_system::instance();
} else {
@ -347,6 +347,7 @@ class badgeinfo {
/* If ALL completion overall, just add it up to the total */
$count += $typecount;
$progress += $typeprogress;
$typefraction = floatval($typeprogress) / floatval($typecount);
}
$aggrgationhandle = ($typeagg == BADGE_CRITERIA_AGGREGATION_ALL) ? "all" : "any";

View File

@ -106,7 +106,8 @@ class cascadeusersync {
}
}
/** Enrol a list of users into a specific course
/**
* Enrol a list of users into a specific course
* @param int $courseid Id of the course
* @param array $userids List of userids to enrol
*/

View File

@ -159,7 +159,7 @@ class completionscanner {
* Webservice model for basic info
* @param int[]|null $studentlist Array of student userids to use for checking. Leave empty to use all course students
*/
public function model(array $studentlist = null): array {
public function model(?array $studentlist = null): array {
/*
If an array of students is provided (usually the case if called from a courecompletioninfo object),
make sure to filter it out, so only the students enrolled in the course are included.. Otherwise

View File

@ -241,10 +241,10 @@ class corecompletioninfo {
/**
* Webservice model for editor info
* @param int[] $studentlist List of user id's to use for checking issueing progress within a study plan
* @param int[]|null $studentlist List of user id's to use for checking issueing progress within a study plan
* @return array Webservice data model
*/
public function editor_model(array $studentlist = null) {
public function editor_model(?array $studentlist = null) {
global $DB, $CFG;
$conditions = [];

View File

@ -221,10 +221,10 @@ class coursecompetencyinfo {
/**
* Webservice model for editor info
* @param int[] $studentlist List of user id's to use for checking issueing progress within a study plan
* @param int[]|null $studentlist List of user id's to use for checking issueing progress within a study plan
* @return array Webservice data model
*/
public function editor_model(array $studentlist = null) {
public function editor_model(?array $studentlist = null) {
$coursecompetencies = $this->course_competencies();
// Next create the data model, and check user proficiency for each competency.

View File

@ -153,7 +153,7 @@ class courseinfo {
* @param int $id Course id
* @param studyitem|null $studyitem Studyitem linking this course (if applicable)
*/
public function __construct($id, studyitem $studyitem = null) {
public function __construct($id, ?studyitem $studyitem = null) {
global $DB;
$this->studyitem = $studyitem;
$this->course = \get_course($id);
@ -616,8 +616,10 @@ class courseinfo {
$value = date("Y-m-d", $raw);
}
} else {
// Everything else can just use the export value.
if (empty($PAGE->context)) {
$PAGE->set_context(\context_system::instance());
}
// Everything else can just use the export value.
$value = $data->export_value();
}

View File

@ -121,7 +121,9 @@ class gradeinfo {
protected static function get_contentitems(): array {
global $PAGE;
if (empty(static::$contentitems)) {
if(empty($PAGE->context)) {
$PAGE->set_context(\context_system::instance());
}
static::$contentitems = (new content_item_readonly_repository())->find_all();
}
return static::$contentitems;
@ -161,7 +163,7 @@ class gradeinfo {
* @param int $id Grade item id of the grade item to use as base
* @param studyitem|null $studyitem Studyitem containg the course that references this grade
*/
public function __construct($id, studyitem $studyitem = null) {
public function __construct($id, ?studyitem $studyitem = null) {
global $DB;
$this->studyitem = $studyitem;
@ -277,10 +279,10 @@ class gradeinfo {
/**
* Webservice model for editor info
* @param studyitem $studyitem Related studyitem to check for
* @param studyitem|null $studyitem Related studyitem to check for
* @return array Webservice data model
*/
public function editor_model(studyitem $studyitem = null) {
public function editor_model(?studyitem $studyitem = null) {
$model = [
"id" => $this->id,
"cmid" => $this->cmid,
@ -418,7 +420,7 @@ class gradeinfo {
* @param studyitem|null $studyitem Studyitem linked to the course which can be linked to created gradeinfo objects
* @return gradeinfo[] Array of gradeinfo
*/
public static function list_course_gradables($course, studyitem $studyitem = null): array {
public static function list_course_gradables($course, ?studyitem $studyitem = null): array {
$list = [];
if (method_exists("\course_modinfo", "get_array_of_activities")) {

View File

@ -79,8 +79,7 @@ class randomimage {
$color = imagecolorallocatealpha($im, ...$this->random_color_alpha());
$numpoints = \random_int(3, $maxpts);
$pts = $this->random_pts($numpoints);
// Remove $numpoints parameter when php7.4 is no longer supported (param is deprecated in >8.1).
imagefilledpolygon($im, $pts, $numpoints, $color);
imagefilledpolygon($im, $pts, $color);
}
/**

View File

@ -35,7 +35,7 @@ class premium extends \external_api {
* If set to false, all premium features will be enabled and no premium settings panel will be visible.
* @var bool
*/
private static $premiumsupported = false;
private static $premiumsupported = true;
/**
* Certficate code

View File

@ -238,6 +238,7 @@ class studyline {
public function enrol_roles(): array {
global $DB;
$list = [];
if ($this->r->enrolrole) {
$roles = explode(",", $this->r->enrolrole);
foreach ($roles as $r) {
$roleid = intval($r);
@ -250,7 +251,7 @@ class studyline {
}
}
}
}
return $list;
}
@ -260,6 +261,7 @@ class studyline {
public function enrol_roleids(): array {
global $DB;
$list = [];
if ($this->r->enrolrole) {
$roles = explode(",", $this->r->enrolrole);
foreach ($roles as $r) {
$roleid = intval($r);
@ -267,6 +269,7 @@ class studyline {
$list[] = $roleid;
}
}
}
return $list;
}

View File

@ -921,7 +921,7 @@ class studyplan {
* @param string $shortname New shortname of studyplan
* @param int $contextid Id of context for new plan
* @param string|null $idnumber New idnumber (duplicate old one if left empty)
* @param string|null $newstartdate If provided, all dates in the copy will be shifted so this is the start date of the new studyplan
* @param string|null $newstartdate If provided, all dates in the copy will be shifted so the plan starts at this date
*/
public function duplicate($name, $shortname, $contextid, $idnumber=null, $newstartdate = null): self {
// First duplicate the studyplan structure.

View File

@ -121,7 +121,7 @@ body.path-local-treestudyplan .editmode-switch-form > * {
.features-treestudyplan .t-studyplan-timeline,
.features-treestudyplan .r-studyplan-timeline {
display: grid;
position: relative; /* make sure this grid is the offset for all arrows that are drawn by SimpleLine */
position: relative; /* Make sure this grid is the offset for all arrows that are drawn by SimpleLine */
/* grid-template-columns will be set in the style attribute */
/* Use the variables below to specify width for filter spots and course spots */
--studyplan-filter-width: auto; /* better leave this at auto for now*/
@ -135,11 +135,13 @@ body.path-local-treestudyplan .editmode-switch-form > * {
.path-local-treestudyplan .r-studyplan-scrollable,
.features-treestudyplan .t-studyplan-scrollable,
.features-treestudyplan .r-studyplan-scrollable {
/* below lines actually have the important flag set, since we do not want these very specific classes
/* Below lines actually have the important flag set, since we do not want these very specific classes
to be overridden anywhere - we always need them to be scrollable */
overflow-x: scroll !important; /* stylelint-disable-line declaration-no-important */
/* to ensure the x scrollbar does not cause an y scrollbar to appear */
overflow-y: clip !important; /* stylelint-disable-line declaration-no-important */
/* stylelint-disable-next-line declaration-no-important */
overflow-x: scroll !important;
/* To ensure the x scrollbar does not cause an y scrollbar to appear */
/* stylelint-disable-next-line declaration-no-important */
overflow-y: clip !important;
scrollbar-color: var(--primary) color-mix(in srgb, var(--primary) 20%, white);
scrollbar-width: thin;
}

Some files were not shown because too many files have changed in this diff Show More