Number of minor changes

This commit is contained in:
PMKuipers 2024-03-22 22:01:42 +01:00
parent 0163471a92
commit d225d82038
14 changed files with 31 additions and 11923 deletions

View File

@ -37,7 +37,7 @@ module.exports = function(grunt) {
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 require(path.resolve(`./Gruntfile.js`))(grunt); // Run Gruntfile module from moodle base
grunt.registerTask('scssplugin','Compile scss/*.sccs into styles.css and css/devstyles.css', () => { grunt.registerTask('scssplugin','Compile scss/styles.sccs into styles.css and css/devstyles.css', () => {
const devoutput = 'css/devstyles.css'; const devoutput = 'css/devstyles.css';
const prodoutput = 'styles.css'; const prodoutput = 'styles.css';

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/util/string-helper",["exports","core/str"],(function(_exports,_str){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.load_stringkeys=function(string_keys){for(let idx in string_keys){let stringkeys=[];for(const i in string_keys[idx]){let parts=string_keys[idx][i].textkey.split("$"),identifier=parts[0],component=parts.length>1?parts[1]:"local_treestudyplan";stringkeys.push({key:identifier,component:component})}getstr_func(stringkeys).then((function(strings){for(const i in strings){const s=strings[i];string_keys[idx][i].text=s}}))}return string_keys},_exports.load_strings=function(strings){for(let idx in strings){let stringkeys=[];for(const handle in strings[idx]){let parts=strings[idx][handle].split(/[$@]/),identifier=parts[0],component=parts.length>1?parts[1]:"local_treestudyplan";stringkeys.push({key:identifier,component:component})}getstr_func(stringkeys).then((function(str){let i=0;for(const handle in strings[idx])strings[idx][handle]=str[i],i++}))}return strings},_exports.strformat=function(str,values){return str.replace(/\{(\w+)\}/g,((m,m1)=>m1&&values.hasOwnProperty(m1)?values[m1]:m))};const getstr_func=void 0!==_str.getStrings?_str.getStrings:_str.get_strings})); define("local_treestudyplan/util/string-helper",["exports","core/str"],(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}));
//# sourceMappingURL=string-helper.min.js.map //# 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 * @returns {Object} The map with strings loaded in\n */\nexport function load_strings(strings){\n for(let idx in strings){\n let stringkeys = [];\n for(const handle in strings[idx]){\n const key = strings[idx][handle];\n let parts = key.split(/[$@]/);\n let identifier = parts[0];\n let component = (parts.length > 1)?parts[1]:'local_treestudyplan';\n stringkeys.push({ key: identifier, component: component});\n }\n getstr_func(stringkeys).then(function(str){\n let i = 0;\n for(const handle in strings[idx]){\n strings[idx][handle] = str[i];\n i++;\n }\n });\n }\n\n return strings;\n}\n\n/**\n * Load the translation of strings from a strings object based on keys\n * Used for loading values for a drop down menu or the like\n * @param {Object} string_keys The map of stringkeys\n * @returns {Object} The map with strings loaded in\n */\nexport function load_stringkeys(string_keys){\n for(let idx in string_keys){\n // Get text strings for condition settings\n let stringkeys = [];\n for(const i in string_keys[idx]){\n const key = string_keys[idx][i].textkey;\n let parts = key.split(\"$\");\n let identifier = parts[0];\n let component = (parts.length > 1)?parts[1]:'local_treestudyplan';\n stringkeys.push({ key: identifier, component: component});\n }\n getstr_func(stringkeys).then(function(strings){\n for(const i in strings) {\n const s = strings[i];\n const l = string_keys[idx][i];\n l.text = s;\n }\n });\n }\n return string_keys;\n}\n\n/**\n * String formatting function - replaces {name} in string by value of same key in values parameter\n * @param {string} str String t\n * @param {object} values Object containing keys to replace {key} strings with\n * @returns Formatted string\n */\nexport function strformat(str,values) {\n return str.replace(/\\{(\\w+)\\}/g, (m, m1) => {\n if (m1 && values.hasOwnProperty(m1)) {\n return values[m1];\n } else {\n return m;\n }\n });\n}"],"names":["string_keys","idx","stringkeys","i","parts","textkey","split","identifier","component","length","push","key","getstr_func","then","strings","s","text","handle","str","values","replace","m","m1","hasOwnProperty","undefined","getStrings","get_strings"],"mappings":"0LAuCgCA,iBACxB,IAAIC,OAAOD,YAAY,KAEnBE,WAAa,OACb,MAAMC,KAAMH,YAAYC,KAAK,KAEzBG,MADQJ,YAAYC,KAAKE,GAAGE,QAChBC,MAAM,KAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAGL,MAAM,GAAG,sBAC5CF,WAAWQ,KAAK,CAAEC,IAAKJ,WAAYC,UAAWA,YAElDI,YAAYV,YAAYW,MAAK,SAASC,aAC9B,MAAMX,KAAKW,QAAS,OACdC,EAAID,QAAQX,GACRH,YAAYC,KAAKE,GACzBa,KAAOD,aAIdf,4CA/CkBc,aACrB,IAAIb,OAAOa,QAAQ,KACfZ,WAAa,OACb,MAAMe,UAAWH,QAAQb,KAAK,KAE1BG,MADQU,QAAQb,KAAKgB,QACTX,MAAM,QAClBC,WAAaH,MAAM,GACnBI,UAAaJ,MAAMK,OAAS,EAAGL,MAAM,GAAG,sBAC5CF,WAAWQ,KAAK,CAAEC,IAAKJ,WAAYC,UAAWA,YAElDI,YAAYV,YAAYW,MAAK,SAASK,SAC9Bf,EAAI,MACJ,MAAMc,UAAUH,QAAQb,KACxBa,QAAQb,KAAKgB,QAAUC,IAAIf,GAC3BA,cAKLW,qCAqCeI,IAAIC,eACnBD,IAAIE,QAAQ,cAAc,CAACC,EAAGC,KAC7BA,IAAMH,OAAOI,eAAeD,IACrBH,OAAOG,IAEPD,WApEbT,iBAA8BY,IAAfC,gBAA0BA,gBAAWC"} {"version":3,"file":"string-helper.min.js","sources":["../../src/util/string-helper.js"],"sourcesContent":["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"}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -17,7 +17,7 @@ import Debugger from './util/debugger';
import Config from 'core/config'; 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 TSComponents from './treestudyplan-components';
import {eventTypes as editSwEventTypes} from 'core/edit_switch'; /*import {eventTypes as editSwEventTypes} from 'core/edit_switch';*/
import { premiumenabled, premiumstatus } from "./util/premium"; import { premiumenabled, premiumstatus } from "./util/premium";
import FitTextVue from './util/fittext-vue'; import FitTextVue from './util/fittext-vue';
@ -237,12 +237,13 @@ export default {
// Create new eventbus for interaction between item components // Create new eventbus for interaction between item components
const ItemEventBus = new Vue(); const ItemEventBus = new Vue();
/*
// Add event listener for the edit mode event so we can react to it, or at the very least ignore it // Add event listener for the edit mode event so we can react to it, or at the very least ignore it
document.addEventListener(editSwEventTypes.editModeSet,(e) => { document.addEventListener(editSwEventTypes.editModeSet,(e) => {
e.preventDefault(); e.preventDefault();
ItemEventBus.$emit('editModeSet',e.detail.editMode); ItemEventBus.$emit('editModeSet',e.detail.editMode);
}); });
*/
Vue.component('r-progress-circle',{ Vue.component('r-progress-circle',{
props: { props: {
@ -627,7 +628,7 @@ export default {
for(let i = 0; i < periods; i++){ for(let i = 0; i < periods; i++){
if(line.slots[index-i] && line.slots[index-i].courses){ if(line.slots[index-i] && line.slots[index-i].courses){
const list = line.slots[index-i].courses; const list = line.slots[index-i].courses;
for(const ix in list){ s for(const ix in list){
const item = list[ix]; const item = list[ix];
if(item.layer == layeridx){ if(item.layer == layeridx){
if(forGradable){ if(forGradable){

View File

@ -17,7 +17,7 @@ import Debugger from './util/debugger';
import Config from 'core/config'; import Config from 'core/config';
import {download,upload} from './downloader'; 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 {eventTypes as editSwEventTypes} from 'core/edit_switch';*/
import { premiumenabled, premiumstatus } from "./util/premium"; import { premiumenabled, premiumstatus } from "./util/premium";
import TSComponents from './treestudyplan-components'; import TSComponents from './treestudyplan-components';
@ -68,11 +68,13 @@ export default {
// Create new eventbus for interaction between item components // Create new eventbus for interaction between item components
const ItemEventBus = new Vue(); const ItemEventBus = new Vue();
/*
// Add event listener for the edit mode event so we can react to it, or at the very least ignore it // Add event listener for the edit mode event so we can react to it, or at the very least ignore it
document.addEventListener(editSwEventTypes.editModeSet,(e) => { document.addEventListener(editSwEventTypes.editModeSet,(e) => {
e.preventDefault(); e.preventDefault();
ItemEventBus.$emit('editModeSet', e.detail.editMode); ItemEventBus.$emit('editModeSet', e.detail.editMode);
}); });
*/
let string_keys = load_stringkeys({ let string_keys = load_stringkeys({
conditions: [ conditions: [

View File

@ -7,16 +7,20 @@ const getstr_func = (getStrings !== undefined)?getStrings:get_strings;
/** /**
* Load the translation of strings from a strings object * Load the translation of strings from a strings object
* @param {Object} strings The map of strings * @param {Object} strings The map of strings
* @param {String} plugin Name of plugin to load for by default (leave empty for 'local_treestudyplan')
* @returns {Object} The map with strings loaded in * @returns {Object} The map with strings loaded in
*/ */
export function load_strings(strings){ export function load_strings(strings,plugin){
if (plugin === undefined) {
plugin = 'local_treestudyplan';
}
for(let idx in strings){ for(let idx in strings){
let stringkeys = []; let stringkeys = [];
for(const handle in strings[idx]){ for(const handle in strings[idx]){
const key = strings[idx][handle]; const key = strings[idx][handle];
let parts = key.split(/[$@]/); let parts = key.split(/[$@]/);
let identifier = parts[0]; let identifier = parts[0];
let component = (parts.length > 1)?parts[1]:'local_treestudyplan'; let component = (parts.length > 1)?parts[1]:plugin;
stringkeys.push({ key: identifier, component: component}); stringkeys.push({ key: identifier, component: component});
} }
getstr_func(stringkeys).then(function(str){ getstr_func(stringkeys).then(function(str){
@ -35,9 +39,13 @@ export function load_strings(strings){
* Load the translation of strings from a strings object based on keys * Load the translation of strings from a strings object based on keys
* Used for loading values for a drop down menu or the like * Used for loading values for a drop down menu or the like
* @param {Object} string_keys The map of stringkeys * @param {Object} string_keys The map of stringkeys
* @param {String} plugin Name of plugin to load for by default (leave empty for 'local_treestudyplan')
* @returns {Object} The map with strings loaded in * @returns {Object} The map with strings loaded in
*/ */
export function load_stringkeys(string_keys){ export function load_stringkeys(string_keys,plugin){
if (plugin === undefined) {
plugin = 'local_treestudyplan';
}
for(let idx in string_keys){ for(let idx in string_keys){
// Get text strings for condition settings // Get text strings for condition settings
let stringkeys = []; let stringkeys = [];
@ -45,7 +53,7 @@ export function load_stringkeys(string_keys){
const key = string_keys[idx][i].textkey; const key = string_keys[idx][i].textkey;
let parts = key.split("$"); let parts = key.split("$");
let identifier = parts[0]; let identifier = parts[0];
let component = (parts.length > 1)?parts[1]:'local_treestudyplan'; let component = (parts.length > 1)?parts[1]:plugin;
stringkeys.push({ key: identifier, component: component}); stringkeys.push({ key: identifier, component: component});
} }
getstr_func(stringkeys).then(function(strings){ getstr_func(stringkeys).then(function(strings){

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494). $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
$plugin->version = 2024031003; // YYYYMMDDHH (year, month, day, iteration). $plugin->version = 2024032200; // YYYYMMDDHH (year, month, day, iteration).
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11). $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
$plugin->release = "1.1.6"; $plugin->release = "1.1.6";