1 line
14 KiB
Plaintext
1 line
14 KiB
Plaintext
![]() |
{"version":3,"file":"page-edit-plan.min.js","sources":["../src/page-edit-plan.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 notification from 'core/notification';\nimport Vue from './vue';\nimport EditorComponents from './studyplan-editor-components';\nimport TSComponents from './treestudyplan-components';\nimport ModalComponents from './modedit-modal';\nimport Debugger from './debugger';\n\nimport {load_strings} from './string-helper';\nimport {ProcessStudyplan} from './studyplan-processor';\nimport {download,upload} from './downloader';\n\nimport PortalVue from './portal-vue';\nimport BootstrapVue from './bootstrap-vue';\nimport {Drag, Drop, DropList} from './vue-easy-dnd';\nVue.use(PortalVue);\nVue.use(BootstrapVue);\nVue.use(TSComponents);\nVue.use(EditorComponents);\nvue.use(ModalComponents);\nVue.component('drag',Drag);\nVue.component('drop',Drop);\nVue.component('drop-list',DropList);\n\n\nimport vue from './vue';\n\nconst debug = new Debugger(\"treestudyplan\");\ndebug.enable();\n\n\nlet strings = load_strings({\n studyplan: {\n studyplan_select_placeholder: 'studyplan_select_placeholder',\n },\n});\n\n/**\n * Initialize the Page\n * @param {int} contextid The context we should attempt to work in (1:1 related to the category)\n * @param {int} categoryid The category we shoud attempt to work in (1:1 related to the context)\n */\nexport function init(contextid,categoryid) {\n // Make sure the id's are numeric and integer\n if(undefined === contextid || !Number.isInteger(contextid) || contextid < 1 ){ contextid = 1;}\n if(undefined === categoryid || !Number.isInteger(categoryid)){ categoryid = 0;}\n\n const in_systemcontext = (contextid <= 1);\n\n // Setup the initial Vue app for this page\n let app = new Vue({\n el: '#root',\n data: {\n create: {\n studyplan: {\n name: '',\n shortname: '',\n description: '',\n slots : 4,\n startdate: '2020-08-01',\n enddate: '',\n aggregation: 'bistate',\n aggregation_config: '',\n }\n },\n toolbox: {\n right: true,\n },\n activestudyplan: null,\n loadingstudyplan: false,\n studyplans: [],\n frameworks: [],\n badges: [],\n courses: [],\n text: strings.studyplan,\n usedcontexts: [],\n },\n created() {\n this.$root.$on('studyplanRemoved',(studyplan)=>{\n \n if(app.activestudyplan == studyplan){\n app.activestudyplan = null;\n }\n\n // remove studyplan from index list\n let index = null;\n for(let idx in app.studyplans){\n if(app.studyplans[idx].id == studyplan.id){\n index = idx;\n break;\n }\n }\n if(index){\n app.studyplans.splice(index, 1);\n }\n\n });\n },\n mounted() {\n call([{\n methodname: 'local_treestudyplan_list_studyplans',\n args: { context_id: contextid}\n }])[0].done(function(response){\n const timingval = { future: 0, present: 1, past: 2, };\n response.sort((a,b) => {\n const timinga = TSComponents.studyplanTiming(a);\n const timingb = TSComponents.studyplanTiming(b);\n\n let t = timingval[timinga] - timingval[timingb];\n if(t == 0
|