Initial Commit
This commit is contained in:
commit
8316669b71
4
.gitignore
vendored
Executable file
4
.gitignore
vendored
Executable file
|
@ -0,0 +1,4 @@
|
|||
/.vs
|
||||
/node_modules
|
||||
/amd/build
|
||||
/build
|
101
Gruntfile.js
Normal file
101
Gruntfile.js
Normal file
|
@ -0,0 +1,101 @@
|
|||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
/* jshint node: true, browser: false */
|
||||
/* eslint-env node */
|
||||
|
||||
/**
|
||||
* Grunt configuration for local_treestudyplan
|
||||
*
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Grunt configuration.
|
||||
*
|
||||
* @param {Grunt} grunt
|
||||
*/
|
||||
module.exports = function(grunt) {
|
||||
const path = require('path');
|
||||
const process = require('process');
|
||||
const sass = require('sass');
|
||||
|
||||
// Import grunt configuration for 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', () => {
|
||||
|
||||
const devoutput = 'css/devstyles.css';
|
||||
const prodoutput = 'styles.css';
|
||||
|
||||
// Get full path of compenent and scss folder
|
||||
const componentPath = path.join(grunt.moodleEnv.gruntFilePath,grunt.moodleEnv.componentDirectory);
|
||||
const scssPath = path.join(componentPath, 'scss','styles.scss');
|
||||
console.log(`Compiling ${scssPath} including any imported files therein`);
|
||||
|
||||
process.chdir(path.join(componentPath, 'scss'));
|
||||
const result = sass.compile(scssPath);
|
||||
if ( result ) {
|
||||
console.info("got result");
|
||||
|
||||
// Some regex processing to match moodle stylelint styles
|
||||
|
||||
// change tab indent to 4 instead of 2
|
||||
let css = result.css.replace(/^ ([^ ])/gm ," $1");
|
||||
|
||||
// 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
|
||||
});
|
||||
|
||||
// replace hex color codes with lowercase (convenience function since I don't really care for the hex codes lowercase only rule)
|
||||
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)
|
||||
|
||||
// All other errors should really be fixed in the scss files :)
|
||||
|
||||
[devoutput,prodoutput].forEach((output) => {
|
||||
console.info(`Storing ${output}`);
|
||||
grunt.file.write(path.join(componentPath, output),css);
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Rebuild on changes in the scss files when using 'grunt watch'
|
||||
grunt.config.merge({
|
||||
watch: {
|
||||
scssplugin: {
|
||||
files: ['scss/*.scss'],
|
||||
tasks: ['scssplugin']
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Remove gherkinlint from the startup list, since it exits with an error because of errors in moodle's own code
|
||||
grunt.moodleEnv.startupTasks.splice(grunt.moodleEnv.startupTasks.indexOf("gherkinlint"),1);
|
||||
|
||||
// Add the 'scssplugin' task as a startup task.
|
||||
grunt.moodleEnv.startupTasks.push('scssplugin');
|
||||
|
||||
|
||||
};
|
4
LICENSE
Executable file
4
LICENSE
Executable file
|
@ -0,0 +1,4 @@
|
|||
Copyright (C) 2024 Peter-Martijn Kuipers
|
||||
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 , USA. Also add information on how to contact you by electronic and paper mail.
|
29
amd/src/tool_sptoolboxmanager.js
Normal file
29
amd/src/tool_sptoolboxmanager.js
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*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 {call} from 'core/ajax';
|
||||
import notification from 'core/notification';
|
||||
import {load_strings} from 'local_treestudyplan/util/string-helper';
|
||||
import Debugger from 'local_treestudyplan/util/debugger';
|
||||
|
||||
let debug = new Debugger("mytreestudyplan");
|
||||
debug.enable();
|
||||
|
||||
let strings = load_strings({
|
||||
studyplan: {
|
||||
|
||||
},
|
||||
},"tool_sptoolboxmgr");
|
||||
|
||||
/**
|
||||
* Initialize the Page
|
||||
*/
|
||||
export function init() {
|
||||
|
||||
}
|
76
build.php
Normal file
76
build.php
Normal file
|
@ -0,0 +1,76 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Build script to properly create a distribution zip
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define('CLI_SCRIPT', true);
|
||||
require_once("../../config.php");
|
||||
$plugin = new stdClass;
|
||||
require_once('version.php');
|
||||
|
||||
$a = explode("_", $plugin->component, 2);
|
||||
$plugin->type = $a[0];
|
||||
$plugin->name = $a[1];
|
||||
|
||||
$excludepaths = [
|
||||
"build", // Dir for build zip files.
|
||||
"build/*",
|
||||
"build.*",
|
||||
"vuemode.sh",
|
||||
"amd/src",
|
||||
"amd/src/*",
|
||||
".git",
|
||||
".git/*",
|
||||
".gitignore",
|
||||
"*.zip",
|
||||
];
|
||||
|
||||
// Determine some paths.
|
||||
$wd = realpath(dirname(__FILE__));
|
||||
$parent = dirname($wd);
|
||||
$plugindirname = basename($wd);
|
||||
$builddir = $wd."/"."build";
|
||||
$zipname = $builddir."/"."{$plugin->name}-{$plugin->version}.zip";
|
||||
|
||||
// Create the exclude line.
|
||||
$exclude = "-x ";
|
||||
foreach ($excludepaths as $x) {
|
||||
$exclude .= "'{$plugindirname}/{$x}' ";
|
||||
}
|
||||
|
||||
if (!is_dir($builddir)) {
|
||||
mkdir($builddir);
|
||||
if (!is_dir($builddir)) {
|
||||
print("Cannot access dir '{$builddir}' to store zip files\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (file_exists($zipfile)) {
|
||||
print("Zip file '{$zipfile}' already exists. Exiting...\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$cwd = getcwd();
|
||||
chdir($parent);
|
||||
|
||||
$cmd = "zip -r '{$zipname}' '{$plugindirname}' {$exclude}";
|
||||
system($cmd);
|
||||
|
||||
chdir($cwd);
|
14
build.sh
Executable file
14
build.sh
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/bin/bash
|
||||
SCRIPTDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
WD=`pwd`
|
||||
|
||||
# run the grunt script in the scripts working directory
|
||||
cd $SCRIPTDIR
|
||||
grunt amd
|
||||
|
||||
# run the build php script
|
||||
php ${SCRIPTDIR}/build.php $@
|
||||
|
||||
|
||||
# return to the working directory
|
||||
cd $WD
|
4
css/devstyles.css
Normal file
4
css/devstyles.css
Normal file
|
@ -0,0 +1,4 @@
|
|||
/* stylelint-disable length-zero-no-unit, color-hex-case, color-hex-length*/
|
||||
.path-admin-tool-sptoolboxmgr [v-cloak] {
|
||||
visibility: hidden;
|
||||
}
|
26
db/access.php
Executable file
26
db/access.php
Executable file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Permission descriptions
|
||||
* @package block_mytreestudyplan
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$capabilities = [
|
||||
|
||||
];
|
25
lang/en/tool_sptoolboxmgr.php
Executable file
25
lang/en/tool_sptoolboxmgr.php
Executable file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* English language file
|
||||
* @package tool_sptoolboxmgr
|
||||
* @copyright 2024 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'ToolboxManager (Studyplan)';
|
||||
$string['toolboxmanager'] = 'ToolboxManager';
|
||||
|
25
lang/nl/tool_sptoolboxmgr.php
Executable file
25
lang/nl/tool_sptoolboxmgr.php
Executable file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Dutch language file
|
||||
* @package tool_sptoolboxmgr
|
||||
* @copyright 2024 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['pluginname'] = 'ToolboxBeheer (Studieplan)';
|
||||
$string['toolboxmanager'] = 'ToolboxBeheer';
|
||||
|
21
lib.php
Executable file
21
lib.php
Executable file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Library page
|
||||
* @package tool_sptoolboxmgr
|
||||
* @copyright 2023 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
7
scss/styles.scss
Normal file
7
scss/styles.scss
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* stylelint-disable length-zero-no-unit, color-hex-case, color-hex-length*/
|
||||
|
||||
.path-admin-tool-sptoolboxmgr{
|
||||
[v-cloak] {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
21
settings.php
Executable file
21
settings.php
Executable file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Settings page
|
||||
* @package tool_sptoolboxmgr
|
||||
* @copyright 2024 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
4
styles.css
Executable file
4
styles.css
Executable file
|
@ -0,0 +1,4 @@
|
|||
/* stylelint-disable length-zero-no-unit, color-hex-case, color-hex-length*/
|
||||
.path-admin-tool-sptoolboxmgr [v-cloak] {
|
||||
visibility: hidden;
|
||||
}
|
51
templates/block.mustache
Normal file
51
templates/block.mustache
Normal file
|
@ -0,0 +1,51 @@
|
|||
{{!
|
||||
This file is part of Moodle - https://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template block_mytreestudyplan/block
|
||||
|
||||
Render my treestudyplan block
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Context variables required for this template:
|
||||
* none
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
}
|
||||
}}
|
||||
|
||||
<div id='block_mytreestudyplan'>
|
||||
<div class='vue-loader' v-show='false'>
|
||||
<div class='spinner-border text-primary' role='status'>
|
||||
<span class='sr-only'>Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div v-cloak>
|
||||
{{^teachermode}}
|
||||
<r-report type="own"></r-report>
|
||||
{{/teachermode}}
|
||||
{{#teachermode}}
|
||||
<r-report type='teaching' teachermode></r-report>
|
||||
{{/teachermode}}
|
||||
|
||||
</div>
|
||||
</div>
|
35
version.php
Normal file
35
version.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
// This file is part of the Studyplan plugin for Moodle
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <https://www.gnu.org/licenses/>.
|
||||
/**
|
||||
* Version description
|
||||
* @package tool_sptoolboxmgr
|
||||
* @copyright 2024 P.M. Kuipers
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'tool_sptoolboxmgr'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494).
|
||||
$plugin->version = 2024032200; // YYYYMMDDHH (year, month, day, iteration).
|
||||
$plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
|
||||
|
||||
$plugin->release = "1.0.0";
|
||||
$plugin->maturity = MATURITY_RC;
|
||||
// Supported from Moodle 3.11 to 4.2 (4.3 not yet tested).
|
||||
$plugin->supported = [ 311, 402 ];
|
||||
|
||||
$plugin->dependencies = [
|
||||
'local_treestudyplan' => 2024031300,
|
||||
];
|
Loading…
Reference in New Issue
Block a user