Compare commits
212 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6d7dbaa685 | |||
| 05d7ba80e0 | |||
| cdd969bc64 | |||
| 4f5ad93e83 | |||
| c8f275ceb0 | |||
| 87bb565607 | |||
| 333811ca7b | |||
| b052925815 | |||
| f29ee3a772 | |||
| a059ee52a4 | |||
| 1e8a05b13a | |||
| 263e28634f | |||
| e40b7928c9 | |||
| f783ae12d9 | |||
| 730e131ad5 | |||
| 951465e810 | |||
| fd9fbe61da | |||
| ed07b798e9 | |||
| d4308f1113 | |||
| a1fa5e7178 | |||
| a484fcb09d | |||
| a17a59c8fe | |||
| cf7429e55e | |||
| 38a6eb9739 | |||
| cdc78a16a5 | |||
| 6a4801b152 | |||
| 4c00836de9 | |||
| e66a822d8a | |||
| 9f905c73fd | |||
| 8a6a7d7e36 | |||
| a2d230777f | |||
| 3fe211d602 | |||
| 865cd7235e | |||
| 2b61c1b77c | |||
| c653a49fe3 | |||
| 15c282d1e5 | |||
| d8ce474882 | |||
| 9fc9168f1c | |||
| bb864ee2e1 | |||
| d96a108ea0 | |||
| 9c6d7dbf7b | |||
| 8c1587e612 | |||
| 3679e8d579 | |||
| e0dcb76a41 | |||
| 90290e5957 | |||
| 64b9992366 | |||
| 3c18fd4e3d | |||
| 523ee08608 | |||
| e650d04b34 | |||
| bb228c82c1 | |||
| cdfae47f94 | |||
| 93052dde8d | |||
| c2e5f45769 | |||
| c6691f7ef7 | |||
| 7139d3404f | |||
| 0cdd0b34f6 | |||
| 1c3084df01 | |||
| 95430c15f9 | |||
| 5d9b0a171b | |||
| 14403a8cb8 | |||
| 5971de4590 | |||
| 950c3a59cc | |||
| 960cfda886 | |||
| eb0c520ad6 | |||
| 646c691107 | |||
| 23fb69bbe3 | |||
| 498c78e23a | |||
| 83b7836068 | |||
| 2cae00d9d3 | |||
| d7de09d272 | |||
| 28761c2eba | |||
| 48a9189c12 | |||
| 5b5c4361ee | |||
| 33b053ede8 | |||
| 5c762b40bf | |||
| ca0bf01e23 | |||
| 1bd98e1641 | |||
| ef132f0ab4 | |||
| 62a90218e1 | |||
| 360b0271a5 | |||
| fe8d169b36 | |||
| b3c3f4e0ba | |||
| 6fc3618bd5 | |||
| 034ffb924b | |||
| 3ee0da8f17 | |||
| a6f5c43c9f | |||
| c2f8050802 | |||
| e3c9bab5e5 | |||
| 383a8f5fc7 | |||
| c1441da84a | |||
| 18eee87ae9 | |||
| cbd3fd7d9c | |||
| 729ca7f2f8 | |||
| 7a87dac5cd | |||
| 0196f5326f | |||
| 2b0be5b36c | |||
| 6513f39863 | |||
| 2407b79b8b | |||
| a77a75fe72 | |||
| ea801b6374 | |||
| 554911ee4e | |||
| 7052e98f2c | |||
| 6701dbec13 | |||
| bd56366374 | |||
| 3310bf9924 | |||
| 21e61a347e | |||
| 134a7ca404 | |||
| 7b519f1c20 | |||
| 65b49f5be6 | |||
| 171c9cc802 | |||
| 4e4f395994 | |||
| 1755da1e81 | |||
| c3facdf7dc | |||
| 0b79f9fdf1 | |||
| 3b2234ee76 | |||
| b57b50cc0c | |||
| 781c3438c2 | |||
| e8721581cd | |||
| ef6a2e594f | |||
| 3b32118506 | |||
| 77857ced5a | |||
| 48a0d87f2f | |||
| d6984b7616 | |||
| ad1c072d04 | |||
| e6aeab1fc0 | |||
| 6994e82281 | |||
| eb5efbd0ca | |||
| d130a9d0b7 | |||
| b9e8a9af10 | |||
| 3bb11e2ab4 | |||
| 9ce0d04ceb | |||
| 75968fb87e | |||
| a268911ffe | |||
| 5707de083a | |||
| 8d97af30c0 | |||
| bcb55ea61a | |||
| 6af84076b0 | |||
| efd150059b | |||
| e91a1432d1 | |||
| 7c9b0751f8 | |||
| 66396cf4a5 | |||
| 0f0b8bbf68 | |||
| 1142892aca | |||
| 1330fadb00 | |||
| 3d7e4f8900 | |||
| 27ec971d45 | |||
| 261f79884f | |||
| 20797726bb | |||
| f92877a5a3 | |||
| 8b5e15ef5b | |||
| 62fe7519b8 | |||
| 579498f9fa | |||
| b447e683f7 | |||
| 4b9d3d514d | |||
| 30aa6960fc | |||
| 072f686193 | |||
| 3e4dd17c54 | |||
| a1059b10c1 | |||
| 19c1c5fea6 | |||
| 29936a7238 | |||
| 8f46c10cb8 | |||
| b9348695f6 | |||
| b2c031f401 | |||
| 071ea825b7 | |||
| 5e8812bfc5 | |||
| 0b00e04cf3 | |||
| a0386b12ad | |||
| 75df86e057 | |||
| 3fc51cf8b4 | |||
| 42bcaa8aa7 | |||
| 46cbfbfb21 | |||
| 26ac673e3e | |||
| fc2020f573 | |||
| 957ac32358 | |||
| 838b33b9ab | |||
| 36b4656906 | |||
| e44f94b493 | |||
| acbfa890f6 | |||
| d9bde2ab22 | |||
| 1dd52d7b47 | |||
| 4eda8d0571 | |||
| 4b919b20bc | |||
| 9835d6920f | |||
| 517e301d5a | |||
| 1bd5d40c8f | |||
| 00ebf601ff | |||
| 8d8b24a320 | |||
| 04c907d433 | |||
| 573de6d923 | |||
| 158518c79e | |||
| 42e9f29f8a | |||
| 4eebc40ec3 | |||
| 32d68836a4 | |||
| ae8b4733fd | |||
| 21865b22e7 | |||
| 1fcccd8722 | |||
| 0f6643a972 | |||
| 6c8fd471b4 | |||
| b5dd9b2e8a | |||
| c95fad5c21 | |||
| 0b73fde437 | |||
| 36100ed441 | |||
| 48fac357b6 | |||
| 76756f1e10 | |||
| f2b9070a2c | |||
| edfcc33471 | |||
| 9d49d402eb | |||
| f773514761 | |||
| c31822a6b4 | |||
| f84ab6c2e4 | |||
| 817212be50 | |||
| cf7238ac5e |
@@ -227,7 +227,7 @@
|
||||
},
|
||||
// We're using babel transpiling so use their parser
|
||||
// for linting.
|
||||
parser: 'babel-eslint',
|
||||
parser: '@babel/eslint-parser',
|
||||
// Check AMD with some slightly stricter rules.
|
||||
rules: {
|
||||
'no-unused-vars': 'error',
|
||||
@@ -300,7 +300,8 @@
|
||||
},
|
||||
parserOptions: {
|
||||
'ecmaVersion': 9,
|
||||
'sourceType': 'module'
|
||||
'sourceType': 'module',
|
||||
'requireConfigFile': false,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
+119
-44
@@ -30,6 +30,7 @@
|
||||
* @param {String} srcPath the matched src path
|
||||
* @return {String} The rewritten destination path.
|
||||
*/
|
||||
|
||||
const babelRename = function(destPath, srcPath) {
|
||||
destPath = srcPath.replace('src', 'build');
|
||||
destPath = destPath.replace('.js', '.min.js');
|
||||
@@ -53,65 +54,139 @@ module.exports = grunt => {
|
||||
|
||||
// Register JS tasks.
|
||||
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
|
||||
grunt.registerTask('amd', ['ignorefiles', 'eslint:amd', 'babel']);
|
||||
grunt.registerTask('amd', ['ignorefiles', 'eslint:amd', 'rollup']);
|
||||
grunt.registerTask('js', ['amd', 'yui']);
|
||||
|
||||
// Register NPM tasks.
|
||||
grunt.loadNpmTasks('grunt-contrib-uglify');
|
||||
grunt.loadNpmTasks('grunt-contrib-watch');
|
||||
grunt.loadNpmTasks('grunt-rollup');
|
||||
|
||||
// Load the Babel tasks and config.
|
||||
grunt.loadNpmTasks('grunt-babel');
|
||||
const babelTransform = require('@babel/core').transform;
|
||||
const babel = (options = {}) => {
|
||||
return {
|
||||
name: 'babel',
|
||||
|
||||
transform: (code, id) => {
|
||||
grunt.log.debug(`Transforming ${id}`);
|
||||
options.filename = id;
|
||||
const transformed = babelTransform(code, options);
|
||||
|
||||
return {
|
||||
code: transformed.code,
|
||||
map: transformed.map
|
||||
};
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
// Note: We have to use a rate limit plugin here because rollup runs all tasks asynchronously and in parallel.
|
||||
// When we kick off a full run, if we kick off a rollup of every file this will fork-bomb the machine.
|
||||
// To work around this we use a concurrent Promise queue based on the number of available processors.
|
||||
const rateLimit = () => {
|
||||
const queue = [];
|
||||
let queueRunner;
|
||||
|
||||
const startQueue = () => {
|
||||
if (queueRunner) {
|
||||
return;
|
||||
}
|
||||
|
||||
queueRunner = setTimeout(() => {
|
||||
const limit = Math.max(1, require('os').cpus().length / 2);
|
||||
grunt.log.debug(`Starting rollup with queue size of ${limit}`);
|
||||
runQueue(limit);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
// The queue runner will run the next `size` items in the queue.
|
||||
const runQueue = (size = 1) => {
|
||||
queue.splice(0, size).forEach(resolve => {
|
||||
resolve();
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
name: 'ratelimit',
|
||||
|
||||
// The options hook is run in parallel.
|
||||
// We can return an unresolved Promise which is queued for later resolution.
|
||||
options: async() => {
|
||||
return new Promise(resolve => {
|
||||
queue.push(resolve);
|
||||
startQueue();
|
||||
});
|
||||
},
|
||||
|
||||
// When an item in the queue completes, start the next item in the queue.
|
||||
buildEnd: () => {
|
||||
runQueue();
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
const terser = require('rollup-plugin-terser').terser;
|
||||
grunt.config.merge({
|
||||
babel: {
|
||||
rollup: {
|
||||
options: {
|
||||
sourceMaps: true,
|
||||
comments: false,
|
||||
format: 'esm',
|
||||
dir: 'output',
|
||||
sourcemap: true,
|
||||
treeshake: false,
|
||||
context: 'window',
|
||||
plugins: [
|
||||
'transform-es2015-modules-amd-lazy',
|
||||
'system-import-transformer',
|
||||
// This plugin modifies the Babel transpiling for "export default"
|
||||
// so that if it's used then only the exported value is returned
|
||||
// by the generated AMD module.
|
||||
//
|
||||
// It also adds the Moodle plugin name to the AMD module definition
|
||||
// so that it can be imported as expected in other modules.
|
||||
path.resolve('.grunt/babel-plugin-add-module-to-define.js'),
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-syntax-import-meta',
|
||||
['@babel/plugin-proposal-class-properties', {'loose': false}],
|
||||
'@babel/plugin-proposal-json-strings'
|
||||
rateLimit(),
|
||||
babel({
|
||||
sourceMaps: true,
|
||||
comments: false,
|
||||
compact: false,
|
||||
plugins: [
|
||||
'transform-es2015-modules-amd-lazy',
|
||||
'system-import-transformer',
|
||||
// This plugin modifies the Babel transpiling for "export default"
|
||||
// so that if it's used then only the exported value is returned
|
||||
// by the generated AMD module.
|
||||
//
|
||||
// It also adds the Moodle plugin name to the AMD module definition
|
||||
// so that it can be imported as expected in other modules.
|
||||
path.resolve('.grunt/babel-plugin-add-module-to-define.js'),
|
||||
'@babel/plugin-syntax-dynamic-import',
|
||||
'@babel/plugin-syntax-import-meta',
|
||||
['@babel/plugin-proposal-class-properties', {'loose': false}],
|
||||
'@babel/plugin-proposal-json-strings'
|
||||
],
|
||||
presets: [
|
||||
['@babel/preset-env', {
|
||||
targets: {
|
||||
browsers: [
|
||||
">0.25%",
|
||||
"last 2 versions",
|
||||
"not ie <= 10",
|
||||
"not op_mini all",
|
||||
"not Opera > 0",
|
||||
"not dead"
|
||||
]
|
||||
},
|
||||
modules: false,
|
||||
useBuiltIns: false
|
||||
}]
|
||||
]
|
||||
}),
|
||||
|
||||
terser({
|
||||
// Do not mangle variables.
|
||||
// Makes debugging easier.
|
||||
mangle: false,
|
||||
}),
|
||||
],
|
||||
presets: [
|
||||
['minify', {
|
||||
// This minification plugin needs to be disabled because it breaks the
|
||||
// source map generation and causes invalid source maps to be output.
|
||||
simplify: false,
|
||||
builtIns: false
|
||||
}],
|
||||
['@babel/preset-env', {
|
||||
targets: {
|
||||
browsers: [
|
||||
">0.25%",
|
||||
"last 2 versions",
|
||||
"not ie <= 10",
|
||||
"not op_mini all",
|
||||
"not Opera > 0",
|
||||
"not dead"
|
||||
]
|
||||
},
|
||||
modules: false,
|
||||
useBuiltIns: false
|
||||
}]
|
||||
]
|
||||
},
|
||||
dist: {
|
||||
files: [{
|
||||
expand: true,
|
||||
src: grunt.moodleEnv.files ? grunt.moodleEnv.files : grunt.moodleEnv.amdSrc,
|
||||
rename: babelRename
|
||||
}]
|
||||
}
|
||||
}],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -132,7 +207,7 @@ module.exports = grunt => {
|
||||
let changedFiles = Object.create(null);
|
||||
const onChange = grunt.util._.debounce(function() {
|
||||
const files = Object.keys(changedFiles);
|
||||
grunt.config('babel.dist.files', [{expand: true, src: files, rename: babelRename}]);
|
||||
grunt.config('rollup.dist.files', [{expand: true, src: files, rename: babelRename}]);
|
||||
changedFiles = Object.create(null);
|
||||
}, 200);
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// 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/>.
|
||||
|
||||
/**
|
||||
* Endpoint to get the Moodle version
|
||||
*
|
||||
* Moodle linkchecker will check this endpoint when it cannot get the Moodle version otherwise.
|
||||
*
|
||||
* @package core
|
||||
* @copyright 2022 Victor Deniz <victor@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(__DIR__ . '/../../config.php');
|
||||
require_once($CFG->libdir . '/filelib.php');
|
||||
|
||||
// Get public key.
|
||||
$key = download_file_content(HUB_STATSPUBLICKEY);
|
||||
// Check $key is a valid public key.
|
||||
$publickey = openssl_pkey_get_public($key);
|
||||
if ($publickey !== false) {
|
||||
$publickeystr = openssl_pkey_get_details($publickey)['key'];
|
||||
} else {
|
||||
die('Error getting a valid public key');
|
||||
}
|
||||
|
||||
// Encrypt data.
|
||||
$message = $CFG->release;
|
||||
$success = openssl_public_encrypt(utf8_encode($message), $encrypteddata, $publickeystr);
|
||||
|
||||
if ($success) {
|
||||
echo base64_encode($encrypteddata);
|
||||
} else {
|
||||
die ('Error encrypting the data');
|
||||
}
|
||||
@@ -163,7 +163,8 @@ if (!empty($capabilities)) {
|
||||
echo html_writer::start_tag('div', array('class'=>'submit_buttons'));
|
||||
$attrs = array('type'=>'submit', 'name'=>'savechanges', 'value'=>get_string('savechanges'), 'class'=>'btn btn-primary');
|
||||
echo html_writer::empty_tag('input', $attrs);
|
||||
$attrs = array('type'=>'submit', 'name'=>'cancel', 'value'=>get_string('cancel'), 'class' => 'btn btn-secondary');
|
||||
$attrs = array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('cancel'),
|
||||
'class' => 'btn btn-secondary ml-1');
|
||||
echo html_writer::empty_tag('input', $attrs);
|
||||
echo html_writer::end_tag('div');
|
||||
echo html_writer::end_tag('div');
|
||||
|
||||
@@ -231,6 +231,9 @@ if ($hassiteconfig) {
|
||||
array('0' => new lang_string('none'), '1' => new lang_string('allfiles'), '2' => new lang_string('htmlfilesonly')));
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchoneperpage', new lang_string('filtermatchoneperpage', 'admin'), new lang_string('configfiltermatchoneperpage', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filtermatchonepertext', new lang_string('filtermatchonepertext', 'admin'), new lang_string('configfiltermatchonepertext', 'admin'), 0);
|
||||
$items[] = new admin_setting_configcheckbox('filternavigationwithsystemcontext',
|
||||
new lang_string('filternavigationwithsystemcontext', 'admin'),
|
||||
new lang_string('configfilternavigationwithsystemcontext', 'admin'), 0);
|
||||
foreach ($items as $item) {
|
||||
$item->set_updatedcallback('reset_text_filters_cache');
|
||||
$temp->add($item);
|
||||
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_analytics/log_info",["jquery","core/str","core/modal_factory","core/notification"],function(a,b,c,d){return{loadInfo:function loadInfo(e,f){var g=a("[data-model-log-id=\""+e+"\"]");b.get_string("loginfo","tool_analytics").then(function(b){var d=a("<ul>");f.forEach(function(a){d.append("<li>"+a+"</li>")});d.append("</ul>");return c.create({title:b,body:d.html(),large:!0},g)}).catch(d.exception)}}});
|
||||
//# sourceMappingURL=log_info.min.js.map
|
||||
/**
|
||||
* Shows a dialogue with info about this logs.
|
||||
*
|
||||
* @module tool_analytics/log_info
|
||||
* @copyright 2017 David Monllao {@link http://www.davidmonllao.com}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_analytics/log_info",["jquery","core/str","core/modal_factory","core/notification"],(function($,str,ModalFactory,Notification){return{loadInfo:function(id,info){var link=$('[data-model-log-id="'+id+'"]');str.get_string("loginfo","tool_analytics").then((function(langString){var bodyInfo=$("<ul>");return info.forEach((function(item){bodyInfo.append("<li>"+item+"</li>")})),bodyInfo.append("</ul>"),ModalFactory.create({title:langString,body:bodyInfo.html(),large:!0},link)})).catch(Notification.exception)}}}));
|
||||
|
||||
//# sourceMappingURL=log_info.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/log_info.js"],"names":["define","$","str","ModalFactory","Notification","loadInfo","id","info","link","get_string","then","langString","bodyInfo","forEach","item","append","create","title","body","html","large","catch","exception"],"mappings":"AAsBAA,OAAM,2BAAC,CAAC,QAAD,CAAW,UAAX,CAAuB,oBAAvB,CAA6C,mBAA7C,CAAD,CAAoE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA+BC,CAA/B,CAA6C,CAEnH,MAAoD,CAShDC,QAAQ,CAAE,kBAASC,CAAT,CAAaC,CAAb,CAAmB,CAEzB,GAAIC,CAAAA,CAAI,CAAGP,CAAC,CAAC,wBAAyBK,CAAzB,CAA8B,KAA/B,CAAZ,CACAJ,CAAG,CAACO,UAAJ,CAAe,SAAf,CAA0B,gBAA1B,EAA4CC,IAA5C,CAAiD,SAASC,CAAT,CAAqB,CAElE,GAAIC,CAAAA,CAAQ,CAAGX,CAAC,CAAC,MAAD,CAAhB,CACAM,CAAI,CAACM,OAAL,CAAa,SAASC,CAAT,CAAe,CACxBF,CAAQ,CAACG,MAAT,CAAgB,OAASD,CAAT,CAAgB,OAAhC,CACH,CAFD,EAGAF,CAAQ,CAACG,MAAT,CAAgB,OAAhB,EAEA,MAAOZ,CAAAA,CAAY,CAACa,MAAb,CAAoB,CACvBC,KAAK,CAAEN,CADgB,CAEvBO,IAAI,CAAEN,CAAQ,CAACO,IAAT,EAFiB,CAGvBC,KAAK,GAHkB,CAApB,CAIJZ,CAJI,CAMV,CAdD,EAcGa,KAdH,CAcSjB,CAAY,CAACkB,SAdtB,CAeH,CA3B+C,CA6BvD,CA/BK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Shows a dialogue with info about this logs.\n *\n * @module tool_analytics/log_info\n * @copyright 2017 David Monllao {@link http://www.davidmonllao.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, str, ModalFactory, Notification) {\n\n return /** @alias module:tool_analytics/log_info */ {\n\n /**\n * Prepares a modal info for a log's results.\n *\n * @method loadInfo\n * @param {int} id\n * @param {string[]} info\n */\n loadInfo: function(id, info) {\n\n var link = $('[data-model-log-id=\"' + id + '\"]');\n str.get_string('loginfo', 'tool_analytics').then(function(langString) {\n\n var bodyInfo = $(\"<ul>\");\n info.forEach(function(item) {\n bodyInfo.append('<li>' + item + '</li>');\n });\n bodyInfo.append(\"</ul>\");\n\n return ModalFactory.create({\n title: langString,\n body: bodyInfo.html(),\n large: true,\n }, link);\n\n }).catch(Notification.exception);\n }\n };\n});\n"],"file":"log_info.min.js"}
|
||||
{"version":3,"file":"log_info.min.js","sources":["../src/log_info.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Shows a dialogue with info about this logs.\n *\n * @module tool_analytics/log_info\n * @copyright 2017 David Monllao {@link http://www.davidmonllao.com}\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/str', 'core/modal_factory', 'core/notification'], function($, str, ModalFactory, Notification) {\n\n return /** @alias module:tool_analytics/log_info */ {\n\n /**\n * Prepares a modal info for a log's results.\n *\n * @method loadInfo\n * @param {int} id\n * @param {string[]} info\n */\n loadInfo: function(id, info) {\n\n var link = $('[data-model-log-id=\"' + id + '\"]');\n str.get_string('loginfo', 'tool_analytics').then(function(langString) {\n\n var bodyInfo = $(\"<ul>\");\n info.forEach(function(item) {\n bodyInfo.append('<li>' + item + '</li>');\n });\n bodyInfo.append(\"</ul>\");\n\n return ModalFactory.create({\n title: langString,\n body: bodyInfo.html(),\n large: true,\n }, link);\n\n }).catch(Notification.exception);\n }\n };\n});\n"],"names":["define","$","str","ModalFactory","Notification","loadInfo","id","info","link","get_string","then","langString","bodyInfo","forEach","item","append","create","title","body","html","large","catch","exception"],"mappings":";;;;;;;AAsBAA,iCAAO,CAAC,SAAU,WAAY,qBAAsB,sBAAsB,SAASC,EAAGC,IAAKC,aAAcC,oBAEjD,CAShDC,SAAU,SAASC,GAAIC,UAEfC,KAAOP,EAAE,uBAAyBK,GAAK,MAC3CJ,IAAIO,WAAW,UAAW,kBAAkBC,MAAK,SAASC,gBAElDC,SAAWX,EAAE,eACjBM,KAAKM,SAAQ,SAASC,MAClBF,SAASG,OAAO,OAASD,KAAO,YAEpCF,SAASG,OAAO,SAETZ,aAAaa,OAAO,CACvBC,MAAON,WACPO,KAAMN,SAASO,OACfC,OAAO,GACRZ,SAEJa,MAAMjB,aAAakB"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_analytics/model",["jquery","core/str","core/log","core/notification","core/modal_factory","core/modal_events","core/templates"],function(b,c,d,e,f,g,h){var i={clear:{title:{key:"clearpredictions",component:"tool_analytics"},body:{key:"clearmodelpredictions",component:"tool_analytics"}},delete:{title:{key:"delete",component:"tool_analytics"},body:{key:"deletemodelconfirmation",component:"tool_analytics"}}},j=function(a){var c=b(a).closest("[data-model-name]");if(c.length){return c.attr("data-model-name")}else{d.error("Unexpected DOM error - unable to obtain the model name");return""}};return{confirmAction:function confirmAction(a,h){b("[data-action-id=\""+a+"\"]").on("click",function(k){k.preventDefault();var l=b(k.currentTarget);if("undefined"==typeof i[h]){d.error("Action \""+h+"\" is not allowed.");return}var a=[i[h].title,i[h].body];a[1].param=j(l);var m=c.get_strings(a),n=f.create({type:f.types.SAVE_CANCEL});b.when(m,n).then(function(a,b){b.setTitle(a[0]);b.setBody(a[1]);b.setSaveButtonText(a[0]);b.getRoot().on(g.save,function(){window.location.href=l.attr("href")});b.show();return b}).fail(e.exception)})},selectEvaluationOptions:function selectEvaluationOptions(a,d){b("[data-action-id=\""+a+"\"]").on("click",function(i){i.preventDefault();var j=b(i.currentTarget),a=b(this).attr("data-timesplitting-methods"),k=c.get_strings([{key:"evaluatemodel",component:"tool_analytics"},{key:"evaluate",component:"tool_analytics"}]),l=f.create({type:f.types.SAVE_CANCEL}),m=h.render("tool_analytics/evaluation_options",{trainedexternally:d,timesplittingmethods:JSON.parse(a)});b.when(k,l).then(function(a,c){c.getRoot().on(g.hidden,c.destroy.bind(c));c.setTitle(a[0]);c.setSaveButtonText(a[1]);c.setBody(m);c.getRoot().on(g.save,function(){var a=b("input[name='evaluationmode']:checked").val();if("trainedmodel"==a){j.attr("href",j.attr("href")+"&mode=trainedmodel")}var c=b("#id-evaluation-timesplitting").val();j.attr("href",j.attr("href")+"×plitting="+c);window.location.href=j.attr("href")});c.show();return c}).fail(e.exception)})},selectExportOptions:function selectExportOptions(a,d){b("[data-action-id=\""+a+"\"]").on("click",function(i){i.preventDefault();var j=b(i.currentTarget);if(!d){j.attr("href",j.attr("href")+"&action=exportmodel&includeweights=0");window.location.href=j.attr("href");return}var a=c.get_strings([{key:"export",component:"tool_analytics"}]),k=f.create({type:f.types.SAVE_CANCEL}),l=h.render("tool_analytics/export_options",{});b.when(a,k).then(function(a,c){c.getRoot().on(g.hidden,c.destroy.bind(c));c.setTitle(a[0]);c.setSaveButtonText(a[0]);c.setBody(l);c.getRoot().on(g.save,function(){var a=b("input[name='exportoption']:checked").val();if("exportdata"==a){j.attr("href",j.attr("href")+"&action=exportdata")}else{j.attr("href",j.attr("href")+"&action=exportmodel");if(b("#id-includeweights").is(":checked")){j.attr("href",j.attr("href")+"&includeweights=1")}else{j.attr("href",j.attr("href")+"&includeweights=0")}}window.location.href=j.attr("href")});c.show();return c}).fail(e.exception)})}}});
|
||||
//# sourceMappingURL=model.min.js.map
|
||||
/**
|
||||
* AMD module for model actions confirmation.
|
||||
*
|
||||
* @module tool_analytics/model
|
||||
* @copyright 2017 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_analytics/model",["jquery","core/str","core/log","core/notification","core/modal_factory","core/modal_events","core/templates"],(function($,Str,log,Notification,ModalFactory,ModalEvents,Templates){var actionsList={clear:{title:{key:"clearpredictions",component:"tool_analytics"},body:{key:"clearmodelpredictions",component:"tool_analytics"}},delete:{title:{key:"delete",component:"tool_analytics"},body:{key:"deletemodelconfirmation",component:"tool_analytics"}}};return{confirmAction:function(actionId,actionType){$('[data-action-id="'+actionId+'"]').on("click",(function(ev){ev.preventDefault();var a=$(ev.currentTarget);if(void 0!==actionsList[actionType]){var wrap,reqStrings=[actionsList[actionType].title,actionsList[actionType].body];reqStrings[1].param=(wrap=$(a).closest("[data-model-name]")).length?wrap.attr("data-model-name"):(log.error("Unexpected DOM error - unable to obtain the model name"),"");var stringsPromise=Str.get_strings(reqStrings),modalPromise=ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL});$.when(stringsPromise,modalPromise).then((function(strings,modal){return modal.setTitle(strings[0]),modal.setBody(strings[1]),modal.setSaveButtonText(strings[0]),modal.getRoot().on(ModalEvents.save,(function(){window.location.href=a.attr("href")})),modal.show(),modal})).fail(Notification.exception)}else log.error('Action "'+actionType+'" is not allowed.')}))},selectEvaluationOptions:function(actionId,trainedOnlyExternally){$('[data-action-id="'+actionId+'"]').on("click",(function(ev){ev.preventDefault();var a=$(ev.currentTarget),timeSplittingMethods=$(this).attr("data-timesplitting-methods"),stringsPromise=Str.get_strings([{key:"evaluatemodel",component:"tool_analytics"},{key:"evaluate",component:"tool_analytics"}]),modalPromise=ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL}),bodyPromise=Templates.render("tool_analytics/evaluation_options",{trainedexternally:trainedOnlyExternally,timesplittingmethods:JSON.parse(timeSplittingMethods)});$.when(stringsPromise,modalPromise).then((function(strings,modal){return modal.getRoot().on(ModalEvents.hidden,modal.destroy.bind(modal)),modal.setTitle(strings[0]),modal.setSaveButtonText(strings[1]),modal.setBody(bodyPromise),modal.getRoot().on(ModalEvents.save,(function(){"trainedmodel"==$("input[name='evaluationmode']:checked").val()&&a.attr("href",a.attr("href")+"&mode=trainedmodel");var timeSplittingMethod=$("#id-evaluation-timesplitting").val();a.attr("href",a.attr("href")+"×plitting="+timeSplittingMethod),window.location.href=a.attr("href")})),modal.show(),modal})).fail(Notification.exception)}))},selectExportOptions:function(actionId,isTrained){$('[data-action-id="'+actionId+'"]').on("click",(function(ev){ev.preventDefault();var a=$(ev.currentTarget);if(!isTrained)return a.attr("href",a.attr("href")+"&action=exportmodel&includeweights=0"),void(window.location.href=a.attr("href"));var stringsPromise=Str.get_strings([{key:"export",component:"tool_analytics"}]),modalPromise=ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL}),bodyPromise=Templates.render("tool_analytics/export_options",{});$.when(stringsPromise,modalPromise).then((function(strings,modal){return modal.getRoot().on(ModalEvents.hidden,modal.destroy.bind(modal)),modal.setTitle(strings[0]),modal.setSaveButtonText(strings[0]),modal.setBody(bodyPromise),modal.getRoot().on(ModalEvents.save,(function(){"exportdata"==$("input[name='exportoption']:checked").val()?a.attr("href",a.attr("href")+"&action=exportdata"):(a.attr("href",a.attr("href")+"&action=exportmodel"),$("#id-includeweights").is(":checked")?a.attr("href",a.attr("href")+"&includeweights=1"):a.attr("href",a.attr("href")+"&includeweights=0")),window.location.href=a.attr("href")})),modal.show(),modal})).fail(Notification.exception)}))}}}));
|
||||
|
||||
//# sourceMappingURL=model.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_analytics/potential-contexts",["jquery","core/ajax"],function(a,b){return{processResults:function processResults(b,c){var d=[];if(a.isArray(c)){a.each(c,function(a,b){d.push({value:b.id,label:b.name})});return d}else{return c}},transport:function transport(c,d,e,f){var g,h=a(c).attr("modelid")||null;g=b.call([{methodname:"tool_analytics_potential_contexts",args:{query:d,modelid:h}}]);g[0].then(e).fail(f)}}});
|
||||
//# sourceMappingURL=potential-contexts.min.js.map
|
||||
/**
|
||||
* Potential contexts selector module.
|
||||
*
|
||||
* @module tool_analytics/potential-contexts
|
||||
* @copyright 2019 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_analytics/potential-contexts",["jquery","core/ajax"],(function($,Ajax){return{processResults:function(selector,results){var contexts=[];return $.isArray(results)?($.each(results,(function(index,context){contexts.push({value:context.id,label:context.name})})),contexts):results},transport:function(selector,query,success,failure){var modelid=$(selector).attr("modelid")||null;Ajax.call([{methodname:"tool_analytics_potential_contexts",args:{query:query,modelid:modelid}}])[0].then(success).fail(failure)}}}));
|
||||
|
||||
//# sourceMappingURL=potential-contexts.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/potential-contexts.js"],"names":["define","$","Ajax","processResults","selector","results","contexts","isArray","each","index","context","push","value","id","label","name","transport","query","success","failure","promise","modelid","attr","call","methodname","args","then","fail"],"mappings":"AAuBAA,OAAM,qCAAC,CAAC,QAAD,CAAW,WAAX,CAAD,CAA0B,SAASC,CAAT,CAAYC,CAAZ,CAAkB,CAE9C,MAA8D,CAE1DC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAA4B,CACxC,GAAIC,CAAAA,CAAQ,CAAG,EAAf,CACA,GAAIL,CAAC,CAACM,OAAF,CAAUF,CAAV,CAAJ,CAAwB,CACpBJ,CAAC,CAACO,IAAF,CAAOH,CAAP,CAAgB,SAASI,CAAT,CAAgBC,CAAhB,CAAyB,CACrCJ,CAAQ,CAACK,IAAT,CAAc,CACVC,KAAK,CAAEF,CAAO,CAACG,EADL,CAEVC,KAAK,CAAEJ,CAAO,CAACK,IAFL,CAAd,CAIH,CALD,EAMA,MAAOT,CAAAA,CAEV,CATD,IASO,CACH,MAAOD,CAAAA,CACV,CACJ,CAhByD,CAkB1DW,SAAS,CAAE,mBAASZ,CAAT,CAAmBa,CAAnB,CAA0BC,CAA1B,CAAmCC,CAAnC,CAA4C,IAC/CC,CAAAA,CAD+C,CAG/CC,CAAO,CAAGpB,CAAC,CAACG,CAAD,CAAD,CAAYkB,IAAZ,CAAiB,SAAjB,GAA+B,IAHM,CAInDF,CAAO,CAAGlB,CAAI,CAACqB,IAAL,CAAU,CAAC,CACjBC,UAAU,CAAE,mCADK,CAEjBC,IAAI,CAAE,CACFR,KAAK,CAAEA,CADL,CAEFI,OAAO,CAAEA,CAFP,CAFW,CAAD,CAAV,CAAV,CAQAD,CAAO,CAAC,CAAD,CAAP,CAAWM,IAAX,CAAgBR,CAAhB,EAAyBS,IAAzB,CAA8BR,CAA9B,CACH,CA/ByD,CAmCjE,CArCK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential contexts selector module.\n *\n * @module tool_analytics/potential-contexts\n * @copyright 2019 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax'], function($, Ajax) {\n\n return /** @alias module:tool_analytics/potential-contexts */ {\n\n processResults: function(selector, results) {\n var contexts = [];\n if ($.isArray(results)) {\n $.each(results, function(index, context) {\n contexts.push({\n value: context.id,\n label: context.name\n });\n });\n return contexts;\n\n } else {\n return results;\n }\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n let modelid = $(selector).attr('modelid') || null;\n promise = Ajax.call([{\n methodname: 'tool_analytics_potential_contexts',\n args: {\n query: query,\n modelid: modelid\n }\n }]);\n\n promise[0].then(success).fail(failure);\n }\n\n };\n\n});\n"],"file":"potential-contexts.min.js"}
|
||||
{"version":3,"file":"potential-contexts.min.js","sources":["../src/potential-contexts.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential contexts selector module.\n *\n * @module tool_analytics/potential-contexts\n * @copyright 2019 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax'], function($, Ajax) {\n\n return /** @alias module:tool_analytics/potential-contexts */ {\n\n processResults: function(selector, results) {\n var contexts = [];\n if ($.isArray(results)) {\n $.each(results, function(index, context) {\n contexts.push({\n value: context.id,\n label: context.name\n });\n });\n return contexts;\n\n } else {\n return results;\n }\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n let modelid = $(selector).attr('modelid') || null;\n promise = Ajax.call([{\n methodname: 'tool_analytics_potential_contexts',\n args: {\n query: query,\n modelid: modelid\n }\n }]);\n\n promise[0].then(success).fail(failure);\n }\n\n };\n\n});\n"],"names":["define","$","Ajax","processResults","selector","results","contexts","isArray","each","index","context","push","value","id","label","name","transport","query","success","failure","modelid","attr","call","methodname","args","then","fail"],"mappings":";;;;;;;AAuBAA,2CAAO,CAAC,SAAU,cAAc,SAASC,EAAGC,YAEsB,CAE1DC,eAAgB,SAASC,SAAUC,aAC3BC,SAAW,UACXL,EAAEM,QAAQF,UACVJ,EAAEO,KAAKH,SAAS,SAASI,MAAOC,SAC5BJ,SAASK,KAAK,CACVC,MAAOF,QAAQG,GACfC,MAAOJ,QAAQK,UAGhBT,UAGAD,SAIfW,UAAW,SAASZ,SAAUa,MAAOC,QAASC,aAGtCC,QAAUnB,EAAEG,UAAUiB,KAAK,YAAc,KACnCnB,KAAKoB,KAAK,CAAC,CACjBC,WAAY,oCACZC,KAAM,CACFP,MAAOA,MACPG,QAASA,YAIT,GAAGK,KAAKP,SAASQ,KAAKP"}
|
||||
admin/tool/analytics/tests/external_test.php → admin/tool/analytics/tests/external/external_test.php
Vendored
+8
-4
@@ -24,13 +24,17 @@
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
|
||||
namespace tool_analytics\external;
|
||||
|
||||
use externallib_advanced_testcase;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
require_once(__DIR__ . '/../../../../analytics/tests/fixtures/test_indicator_max.php');
|
||||
require_once(__DIR__ . '/../../../../analytics/tests/fixtures/test_target_course_level_shortname.php');
|
||||
require_once($CFG->dirroot . '/analytics/tests/fixtures/test_indicator_max.php');
|
||||
require_once($CFG->dirroot . '/analytics/tests/fixtures/test_target_course_level_shortname.php');
|
||||
|
||||
/**
|
||||
* Tool analytics external functions tests
|
||||
@@ -41,7 +45,7 @@ require_once(__DIR__ . '/../../../../analytics/tests/fixtures/test_target_course
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
* @since Moodle 3.8
|
||||
*/
|
||||
class tool_analytics_external_testcase extends externallib_advanced_testcase {
|
||||
class external_test extends externallib_advanced_testcase {
|
||||
|
||||
/**
|
||||
* test_potential_contexts description
|
||||
@@ -73,7 +77,7 @@ class tool_analytics_external_testcase extends externallib_advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$this->assertCount(2, \tool_analytics\external::potential_contexts());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
<?php
|
||||
// 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 <https://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for behat_form_text class
|
||||
*
|
||||
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_behat;
|
||||
|
||||
use behat_form_text;
|
||||
use Behat\Mink\Session;
|
||||
use Behat\Mink\Element\NodeElement;
|
||||
use core_string_manager_standard;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
global $CFG;
|
||||
require_once($CFG->libdir . '/behat/classes/behat_session_interface.php');
|
||||
require_once($CFG->libdir . '/behat/classes/behat_session_trait.php');
|
||||
require_once($CFG->libdir . '/behat/form_field/behat_form_text.php');
|
||||
|
||||
/**
|
||||
* Tests for the behat_form_text class
|
||||
*
|
||||
* @package tool_behat
|
||||
* @category test
|
||||
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*
|
||||
* @covers \behat_form_text
|
||||
* @covers \behat_form_field
|
||||
*/
|
||||
class behat_form_text_test extends \basic_testcase {
|
||||
|
||||
/**
|
||||
* Data provider for the test_set_get_value() method.
|
||||
*
|
||||
* @return array of value and expectation pairs to be tested.
|
||||
*/
|
||||
public function provider_test_set_get_value() {
|
||||
return [
|
||||
'null' => [null, null],
|
||||
'int' => [3, 3],
|
||||
'float' => [3.14, 3.14],
|
||||
'string' => ['hello', 'hello'],
|
||||
'utf8' => ['你好', '你好'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the set_value() and get_value() methods.
|
||||
*
|
||||
* @param mixed $value value to be set.
|
||||
* @param mixed $expectation value to be checked.
|
||||
* @dataProvider provider_test_set_get_value()
|
||||
*/
|
||||
public function test_set_get_value($value, $expectation) {
|
||||
$session = $this->createMock(Session::class);
|
||||
$node = $this->createMock(NodeElement::class);
|
||||
$node->method('getValue')->willReturn($value);
|
||||
$field = new behat_form_text($session, $node);
|
||||
|
||||
$field->set_value($value);
|
||||
$this->assertEquals($expectation, $field->get_value());
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for the test_text_matches() method.
|
||||
*
|
||||
* @return array of decsep, value, match and result pairs to be tested.
|
||||
*/
|
||||
public function provider_test_matches() {
|
||||
return [
|
||||
'lazy true' => ['.', 'hello', 'hello', true],
|
||||
'lazy false' => ['.', 'hello', 'bye', false],
|
||||
'float true' => ['.', '3.14', '3.1400', true],
|
||||
'float false' => ['.', '3.14', '3.1401', false],
|
||||
'float and float string true' => ['.', 3.14, '3.1400', true],
|
||||
'float and unrelated string false' => ['.', 3.14, 'hello', false],
|
||||
'float hash decsep true' => ['#', '3#14', '3#1400', true],
|
||||
'float hash decsep false' => ['#', '3#14', '3#1401', false],
|
||||
'float and float string hash decsep true' => ['#', 3.14, '3.1400', true],
|
||||
'float and unrelated string hash decsep false' => ['#', 3.14, 'hello', false],
|
||||
'float custom-default decsep mix1 true' => ['#', '3#14', '3.1400', true],
|
||||
'float custom-default decsep mix2 true' => ['#', '3.14', '3#1400', true],
|
||||
'float 2-custom decsep mix1 false' => ['#', '3#14', '3,1400', false],
|
||||
'float 2-custom decsep mix2 false' => [',', '3#14', '3,1400', false],
|
||||
'float default-custom decsep mix1 false' => ['.', '3#14', '3.1400', false],
|
||||
'float default-custom decsep mix2 false' => ['.', '3.14', '3#1400', false],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the matches() method.
|
||||
*
|
||||
* @param string $decsep decimal separator to use.
|
||||
* @param mixed $value value to be set.
|
||||
* @param mixed $match value to be matched.
|
||||
* @param bool $result expected return status of the function.
|
||||
* @dataProvider provider_test_matches()
|
||||
*/
|
||||
public function test_matches($decsep, $value, $match, $result) {
|
||||
global $CFG;
|
||||
|
||||
// Switch of string manager to avoid having to (slow) customise the lang file.
|
||||
$origcustom = $CFG->config_php_settings['customstringmanager'] ?? null;
|
||||
$CFG->config_php_settings['customstringmanager'] = '\tool_behat\phpunit_string_manager';
|
||||
$manager = get_string_manager(true);
|
||||
$manager->set_string('decsep', 'langconfig', $decsep);
|
||||
|
||||
$session = $this->createMock(Session::class);
|
||||
$node = $this->createMock(NodeElement::class);
|
||||
$node->method('getValue')->willReturn($value);
|
||||
|
||||
$field = new behat_form_text($session, $node);
|
||||
|
||||
$field->set_value($value);
|
||||
$this->assertSame($result, $field->matches($match));
|
||||
|
||||
// Switch back to the original string manager.
|
||||
if (is_null($origcustom)) {
|
||||
unset($CFG->config_php_settings['customstringmanager']);
|
||||
} else {
|
||||
$CFG->config_php_settings['customstringmanager'] = $origcustom;
|
||||
}
|
||||
$manager = get_string_manager(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Customised values that will be used instead of standard manager one.
|
||||
*
|
||||
* If an existing component/identifier is found, return it instead of the real
|
||||
* one from language files. Note this doesn't support place holders or another niceties.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @category test
|
||||
* @copyright 2022 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
|
||||
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class phpunit_string_manager extends core_string_manager_standard {
|
||||
|
||||
/** @var array language customisations provided by the manager without asking for real contents */
|
||||
protected $customstrings = [];
|
||||
|
||||
/**
|
||||
* Get String returns a requested string
|
||||
*
|
||||
* @param string $identifier The identifier of the string to search for
|
||||
* @param string $component The module the string is associated with
|
||||
* @param string|object|array $a An object, string or number that can be used
|
||||
* within translation strings
|
||||
* @param string $lang moodle translation language, null means use current
|
||||
* @return string The String !
|
||||
*/
|
||||
public function get_string($identifier, $component = '', $a = null, $lang = null) {
|
||||
$key = trim($component) . '/' . trim($identifier);
|
||||
if (isset($this->customstrings[$key])) {
|
||||
return $this->customstrings[$key];
|
||||
}
|
||||
return parent::get_string($identifier, $component, $a, $lang);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a custom string to be returned by the string manager instead of the language file one.
|
||||
*
|
||||
* @param string $identifier The identifier of the string to search for
|
||||
* @param string $component The module the string is associated with
|
||||
* @param string $value the contents of the language string to be returned by get_string()
|
||||
*/
|
||||
public function set_string($identifier, $component, $value) {
|
||||
$key = trim($component) . '/' . trim($identifier);
|
||||
$this->customstrings[$key] = $value;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// @codingStandardsIgnoreFile
|
||||
// phpcs:ignoreFile
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<XMLDB PATH="admin/tool/brickfield/db" VERSION="20200215" COMMENT="XMLDB file for Moodle admin/tool/brickfield"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
|
||||
xsi:noNamespaceSchemaLocation="../../../../lib/xmldb/xmldb.xsd"
|
||||
>
|
||||
<TABLES>
|
||||
<TABLE NAME="tool_brickfield_checks" COMMENT="Checks details">
|
||||
|
||||
@@ -101,6 +101,6 @@ class printable_test extends \advanced_testcase {
|
||||
$object->set_filter($filter);
|
||||
$output = $object->get_output();
|
||||
$this->assertStringContainsString('<i class="icon fa fa-tachometer fa-fw " title="Total activities" '.
|
||||
'aria-label="Total activities">', $output);
|
||||
'role="img" aria-label="Total activities">', $output);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -22,7 +22,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_capability\event;
|
||||
|
||||
/**
|
||||
* Class for capability overview events.
|
||||
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2014 Petr Skoda
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
class tool_capability_events_testcase extends advanced_testcase {
|
||||
class events_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Setup testcase.
|
||||
@@ -54,11 +54,11 @@ class tool_capability_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_capability\event\report_viewed', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
$expected = array(SITEID, "admin", "tool capability", "tool/capability/index.php");
|
||||
$this->assertEventLegacyLogData($expected, $event);
|
||||
$this->assertEventContextNotUsed($event);
|
||||
$url = new moodle_url('/admin/tool/capability/index.php');
|
||||
$url = new \moodle_url('/admin/tool/capability/index.php');
|
||||
$this->assertEquals($url, $event->get_url());
|
||||
$event->get_name();
|
||||
}
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-tool_capability-search",function(s,t){var e=function(){e.superclass.constructor.apply(this,arguments)};e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,cancel:null,lastsearch:null,initializer:function(){this.form=s.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(t){var e=t.get("value");this.selectoptions[e]=t},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=s.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"data-fieldtype="text"></div>'),e=s.Node.create('<label for="capabilitysearch"><span class="sr-only"'+this.get("strsearch")+"</span></label>");this.cancel=s.Node.create('<a class="btn btn-clear d-none icon-no-margin"><i class="icon fa fa-times fa-fw " aria-hidden="true"></i></a>'),this.input=s.Node.create('<input type="text" class="form-control withclear" placeholder="'+this.get("strsearch")+'"id="capabilitysearch" />'),t.append(e).append(this.input).append(this.cancel),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.cancel.on("click",function(){this.input.set("value",""),this.typed()},this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",""===this.select.get("value"))},typed:function(){var t,e=this.input.get("value"),s=0,i=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(s++,i=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===s?this.input.addClass("error"):(this.input.removeClass("error"),1===s&&i.set("selected",!0)),""!==e?this.cancel.removeClass("d-none"):this.cancel.addClass("d-none"),this.validate()}},s.extend(e,s.Base,e.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(t){new e(t)}},"@VERSION@",{requires:["base","node"]});
|
||||
YUI.add("moodle-tool_capability-search",function(s,t){var e=function(){e.superclass.constructor.apply(this,arguments)};s.extend(e,s.Base,e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,cancel:null,lastsearch:null,initializer:function(){this.form=s.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(t){var e=t.get("value");this.selectoptions[e]=t},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=s.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"data-fieldtype="text"></div>'),e=s.Node.create('<label for="capabilitysearch"><span class="sr-only"'+this.get("strsearch")+"</span></label>");this.cancel=s.Node.create('<a class="btn btn-clear d-none icon-no-margin"><i class="icon fa fa-times fa-fw " aria-hidden="true"></i></a>'),this.input=s.Node.create('<input type="text" class="form-control withclear" placeholder="'+this.get("strsearch")+'"id="capabilitysearch" />'),t.append(e).append(this.input).append(this.cancel),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.cancel.on("click",function(){this.input.set("value",""),this.typed()},this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",""===this.select.get("value"))},typed:function(){var t,e=this.input.get("value"),s=0,i=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(s++,i=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===s?this.input.addClass("error"):(this.input.removeClass("error"),1===s&&i.set("selected",!0)),""!==e?this.cancel.removeClass("d-none"):this.cancel.addClass("d-none"),this.validate()}},{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(t){new e(t)}},"@VERSION@",{requires:["base","node"]});
|
||||
@@ -14,17 +14,7 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_cohortroles
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
use tool_cohortroles\api;
|
||||
namespace tool_cohortroles;
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
@@ -33,17 +23,17 @@ use tool_cohortroles\api;
|
||||
* @copyright 2015 Damyon Wiese
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
/** @var stdClass $cohort */
|
||||
class api_test extends \advanced_testcase {
|
||||
/** @var \stdClass $cohort */
|
||||
protected $cohort = null;
|
||||
|
||||
/** @var stdClass $userassignto */
|
||||
/** @var \stdClass $userassignto */
|
||||
protected $userassignto = null;
|
||||
|
||||
/** @var stdClass $userassignover */
|
||||
/** @var \stdClass $userassignover */
|
||||
protected $userassignover = null;
|
||||
|
||||
/** @var stdClass $role */
|
||||
/** @var \stdClass $role */
|
||||
protected $role = null;
|
||||
|
||||
/**
|
||||
@@ -67,7 +57,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
'roleid' => $this->roleid,
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::create_cohort_role_assignment($params);
|
||||
}
|
||||
|
||||
@@ -105,7 +95,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->setUser($this->userassignto);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::delete_cohort_role_assignment($result->get('id'));
|
||||
}
|
||||
|
||||
@@ -117,7 +107,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
'cohortid' => $this->cohort->id
|
||||
);
|
||||
$result = api::create_cohort_role_assignment($params);
|
||||
$this->expectException(dml_missing_record_exception::class);
|
||||
$this->expectException(\dml_missing_record_exception::class);
|
||||
api::delete_cohort_role_assignment($result->get('id') + 1);
|
||||
}
|
||||
|
||||
@@ -274,7 +264,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
|
||||
$this->assertEquals($sync, $expected);
|
||||
|
||||
// Verify roles assigned by any other component are not removed.
|
||||
$usercontext = context_user::instance($this->userassignover->id);
|
||||
$usercontext = \context_user::instance($this->userassignover->id);
|
||||
role_assign($this->roleid, $this->userassignto->id, $usercontext->id);
|
||||
$sync = api::sync_all_cohort_roles();
|
||||
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
<FIELD NAME="lang" TYPE="char" LENGTH="20" NOTNULL="true" SEQUENCE="false" COMMENT="The code of the language this string belongs to. Like en, cs or es"/>
|
||||
<FIELD NAME="componentid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The id of the component"/>
|
||||
<FIELD NAME="stringid" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" COMMENT="The identifier of the string"/>
|
||||
<FIELD NAME="original" TYPE="text" LENGTH="big" NOTNULL="true" SEQUENCE="false" COMMENT="English original of the string"/>
|
||||
<FIELD NAME="master" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Master translation of the string as is distributed in the official lang pack, null if not translated"/>
|
||||
<FIELD NAME="local" TYPE="text" LENGTH="big" NOTNULL="false" SEQUENCE="false" COMMENT="Local customization of the string, null if not customized"/>
|
||||
<FIELD NAME="original" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="English original of the string"/>
|
||||
<FIELD NAME="master" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Master translation of the string as is distributed in the official lang pack, null if not translated"/>
|
||||
<FIELD NAME="local" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Local customization of the string, null if not customized"/>
|
||||
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="The timestamp of when the original or master was recently modified"/>
|
||||
<FIELD NAME="timecustomized" TYPE="int" LENGTH="10" NOTNULL="false" SEQUENCE="false" COMMENT="The timestamp of when the value of the local translation was recently modified, null if not customized yet"/>
|
||||
<FIELD NAME="outdated" TYPE="int" LENGTH="3" NOTNULL="false" DEFAULT="0" SEQUENCE="false" COMMENT="Either the English original or the master translation changed and the customization may be outdated"/>
|
||||
@@ -37,4 +37,4 @@
|
||||
</KEYS>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/add_category",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],function(a,b,c,d,e,f,g){var h={CATEGORY_LINK:"[data-add-element=\"category\"]"},i=function(a){this.contextId=a;this.strings=b.get_strings([{key:"addcategory",component:"tool_dataprivacy"},{key:"save",component:"admin"}]);this.registerEventListeners()};i.prototype.contextId=0;i.prototype.strings=0;i.prototype.registerEventListeners=function(){var b=a(h.CATEGORY_LINK);b.on("click",function(){return this.strings.then(function(a){e.create({type:e.types.SAVE_CANCEL,title:a[0],body:""},b).done(function(b){this.setupFormModal(b,a[1])}.bind(this))}.bind(this)).fail(d.exception)}.bind(this))};i.prototype.getBody=function(a){var b=null;if("undefined"!=typeof a){b={jsonformdata:JSON.stringify(a)}}return g.loadFragment("tool_dataprivacy","addcategory_form",this.contextId,b)};i.prototype.setupFormModal=function(a,b){a.setLarge();a.setSaveButtonText(b);a.getRoot().on(f.hidden,this.destroy.bind(this));a.setBody(this.getBody());a.getRoot().on(f.save,this.submitForm.bind(this));a.getRoot().on("submit","form",this.submitFormAjax.bind(this));this.modal=a;a.show()};i.prototype.submitForm=function(a){a.preventDefault();this.modal.getRoot().find("form").submit()};i.prototype.submitFormAjax=function(a){a.preventDefault();var b=this.modal.getRoot().find("form").serialize();c.call([{methodname:"tool_dataprivacy_create_category_form",args:{jsonformdata:JSON.stringify(b)},done:function(a){if(a.validationerrors){this.modal.setBody(this.getBody(b))}else{this.close()}}.bind(this),fail:d.exception}])};i.prototype.close=function(){this.destroy();document.location.reload()};i.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",function(){M.core_formchangechecker.reset_form_dirty_state()});this.modal.destroy()};i.prototype.removeListeners=function(){a(h.CATEGORY_LINK).off("click")};return{getInstance:function getInstance(a){return new i(a)}}});
|
||||
//# sourceMappingURL=add_category.min.js.map
|
||||
/**
|
||||
* Module to add categories.
|
||||
*
|
||||
* @module tool_dataprivacy/add_category
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/add_category",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],(function($,Str,Ajax,Notification,ModalFactory,ModalEvents,Fragment){var SELECTORS_CATEGORY_LINK='[data-add-element="category"]',AddCategory=function(contextId){this.contextId=contextId;this.strings=Str.get_strings([{key:"addcategory",component:"tool_dataprivacy"},{key:"save",component:"admin"}]),this.registerEventListeners()};return AddCategory.prototype.contextId=0,AddCategory.prototype.strings=0,AddCategory.prototype.registerEventListeners=function(){var trigger=$(SELECTORS_CATEGORY_LINK);trigger.on("click",function(){return this.strings.then(function(strings){ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:strings[0],body:""},trigger).done(function(modal){this.setupFormModal(modal,strings[1])}.bind(this))}.bind(this)).fail(Notification.exception)}.bind(this))},AddCategory.prototype.getBody=function(formdata){var params=null;return void 0!==formdata&&(params={jsonformdata:JSON.stringify(formdata)}),Fragment.loadFragment("tool_dataprivacy","addcategory_form",this.contextId,params)},AddCategory.prototype.setupFormModal=function(modal,saveText){modal.setLarge(),modal.setSaveButtonText(saveText),modal.getRoot().on(ModalEvents.hidden,this.destroy.bind(this)),modal.setBody(this.getBody()),modal.getRoot().on(ModalEvents.save,this.submitForm.bind(this)),modal.getRoot().on("submit","form",this.submitFormAjax.bind(this)),this.modal=modal,modal.show()},AddCategory.prototype.submitForm=function(e){e.preventDefault(),this.modal.getRoot().find("form").submit()},AddCategory.prototype.submitFormAjax=function(e){e.preventDefault();var formData=this.modal.getRoot().find("form").serialize();Ajax.call([{methodname:"tool_dataprivacy_create_category_form",args:{jsonformdata:JSON.stringify(formData)},done:function(data){data.validationerrors?this.modal.setBody(this.getBody(formData)):this.close()}.bind(this),fail:Notification.exception}])},AddCategory.prototype.close=function(){this.destroy(),document.location.reload()},AddCategory.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",(function(){M.core_formchangechecker.reset_form_dirty_state()})),this.modal.destroy()},AddCategory.prototype.removeListeners=function(){$(SELECTORS_CATEGORY_LINK).off("click")},{getInstance:function(contextId){return new AddCategory(contextId)}}}));
|
||||
|
||||
//# sourceMappingURL=add_category.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/add_purpose",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],function(a,b,c,d,e,f,g){var h={PURPOSE_LINK:"[data-add-element=\"purpose\"]"},i=function(a){this.contextId=a;this.strings=b.get_strings([{key:"addpurpose",component:"tool_dataprivacy"},{key:"save",component:"admin"}]);this.registerEventListeners()};i.prototype.contextId=0;i.prototype.strings=0;i.prototype.registerEventListeners=function(){var b=a(h.PURPOSE_LINK);b.on("click",function(){return this.strings.then(function(a){e.create({type:e.types.SAVE_CANCEL,title:a[0],body:""},b).done(function(b){this.setupFormModal(b,a[1])}.bind(this))}.bind(this)).fail(d.exception)}.bind(this))};i.prototype.getBody=function(a){var b=null;if("undefined"!=typeof a){b={jsonformdata:JSON.stringify(a)}}return g.loadFragment("tool_dataprivacy","addpurpose_form",this.contextId,b)};i.prototype.setupFormModal=function(a,b){a.setLarge();a.setSaveButtonText(b);a.getRoot().on(f.hidden,this.destroy.bind(this));a.setBody(this.getBody());a.getRoot().on(f.save,this.submitForm.bind(this));a.getRoot().on("submit","form",this.submitFormAjax.bind(this));this.modal=a;a.show()};i.prototype.submitForm=function(a){a.preventDefault();this.modal.getRoot().find("form").submit()};i.prototype.submitFormAjax=function(a){a.preventDefault();var b=this.modal.getRoot().find("form").serialize();c.call([{methodname:"tool_dataprivacy_create_purpose_form",args:{jsonformdata:JSON.stringify(b)},done:function(a){if(a.validationerrors){this.modal.setBody(this.getBody(b))}else{this.close()}}.bind(this),fail:d.exception}])};i.prototype.close=function(){this.destroy();document.location.reload()};i.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",function(){M.core_formchangechecker.reset_form_dirty_state()});this.modal.destroy()};i.prototype.removeListeners=function(){a(h.PURPOSE_LINK).off("click")};return{getInstance:function getInstance(a){return new i(a)}}});
|
||||
//# sourceMappingURL=add_purpose.min.js.map
|
||||
/**
|
||||
* Module to add purposes.
|
||||
*
|
||||
* @module tool_dataprivacy/add_purpose
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/add_purpose",["jquery","core/str","core/ajax","core/notification","core/modal_factory","core/modal_events","core/fragment"],(function($,Str,Ajax,Notification,ModalFactory,ModalEvents,Fragment){var SELECTORS_PURPOSE_LINK='[data-add-element="purpose"]',AddPurpose=function(contextId){this.contextId=contextId;this.strings=Str.get_strings([{key:"addpurpose",component:"tool_dataprivacy"},{key:"save",component:"admin"}]),this.registerEventListeners()};return AddPurpose.prototype.contextId=0,AddPurpose.prototype.strings=0,AddPurpose.prototype.registerEventListeners=function(){var trigger=$(SELECTORS_PURPOSE_LINK);trigger.on("click",function(){return this.strings.then(function(strings){ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:strings[0],body:""},trigger).done(function(modal){this.setupFormModal(modal,strings[1])}.bind(this))}.bind(this)).fail(Notification.exception)}.bind(this))},AddPurpose.prototype.getBody=function(formdata){var params=null;return void 0!==formdata&&(params={jsonformdata:JSON.stringify(formdata)}),Fragment.loadFragment("tool_dataprivacy","addpurpose_form",this.contextId,params)},AddPurpose.prototype.setupFormModal=function(modal,saveText){modal.setLarge(),modal.setSaveButtonText(saveText),modal.getRoot().on(ModalEvents.hidden,this.destroy.bind(this)),modal.setBody(this.getBody()),modal.getRoot().on(ModalEvents.save,this.submitForm.bind(this)),modal.getRoot().on("submit","form",this.submitFormAjax.bind(this)),this.modal=modal,modal.show()},AddPurpose.prototype.submitForm=function(e){e.preventDefault(),this.modal.getRoot().find("form").submit()},AddPurpose.prototype.submitFormAjax=function(e){e.preventDefault();var formData=this.modal.getRoot().find("form").serialize();Ajax.call([{methodname:"tool_dataprivacy_create_purpose_form",args:{jsonformdata:JSON.stringify(formData)},done:function(data){data.validationerrors?this.modal.setBody(this.getBody(formData)):this.close()}.bind(this),fail:Notification.exception}])},AddPurpose.prototype.close=function(){this.destroy(),document.location.reload()},AddPurpose.prototype.destroy=function(){Y.use("moodle-core-formchangechecker",(function(){M.core_formchangechecker.reset_form_dirty_state()})),this.modal.destroy()},AddPurpose.prototype.removeListeners=function(){$(SELECTORS_PURPOSE_LINK).off("click")},{getInstance:function(contextId){return new AddPurpose(contextId)}}}));
|
||||
|
||||
//# sourceMappingURL=add_purpose.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/categoriesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:"[data-action=\"deletecategory\"]"},h=function(){this.registerEvents()};h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name");d.get_strings([{key:"deletecategory",component:"tool_dataprivacy"},{key:"deletecategorytext",component:"tool_dataprivacy",param:i},{key:"delete"}]).then(function(d){var g=d[0],i=d[1],j=d[2];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){d.setSaveButtonText(j);d.getRoot().on(f.save,function(){b.call([{methodname:"tool_dataprivacy_delete_category",args:{id:h}}])[0].done(function(b){if(b.result){a("tr[data-categoryid=\""+h+"\"]").remove()}else{c.addNotification({message:b.warnings[0].message,type:"error"})}}).fail(c.exception)});d.getRoot().on(f.hidden,function(){d.destroy()});return d})}).done(function(a){a.show()}).fail(c.exception)})};return{init:function init(){return new h}}});
|
||||
//# sourceMappingURL=categoriesactions.min.js.map
|
||||
/**
|
||||
* AMD module for categories actions.
|
||||
*
|
||||
* @module tool_dataprivacy/categoriesactions
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/categoriesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],(function($,Ajax,Notification,Str,ModalFactory,ModalEvents){var ACTIONS_DELETE='[data-action="deletecategory"]',CategoriesActions=function(){this.registerEvents()};return CategoriesActions.prototype.registerEvents=function(){$(ACTIONS_DELETE).click((function(e){e.preventDefault();var id=$(this).data("id"),stringkeys=[{key:"deletecategory",component:"tool_dataprivacy"},{key:"deletecategorytext",component:"tool_dataprivacy",param:$(this).data("name")},{key:"delete"}];Str.get_strings(stringkeys).then((function(langStrings){var title=langStrings[0],confirmMessage=langStrings[1],buttonText=langStrings[2];return ModalFactory.create({title:title,body:confirmMessage,type:ModalFactory.types.SAVE_CANCEL}).then((function(modal){return modal.setSaveButtonText(buttonText),modal.getRoot().on(ModalEvents.save,(function(){var request={methodname:"tool_dataprivacy_delete_category",args:{id:id}};Ajax.call([request])[0].done((function(data){data.result?$('tr[data-categoryid="'+id+'"]').remove():Notification.addNotification({message:data.warnings[0].message,type:"error"})})).fail(Notification.exception)})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal}))})).done((function(modal){modal.show()})).fail(Notification.exception)}))},{init:function(){return new CategoriesActions}}}));
|
||||
|
||||
//# sourceMappingURL=categoriesactions.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/contactdpo",["exports","core_form/modalform","core/notification","core/str","core/toast"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=f(b);c=f(c);function f(a){return a&&a.__esModule?a:{default:a}}var g={CONTACT_DPO:"[data-action=\"contactdpo\"]"};a.init=function init(){var a=document.querySelector(g.CONTACT_DPO);a.addEventListener("click",function(f){f.preventDefault();var g=new b.default({modalConfig:{title:(0,d.get_string)("contactdataprotectionofficer","tool_dataprivacy")},formClass:"tool_dataprivacy\\form\\contactdpo",saveButtonText:(0,d.get_string)("send","tool_dataprivacy"),returnFocus:a});g.addEventListener(g.events.FORM_SUBMITTED,function(a){if(a.detail.result){(0,d.get_string)("requestsubmitted","tool_dataprivacy").then(e.add).catch()}else{var b=a.detail.warnings.map(function(a){return a.message});c.default.addNotification({type:"error",message:b.join("<br>")})}});g.show()})}});
|
||||
//# sourceMappingURL=contactdpo.min.js.map
|
||||
define("tool_dataprivacy/contactdpo",["exports","core_form/modalform","core/notification","core/str","core/toast"],(function(_exports,_modalform,_notification,_str,_toast){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
|
||||
/**
|
||||
* Javascript module for contacting the site DPO
|
||||
*
|
||||
* @module tool_dataprivacy/contactdpo
|
||||
* @copyright 2021 Paul Holden <paulh@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modalform=_interopRequireDefault(_modalform),_notification=_interopRequireDefault(_notification);var SELECTORS_CONTACT_DPO='[data-action="contactdpo"]';_exports.init=function(){var triggerElement=document.querySelector(SELECTORS_CONTACT_DPO);triggerElement.addEventListener("click",(function(event){event.preventDefault();var modalForm=new _modalform.default({modalConfig:{title:(0,_str.get_string)("contactdataprotectionofficer","tool_dataprivacy")},formClass:"tool_dataprivacy\\form\\contactdpo",saveButtonText:(0,_str.get_string)("send","tool_dataprivacy"),returnFocus:triggerElement});modalForm.addEventListener(modalForm.events.FORM_SUBMITTED,(function(event){if(event.detail.result)(0,_str.get_string)("requestsubmitted","tool_dataprivacy").then(_toast.add).catch();else{var warningMessages=event.detail.warnings.map((function(warning){return warning.message}));_notification.default.addNotification({type:"error",message:warningMessages.join("<br>")})}})),modalForm.show()}))}}));
|
||||
|
||||
//# sourceMappingURL=contactdpo.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/contactdpo.js"],"names":["SELECTORS","CONTACT_DPO","init","triggerElement","document","querySelector","addEventListener","event","preventDefault","modalForm","ModalForm","modalConfig","title","formClass","saveButtonText","returnFocus","events","FORM_SUBMITTED","detail","result","then","addToast","catch","warningMessages","warnings","map","warning","message","Notification","addNotification","type","join","show"],"mappings":"oNAuBA,OACA,O,sDAIMA,CAAAA,CAAS,CAAG,CACdC,WAAW,CAAE,8BADC,C,QAOE,QAAPC,CAAAA,IAAO,EAAM,CACtB,GAAMC,CAAAA,CAAc,CAAGC,QAAQ,CAACC,aAAT,CAAuBL,CAAS,CAACC,WAAjC,CAAvB,CAEAE,CAAc,CAACG,gBAAf,CAAgC,OAAhC,CAAyC,SAAAC,CAAK,CAAI,CAC9CA,CAAK,CAACC,cAAN,GAEA,GAAMC,CAAAA,CAAS,CAAG,GAAIC,UAAJ,CAAc,CAC5BC,WAAW,CAAE,CACTC,KAAK,CAAE,iBAAU,8BAAV,CAA0C,kBAA1C,CADE,CADe,CAI5BC,SAAS,CAAE,oCAJiB,CAK5BC,cAAc,CAAE,iBAAU,MAAV,CAAkB,kBAAlB,CALY,CAM5BC,WAAW,CAAEZ,CANe,CAAd,CAAlB,CAUAM,CAAS,CAACH,gBAAV,CAA2BG,CAAS,CAACO,MAAV,CAAiBC,cAA5C,CAA4D,SAAAV,CAAK,CAAI,CACjE,GAAIA,CAAK,CAACW,MAAN,CAAaC,MAAjB,CAAyB,CACrB,iBAAU,kBAAV,CAA8B,kBAA9B,EAAkDC,IAAlD,CAAuDC,KAAvD,EAAiEC,KAAjE,EACH,CAFD,IAEO,CACH,GAAMC,CAAAA,CAAe,CAAGhB,CAAK,CAACW,MAAN,CAAaM,QAAb,CAAsBC,GAAtB,CAA0B,SAAAC,CAAO,QAAIA,CAAAA,CAAO,CAACC,OAAZ,CAAjC,CAAxB,CACAC,UAAaC,eAAb,CAA6B,CACzBC,IAAI,CAAE,OADmB,CAEzBH,OAAO,CAAEJ,CAAe,CAACQ,IAAhB,CAAqB,MAArB,CAFgB,CAA7B,CAIH,CACJ,CAVD,EAYAtB,CAAS,CAACuB,IAAV,EACH,CA1BD,CA2BH,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript module for contacting the site DPO\n *\n * @module tool_dataprivacy/contactdpo\n * @copyright 2021 Paul Holden <paulh@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalForm from 'core_form/modalform';\nimport Notification from 'core/notification';\nimport {get_string as getString} from 'core/str';\nimport {add as addToast} from 'core/toast';\n\nconst SELECTORS = {\n CONTACT_DPO: '[data-action=\"contactdpo\"]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n const triggerElement = document.querySelector(SELECTORS.CONTACT_DPO);\n\n triggerElement.addEventListener('click', event => {\n event.preventDefault();\n\n const modalForm = new ModalForm({\n modalConfig: {\n title: getString('contactdataprotectionofficer', 'tool_dataprivacy'),\n },\n formClass: 'tool_dataprivacy\\\\form\\\\contactdpo',\n saveButtonText: getString('send', 'tool_dataprivacy'),\n returnFocus: triggerElement,\n });\n\n // Show a toast notification when the form is submitted.\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {\n if (event.detail.result) {\n getString('requestsubmitted', 'tool_dataprivacy').then(addToast).catch();\n } else {\n const warningMessages = event.detail.warnings.map(warning => warning.message);\n Notification.addNotification({\n type: 'error',\n message: warningMessages.join('<br>')\n });\n }\n });\n\n modalForm.show();\n });\n};\n"],"file":"contactdpo.min.js"}
|
||||
{"version":3,"file":"contactdpo.min.js","sources":["../src/contactdpo.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Javascript module for contacting the site DPO\n *\n * @module tool_dataprivacy/contactdpo\n * @copyright 2021 Paul Holden <paulh@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalForm from 'core_form/modalform';\nimport Notification from 'core/notification';\nimport {get_string as getString} from 'core/str';\nimport {add as addToast} from 'core/toast';\n\nconst SELECTORS = {\n CONTACT_DPO: '[data-action=\"contactdpo\"]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n const triggerElement = document.querySelector(SELECTORS.CONTACT_DPO);\n\n triggerElement.addEventListener('click', event => {\n event.preventDefault();\n\n const modalForm = new ModalForm({\n modalConfig: {\n title: getString('contactdataprotectionofficer', 'tool_dataprivacy'),\n },\n formClass: 'tool_dataprivacy\\\\form\\\\contactdpo',\n saveButtonText: getString('send', 'tool_dataprivacy'),\n returnFocus: triggerElement,\n });\n\n // Show a toast notification when the form is submitted.\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, event => {\n if (event.detail.result) {\n getString('requestsubmitted', 'tool_dataprivacy').then(addToast).catch();\n } else {\n const warningMessages = event.detail.warnings.map(warning => warning.message);\n Notification.addNotification({\n type: 'error',\n message: warningMessages.join('<br>')\n });\n }\n });\n\n modalForm.show();\n });\n};\n"],"names":["SELECTORS","triggerElement","document","querySelector","addEventListener","event","preventDefault","modalForm","ModalForm","modalConfig","title","formClass","saveButtonText","returnFocus","events","FORM_SUBMITTED","detail","result","then","addToast","catch","warningMessages","warnings","map","warning","message","addNotification","type","join","show"],"mappings":";;;;;;;wLA4BMA,sBACW,2CAMG,eACVC,eAAiBC,SAASC,cAAcH,uBAE9CC,eAAeG,iBAAiB,SAAS,SAAAC,OACrCA,MAAMC,qBAEAC,UAAY,IAAIC,mBAAU,CAC5BC,YAAa,CACTC,OAAO,mBAAU,+BAAgC,qBAErDC,UAAW,qCACXC,gBAAgB,mBAAU,OAAQ,oBAClCC,YAAaZ,iBAIjBM,UAAUH,iBAAiBG,UAAUO,OAAOC,gBAAgB,SAAAV,UACpDA,MAAMW,OAAOC,2BACH,mBAAoB,oBAAoBC,KAAKC,YAAUC,YAC9D,KACGC,gBAAkBhB,MAAMW,OAAOM,SAASC,KAAI,SAAAC,gBAAWA,QAAQC,iCACxDC,gBAAgB,CACzBC,KAAM,QACNF,QAASJ,gBAAgBO,KAAK,cAK1CrB,UAAUsB"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/data_deletion",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var h={MARK_FOR_DELETION:"[data-action=\"markfordeletion\"]",SELECT_ALL:"[data-action=\"selectall\"]"},i={SELECTCONTEXT:".selectcontext"},j=function(){this.registerEvents()};j.prototype.registerEvents=function(){a(h.MARK_FOR_DELETION).click(function(b){b.preventDefault();var c=[];a(i.SELECTCONTEXT).each(function(){var b=a(this);if(b.is(":checked")){c.push(b.val())}});g(c)});a(h.SELECT_ALL).change(function(b){b.preventDefault();var c=a(this);if(c.is(":checked")){a(i.SELECTCONTEXT).attr("checked","checked")}else{a(i.SELECTCONTEXT).removeAttr("checked")}})};function g(a){var g="";d.get_strings([{key:"confirm",component:"moodle"},{key:"confirmcontextdeletion",component:"tool_dataprivacy"}]).then(function(a){g=a[0];var b=a[1];return e.create({title:g,body:b,type:e.types.SAVE_CANCEL})}).then(function(d){d.setSaveButtonText(g);d.getRoot().on(f.save,function(){b.call([{methodname:"tool_dataprivacy_confirm_contexts_for_deletion",args:{ids:a}}])[0].done(function(a){if(a.result){window.location.reload()}else{c.addNotification({message:a.warnings[0].message,type:"error"})}}).fail(c.exception)});d.getRoot().on(f.hidden,function(){d.destroy()});return d}).done(function(a){a.show()}).fail(c.exception)}return j});
|
||||
//# sourceMappingURL=data_deletion.min.js.map
|
||||
/**
|
||||
* Request actions.
|
||||
*
|
||||
* @module tool_dataprivacy/data_deletion
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/data_deletion",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],(function($,Ajax,Notification,Str,ModalFactory,ModalEvents){var ACTIONS_MARK_FOR_DELETION='[data-action="markfordeletion"]',ACTIONS_SELECT_ALL='[data-action="selectall"]',SELECTORS_SELECTCONTEXT=".selectcontext",DataDeletionActions=function(){this.registerEvents()};return DataDeletionActions.prototype.registerEvents=function(){$(ACTIONS_MARK_FOR_DELETION).click((function(e){e.preventDefault();var ids,keys,wsfunction,modalTitle,selectedIds=[];$(SELECTORS_SELECTCONTEXT).each((function(){var checkbox=$(this);checkbox.is(":checked")&&selectedIds.push(checkbox.val())})),ids=selectedIds,keys=[{key:"confirm",component:"moodle"},{key:"confirmcontextdeletion",component:"tool_dataprivacy"}],wsfunction="tool_dataprivacy_confirm_contexts_for_deletion",modalTitle="",Str.get_strings(keys).then((function(langStrings){modalTitle=langStrings[0];var confirmMessage=langStrings[1];return ModalFactory.create({title:modalTitle,body:confirmMessage,type:ModalFactory.types.SAVE_CANCEL})})).then((function(modal){return modal.setSaveButtonText(modalTitle),modal.getRoot().on(ModalEvents.save,(function(){var request={methodname:wsfunction,args:{ids:ids}};Ajax.call([request])[0].done((function(data){data.result?window.location.reload():Notification.addNotification({message:data.warnings[0].message,type:"error"})})).fail(Notification.exception)})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal})).done((function(modal){modal.show()})).fail(Notification.exception)})),$(ACTIONS_SELECT_ALL).change((function(e){e.preventDefault(),$(this).is(":checked")?$(SELECTORS_SELECTCONTEXT).attr("checked","checked"):$(SELECTORS_SELECTCONTEXT).removeAttr("checked")}))},DataDeletionActions}));
|
||||
|
||||
//# sourceMappingURL=data_deletion.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/data_request_modal",["jquery","core/notification","core/custom_interaction_events","core/modal","core/modal_registry","tool_dataprivacy/events"],function(a,b,c,d,e,f){var g=!1,h={APPROVE_BUTTON:"[data-action=\"approve\"]",DENY_BUTTON:"[data-action=\"deny\"]",COMPLETE_BUTTON:"[data-action=\"complete\"]"},i=function(a){d.call(this,a)};i.TYPE="tool_dataprivacy-data_request";i.prototype=Object.create(d.prototype);i.prototype.constructor=i;i.prototype.registerEventListeners=function(){d.prototype.registerEventListeners.call(this);this.getModal().on(c.events.activate,h.APPROVE_BUTTON,function(b,c){var d=a.Event(f.approve);this.getRoot().trigger(d,this);if(!d.isDefaultPrevented()){this.hide();c.originalEvent.preventDefault()}}.bind(this));this.getModal().on(c.events.activate,h.DENY_BUTTON,function(b,c){var d=a.Event(f.deny);this.getRoot().trigger(d,this);if(!d.isDefaultPrevented()){this.hide();c.originalEvent.preventDefault()}}.bind(this));this.getModal().on(c.events.activate,h.COMPLETE_BUTTON,function(b,c){var d=a.Event(f.complete);this.getRoot().trigger(d,this);if(!d.isDefaultPrevented()){this.hide();c.originalEvent.preventDefault()}}.bind(this))};if(!g){e.register(i.TYPE,i,"tool_dataprivacy/data_request_modal");g=!0}return i});
|
||||
//# sourceMappingURL=data_request_modal.min.js.map
|
||||
/**
|
||||
* Request actions.
|
||||
*
|
||||
* @module tool_dataprivacy/data_request_modal
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/data_request_modal",["jquery","core/notification","core/custom_interaction_events","core/modal","core/modal_registry","tool_dataprivacy/events"],(function($,Notification,CustomEvents,Modal,ModalRegistry,DataPrivacyEvents){var registered=!1,SELECTORS_APPROVE_BUTTON='[data-action="approve"]',SELECTORS_DENY_BUTTON='[data-action="deny"]',SELECTORS_COMPLETE_BUTTON='[data-action="complete"]',ModalDataRequest=function(root){Modal.call(this,root)};return ModalDataRequest.TYPE="tool_dataprivacy-data_request",(ModalDataRequest.prototype=Object.create(Modal.prototype)).constructor=ModalDataRequest,ModalDataRequest.prototype.registerEventListeners=function(){Modal.prototype.registerEventListeners.call(this),this.getModal().on(CustomEvents.events.activate,SELECTORS_APPROVE_BUTTON,function(e,data){var approveEvent=$.Event(DataPrivacyEvents.approve);this.getRoot().trigger(approveEvent,this),approveEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}.bind(this)),this.getModal().on(CustomEvents.events.activate,SELECTORS_DENY_BUTTON,function(e,data){var denyEvent=$.Event(DataPrivacyEvents.deny);this.getRoot().trigger(denyEvent,this),denyEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}.bind(this)),this.getModal().on(CustomEvents.events.activate,SELECTORS_COMPLETE_BUTTON,function(e,data){var completeEvent=$.Event(DataPrivacyEvents.complete);this.getRoot().trigger(completeEvent,this),completeEvent.isDefaultPrevented()||(this.hide(),data.originalEvent.preventDefault())}.bind(this))},registered||(ModalRegistry.register(ModalDataRequest.TYPE,ModalDataRequest,"tool_dataprivacy/data_request_modal"),registered=!0),ModalDataRequest}));
|
||||
|
||||
//# sourceMappingURL=data_request_modal.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/effective_retention_period",["jquery"],function(a){var b={PURPOSE_SELECT:"#id_purposeid",RETENTION_FIELD:"#fitem_id_retention_current [data-fieldtype=static]"},c=function(a){this.purposeRetentionPeriods=a;this.registerEventListeners()},d=function(){a(b.PURPOSE_SELECT).off("change")};c.prototype.purposeRetentionPeriods=[];c.prototype.registerEventListeners=function(){a(b.PURPOSE_SELECT).on("change",function(c){var d=a(c.currentTarget).val(),e=this.purposeRetentionPeriods[d];a(b.RETENTION_FIELD).text(e)}.bind(this))};return{init:function init(a){d();return new c(a)}}});
|
||||
//# sourceMappingURL=effective_retention_period.min.js.map
|
||||
/**
|
||||
* Module to update the displayed retention period.
|
||||
*
|
||||
* @module tool_dataprivacy/effective_retention_period
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/effective_retention_period",["jquery"],(function($){var SELECTORS_PURPOSE_SELECT="#id_purposeid",SELECTORS_RETENTION_FIELD="#fitem_id_retention_current [data-fieldtype=static]",EffectiveRetentionPeriod=function(purposeRetentionPeriods){this.purposeRetentionPeriods=purposeRetentionPeriods,this.registerEventListeners()};return EffectiveRetentionPeriod.prototype.purposeRetentionPeriods=[],EffectiveRetentionPeriod.prototype.registerEventListeners=function(){$(SELECTORS_PURPOSE_SELECT).on("change",function(ev){var selected=$(ev.currentTarget).val(),selectedPurpose=this.purposeRetentionPeriods[selected];$(SELECTORS_RETENTION_FIELD).text(selectedPurpose)}.bind(this))},{init:function(purposeRetentionPeriods){return $(SELECTORS_PURPOSE_SELECT).off("change"),new EffectiveRetentionPeriod(purposeRetentionPeriods)}}}));
|
||||
|
||||
//# sourceMappingURL=effective_retention_period.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/effective_retention_period.js"],"names":["define","$","SELECTORS","PURPOSE_SELECT","RETENTION_FIELD","EffectiveRetentionPeriod","purposeRetentionPeriods","registerEventListeners","removeListeners","off","prototype","on","ev","selected","currentTarget","val","selectedPurpose","text","bind","init"],"mappings":"AAsBAA,OAAM,+CAAC,CAAC,QAAD,CAAD,CACF,SAASC,CAAT,CAAY,IAEJC,CAAAA,CAAS,CAAG,CACZC,cAAc,CAAE,eADJ,CAEZC,eAAe,CAAE,qDAFL,CAFR,CAYJC,CAAwB,CAAG,SAASC,CAAT,CAAkC,CAC7D,KAAKA,uBAAL,CAA+BA,CAA/B,CACA,KAAKC,sBAAL,EACH,CAfO,CAsBJC,CAAe,CAAG,UAAW,CAC7BP,CAAC,CAACC,CAAS,CAACC,cAAX,CAAD,CAA4BM,GAA5B,CAAgC,QAAhC,CACH,CAxBO,CA8BRJ,CAAwB,CAACK,SAAzB,CAAmCJ,uBAAnC,CAA6D,EAA7D,CAOAD,CAAwB,CAACK,SAAzB,CAAmCH,sBAAnC,CAA4D,UAAW,CAEnEN,CAAC,CAACC,CAAS,CAACC,cAAX,CAAD,CAA4BQ,EAA5B,CAA+B,QAA/B,CAAyC,SAASC,CAAT,CAAa,IAC9CC,CAAAA,CAAQ,CAAGZ,CAAC,CAACW,CAAE,CAACE,aAAJ,CAAD,CAAoBC,GAApB,EADmC,CAE9CC,CAAe,CAAG,KAAKV,uBAAL,CAA6BO,CAA7B,CAF4B,CAGlDZ,CAAC,CAACC,CAAS,CAACE,eAAX,CAAD,CAA6Ba,IAA7B,CAAkCD,CAAlC,CACH,CAJwC,CAIvCE,IAJuC,CAIlC,IAJkC,CAAzC,CAKH,CAPD,CASA,MAAwE,CACpEC,IAAI,CAAE,cAASb,CAAT,CAAkC,CAEpCE,CAAe,GACf,MAAO,IAAIH,CAAAA,CAAJ,CAA6BC,CAA7B,CACV,CALmE,CAO3E,CAtDC,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to update the displayed retention period.\n *\n * @module tool_dataprivacy/effective_retention_period\n * @copyright 2018 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery'],\n function($) {\n\n var SELECTORS = {\n PURPOSE_SELECT: '#id_purposeid',\n RETENTION_FIELD: '#fitem_id_retention_current [data-fieldtype=static]',\n };\n\n /**\n * Constructor for the retention period display.\n *\n * @param {Array} purposeRetentionPeriods Associative array of purposeids with effective retention period at this context\n */\n var EffectiveRetentionPeriod = function(purposeRetentionPeriods) {\n this.purposeRetentionPeriods = purposeRetentionPeriods;\n this.registerEventListeners();\n };\n\n /**\n * Removes the current 'change' listeners.\n *\n * Useful when a new form is loaded.\n */\n var removeListeners = function() {\n $(SELECTORS.PURPOSE_SELECT).off('change');\n };\n\n /**\n * @var {Array} purposeRetentionPeriods\n * @private\n */\n EffectiveRetentionPeriod.prototype.purposeRetentionPeriods = [];\n\n /**\n * Add purpose change listeners.\n *\n * @method registerEventListeners\n */\n EffectiveRetentionPeriod.prototype.registerEventListeners = function() {\n\n $(SELECTORS.PURPOSE_SELECT).on('change', function(ev) {\n var selected = $(ev.currentTarget).val();\n var selectedPurpose = this.purposeRetentionPeriods[selected];\n $(SELECTORS.RETENTION_FIELD).text(selectedPurpose);\n }.bind(this));\n };\n\n return /** @alias module:tool_dataprivacy/effective_retention_period */ {\n init: function(purposeRetentionPeriods) {\n // Remove previously attached listeners.\n removeListeners();\n return new EffectiveRetentionPeriod(purposeRetentionPeriods);\n }\n };\n }\n);\n\n"],"file":"effective_retention_period.min.js"}
|
||||
{"version":3,"file":"effective_retention_period.min.js","sources":["../src/effective_retention_period.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Module to update the displayed retention period.\n *\n * @module tool_dataprivacy/effective_retention_period\n * @copyright 2018 David Monllao\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery'],\n function($) {\n\n var SELECTORS = {\n PURPOSE_SELECT: '#id_purposeid',\n RETENTION_FIELD: '#fitem_id_retention_current [data-fieldtype=static]',\n };\n\n /**\n * Constructor for the retention period display.\n *\n * @param {Array} purposeRetentionPeriods Associative array of purposeids with effective retention period at this context\n */\n var EffectiveRetentionPeriod = function(purposeRetentionPeriods) {\n this.purposeRetentionPeriods = purposeRetentionPeriods;\n this.registerEventListeners();\n };\n\n /**\n * Removes the current 'change' listeners.\n *\n * Useful when a new form is loaded.\n */\n var removeListeners = function() {\n $(SELECTORS.PURPOSE_SELECT).off('change');\n };\n\n /**\n * @var {Array} purposeRetentionPeriods\n * @private\n */\n EffectiveRetentionPeriod.prototype.purposeRetentionPeriods = [];\n\n /**\n * Add purpose change listeners.\n *\n * @method registerEventListeners\n */\n EffectiveRetentionPeriod.prototype.registerEventListeners = function() {\n\n $(SELECTORS.PURPOSE_SELECT).on('change', function(ev) {\n var selected = $(ev.currentTarget).val();\n var selectedPurpose = this.purposeRetentionPeriods[selected];\n $(SELECTORS.RETENTION_FIELD).text(selectedPurpose);\n }.bind(this));\n };\n\n return /** @alias module:tool_dataprivacy/effective_retention_period */ {\n init: function(purposeRetentionPeriods) {\n // Remove previously attached listeners.\n removeListeners();\n return new EffectiveRetentionPeriod(purposeRetentionPeriods);\n }\n };\n }\n);\n\n"],"names":["define","$","SELECTORS","EffectiveRetentionPeriod","purposeRetentionPeriods","registerEventListeners","prototype","on","ev","selected","currentTarget","val","selectedPurpose","this","text","bind","init","off"],"mappings":";;;;;;;AAsBAA,qDAAO,CAAC,WACJ,SAASC,OAEDC,yBACgB,gBADhBA,0BAEiB,sDAQjBC,yBAA2B,SAASC,8BAC/BA,wBAA0BA,6BAC1BC,iCAgBTF,yBAAyBG,UAAUF,wBAA0B,GAO7DD,yBAAyBG,UAAUD,uBAAyB,WAExDJ,EAAEC,0BAA0BK,GAAG,SAAU,SAASC,QAC1CC,SAAWR,EAAEO,GAAGE,eAAeC,MAC/BC,gBAAkBC,KAAKT,wBAAwBK,UACnDR,EAAEC,2BAA2BY,KAAKF,kBACpCG,KAAKF,QAG6D,CACpEG,KAAM,SAASZ,gCAxBfH,EAAEC,0BAA0Be,IAAI,UA2BrB,IAAId,yBAAyBC"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/events",[],function(){return{approve:"tool_dataprivacy-data_request:approve",bulkApprove:"tool_dataprivacy-data_request:bulk_approve",deny:"tool_dataprivacy-data_request:deny",bulkDeny:"tool_dataprivacy-data_request:bulk_deny",complete:"tool_dataprivacy-data_request:complete"}});
|
||||
//# sourceMappingURL=events.min.js.map
|
||||
/**
|
||||
* Contain the events the data privacy tool can fire.
|
||||
*
|
||||
* @module tool_dataprivacy/events
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/events",[],(function(){return{approve:"tool_dataprivacy-data_request:approve",bulkApprove:"tool_dataprivacy-data_request:bulk_approve",deny:"tool_dataprivacy-data_request:deny",bulkDeny:"tool_dataprivacy-data_request:bulk_deny",complete:"tool_dataprivacy-data_request:complete"}}));
|
||||
|
||||
//# sourceMappingURL=events.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/events.js"],"names":["define","approve","bulkApprove","deny","bulkDeny","complete"],"mappings":"AAsBAA,OAAM,2BAAC,EAAD,CAAK,UAAW,CAClB,MAAO,CACHC,OAAO,CAAE,uCADN,CAEHC,WAAW,CAAE,4CAFV,CAGHC,IAAI,CAAE,oCAHH,CAIHC,QAAQ,CAAE,yCAJP,CAKHC,QAAQ,CAAE,wCALP,CAOV,CARK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the events the data privacy tool can fire.\n *\n * @module tool_dataprivacy/events\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n approve: 'tool_dataprivacy-data_request:approve',\n bulkApprove: 'tool_dataprivacy-data_request:bulk_approve',\n deny: 'tool_dataprivacy-data_request:deny',\n bulkDeny: 'tool_dataprivacy-data_request:bulk_deny',\n complete: 'tool_dataprivacy-data_request:complete'\n };\n});\n"],"file":"events.min.js"}
|
||||
{"version":3,"file":"events.min.js","sources":["../src/events.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the events the data privacy tool can fire.\n *\n * @module tool_dataprivacy/events\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine([], function() {\n return {\n approve: 'tool_dataprivacy-data_request:approve',\n bulkApprove: 'tool_dataprivacy-data_request:bulk_approve',\n deny: 'tool_dataprivacy-data_request:deny',\n bulkDeny: 'tool_dataprivacy-data_request:bulk_deny',\n complete: 'tool_dataprivacy-data_request:complete'\n };\n});\n"],"names":["define","approve","bulkApprove","deny","bulkDeny","complete"],"mappings":";;;;;;;AAsBAA,iCAAO,IAAI,iBACA,CACHC,QAAS,wCACTC,YAAa,6CACbC,KAAM,qCACNC,SAAU,0CACVC,SAAU"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/expand_contract",["jquery","core/url","core/str"],function(a,b,c){var d=a("<img alt=\"\" src=\""+b.imageUrl("t/expanded")+"\"/>"),e=a("<img alt=\"\" src=\""+b.imageUrl("t/collapsed")+"\"/>"),f={EXPAND:"fa-caret-right",COLLAPSE:"fa-caret-down"};return{expandCollapse:function expandCollapse(a,b){if(a.hasClass("hide")){a.removeClass("hide");a.addClass("visible");a.attr("aria-expanded",!0);b.find(":header i.fa").removeClass(f.EXPAND);b.find(":header i.fa").addClass(f.COLLAPSE);b.find(":header img.icon").attr("src",d.attr("src"))}else{a.removeClass("visible");a.addClass("hide");a.attr("aria-expanded",!1);b.find(":header i.fa").removeClass(f.COLLAPSE);b.find(":header i.fa").addClass(f.EXPAND);b.find(":header img.icon").attr("src",e.attr("src"))}},expandCollapseAll:function expandCollapseAll(b){var g="visible"==b?"hide":"visible",h="visible"==b?!0:!1,i="visible"==b?f.EXPAND:f.COLLAPSE,j="visible"==b?f.COLLAPSE:f.EXPAND,k="visible"==b?d.attr("src"):e.attr("src");a("."+g).each(function(){a(this).removeClass(g);a(this).addClass(b);a(this).attr("aria-expanded",h)});a(".tool_dataprivacy-expand-all").data("visibilityState",g);c.get_string(g,"tool_dataprivacy").then(function(b){a(".tool_dataprivacy-expand-all").html(b)}).catch(Notification.exception);a(":header i.fa").each(function(){a(this).removeClass(i);a(this).addClass(j)});a(":header img.icon").each(function(){a(this).attr("src",k)})}}});
|
||||
//# sourceMappingURL=expand_contract.min.js.map
|
||||
/**
|
||||
* Potential user selector module.
|
||||
*
|
||||
* @module tool_dataprivacy/expand_contract
|
||||
* @copyright 2018 Adrian Greeve
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/expand_contract",["jquery","core/url","core/str"],(function($,url,str){var expandedImage=$('<img alt="" src="'+url.imageUrl("t/expanded")+'"/>'),collapsedImage=$('<img alt="" src="'+url.imageUrl("t/collapsed")+'"/>'),CLASSES_EXPAND="fa-caret-right",CLASSES_COLLAPSE="fa-caret-down";return{expandCollapse:function(targetnode,thisnode){targetnode.hasClass("hide")?(targetnode.removeClass("hide"),targetnode.addClass("visible"),targetnode.attr("aria-expanded",!0),thisnode.find(":header i.fa").removeClass(CLASSES_EXPAND),thisnode.find(":header i.fa").addClass(CLASSES_COLLAPSE),thisnode.find(":header img.icon").attr("src",expandedImage.attr("src"))):(targetnode.removeClass("visible"),targetnode.addClass("hide"),targetnode.attr("aria-expanded",!1),thisnode.find(":header i.fa").removeClass(CLASSES_COLLAPSE),thisnode.find(":header i.fa").addClass(CLASSES_EXPAND),thisnode.find(":header img.icon").attr("src",collapsedImage.attr("src")))},expandCollapseAll:function(nextstate){var currentstate="visible"==nextstate?"hide":"visible",ariaexpandedstate="visible"==nextstate,iconclassnow="visible"==nextstate?CLASSES_EXPAND:CLASSES_COLLAPSE,iconclassnext="visible"==nextstate?CLASSES_COLLAPSE:CLASSES_EXPAND,imagenow="visible"==nextstate?expandedImage.attr("src"):collapsedImage.attr("src");$("."+currentstate).each((function(){$(this).removeClass(currentstate),$(this).addClass(nextstate),$(this).attr("aria-expanded",ariaexpandedstate)})),$(".tool_dataprivacy-expand-all").data("visibilityState",currentstate),str.get_string(currentstate,"tool_dataprivacy").then((function(langString){$(".tool_dataprivacy-expand-all").html(langString)})).catch(Notification.exception),$(":header i.fa").each((function(){$(this).removeClass(iconclassnow),$(this).addClass(iconclassnext)})),$(":header img.icon").each((function(){$(this).attr("src",imagenow)}))}}}));
|
||||
|
||||
//# sourceMappingURL=expand_contract.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/form-user-selector",["jquery","core/ajax","core/templates"],function(a,b,c){return{processResults:function processResults(b,c){var d=[];a.each(c,function(a,b){d.push({value:b.id,label:b._label})});return d},transport:function transport(d,e,f,g){var h=b.call([{methodname:"tool_dataprivacy_get_users",args:{query:e}}]);h[0].then(function(b){var d=[],e=0;a.each(b,function(a,b){d.push(c.render("tool_dataprivacy/form-user-selector-suggestion",b))});return a.when.apply(a.when,d).then(function(){var c=arguments;a.each(b,function(a,b){b._label=c[e];e++});f(b)})}).fail(g)}}});
|
||||
//# sourceMappingURL=form-user-selector.min.js.map
|
||||
/**
|
||||
* Potential user selector module.
|
||||
*
|
||||
* @module tool_dataprivacy/form-user-selector
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/form-user-selector",["jquery","core/ajax","core/templates"],(function($,Ajax,Templates){return{processResults:function(selector,results){var users=[];return $.each(results,(function(index,user){users.push({value:user.id,label:user._label})})),users},transport:function(selector,query,success,failure){Ajax.call([{methodname:"tool_dataprivacy_get_users",args:{query:query}}])[0].then((function(results){var promises=[],i=0;return $.each(results,(function(index,user){promises.push(Templates.render("tool_dataprivacy/form-user-selector-suggestion",user))})),$.when.apply($.when,promises).then((function(){var args=arguments;$.each(results,(function(index,user){user._label=args[i],i++})),success(results)}))})).fail(failure)}}}));
|
||||
|
||||
//# sourceMappingURL=form-user-selector.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/form-user-selector.js"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","promise","call","methodname","args","then","promises","i","render","when","apply","arguments","fail"],"mappings":"AAuBAA,OAAM,uCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,gBAAxB,CAAD,CAA4C,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA6B,CAE3E,MAAgE,CAE5DC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAA4B,CACxC,GAAIC,CAAAA,CAAK,CAAG,EAAZ,CACAN,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCH,CAAK,CAACI,IAAN,CAAW,CACPC,KAAK,CAAEF,CAAI,CAACG,EADL,CAEPC,KAAK,CAAEJ,CAAI,CAACK,MAFL,CAAX,CAIH,CALD,EAMA,MAAOR,CAAAA,CACV,CAX2D,CAa5DS,SAAS,CAAE,mBAASX,CAAT,CAAmBY,CAAnB,CAA0BC,CAA1B,CAAmCC,CAAnC,CAA4C,CACnD,GAAIC,CAAAA,CAAO,CAEDlB,CAAI,CAACmB,IAAL,CAAU,CAAC,CACjBC,UAAU,CAAE,4BADK,CAEjBC,IAAI,CAAE,CACFN,KAAK,CAAEA,CADL,CAFW,CAAD,CAAV,CAFV,CASAG,CAAO,CAAC,CAAD,CAAP,CAAWI,IAAX,CAAgB,SAASlB,CAAT,CAAkB,CAC9B,GAAImB,CAAAA,CAAQ,CAAG,EAAf,CACIC,CAAC,CAAG,CADR,CAIAzB,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCe,CAAQ,CAACd,IAAT,CAAcR,CAAS,CAACwB,MAAV,CAAiB,gDAAjB,CAAmEjB,CAAnE,CAAd,CACH,CAFD,EAKA,MAAOT,CAAAA,CAAC,CAAC2B,IAAF,CAAOC,KAAP,CAAa5B,CAAC,CAAC2B,IAAf,CAAqBH,CAArB,EAA+BD,IAA/B,CAAoC,UAAW,CAClD,GAAID,CAAAA,CAAI,CAAGO,SAAX,CACA7B,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCA,CAAI,CAACK,MAAL,CAAcQ,CAAI,CAACG,CAAD,CAAlB,CACAA,CAAC,EACJ,CAHD,EAIAR,CAAO,CAACZ,CAAD,CAEV,CARM,CAUV,CApBD,EAoBGyB,IApBH,CAoBQZ,CApBR,CAqBH,CA5C2D,CAgDnE,CAlDK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential user selector module.\n *\n * @module tool_dataprivacy/form-user-selector\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\n\n return /** @alias module:tool_dataprivacy/form-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n promise = Ajax.call([{\n methodname: 'tool_dataprivacy_get_users',\n args: {\n query: query\n }\n }]);\n\n promise[0].then(function(results) {\n var promises = [],\n i = 0;\n\n // Render the label.\n $.each(results, function(index, user) {\n promises.push(Templates.render('tool_dataprivacy/form-user-selector-suggestion', user));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n $.each(results, function(index, user) {\n user._label = args[i];\n i++;\n });\n success(results);\n return;\n });\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"file":"form-user-selector.min.js"}
|
||||
{"version":3,"file":"form-user-selector.min.js","sources":["../src/form-user-selector.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Potential user selector module.\n *\n * @module tool_dataprivacy/form-user-selector\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\n\n return /** @alias module:tool_dataprivacy/form-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n\n promise = Ajax.call([{\n methodname: 'tool_dataprivacy_get_users',\n args: {\n query: query\n }\n }]);\n\n promise[0].then(function(results) {\n var promises = [],\n i = 0;\n\n // Render the label.\n $.each(results, function(index, user) {\n promises.push(Templates.render('tool_dataprivacy/form-user-selector-suggestion', user));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n $.each(results, function(index, user) {\n user._label = args[i];\n i++;\n });\n success(results);\n return;\n });\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","call","methodname","args","then","promises","i","render","when","apply","arguments","fail"],"mappings":";;;;;;;AAuBAA,6CAAO,CAAC,SAAU,YAAa,mBAAmB,SAASC,EAAGC,KAAMC,iBAEA,CAE5DC,eAAgB,SAASC,SAAUC,aAC3BC,MAAQ,UACZN,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BH,MAAMI,KAAK,CACPC,MAAOF,KAAKG,GACZC,MAAOJ,KAAKK,YAGbR,OAGXS,UAAW,SAASX,SAAUY,MAAOC,QAASC,SAGhCjB,KAAKkB,KAAK,CAAC,CACjBC,WAAY,6BACZC,KAAM,CACFL,MAAOA,UAIP,GAAGM,MAAK,SAASjB,aACjBkB,SAAW,GACXC,EAAI,SAGRxB,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5Bc,SAASb,KAAKR,UAAUuB,OAAO,iDAAkDhB,UAI9ET,EAAE0B,KAAKC,MAAM3B,EAAE0B,KAAMH,UAAUD,MAAK,eACnCD,KAAOO,UACX5B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BA,KAAKK,OAASO,KAAKG,GACnBA,OAEJP,QAAQZ,eAIbwB,KAAKX"}
|
||||
@@ -1,2 +1,3 @@
|
||||
define ("tool_dataprivacy/myrequestactions",["exports","core/ajax","core/notification","core/pending","core/str"],function(a,b,c,d,e){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.init=void 0;b=f(b);c=f(c);d=f(d);function f(a){return a&&a.__esModule?a:{default:a}}function g(a,b){return m(a)||l(a,b)||j(a,b)||h()}function h(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function j(a,b){if(!a)return;if("string"==typeof a)return k(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return k(a,b)}function k(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}function l(a,b){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(a)))return;var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function m(a){if(Array.isArray(a))return a}var n={CANCEL_REQUEST:"[data-action=\"cancel\"][data-requestid]"};a.init=function init(){document.addEventListener("click",function(a){var f=a.target.closest(n.CANCEL_REQUEST);if(null===f){return}a.preventDefault();(0,e.get_strings)([{key:"cancelrequest",component:"tool_dataprivacy"},{key:"cancelrequestconfirmation",component:"tool_dataprivacy"}]).then(function(a){var e=g(a,2),h=e[0],i=e[1];return c.default.confirm(h,i,h,null,function(){var a=new d.default("tool/dataprivacy:cancelRequest"),e={methodname:"tool_dataprivacy_cancel_data_request",args:{requestid:f.dataset.requestid}};b.default.call([e])[0].then(function(b){if(b.result){window.location.reload()}else{c.default.addNotification({type:"error",message:b.warnings[0].message})}return a.resolve()}).catch(c.default.exception)})}).catch()})}});
|
||||
//# sourceMappingURL=myrequestactions.min.js.map
|
||||
define("tool_dataprivacy/myrequestactions",["exports","core/ajax","core/notification","core/pending","core/str"],(function(_exports,_ajax,_notification,_pending,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _slicedToArray(arr,i){return function(arr){if(Array.isArray(arr))return arr}(arr)||function(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null==_i)return;var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}(arr,i)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_ajax=_interopRequireDefault(_ajax),_notification=_interopRequireDefault(_notification),_pending=_interopRequireDefault(_pending);var SELECTORS_CANCEL_REQUEST='[data-action="cancel"][data-requestid]';_exports.init=function(){document.addEventListener("click",(function(event){var triggerElement=event.target.closest(SELECTORS_CANCEL_REQUEST);if(null!==triggerElement){event.preventDefault();(0,_str.get_strings)([{key:"cancelrequest",component:"tool_dataprivacy"},{key:"cancelrequestconfirmation",component:"tool_dataprivacy"}]).then((function(_ref){var _ref2=_slicedToArray(_ref,2),cancelRequest=_ref2[0],cancelConfirm=_ref2[1];return _notification.default.confirm(cancelRequest,cancelConfirm,cancelRequest,null,(function(){var pendingPromise=new _pending.default("tool/dataprivacy:cancelRequest"),request={methodname:"tool_dataprivacy_cancel_data_request",args:{requestid:triggerElement.dataset.requestid}};_ajax.default.call([request])[0].then((function(response){return response.result?window.location.reload():_notification.default.addNotification({type:"error",message:response.warnings[0].message}),pendingPromise.resolve()})).catch(_notification.default.exception)}))})).catch()}}))}}));
|
||||
|
||||
//# sourceMappingURL=myrequestactions.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/myrequestactions.js"],"names":["SELECTORS","CANCEL_REQUEST","init","document","addEventListener","event","triggerElement","target","closest","preventDefault","key","component","then","cancelRequest","cancelConfirm","Notification","confirm","pendingPromise","Pending","request","methodname","args","requestid","dataset","Ajax","call","response","result","window","location","reload","addNotification","type","message","warnings","resolve","catch","exception"],"mappings":"kNAuBA,OACA,OACA,O,khCAGMA,CAAAA,CAAS,CAAG,CACdC,cAAc,CAAE,0CADF,C,QAOE,QAAPC,CAAAA,IAAO,EAAM,CACtBC,QAAQ,CAACC,gBAAT,CAA0B,OAA1B,CAAmC,SAAAC,CAAK,CAAI,CACxC,GAAMC,CAAAA,CAAc,CAAGD,CAAK,CAACE,MAAN,CAAaC,OAAb,CAAqBR,CAAS,CAACC,cAA/B,CAAvB,CACA,GAAuB,IAAnB,GAAAK,CAAJ,CAA6B,CACzB,MACH,CAEDD,CAAK,CAACI,cAAN,GAOA,kBALwB,CACpB,CAACC,GAAG,CAAE,eAAN,CAAuBC,SAAS,CAAE,kBAAlC,CADoB,CAEpB,CAACD,GAAG,CAAE,2BAAN,CAAmCC,SAAS,CAAE,kBAA9C,CAFoB,CAKxB,EAA4BC,IAA5B,CAAiC,WAAoC,cAAlCC,CAAkC,MAAnBC,CAAmB,MACjE,MAAOC,WAAaC,OAAb,CAAqBH,CAArB,CAAoCC,CAApC,CAAmDD,CAAnD,CAAkE,IAAlE,CAAwE,UAAM,IAC3EI,CAAAA,CAAc,CAAG,GAAIC,UAAJ,CAAY,gCAAZ,CAD0D,CAE3EC,CAAO,CAAG,CACZC,UAAU,CAAE,sCADA,CAEZC,IAAI,CAAE,CAACC,SAAS,CAAEhB,CAAc,CAACiB,OAAf,CAAuBD,SAAnC,CAFM,CAFiE,CAOjFE,UAAKC,IAAL,CAAU,CAACN,CAAD,CAAV,EAAqB,CAArB,EAAwBP,IAAxB,CAA6B,SAAAc,CAAQ,CAAI,CACrC,GAAIA,CAAQ,CAACC,MAAb,CAAqB,CACjBC,MAAM,CAACC,QAAP,CAAgBC,MAAhB,EACH,CAFD,IAEO,CACHf,UAAagB,eAAb,CAA6B,CACzBC,IAAI,CAAE,OADmB,CAEzBC,OAAO,CAAEP,CAAQ,CAACQ,QAAT,CAAkB,CAAlB,EAAqBD,OAFL,CAA7B,CAIH,CACD,MAAOhB,CAAAA,CAAc,CAACkB,OAAf,EACV,CAVD,EAUGC,KAVH,CAUSrB,UAAasB,SAVtB,CAWH,CAlBM,CAmBV,CApBD,EAoBGD,KApBH,EAqBH,CAlCD,CAmCH,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * AMD module to enable users to manage their own data requests.\n *\n * @module tool_dataprivacy/myrequestactions\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {get_strings as getStrings} from 'core/str';\n\nconst SELECTORS = {\n CANCEL_REQUEST: '[data-action=\"cancel\"][data-requestid]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n document.addEventListener('click', event => {\n const triggerElement = event.target.closest(SELECTORS.CANCEL_REQUEST);\n if (triggerElement === null) {\n return;\n }\n\n event.preventDefault();\n\n const requiredStrings = [\n {key: 'cancelrequest', component: 'tool_dataprivacy'},\n {key: 'cancelrequestconfirmation', component: 'tool_dataprivacy'},\n ];\n\n getStrings(requiredStrings).then(([cancelRequest, cancelConfirm]) => {\n return Notification.confirm(cancelRequest, cancelConfirm, cancelRequest, null, () => {\n const pendingPromise = new Pending('tool/dataprivacy:cancelRequest');\n const request = {\n methodname: 'tool_dataprivacy_cancel_data_request',\n args: {requestid: triggerElement.dataset.requestid}\n };\n\n Ajax.call([request])[0].then(response => {\n if (response.result) {\n window.location.reload();\n } else {\n Notification.addNotification({\n type: 'error',\n message: response.warnings[0].message\n });\n }\n return pendingPromise.resolve();\n }).catch(Notification.exception);\n });\n }).catch();\n });\n};\n"],"file":"myrequestactions.min.js"}
|
||||
{"version":3,"file":"myrequestactions.min.js","sources":["../src/myrequestactions.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * AMD module to enable users to manage their own data requests.\n *\n * @module tool_dataprivacy/myrequestactions\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport Ajax from 'core/ajax';\nimport Notification from 'core/notification';\nimport Pending from 'core/pending';\nimport {get_strings as getStrings} from 'core/str';\n\nconst SELECTORS = {\n CANCEL_REQUEST: '[data-action=\"cancel\"][data-requestid]',\n};\n\n/**\n * Initialize module\n */\nexport const init = () => {\n document.addEventListener('click', event => {\n const triggerElement = event.target.closest(SELECTORS.CANCEL_REQUEST);\n if (triggerElement === null) {\n return;\n }\n\n event.preventDefault();\n\n const requiredStrings = [\n {key: 'cancelrequest', component: 'tool_dataprivacy'},\n {key: 'cancelrequestconfirmation', component: 'tool_dataprivacy'},\n ];\n\n getStrings(requiredStrings).then(([cancelRequest, cancelConfirm]) => {\n return Notification.confirm(cancelRequest, cancelConfirm, cancelRequest, null, () => {\n const pendingPromise = new Pending('tool/dataprivacy:cancelRequest');\n const request = {\n methodname: 'tool_dataprivacy_cancel_data_request',\n args: {requestid: triggerElement.dataset.requestid}\n };\n\n Ajax.call([request])[0].then(response => {\n if (response.result) {\n window.location.reload();\n } else {\n Notification.addNotification({\n type: 'error',\n message: response.warnings[0].message\n });\n }\n return pendingPromise.resolve();\n }).catch(Notification.exception);\n });\n }).catch();\n });\n};\n"],"names":["SELECTORS","document","addEventListener","event","triggerElement","target","closest","preventDefault","key","component","then","cancelRequest","cancelConfirm","Notification","confirm","pendingPromise","Pending","request","methodname","args","requestid","dataset","call","response","result","window","location","reload","addNotification","type","message","warnings","resolve","catch","exception"],"mappings":"ikDA4BMA,yBACc,uDAMA,WAChBC,SAASC,iBAAiB,SAAS,SAAAC,WACzBC,eAAiBD,MAAME,OAAOC,QAAQN,6BACrB,OAAnBI,gBAIJD,MAAMI,sCAEkB,CACpB,CAACC,IAAK,gBAAiBC,UAAW,oBAClC,CAACD,IAAK,4BAA6BC,UAAW,sBAGtBC,MAAK,gDAAEC,uBAAeC,8BACvCC,sBAAaC,QAAQH,cAAeC,cAAeD,cAAe,MAAM,eACrEI,eAAiB,IAAIC,iBAAQ,kCAC7BC,QAAU,CACZC,WAAY,uCACZC,KAAM,CAACC,UAAWhB,eAAeiB,QAAQD,0BAGxCE,KAAK,CAACL,UAAU,GAAGP,MAAK,SAAAa,iBACrBA,SAASC,OACTC,OAAOC,SAASC,+BAEHC,gBAAgB,CACzBC,KAAM,QACNC,QAASP,SAASQ,SAAS,GAAGD,UAG/Bf,eAAeiB,aACvBC,MAAMpB,sBAAaqB,iBAE3BD"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/purposesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],function(a,b,c,d,e,f){var g={DELETE:"[data-action=\"deletepurpose\"]"},h=function(){this.registerEvents()};h.prototype.registerEvents=function(){a(g.DELETE).click(function(g){g.preventDefault();var h=a(this).data("id"),i=a(this).data("name");d.get_strings([{key:"deletepurpose",component:"tool_dataprivacy"},{key:"deletepurposetext",component:"tool_dataprivacy",param:i},{key:"delete"}]).then(function(d){var g=d[0],i=d[1],j=d[2];return e.create({title:g,body:i,type:e.types.SAVE_CANCEL}).then(function(d){d.setSaveButtonText(j);d.getRoot().on(f.save,function(){b.call([{methodname:"tool_dataprivacy_delete_purpose",args:{id:h}}])[0].done(function(b){if(b.result){a("tr[data-purposeid=\""+h+"\"]").remove()}else{c.addNotification({message:b.warnings[0].message,type:"error"})}}).fail(c.exception)});d.getRoot().on(f.hidden,function(){d.destroy()});return d})}).done(function(a){a.show()}).fail(c.exception)})};return{init:function init(){return new h}}});
|
||||
//# sourceMappingURL=purposesactions.min.js.map
|
||||
/**
|
||||
* AMD module for purposes actions.
|
||||
*
|
||||
* @module tool_dataprivacy/purposesactions
|
||||
* @copyright 2018 David Monllao
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/purposesactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events"],(function($,Ajax,Notification,Str,ModalFactory,ModalEvents){var ACTIONS_DELETE='[data-action="deletepurpose"]',PurposesActions=function(){this.registerEvents()};return PurposesActions.prototype.registerEvents=function(){$(ACTIONS_DELETE).click((function(e){e.preventDefault();var id=$(this).data("id"),stringkeys=[{key:"deletepurpose",component:"tool_dataprivacy"},{key:"deletepurposetext",component:"tool_dataprivacy",param:$(this).data("name")},{key:"delete"}];Str.get_strings(stringkeys).then((function(langStrings){var title=langStrings[0],confirmMessage=langStrings[1],buttonText=langStrings[2];return ModalFactory.create({title:title,body:confirmMessage,type:ModalFactory.types.SAVE_CANCEL}).then((function(modal){return modal.setSaveButtonText(buttonText),modal.getRoot().on(ModalEvents.save,(function(){var request={methodname:"tool_dataprivacy_delete_purpose",args:{id:id}};Ajax.call([request])[0].done((function(data){data.result?$('tr[data-purposeid="'+id+'"]').remove():Notification.addNotification({message:data.warnings[0].message,type:"error"})})).fail(Notification.exception)})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()})),modal}))})).done((function(modal){modal.show()})).fail(Notification.exception)}))},{init:function(){return new PurposesActions}}}));
|
||||
|
||||
//# sourceMappingURL=purposesactions.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_dataprivacy/request_filter",["jquery","core/form-autocomplete","core/str","core/notification"],function(a,b,c,d){var e={REQUEST_FILTERS:"#request-filters"},f=function init(){c.get_strings([{key:"filter",component:"moodle"},{key:"nofiltersapplied",component:"moodle"}]).then(function(a){var c=a[0],d=a[1];return b.enhance(e.REQUEST_FILTERS,!1,"",c,!1,!0,d,!0)}).fail(d.exception);var f=a(e.REQUEST_FILTERS).val();a(e.REQUEST_FILTERS).on("change",function(){var b=a(this).val();if(f.join(",")!==b.join(",")){if(0===b.length){a("#filters-cleared").val(1)}a(this.form).submit()}})};return{init:function init(){f()}}});
|
||||
//# sourceMappingURL=request_filter.min.js.map
|
||||
/**
|
||||
* JS module for the data requests filter.
|
||||
*
|
||||
* @module tool_dataprivacy/request_filter
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/request_filter",["jquery","core/form-autocomplete","core/str","core/notification"],(function($,Autocomplete,Str,Notification){var SELECTORS_REQUEST_FILTERS="#request-filters";return{init:function(){!function(){Str.get_strings([{key:"filter",component:"moodle"},{key:"nofiltersapplied",component:"moodle"}]).then((function(langstrings){var placeholder=langstrings[0],noSelectionString=langstrings[1];return Autocomplete.enhance(SELECTORS_REQUEST_FILTERS,!1,"",placeholder,!1,!0,noSelectionString,!0)})).fail(Notification.exception);var last=$(SELECTORS_REQUEST_FILTERS).val();$(SELECTORS_REQUEST_FILTERS).on("change",(function(){var current=$(this).val();last.join(",")!==current.join(",")&&(0===current.length&&$("#filters-cleared").val(1),$(this.form).submit())}))}()}}}));
|
||||
|
||||
//# sourceMappingURL=request_filter.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/request_filter.js"],"names":["define","$","Autocomplete","Str","Notification","SELECTORS","REQUEST_FILTERS","init","get_strings","key","component","then","langstrings","placeholder","noSelectionString","enhance","fail","exception","last","val","on","current","join","length","form","submit"],"mappings":"AAsBAA,OAAM,mCAAC,CAAC,QAAD,CAAW,wBAAX,CAAqC,UAArC,CAAiD,mBAAjD,CAAD,CAAwE,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAA+BC,CAA/B,CAA6C,IAQnHC,CAAAA,CAAS,CAAG,CACZC,eAAe,CAAE,kBADL,CARuG,CAkBnHC,CAAI,CAAG,QAAPA,CAAAA,IAAO,EAAW,CAYlBJ,CAAG,CAACK,WAAJ,CAXiB,CACb,CACIC,GAAG,CAAE,QADT,CAEIC,SAAS,CAAE,QAFf,CADa,CAKb,CACID,GAAG,CAAE,kBADT,CAEIC,SAAS,CAAE,QAFf,CALa,CAWjB,EAA4BC,IAA5B,CAAiC,SAASC,CAAT,CAAsB,IAC/CC,CAAAA,CAAW,CAAGD,CAAW,CAAC,CAAD,CADsB,CAE/CE,CAAiB,CAAGF,CAAW,CAAC,CAAD,CAFgB,CAGnD,MAAOV,CAAAA,CAAY,CAACa,OAAb,CAAqBV,CAAS,CAACC,eAA/B,IAAuD,EAAvD,CAA2DO,CAA3D,OAAqFC,CAArF,IACV,CAJD,EAIGE,IAJH,CAIQZ,CAAY,CAACa,SAJrB,EAMA,GAAIC,CAAAA,CAAI,CAAGjB,CAAC,CAACI,CAAS,CAACC,eAAX,CAAD,CAA6Ba,GAA7B,EAAX,CACAlB,CAAC,CAACI,CAAS,CAACC,eAAX,CAAD,CAA6Bc,EAA7B,CAAgC,QAAhC,CAA0C,UAAW,CACjD,GAAIC,CAAAA,CAAO,CAAGpB,CAAC,CAAC,IAAD,CAAD,CAAQkB,GAAR,EAAd,CAEA,GAAID,CAAI,CAACI,IAAL,CAAU,GAAV,IAAmBD,CAAO,CAACC,IAAR,CAAa,GAAb,CAAvB,CAA0C,CAEtC,GAAuB,CAAnB,GAAAD,CAAO,CAACE,MAAZ,CAA0B,CACtBtB,CAAC,CAAC,kBAAD,CAAD,CAAsBkB,GAAtB,CAA0B,CAA1B,CACH,CACDlB,CAAC,CAAC,KAAKuB,IAAN,CAAD,CAAaC,MAAb,EACH,CACJ,CAVD,CAWH,CAhDsH,CAkDvH,MAAmD,CAM/ClB,IAAI,CAAE,eAAW,CACbA,CAAI,EACP,CAR8C,CAUtD,CA5DK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * JS module for the data requests filter.\n *\n * @module tool_dataprivacy/request_filter\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/form-autocomplete', 'core/str', 'core/notification'], function($, Autocomplete, Str, Notification) {\n\n /**\n * Selectors.\n *\n * @access private\n * @type {{REQUEST_FILTERS: string}}\n */\n var SELECTORS = {\n REQUEST_FILTERS: '#request-filters'\n };\n\n /**\n * Init function.\n *\n * @method init\n * @private\n */\n var init = function() {\n var stringkeys = [\n {\n key: 'filter',\n component: 'moodle'\n },\n {\n key: 'nofiltersapplied',\n component: 'moodle'\n }\n ];\n\n Str.get_strings(stringkeys).then(function(langstrings) {\n var placeholder = langstrings[0];\n var noSelectionString = langstrings[1];\n return Autocomplete.enhance(SELECTORS.REQUEST_FILTERS, false, '', placeholder, false, true, noSelectionString, true);\n }).fail(Notification.exception);\n\n var last = $(SELECTORS.REQUEST_FILTERS).val();\n $(SELECTORS.REQUEST_FILTERS).on('change', function() {\n var current = $(this).val();\n // Prevent form from submitting unnecessarily, eg. on blur when no filter is selected.\n if (last.join(',') !== current.join(',')) {\n // If we're submitting without filters, set the hidden input 'filters-cleared' to 1.\n if (current.length === 0) {\n $('#filters-cleared').val(1);\n }\n $(this.form).submit();\n }\n });\n };\n\n return /** @alias module:core/form-autocomplete */ {\n /**\n * Initialise the unified user filter.\n *\n * @method init\n */\n init: function() {\n init();\n }\n };\n});\n"],"file":"request_filter.min.js"}
|
||||
{"version":3,"file":"request_filter.min.js","sources":["../src/request_filter.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * JS module for the data requests filter.\n *\n * @module tool_dataprivacy/request_filter\n * @copyright 2018 Jun Pataleta\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/form-autocomplete', 'core/str', 'core/notification'], function($, Autocomplete, Str, Notification) {\n\n /**\n * Selectors.\n *\n * @access private\n * @type {{REQUEST_FILTERS: string}}\n */\n var SELECTORS = {\n REQUEST_FILTERS: '#request-filters'\n };\n\n /**\n * Init function.\n *\n * @method init\n * @private\n */\n var init = function() {\n var stringkeys = [\n {\n key: 'filter',\n component: 'moodle'\n },\n {\n key: 'nofiltersapplied',\n component: 'moodle'\n }\n ];\n\n Str.get_strings(stringkeys).then(function(langstrings) {\n var placeholder = langstrings[0];\n var noSelectionString = langstrings[1];\n return Autocomplete.enhance(SELECTORS.REQUEST_FILTERS, false, '', placeholder, false, true, noSelectionString, true);\n }).fail(Notification.exception);\n\n var last = $(SELECTORS.REQUEST_FILTERS).val();\n $(SELECTORS.REQUEST_FILTERS).on('change', function() {\n var current = $(this).val();\n // Prevent form from submitting unnecessarily, eg. on blur when no filter is selected.\n if (last.join(',') !== current.join(',')) {\n // If we're submitting without filters, set the hidden input 'filters-cleared' to 1.\n if (current.length === 0) {\n $('#filters-cleared').val(1);\n }\n $(this.form).submit();\n }\n });\n };\n\n return /** @alias module:core/form-autocomplete */ {\n /**\n * Initialise the unified user filter.\n *\n * @method init\n */\n init: function() {\n init();\n }\n };\n});\n"],"names":["define","$","Autocomplete","Str","Notification","SELECTORS","init","get_strings","key","component","then","langstrings","placeholder","noSelectionString","enhance","fail","exception","last","val","on","current","this","join","length","form","submit"],"mappings":";;;;;;;AAsBAA,yCAAO,CAAC,SAAU,yBAA0B,WAAY,sBAAsB,SAASC,EAAGC,aAAcC,IAAKC,kBAQrGC,0BACiB,yBAyC8B,CAM/CC,KAAM,YAtCC,WAYPH,IAAII,YAXa,CACb,CACIC,IAAK,SACLC,UAAW,UAEf,CACID,IAAK,mBACLC,UAAW,YAISC,MAAK,SAASC,iBAClCC,YAAcD,YAAY,GAC1BE,kBAAoBF,YAAY,UAC7BT,aAAaY,QAAQT,2BAA2B,EAAO,GAAIO,aAAa,GAAO,EAAMC,mBAAmB,MAChHE,KAAKX,aAAaY,eAEjBC,KAAOhB,EAAEI,2BAA2Ba,MACxCjB,EAAEI,2BAA2Bc,GAAG,UAAU,eAClCC,QAAUnB,EAAEoB,MAAMH,MAElBD,KAAKK,KAAK,OAASF,QAAQE,KAAK,OAET,IAAnBF,QAAQG,QACRtB,EAAE,oBAAoBiB,IAAI,GAE9BjB,EAAEoB,KAAKG,MAAMC,aAYjBnB"}
|
||||
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -136,4 +136,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
||||
@@ -14,29 +14,14 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
namespace tool_dataprivacy;
|
||||
|
||||
use core\invalid_persistent_exception;
|
||||
use core\task\manager;
|
||||
use tool_dataprivacy\context_instance;
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\data_registry;
|
||||
use tool_dataprivacy\expired_context;
|
||||
use tool_dataprivacy\data_request;
|
||||
use tool_dataprivacy\purpose;
|
||||
use tool_dataprivacy\category;
|
||||
use testing_data_generator;
|
||||
use tool_dataprivacy\local\helper;
|
||||
use tool_dataprivacy\task\process_data_request_task;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* API tests.
|
||||
*
|
||||
@@ -44,7 +29,7 @@ global $CFG;
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
class api_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Ensure that the check_can_manage_data_registry function fails cap testing when a user without capabilities is
|
||||
@@ -68,7 +53,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::check_can_manage_data_registry();
|
||||
}
|
||||
|
||||
@@ -82,7 +67,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::check_can_manage_data_registry(\context_system::instance()->id);
|
||||
}
|
||||
|
||||
@@ -96,7 +81,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::check_can_manage_data_registry(\context_user::instance($user->id)->id);
|
||||
}
|
||||
|
||||
@@ -174,7 +159,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$u1 = $generator->create_user();
|
||||
$u2 = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Give the manager role with the capability to manage data requests.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -215,7 +200,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
// Confirm that the returned list is empty.
|
||||
$this->assertEmpty($roleids);
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Give the manager role with the capability to manage data requests.
|
||||
assign_capability('tool/dataprivacy:managedatarequests', CAP_ALLOW, $managerroleid, $context->id, true);
|
||||
@@ -254,7 +239,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$s1 = $generator->create_user();
|
||||
$u1 = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Manager role.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -304,7 +289,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
|
||||
// Login as a user without DPO role.
|
||||
$this->setUser($teacher);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
api::approve_data_request($requestid);
|
||||
}
|
||||
|
||||
@@ -327,8 +312,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$this->assertEquals(api::DATAREQUEST_STATUS_REJECTED, $request->get('status'));
|
||||
|
||||
// Confirm they weren't deleted.
|
||||
$user = core_user::get_user($request->get('userid'));
|
||||
core_user::require_active_user($user);
|
||||
$user = \core_user::get_user($request->get('userid'));
|
||||
\core_user::require_active_user($user);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -366,7 +351,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$nondpocapable = $generator->create_user();
|
||||
$nondpoincapable = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Manager role.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -666,8 +651,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$comment = 'sample comment';
|
||||
|
||||
// Get the teacher role pretend it's the parent roles ;).
|
||||
$systemcontext = context_system::instance();
|
||||
$usercontext = context_user::instance($user->id);
|
||||
$systemcontext = \context_system::instance();
|
||||
$usercontext = \context_user::instance($user->id);
|
||||
$parentroleid = $DB->get_field('role', 'id', array('shortname' => 'teacher'));
|
||||
// Give the manager role with the capability to manage data requests.
|
||||
assign_capability('tool/dataprivacy:makedatarequestsforchildren', CAP_ALLOW, $parentroleid, $systemcontext->id, true);
|
||||
@@ -923,7 +908,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$dpo = $generator->create_user();
|
||||
$nondpo = $generator->create_user();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
|
||||
// Manager role.
|
||||
$managerroleid = $DB->get_field('role', 'id', array('shortname' => 'manager'));
|
||||
@@ -1222,7 +1207,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
*/
|
||||
public function test_set_contextlevel_invalid_contextlevels($contextlevel) {
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
api::set_contextlevel((object) [
|
||||
'contextlevel' => $contextlevel,
|
||||
]);
|
||||
@@ -1291,7 +1276,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
'categoryid' => $category1->get('id'),
|
||||
]);
|
||||
|
||||
$this->expectException(coding_exception::class);
|
||||
$this->expectException(\coding_exception::class);
|
||||
api::get_effective_contextlevel_purpose($contextlevel);
|
||||
}
|
||||
|
||||
@@ -1908,14 +1893,14 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$assign = $generator->create_module('assign', ['course' => $course->id]);
|
||||
$forum = $generator->create_module('forum', ['course' => $course->id]);
|
||||
|
||||
$coursecatcontext = context_coursecat::instance($coursecat->id);
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
$blockcontext = context_block::instance($block->id);
|
||||
$coursecatcontext = \context_coursecat::instance($coursecat->id);
|
||||
$coursecontext = \context_course::instance($course->id);
|
||||
$blockcontext = \context_block::instance($block->id);
|
||||
|
||||
list($course, $assigncm) = get_course_and_cm_from_instance($assign->id, 'assign');
|
||||
list($course, $forumcm) = get_course_and_cm_from_instance($forum->id, 'forum');
|
||||
$assigncontext = context_module::instance($assigncm->id);
|
||||
$forumcontext = context_module::instance($forumcm->id);
|
||||
$assigncontext = \context_module::instance($assigncm->id);
|
||||
$forumcontext = \context_module::instance($forumcm->id);
|
||||
|
||||
// Generate purposes and categories.
|
||||
$category1 = api::create_category((object)['name' => 'Test category 1']);
|
||||
@@ -2199,8 +2184,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$roleid = $this->getDataGenerator()->create_role();
|
||||
assign_capability('tool/dataprivacy:requestdelete', CAP_PROHIBIT, $roleid, context_user::instance($userid));
|
||||
role_assign($roleid, $userid, context_user::instance($userid));
|
||||
assign_capability('tool/dataprivacy:requestdelete', CAP_PROHIBIT, $roleid, \context_user::instance($userid));
|
||||
role_assign($roleid, $userid, \context_user::instance($userid));
|
||||
$this->setUser($userid);
|
||||
$this->assertFalse(api::can_create_data_deletion_request_for_self());
|
||||
}
|
||||
@@ -2269,7 +2254,7 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
$userid = $this->getDataGenerator()->create_user()->id;
|
||||
$roleid = $this->getDataGenerator()->create_role();
|
||||
$contextsystem = context_system::instance();
|
||||
$contextsystem = \context_system::instance();
|
||||
assign_capability('tool/dataprivacy:requestdeleteforotheruser', CAP_ALLOW, $roleid, $contextsystem);
|
||||
role_assign($roleid, $userid, $contextsystem);
|
||||
$this->setUser($userid);
|
||||
|
||||
+66
-63
@@ -22,15 +22,18 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_dataprivacy\external;
|
||||
|
||||
use externallib_advanced_testcase;
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\context_instance;
|
||||
use tool_dataprivacy\external;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/webservice/tests/helpers.php');
|
||||
|
||||
use tool_dataprivacy\api;
|
||||
use tool_dataprivacy\context_instance;
|
||||
use tool_dataprivacy\external;
|
||||
|
||||
/**
|
||||
* External testcase.
|
||||
*
|
||||
@@ -38,7 +41,7 @@ use tool_dataprivacy\external;
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
class external_test extends externallib_advanced_testcase {
|
||||
|
||||
/**
|
||||
* Test for external::approve_data_request() with the user not logged in.
|
||||
@@ -46,7 +49,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request_not_logged_in() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -57,7 +60,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
// Log out the user and set force login to true.
|
||||
$this->setUser();
|
||||
|
||||
$this->expectException(require_login_exception::class);
|
||||
$this->expectException(\require_login_exception::class);
|
||||
external::approve_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -67,7 +70,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request_not_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -77,7 +80,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Login as the requester.
|
||||
$this->setUser($requester);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::approve_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -87,7 +90,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request_not_waiting_for_approval() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -98,7 +101,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
$this->setAdminUser();
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectException(\moodle_exception::class);
|
||||
external::approve_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -108,7 +111,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_approve_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -120,7 +123,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
api::update_request_status($datarequest->get('id'), api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::approve_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -136,7 +139,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$result = external::approve_data_request(1);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -149,7 +152,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_other_user() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -162,7 +165,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setUser($otheruser);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -175,7 +178,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_other_user_as_requester() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -191,7 +194,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$datarequest = api::create_data_request($otheruser->id, api::DATAREQUEST_TYPE_EXPORT, $comment);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -202,7 +205,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_requester_lost_permissions() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -220,7 +223,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
role_unassign($parentrole, $requester->id, \context_user::instance($otheruser->id)->id);
|
||||
|
||||
// This user can no longer make the request.
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
}
|
||||
@@ -231,7 +234,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request_other_user_as_child() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -247,7 +250,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$datarequest = api::create_data_request($otheruser->id, api::DATAREQUEST_TYPE_EXPORT, $comment);
|
||||
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -258,7 +261,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_cancel_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -270,7 +273,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setUser($requester);
|
||||
$result = external::cancel_data_request($datarequest->get('id'));
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::approve_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -281,13 +284,13 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_contact_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$user = $generator->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
$message = 'Hello world!';
|
||||
$result = external::contact_dpo($message);
|
||||
$return = (object) external_api::clean_returnvalue(external::contact_dpo_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::contact_dpo_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -298,7 +301,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_contact_dpo_with_nasty_input() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$user = $generator->create_user();
|
||||
|
||||
$this->setUser($user);
|
||||
@@ -312,7 +315,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request_not_logged_in() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -322,7 +325,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Log out.
|
||||
$this->setUser();
|
||||
$this->expectException(require_login_exception::class);
|
||||
$this->expectException(\require_login_exception::class);
|
||||
external::deny_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -332,7 +335,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request_not_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -341,7 +344,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Login as the requester.
|
||||
$this->setUser($requester);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::deny_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -351,7 +354,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request_not_waiting_for_approval() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -361,7 +364,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
$this->setAdminUser();
|
||||
$this->expectException(moodle_exception::class);
|
||||
$this->expectException(\moodle_exception::class);
|
||||
external::deny_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -371,7 +374,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_deny_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -382,7 +385,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
api::update_request_status($datarequest->get('id'), api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::approve_data_request($datarequest->get('id'));
|
||||
$return = (object) external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -397,7 +400,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
$result = external::deny_data_request(1);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::deny_data_request_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -410,7 +413,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_data_request_not_logged_in() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -418,7 +421,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$datarequest = api::create_data_request($requester->id, api::DATAREQUEST_TYPE_EXPORT, $comment);
|
||||
|
||||
$this->setUser();
|
||||
$this->expectException(require_login_exception::class);
|
||||
$this->expectException(\require_login_exception::class);
|
||||
external::get_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -428,7 +431,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_data_request_not_dpo() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$otheruser = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
@@ -438,7 +441,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Login as the otheruser.
|
||||
$this->setUser($otheruser);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::get_data_request($datarequest->get('id'));
|
||||
}
|
||||
|
||||
@@ -448,7 +451,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_data_request() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$generator = new testing_data_generator();
|
||||
$generator = new \testing_data_generator();
|
||||
$requester = $generator->create_user();
|
||||
$comment = 'sample comment';
|
||||
|
||||
@@ -459,7 +462,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$this->setAdminUser();
|
||||
$result = external::get_data_request($datarequest->get('id'));
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::get_data_request_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_data_request_returns(), $result);
|
||||
$this->assertEquals(api::DATAREQUEST_TYPE_EXPORT, $return->result['type']);
|
||||
$this->assertEquals('sample comment', $return->result['comments']);
|
||||
$this->assertEquals($requester->id, $return->result['userid']);
|
||||
@@ -475,7 +478,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Admin as DPO. (The default when no one's assigned as a DPO in the site).
|
||||
$this->setAdminUser();
|
||||
$this->expectException(dml_missing_record_exception::class);
|
||||
$this->expectException(\dml_missing_record_exception::class);
|
||||
external::get_data_request(1);
|
||||
}
|
||||
|
||||
@@ -489,7 +492,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::set_context_defaults(CONTEXT_COURSECAT, context_instance::INHERIT, context_instance::INHERIT, '', false);
|
||||
}
|
||||
|
||||
@@ -514,7 +517,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$course = $generator->create_course(['category' => $coursecat->id]);
|
||||
$assign = $generator->create_module('assign', ['course' => $course->id]);
|
||||
list($course, $assigncm) = get_course_and_cm_from_instance($assign->id, 'assign');
|
||||
$assigncontext = context_module::instance($assigncm->id);
|
||||
$assigncontext = \context_module::instance($assigncm->id);
|
||||
|
||||
// Generate purpose and category.
|
||||
$category1 = api::create_category((object)['name' => 'Test category 1']);
|
||||
@@ -539,7 +542,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::set_context_defaults(CONTEXT_MODULE, $categoryid, $purposeid, $modulename, $override);
|
||||
|
||||
// Extract the result.
|
||||
$return = external_api::clean_returnvalue(external::set_context_defaults_returns(), $result);
|
||||
$return = \external_api::clean_returnvalue(external::set_context_defaults_returns(), $result);
|
||||
$this->assertTrue($return['result']);
|
||||
|
||||
// Check the assignment context instance.
|
||||
@@ -568,7 +571,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$user = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($user);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::get_category_options(true, true);
|
||||
}
|
||||
|
||||
@@ -623,7 +626,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::get_category_options($includeinherit, $includenotset);
|
||||
|
||||
// Extract the options.
|
||||
$return = (object) external_api::clean_returnvalue(external::get_category_options_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_category_options_returns(), $result);
|
||||
$options = $return->options;
|
||||
|
||||
// Make sure everything checks out.
|
||||
@@ -642,7 +645,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$generator = $this->getDataGenerator();
|
||||
$user = $generator->create_user();
|
||||
$this->setUser($user);
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
external::get_category_options(true, true);
|
||||
}
|
||||
|
||||
@@ -687,7 +690,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::get_purpose_options($includeinherit, $includenotset);
|
||||
|
||||
// Extract the options.
|
||||
$return = (object) external_api::clean_returnvalue(external::get_purpose_options_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_purpose_options_returns(), $result);
|
||||
$options = $return->options;
|
||||
|
||||
// Make sure everything checks out.
|
||||
@@ -746,7 +749,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::get_activity_options($nodefaults);
|
||||
|
||||
// Extract the options.
|
||||
$return = (object) external_api::clean_returnvalue(external::get_activity_options_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::get_activity_options_returns(), $result);
|
||||
$options = $return->options;
|
||||
|
||||
// Make sure the options list is not empty.
|
||||
@@ -789,7 +792,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
api::update_request_status($requestid2, api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::bulk_approve_data_requests([$requestid1, $requestid2]);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -804,7 +807,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$result = external::bulk_approve_data_requests([42]);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
$warning = reset($return->warnings);
|
||||
@@ -837,7 +840,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$uut = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($uut);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_approve_data_requests([$requestid1, $requestid2]);
|
||||
}
|
||||
|
||||
@@ -865,7 +868,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
// Deny the requests.
|
||||
$this->setUser($requester1);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_approve_data_requests([$requestid1]);
|
||||
}
|
||||
|
||||
@@ -892,7 +895,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
api::update_request_status($requestid2, api::DATAREQUEST_STATUS_AWAITING_APPROVAL);
|
||||
$result = external::bulk_deny_data_requests([$requestid1, $requestid2]);
|
||||
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$this->assertTrue($return->result);
|
||||
$this->assertEmpty($return->warnings);
|
||||
}
|
||||
@@ -905,7 +908,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
$this->setAdminUser();
|
||||
$result = external::bulk_deny_data_requests([42]);
|
||||
$return = (object) external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
$return = (object) \external_api::clean_returnvalue(external::bulk_approve_data_requests_returns(), $result);
|
||||
|
||||
$this->assertFalse($return->result);
|
||||
$this->assertCount(1, $return->warnings);
|
||||
@@ -939,7 +942,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$uut = $this->getDataGenerator()->create_user();
|
||||
$this->setUser($uut);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_deny_data_requests([$requestid1, $requestid2]);
|
||||
}
|
||||
|
||||
@@ -967,7 +970,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
// Deny the requests.
|
||||
$this->setUser($requester1);
|
||||
|
||||
$this->expectException(required_capability_exception::class);
|
||||
$this->expectException(\required_capability_exception::class);
|
||||
$result = external::bulk_deny_data_requests([$requestid1]);
|
||||
}
|
||||
|
||||
@@ -983,7 +986,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
*/
|
||||
public function test_get_users_using_using_non_identity() {
|
||||
$this->resetAfterTest();
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
@@ -1023,7 +1026,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
$CFG->showuseridentity = 'institution';
|
||||
|
||||
// Create requester user and assign correct capability.
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
@@ -1051,7 +1054,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
public function test_get_users_using_field_not_in_identity() {
|
||||
$this->resetAfterTest();
|
||||
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
@@ -1081,7 +1084,7 @@ class tool_dataprivacy_external_testcase extends externallib_advanced_testcase {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
$CFG->showuseridentity = 'institution';
|
||||
$context = context_system::instance();
|
||||
$context = \context_system::instance();
|
||||
$requester = $this->getDataGenerator()->create_user();
|
||||
$role = $this->getDataGenerator()->create_role();
|
||||
role_assign($role, $requester->id, $context);
|
||||
+5
-11
@@ -14,19 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Tests for scheduled tasks.
|
||||
*
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once('data_privacy_testcase.php');
|
||||
namespace tool_dataprivacy\task;
|
||||
|
||||
use tool_dataprivacy\api;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
require_once(__DIR__ . '/../data_privacy_testcase.php');
|
||||
|
||||
/**
|
||||
* Tests for scheduled tasks.
|
||||
*
|
||||
@@ -34,7 +28,7 @@ use tool_dataprivacy\api;
|
||||
* @copyright 2018 Mihail Geshoski <mihail@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class tool_dataprivacy_task_testcase extends data_privacy_testcase {
|
||||
class task_test extends \data_privacy_testcase {
|
||||
|
||||
/**
|
||||
* Test tearDown.
|
||||
+3
-2
@@ -1,2 +1,3 @@
|
||||
define ("tool_langimport/search",["exports","core/pending","core/utils"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});a.default=void 0;b=function(a){return a&&a.__esModule?a:{default:a}}(b);function d(a,b){return j(a)||h(a,b)||f(a,b)||e()}function e(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function f(a,b){if(!a)return;if("string"==typeof a)return g(a,b);var c=Object.prototype.toString.call(a).slice(8,-1);if("Object"===c&&a.constructor)c=a.constructor.name;if("Map"===c||"Set"===c)return Array.from(c);if("Arguments"===c||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(c))return g(a,b)}function g(a,b){if(null==b||b>a.length)b=a.length;for(var c=0,d=Array(b);c<b;c++){d[c]=a[c]}return d}function h(a,b){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(a)))return;var c=[],d=!0,e=!1,f=void 0;try{for(var g=a[Symbol.iterator](),h;!(d=(h=g.next()).done);d=!0){c.push(h.value);if(b&&c.length===b)break}}catch(a){e=!0;f=a}finally{try{if(!d&&null!=g["return"])g["return"]()}finally{if(e)throw f}}return c}function j(a){if(Array.isArray(a))return a}var k={AVAILABLE_LANG_SELECT:"select",AVAILABLE_LANG_SEARCH:"[data-action=\"search\"]"},l=250;a.default={init:function init(a){var e=a.querySelector(k.AVAILABLE_LANG_SELECT),f=function(a){var c=new b.default("tool_langimport/search:filter");e.querySelectorAll("option").forEach(function(a){a.remove()});var f=a.target.value.toLowerCase(),g=JSON.parse(e.dataset.availableLanguages),h=Object.keys(g).reduce(function(a,b){if(g[b].toLowerCase().includes(f)){a[b]=g[b]}return a},[]);Object.entries(h).forEach(function(a){var b=d(a,2),c=b[0],f=b[1],g=document.createElement("option");g.value=c;g.innerText=f;e.append(g)});c.resolve()},g={};e.querySelectorAll("option").forEach(function(a){g[a.value]=a.text});e.dataset.availableLanguages=JSON.stringify(g);var h=a.querySelector(k.AVAILABLE_LANG_SEARCH);h.addEventListener("keydown",function(a){if("Enter"===a.key){a.preventDefault()}});h.addEventListener("keyup",function(a){var d=new b.default("tool_langimport/search:keyup");(0,c.debounce)(f,l)(a);setTimeout(function(){d.resolve()},l)})}};return a.default});
|
||||
//# sourceMappingURL=search.min.js.map
|
||||
define("tool_langimport/search",["exports","core/pending","core/utils"],(function(_exports,_pending,_utils){var obj;function _slicedToArray(arr,i){return function(arr){if(Array.isArray(arr))return arr}(arr)||function(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null==_i)return;var _s,_e,_arr=[],_n=!0,_d=!1;try{for(_i=_i.call(arr);!(_n=(_s=_i.next()).done)&&(_arr.push(_s.value),!i||_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{_n||null==_i.return||_i.return()}finally{if(_d)throw _e}}return _arr}(arr,i)||function(o,minLen){if(!o)return;if("string"==typeof o)return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);"Object"===n&&o.constructor&&(n=o.constructor.name);if("Map"===n||"Set"===n)return Array.from(o);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}(arr,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _arrayLikeToArray(arr,len){(null==len||len>arr.length)&&(len=arr.length);for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_pending=(obj=_pending)&&obj.__esModule?obj:{default:obj};var SELECTORS_AVAILABLE_LANG_SELECT="select",SELECTORS_AVAILABLE_LANG_SEARCH='[data-action="search"]',_default={init:function(form){var availableLangsElement=form.querySelector(SELECTORS_AVAILABLE_LANG_SELECT),availableLangsFilter=function(event){var pendingPromise=new _pending.default("tool_langimport/search:filter");availableLangsElement.querySelectorAll("option").forEach((function(option){option.remove()}));var searchTerm=event.target.value.toLowerCase(),availableLanguages=JSON.parse(availableLangsElement.dataset.availableLanguages),filteredLanguages=Object.keys(availableLanguages).reduce((function(matches,langcode){return availableLanguages[langcode].toLowerCase().includes(searchTerm)&&(matches[langcode]=availableLanguages[langcode]),matches}),[]);Object.entries(filteredLanguages).forEach((function(_ref){var _ref2=_slicedToArray(_ref,2),langcode=_ref2[0],langname=_ref2[1],option=document.createElement("option");option.value=langcode,option.innerText=langname,availableLangsElement.append(option)})),pendingPromise.resolve()},availableLanguages={};availableLangsElement.querySelectorAll("option").forEach((function(option){availableLanguages[option.value]=option.text})),availableLangsElement.dataset.availableLanguages=JSON.stringify(availableLanguages);var availableLangsSearch=form.querySelector(SELECTORS_AVAILABLE_LANG_SEARCH);availableLangsSearch.addEventListener("keydown",(function(event){"Enter"===event.key&&event.preventDefault()})),availableLangsSearch.addEventListener("keyup",(function(event){var pendingPromise=new _pending.default("tool_langimport/search:keyup");(0,_utils.debounce)(availableLangsFilter,250)(event),setTimeout((function(){pendingPromise.resolve()}),250)}))}};return _exports.default=_default,_exports.default}));
|
||||
|
||||
//# sourceMappingURL=search.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+5
-5
@@ -22,7 +22,7 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
namespace tool_langimport\event;
|
||||
|
||||
/**
|
||||
* Test class for langimport events.
|
||||
@@ -31,7 +31,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @copyright 2014 Dan Poltawski
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
|
||||
*/
|
||||
class tool_langimport_events_testcase extends advanced_testcase {
|
||||
class events_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Setup testcase.
|
||||
@@ -53,7 +53,7 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_langimport\event\langpack_updated', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
public function test_langpack_updated_validation() {
|
||||
@@ -73,7 +73,7 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_langimport\event\langpack_imported', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
public function test_langpack_installed_validation() {
|
||||
@@ -93,7 +93,7 @@ class tool_langimport_events_testcase extends advanced_testcase {
|
||||
$event = reset($events);
|
||||
|
||||
$this->assertInstanceOf('\tool_langimport\event\langpack_removed', $event);
|
||||
$this->assertEquals(context_system::instance(), $event->get_context());
|
||||
$this->assertEquals(\context_system::instance(), $event->get_context());
|
||||
}
|
||||
|
||||
public function test_langpack_removed_validation() {
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_licensemanager/delete_license",["jquery","core/modal_factory","core/modal_events","core/url","core/str"],function(a,b,c,d,e){var f=a(".delete-license");b.create({type:b.types.SAVE_CANCEL,title:e.get_string("deletelicense","tool_licensemanager"),body:e.get_string("deletelicenseconfirmmessage","tool_licensemanager"),preShowCallback:function preShowCallback(b,c){b=a(b);var e={action:"delete",license:b.data("license")};c.deleteURL=d.relativeUrl("/admin/tool/licensemanager/index.php",e,!0)},large:!0},f).done(function(a){a.getRoot().on(c.save,function(b){b.preventDefault();window.location.href=a.deleteURL})})});
|
||||
//# sourceMappingURL=delete_license.min.js.map
|
||||
/**
|
||||
* Modal for confirming deletion of a custom license.
|
||||
*
|
||||
* @module tool_licensemanager/delete_license
|
||||
* @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_licensemanager/delete_license",["jquery","core/modal_factory","core/modal_events","core/url","core/str"],(function($,ModalFactory,ModalEvents,Url,String){var trigger=$(".delete-license");ModalFactory.create({type:ModalFactory.types.SAVE_CANCEL,title:String.get_string("deletelicense","tool_licensemanager"),body:String.get_string("deletelicenseconfirmmessage","tool_licensemanager"),preShowCallback:function(triggerElement,modal){var params={action:"delete",license:(triggerElement=$(triggerElement)).data("license")};modal.deleteURL=Url.relativeUrl("/admin/tool/licensemanager/index.php",params,!0)},large:!0},trigger).done((function(modal){modal.getRoot().on(ModalEvents.save,(function(e){e.preventDefault(),window.location.href=modal.deleteURL}))}))}));
|
||||
|
||||
//# sourceMappingURL=delete_license.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/delete_license.js"],"names":["define","$","ModalFactory","ModalEvents","Url","String","trigger","create","type","types","SAVE_CANCEL","title","get_string","body","preShowCallback","triggerElement","modal","params","data","deleteURL","relativeUrl","large","done","getRoot","on","save","e","preventDefault","window","location","href"],"mappings":"AAsBAA,OAAM,sCAAC,CAAC,QAAD,CAAW,oBAAX,CAAiC,mBAAjC,CAAsD,UAAtD,CAAkE,UAAlE,CAAD,CACF,SAASC,CAAT,CAAYC,CAAZ,CAA0BC,CAA1B,CAAuCC,CAAvC,CAA4CC,CAA5C,CAAoD,CAEhD,GAAIC,CAAAA,CAAO,CAAGL,CAAC,CAAC,iBAAD,CAAf,CACAC,CAAY,CAACK,MAAb,CAAoB,CAChBC,IAAI,CAAEN,CAAY,CAACO,KAAb,CAAmBC,WADT,CAEhBC,KAAK,CAAEN,CAAM,CAACO,UAAP,CAAkB,eAAlB,CAAmC,qBAAnC,CAFS,CAGhBC,IAAI,CAAER,CAAM,CAACO,UAAP,CAAkB,6BAAlB,CAAiD,qBAAjD,CAHU,CAIhBE,eAAe,CAAE,yBAASC,CAAT,CAAyBC,CAAzB,CAAgC,CAC7CD,CAAc,CAAGd,CAAC,CAACc,CAAD,CAAlB,CACA,GAAIE,CAAAA,CAAM,CAAG,CACT,OAAU,QADD,CAET,QAAWF,CAAc,CAACG,IAAf,CAAoB,SAApB,CAFF,CAAb,CAIAF,CAAK,CAACG,SAAN,CAAkBf,CAAG,CAACgB,WAAJ,CAAgB,sCAAhB,CAAwDH,CAAxD,IACrB,CAXe,CAYhBI,KAAK,GAZW,CAApB,CAaGf,CAbH,EAcKgB,IAdL,CAcU,SAASN,CAAT,CAAgB,CAClBA,CAAK,CAACO,OAAN,GAAgBC,EAAhB,CAAmBrB,CAAW,CAACsB,IAA/B,CAAqC,SAASC,CAAT,CAAY,CAE7CA,CAAC,CAACC,cAAF,GAEAC,MAAM,CAACC,QAAP,CAAgBC,IAAhB,CAAuBd,CAAK,CAACG,SAChC,CALD,CAMH,CArBL,CAsBH,CA1BC,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Modal for confirming deletion of a custom license.\n *\n * @module tool_licensemanager/delete_license\n * @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/url', 'core/str'],\n function($, ModalFactory, ModalEvents, Url, String) {\n\n var trigger = $('.delete-license');\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: String.get_string('deletelicense', 'tool_licensemanager'),\n body: String.get_string('deletelicenseconfirmmessage', 'tool_licensemanager'),\n preShowCallback: function(triggerElement, modal) {\n triggerElement = $(triggerElement);\n let params = {\n 'action': 'delete',\n 'license': triggerElement.data('license')\n };\n modal.deleteURL = Url.relativeUrl('/admin/tool/licensemanager/index.php', params, true);\n },\n large: true,\n }, trigger)\n .done(function(modal) {\n modal.getRoot().on(ModalEvents.save, function(e) {\n // Stop the default save button behaviour which is to close the modal.\n e.preventDefault();\n // Redirect to delete url.\n window.location.href = modal.deleteURL;\n });\n });\n });\n"],"file":"delete_license.min.js"}
|
||||
{"version":3,"file":"delete_license.min.js","sources":["../src/delete_license.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Modal for confirming deletion of a custom license.\n *\n * @module tool_licensemanager/delete_license\n * @copyright 2019 Tom Dickman <tomdickman@catalyst-au.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/modal_factory', 'core/modal_events', 'core/url', 'core/str'],\n function($, ModalFactory, ModalEvents, Url, String) {\n\n var trigger = $('.delete-license');\n ModalFactory.create({\n type: ModalFactory.types.SAVE_CANCEL,\n title: String.get_string('deletelicense', 'tool_licensemanager'),\n body: String.get_string('deletelicenseconfirmmessage', 'tool_licensemanager'),\n preShowCallback: function(triggerElement, modal) {\n triggerElement = $(triggerElement);\n let params = {\n 'action': 'delete',\n 'license': triggerElement.data('license')\n };\n modal.deleteURL = Url.relativeUrl('/admin/tool/licensemanager/index.php', params, true);\n },\n large: true,\n }, trigger)\n .done(function(modal) {\n modal.getRoot().on(ModalEvents.save, function(e) {\n // Stop the default save button behaviour which is to close the modal.\n e.preventDefault();\n // Redirect to delete url.\n window.location.href = modal.deleteURL;\n });\n });\n });\n"],"names":["define","$","ModalFactory","ModalEvents","Url","String","trigger","create","type","types","SAVE_CANCEL","title","get_string","body","preShowCallback","triggerElement","modal","params","data","deleteURL","relativeUrl","large","done","getRoot","on","save","e","preventDefault","window","location","href"],"mappings":";;;;;;;AAsBAA,4CAAO,CAAC,SAAU,qBAAsB,oBAAqB,WAAY,aACrE,SAASC,EAAGC,aAAcC,YAAaC,IAAKC,YAEpCC,QAAUL,EAAE,mBAChBC,aAAaK,OAAO,CAChBC,KAAMN,aAAaO,MAAMC,YACzBC,MAAON,OAAOO,WAAW,gBAAiB,uBAC1CC,KAAMR,OAAOO,WAAW,8BAA+B,uBACvDE,gBAAiB,SAASC,eAAgBC,WAElCC,OAAS,QACC,kBAFdF,eAAiBd,EAAEc,iBAGWG,KAAK,YAEnCF,MAAMG,UAAYf,IAAIgB,YAAY,uCAAwCH,QAAQ,IAEtFI,OAAO,GACRf,SACEgB,MAAK,SAASN,OACXA,MAAMO,UAAUC,GAAGrB,YAAYsB,MAAM,SAASC,GAE1CA,EAAEC,iBAEFC,OAAOC,SAASC,KAAOd,MAAMG"}
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace logstore_database;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
/**
|
||||
* External database log store tests.
|
||||
*
|
||||
@@ -21,13 +28,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
class logstore_database_store_testcase extends advanced_testcase {
|
||||
class store_test extends \advanced_testcase {
|
||||
/**
|
||||
* Tests log writing.
|
||||
*
|
||||
@@ -120,7 +121,7 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(0);
|
||||
$event1 = \logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$event1->trigger();
|
||||
|
||||
$logs = $DB->get_records('logstore_standard_log', array(), 'id ASC');
|
||||
@@ -141,11 +142,11 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
$this->assertEquals($data, $log1);
|
||||
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($user1->id, context_system::instance());
|
||||
\core\session\manager::loginas($user1->id, \context_system::instance());
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$event2 = \logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
array('context' => \context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
$event2->trigger();
|
||||
|
||||
\core\session\manager::init_empty_session();
|
||||
@@ -190,30 +191,30 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
$DB->delete_records('logstore_standard_log');
|
||||
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
$store->flush();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(8, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
// Test guest logging setting.
|
||||
@@ -225,22 +226,22 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(null);
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setGuestUser();
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user1);
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(1, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user2);
|
||||
\logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
set_config('enabled_stores', '', 'tool_log');
|
||||
@@ -270,7 +271,7 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
set_config('logguests', 0, 'logstore_database');
|
||||
$this->setGuestUser();
|
||||
$event = \logstore_database\event\unittest_executed::create(
|
||||
array('context' => context_system::instance(), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_system::instance(), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$logmanager = get_log_manager();
|
||||
$store = new \logstore_database\test\store($logmanager);
|
||||
$this->assertTrue($store->is_event_ignored($event));
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace logstore_legacy;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
/**
|
||||
* Legacy log store tests.
|
||||
*
|
||||
@@ -21,13 +28,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/store.php');
|
||||
|
||||
class logstore_legacy_store_testcase extends advanced_testcase {
|
||||
class store_test extends \advanced_testcase {
|
||||
public function test_log_writing() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
@@ -58,12 +59,12 @@ class logstore_legacy_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(0);
|
||||
$event1 = \logstore_legacy\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$event1->trigger();
|
||||
|
||||
$this->setUser($user1);
|
||||
$event2 = \logstore_legacy\event\unittest_executed::create(
|
||||
array('context' => context_course::instance($course2->id), 'other' => array('sample' => 6, 'xx' => 11)));
|
||||
array('context' => \context_course::instance($course2->id), 'other' => array('sample' => 6, 'xx' => 11)));
|
||||
$event2->trigger();
|
||||
|
||||
$logs = $DB->get_records('log', array(), 'id ASC');
|
||||
|
||||
@@ -39,4 +39,4 @@
|
||||
</INDEXES>
|
||||
</TABLE>
|
||||
</TABLES>
|
||||
</XMLDB>
|
||||
</XMLDB>
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace logstore_standard;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/restore_hack.php');
|
||||
|
||||
/**
|
||||
* Standard log store tests.
|
||||
*
|
||||
@@ -21,13 +28,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once(__DIR__ . '/fixtures/event.php');
|
||||
require_once(__DIR__ . '/fixtures/restore_hack.php');
|
||||
|
||||
class logstore_standard_store_testcase extends advanced_testcase {
|
||||
class store_test extends \advanced_testcase {
|
||||
/**
|
||||
* @var bool Determine if we disabled the GC, so it can be re-enabled in tearDown.
|
||||
*/
|
||||
@@ -84,7 +85,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(0);
|
||||
$event1 = \logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)));
|
||||
$event1->trigger();
|
||||
|
||||
$logs = $DB->get_records('logstore_standard_log', array(), 'id ASC');
|
||||
@@ -105,14 +106,14 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$this->assertEquals($data, $log1);
|
||||
|
||||
$this->setAdminUser();
|
||||
\core\session\manager::loginas($user1->id, context_system::instance());
|
||||
\core\session\manager::loginas($user1->id, \context_system::instance());
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
logstore_standard_restore::hack_executing(1);
|
||||
\logstore_standard_restore::hack_executing(1);
|
||||
$event2 = \logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
array('context' => \context_module::instance($module2->cmid), 'other' => array('sample' => 6, 'xx' => 9)));
|
||||
$event2->trigger();
|
||||
logstore_standard_restore::hack_executing(0);
|
||||
\logstore_standard_restore::hack_executing(0);
|
||||
|
||||
\core\session\manager::init_empty_session();
|
||||
$this->assertFalse(\core\session\manager::is_loggedinas());
|
||||
@@ -161,30 +162,30 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$DB->delete_records('logstore_standard_log');
|
||||
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
$store->flush();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(5, $DB->count_records('logstore_standard_log'));
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(8, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
// Test guest logging setting.
|
||||
@@ -196,22 +197,22 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
|
||||
$this->setUser(null);
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setGuestUser();
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(0, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user1);
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(1, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
$this->setUser($user2);
|
||||
\logstore_standard\event\unittest_executed::create(
|
||||
array('context' => context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
array('context' => \context_module::instance($module1->cmid), 'other' => array('sample' => 5, 'xx' => 10)))->trigger();
|
||||
$this->assertEquals(2, $DB->count_records('logstore_standard_log'));
|
||||
|
||||
set_config('enabled_stores', '', 'tool_log');
|
||||
@@ -335,7 +336,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$this->resetAfterTest();
|
||||
|
||||
// Create some records spread over various days; test multiple iterations in cleanup.
|
||||
$ctx = context_course::instance(1);
|
||||
$ctx = \context_course::instance(1);
|
||||
$record = (object) array(
|
||||
'edulevel' => 0,
|
||||
'contextid' => $ctx->id,
|
||||
@@ -424,11 +425,11 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
|
||||
// Create some log data in a course - one with other data, one without.
|
||||
\logstore_standard\event\unittest_executed::create([
|
||||
'context' => context_course::instance($course->id),
|
||||
'context' => \context_course::instance($course->id),
|
||||
'other' => ['sample' => 5, 'xx' => 10]])->trigger();
|
||||
$this->waitForSecond();
|
||||
\logstore_standard\event\unittest_executed::create([
|
||||
'context' => context_course::instance($course->id)])->trigger();
|
||||
'context' => \context_course::instance($course->id)])->trigger();
|
||||
|
||||
$records = array_values($DB->get_records('logstore_standard_log',
|
||||
['courseid' => $course->id, 'target' => 'unittest'], 'timecreated'));
|
||||
@@ -473,7 +474,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
/**
|
||||
* Backs a course up to temp directory.
|
||||
*
|
||||
* @param stdClass $course Course object to backup
|
||||
* @param \stdClass $course Course object to backup
|
||||
* @return string ID of backup
|
||||
*/
|
||||
protected function backup($course): string {
|
||||
@@ -481,14 +482,14 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
|
||||
|
||||
// Turn off file logging, otherwise it can't delete the file (Windows).
|
||||
$CFG->backup_file_logger_level = backup::LOG_NONE;
|
||||
$CFG->backup_file_logger_level = \backup::LOG_NONE;
|
||||
|
||||
// Do backup with default settings. MODE_IMPORT means it will just
|
||||
// create the directory and not zip it.
|
||||
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id,
|
||||
backup::FORMAT_MOODLE, backup::INTERACTIVE_NO, backup::MODE_IMPORT,
|
||||
$bc = new \backup_controller(\backup::TYPE_1COURSE, $course->id,
|
||||
\backup::FORMAT_MOODLE, \backup::INTERACTIVE_NO, \backup::MODE_IMPORT,
|
||||
$USER->id);
|
||||
$bc->get_plan()->get_setting('users')->set_status(backup_setting::NOT_LOCKED);
|
||||
$bc->get_plan()->get_setting('users')->set_status(\backup_setting::NOT_LOCKED);
|
||||
$bc->get_plan()->get_setting('users')->set_value(true);
|
||||
$bc->get_plan()->get_setting('logs')->set_value(true);
|
||||
$backupid = $bc->get_backupid();
|
||||
@@ -505,18 +506,18 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
* @param \stdClass $course Original course object
|
||||
* @param string $suffix Suffix to add after original course shortname and fullname
|
||||
* @return int New course id
|
||||
* @throws restore_controller_exception
|
||||
* @throws \restore_controller_exception
|
||||
*/
|
||||
protected function restore(string $backupid, $course, string $suffix): int {
|
||||
global $USER, $CFG;
|
||||
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
|
||||
|
||||
// Do restore to new course with default settings.
|
||||
$newcourseid = restore_dbops::create_new_course(
|
||||
$newcourseid = \restore_dbops::create_new_course(
|
||||
$course->fullname . $suffix, $course->shortname . $suffix, $course->category);
|
||||
$rc = new restore_controller($backupid, $newcourseid,
|
||||
backup::INTERACTIVE_NO, backup::MODE_GENERAL, $USER->id,
|
||||
backup::TARGET_NEW_COURSE);
|
||||
$rc = new \restore_controller($backupid, $newcourseid,
|
||||
\backup::INTERACTIVE_NO, \backup::MODE_GENERAL, $USER->id,
|
||||
\backup::TARGET_NEW_COURSE);
|
||||
$rc->get_plan()->get_setting('logs')->set_value(true);
|
||||
$rc->get_plan()->get_setting('users')->set_value(true);
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
namespace tool_log;
|
||||
|
||||
/**
|
||||
* Log manager and log API tests.
|
||||
*
|
||||
@@ -21,10 +23,7 @@
|
||||
* @copyright 2014 Petr Skoda {@link http://skodak.org/}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
class tool_log_manager_testcase extends advanced_testcase {
|
||||
class manager_test extends \advanced_testcase {
|
||||
public function test_get_log_manager() {
|
||||
global $CFG;
|
||||
$this->resetAfterTest();
|
||||
|
||||
+14
-2
@@ -1,2 +1,14 @@
|
||||
define ("tool_lp/actionselector",["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","tool_lp/event_base"],function(a,b,c,d,e,f){var g=function(a,b,c,d,e){var g=this;f.prototype.constructor.apply(this,[]);g._title=a;g._message=b;g._actions=c;g._confirm=d;g._cancel=e;g._selectedValue=null;g._reset()};g.prototype=Object.create(f.prototype);g.prototype._selectedValue=null;g.prototype._popup=null;g.prototype._title=null;g.prototype._message=null;g.prototype._actions=null;g.prototype._confirm=null;g.prototype._cancel=null;g.prototype._afterRender=function(){var b=this;b._find("[data-action=\"action-selector-confirm\"]").attr("disabled","disabled");b._find("[data-region=\"action-selector-radio-buttons\"]").change(function(){b._selectedValue=a("input[type='radio']:checked").val();b._find("[data-action=\"action-selector-confirm\"]").removeAttr("disabled");b._refresh.bind(b)});b._find("[data-action=\"action-selector-cancel\"]").click(function(a){a.preventDefault();b.close()});b._find("[data-action=\"action-selector-confirm\"]").click(function(a){a.preventDefault();if(!b._selectedValue.length){return}b._trigger("save",{action:b._selectedValue});b.close()})};g.prototype.close=function(){var a=this;a._popup.close();a._reset()};g.prototype.display=function(){var a=this;return a._render().then(function(b){a._popup=new e(a._title,b,a._afterRender.bind(a))}).fail(b.exception)};g.prototype._find=function(b){return a(this._popup.getContent()).find(b)};g.prototype._refresh=function(){var a=this;return a._render().then(function(b){a._find("[data-region=\"action-selector\"]").replaceWith(b);a._afterRender()})};g.prototype._render=function(){var a=this,b=[];for(var c in a._actions){b.push(a._actions[c])}var e={message:a._message,choices:b,confirm:a._confirm,cancel:a._cancel};return d.render("tool_lp/action_selector",e)};g.prototype._reset=function(){this._popup=null;this._selectedValue=""};return g});
|
||||
//# sourceMappingURL=actionselector.min.js.map
|
||||
/**
|
||||
* Action selector.
|
||||
*
|
||||
* To handle 'save' events use: actionselector.on('save')
|
||||
* This will receive the information to display in popup.
|
||||
* The actions have the format [{'text': sometext, 'value' : somevalue}].
|
||||
*
|
||||
* @module tool_lp/actionselector
|
||||
* @copyright 2016 Serge Gauthier - <serge.gauthier.2@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/actionselector",["jquery","core/notification","core/ajax","core/templates","tool_lp/dialogue","tool_lp/event_base"],(function($,Notification,Ajax,Templates,Dialogue,EventBase){var ActionSelector=function(title,message,actions,confirm,cancel){EventBase.prototype.constructor.apply(this,[]),this._title=title,this._message=message,this._actions=actions,this._confirm=confirm,this._cancel=cancel,this._selectedValue=null,this._reset()};return(ActionSelector.prototype=Object.create(EventBase.prototype))._selectedValue=null,ActionSelector.prototype._popup=null,ActionSelector.prototype._title=null,ActionSelector.prototype._message=null,ActionSelector.prototype._actions=null,ActionSelector.prototype._confirm=null,ActionSelector.prototype._cancel=null,ActionSelector.prototype._afterRender=function(){var self=this;self._find('[data-action="action-selector-confirm"]').attr("disabled","disabled"),self._find('[data-region="action-selector-radio-buttons"]').change((function(){self._selectedValue=$("input[type='radio']:checked").val(),self._find('[data-action="action-selector-confirm"]').removeAttr("disabled"),self._refresh.bind(self)})),self._find('[data-action="action-selector-cancel"]').click((function(e){e.preventDefault(),self.close()})),self._find('[data-action="action-selector-confirm"]').click((function(e){e.preventDefault(),self._selectedValue.length&&(self._trigger("save",{action:self._selectedValue}),self.close())}))},ActionSelector.prototype.close=function(){this._popup.close(),this._reset()},ActionSelector.prototype.display=function(){var self=this;return self._render().then((function(html){self._popup=new Dialogue(self._title,html,self._afterRender.bind(self))})).fail(Notification.exception)},ActionSelector.prototype._find=function(selector){return $(this._popup.getContent()).find(selector)},ActionSelector.prototype._refresh=function(){var self=this;return self._render().then((function(html){self._find('[data-region="action-selector"]').replaceWith(html),self._afterRender()}))},ActionSelector.prototype._render=function(){var choices=[];for(var i in this._actions)choices.push(this._actions[i]);var content={message:this._message,choices:choices,confirm:this._confirm,cancel:this._cancel};return Templates.render("tool_lp/action_selector",content)},ActionSelector.prototype._reset=function(){this._popup=null,this._selectedValue=""},ActionSelector}));
|
||||
|
||||
//# sourceMappingURL=actionselector.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competency_outcomes",["jquery","core/str"],function(a,b){return{NONE:0,EVIDENCE:1,COMPLETE:2,RECOMMEND:3,getAll:function getAll(){var a=this;return b.get_strings([{key:"competencyoutcome_none",component:"tool_lp"},{key:"competencyoutcome_evidence",component:"tool_lp"},{key:"competencyoutcome_recommend",component:"tool_lp"},{key:"competencyoutcome_complete",component:"tool_lp"}]).then(function(b){var c={};c[a.NONE]={code:a.NONE,name:b[0]};c[a.EVIDENCE]={code:a.EVIDENCE,name:b[1]};c[a.RECOMMEND]={code:a.RECOMMEND,name:b[2]};c[a.COMPLETE]={code:a.COMPLETE,name:b[3]};return c})},getString:function getString(b){var c=this,d=c.getAll();return d.then(function(c){if("undefined"==typeof c[b]){return a.Deferred().reject().promise()}return c[b].name})}}});
|
||||
//# sourceMappingURL=competency_outcomes.min.js.map
|
||||
/**
|
||||
* Competency rule config.
|
||||
*
|
||||
* @module tool_lp/competency_outcomes
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competency_outcomes",["jquery","core/str"],(function($,Str){return{NONE:0,EVIDENCE:1,COMPLETE:2,RECOMMEND:3,getAll:function(){var self=this;return Str.get_strings([{key:"competencyoutcome_none",component:"tool_lp"},{key:"competencyoutcome_evidence",component:"tool_lp"},{key:"competencyoutcome_recommend",component:"tool_lp"},{key:"competencyoutcome_complete",component:"tool_lp"}]).then((function(strings){var outcomes={};return outcomes[self.NONE]={code:self.NONE,name:strings[0]},outcomes[self.EVIDENCE]={code:self.EVIDENCE,name:strings[1]},outcomes[self.RECOMMEND]={code:self.RECOMMEND,name:strings[2]},outcomes[self.COMPLETE]={code:self.COMPLETE,name:strings[3]},outcomes}))},getString:function(id){return this.getAll().then((function(outcomes){return void 0===outcomes[id]?$.Deferred().reject().promise():outcomes[id].name}))}}}));
|
||||
|
||||
//# sourceMappingURL=competency_outcomes.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/competency_outcomes.js"],"names":["define","$","Str","NONE","EVIDENCE","COMPLETE","RECOMMEND","getAll","self","get_strings","key","component","then","strings","outcomes","code","name","getString","id","all","Deferred","reject","promise"],"mappings":"AAuBAA,OAAM,+BAAC,CAAC,QAAD,CACC,UADD,CAAD,CAEE,SAASC,CAAT,CAAYC,CAAZ,CAAiB,CAOrB,MAAO,CAEHC,IAAI,EAFD,CAGHC,QAAQ,EAHL,CAIHC,QAAQ,EAJL,CAKHC,SAAS,EALN,CAaHC,MAAM,CAAE,iBAAW,CACf,GAAIC,CAAAA,CAAI,CAAG,IAAX,CACA,MAAON,CAAAA,CAAG,CAACO,WAAJ,CAAgB,CACnB,CAACC,GAAG,CAAE,wBAAN,CAAgCC,SAAS,CAAE,SAA3C,CADmB,CAEnB,CAACD,GAAG,CAAE,4BAAN,CAAoCC,SAAS,CAAE,SAA/C,CAFmB,CAGnB,CAACD,GAAG,CAAE,6BAAN,CAAqCC,SAAS,CAAE,SAAhD,CAHmB,CAInB,CAACD,GAAG,CAAE,4BAAN,CAAoCC,SAAS,CAAE,SAA/C,CAJmB,CAAhB,EAKJC,IALI,CAKC,SAASC,CAAT,CAAkB,CACtB,GAAIC,CAAAA,CAAQ,CAAG,EAAf,CACAA,CAAQ,CAACN,CAAI,CAACL,IAAN,CAAR,CAAsB,CAACY,IAAI,CAAEP,CAAI,CAACL,IAAZ,CAAkBa,IAAI,CAAEH,CAAO,CAAC,CAAD,CAA/B,CAAtB,CACAC,CAAQ,CAACN,CAAI,CAACJ,QAAN,CAAR,CAA0B,CAACW,IAAI,CAAEP,CAAI,CAACJ,QAAZ,CAAsBY,IAAI,CAAEH,CAAO,CAAC,CAAD,CAAnC,CAA1B,CACAC,CAAQ,CAACN,CAAI,CAACF,SAAN,CAAR,CAA2B,CAACS,IAAI,CAAEP,CAAI,CAACF,SAAZ,CAAuBU,IAAI,CAAEH,CAAO,CAAC,CAAD,CAApC,CAA3B,CACAC,CAAQ,CAACN,CAAI,CAACH,QAAN,CAAR,CAA0B,CAACU,IAAI,CAAEP,CAAI,CAACH,QAAZ,CAAsBW,IAAI,CAAEH,CAAO,CAAC,CAAD,CAAnC,CAA1B,CACA,MAAOC,CAAAA,CACV,CAZM,CAaV,CA5BE,CAqCHG,SAAS,CAAE,mBAASC,CAAT,CAAa,CACpB,GAAIV,CAAAA,CAAI,CAAG,IAAX,CACIW,CAAG,CAAGX,CAAI,CAACD,MAAL,EADV,CAGA,MAAOY,CAAAA,CAAG,CAACP,IAAJ,CAAS,SAASE,CAAT,CAAmB,CAC/B,GAA4B,WAAxB,QAAOA,CAAAA,CAAQ,CAACI,CAAD,CAAnB,CAAyC,CACrC,MAAOjB,CAAAA,CAAC,CAACmB,QAAF,GAAaC,MAAb,GAAsBC,OAAtB,EACV,CACD,MAAOR,CAAAA,CAAQ,CAACI,CAAD,CAAR,CAAaF,IACvB,CALM,CAMV,CA/CE,CAiDV,CA1DK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Competency rule config.\n *\n * @module tool_lp/competency_outcomes\n * @copyright 2015 Frédéric Massart - FMCorz.net\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery',\n 'core/str'],\n function($, Str) {\n\n var OUTCOME_NONE = 0,\n OUTCOME_EVIDENCE = 1,\n OUTCOME_COMPLETE = 2,\n OUTCOME_RECOMMEND = 3;\n\n return {\n\n NONE: OUTCOME_NONE,\n EVIDENCE: OUTCOME_EVIDENCE,\n COMPLETE: OUTCOME_COMPLETE,\n RECOMMEND: OUTCOME_RECOMMEND,\n\n /**\n * Get all the outcomes.\n *\n * @return {Object} Indexed by outcome code, contains code and name.\n * @method getAll\n */\n getAll: function() {\n var self = this;\n return Str.get_strings([\n {key: 'competencyoutcome_none', component: 'tool_lp'},\n {key: 'competencyoutcome_evidence', component: 'tool_lp'},\n {key: 'competencyoutcome_recommend', component: 'tool_lp'},\n {key: 'competencyoutcome_complete', component: 'tool_lp'},\n ]).then(function(strings) {\n var outcomes = {};\n outcomes[self.NONE] = {code: self.NONE, name: strings[0]};\n outcomes[self.EVIDENCE] = {code: self.EVIDENCE, name: strings[1]};\n outcomes[self.RECOMMEND] = {code: self.RECOMMEND, name: strings[2]};\n outcomes[self.COMPLETE] = {code: self.COMPLETE, name: strings[3]};\n return outcomes;\n });\n },\n\n /**\n * Get the string for an outcome.\n *\n * @param {Number} id The outcome code.\n * @return {Promise} Resolved with the string.\n * @method getString\n */\n getString: function(id) {\n var self = this,\n all = self.getAll();\n\n return all.then(function(outcomes) {\n if (typeof outcomes[id] === 'undefined') {\n return $.Deferred().reject().promise();\n }\n return outcomes[id].name;\n });\n }\n };\n});\n"],"file":"competency_outcomes.min.js"}
|
||||
{"version":3,"file":"competency_outcomes.min.js","sources":["../src/competency_outcomes.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Competency rule config.\n *\n * @module tool_lp/competency_outcomes\n * @copyright 2015 Frédéric Massart - FMCorz.net\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery',\n 'core/str'],\n function($, Str) {\n\n var OUTCOME_NONE = 0,\n OUTCOME_EVIDENCE = 1,\n OUTCOME_COMPLETE = 2,\n OUTCOME_RECOMMEND = 3;\n\n return {\n\n NONE: OUTCOME_NONE,\n EVIDENCE: OUTCOME_EVIDENCE,\n COMPLETE: OUTCOME_COMPLETE,\n RECOMMEND: OUTCOME_RECOMMEND,\n\n /**\n * Get all the outcomes.\n *\n * @return {Object} Indexed by outcome code, contains code and name.\n * @method getAll\n */\n getAll: function() {\n var self = this;\n return Str.get_strings([\n {key: 'competencyoutcome_none', component: 'tool_lp'},\n {key: 'competencyoutcome_evidence', component: 'tool_lp'},\n {key: 'competencyoutcome_recommend', component: 'tool_lp'},\n {key: 'competencyoutcome_complete', component: 'tool_lp'},\n ]).then(function(strings) {\n var outcomes = {};\n outcomes[self.NONE] = {code: self.NONE, name: strings[0]};\n outcomes[self.EVIDENCE] = {code: self.EVIDENCE, name: strings[1]};\n outcomes[self.RECOMMEND] = {code: self.RECOMMEND, name: strings[2]};\n outcomes[self.COMPLETE] = {code: self.COMPLETE, name: strings[3]};\n return outcomes;\n });\n },\n\n /**\n * Get the string for an outcome.\n *\n * @param {Number} id The outcome code.\n * @return {Promise} Resolved with the string.\n * @method getString\n */\n getString: function(id) {\n var self = this,\n all = self.getAll();\n\n return all.then(function(outcomes) {\n if (typeof outcomes[id] === 'undefined') {\n return $.Deferred().reject().promise();\n }\n return outcomes[id].name;\n });\n }\n };\n});\n"],"names":["define","$","Str","NONE","EVIDENCE","COMPLETE","RECOMMEND","getAll","self","this","get_strings","key","component","then","strings","outcomes","code","name","getString","id","Deferred","reject","promise"],"mappings":";;;;;;;AAuBAA,qCAAO,CAAC,SACA,aACA,SAASC,EAAGC,WAOT,CAEHC,KAPe,EAQfC,SAPmB,EAQnBC,SAPmB,EAQnBC,UAPoB,EAepBC,OAAQ,eACAC,KAAOC,YACJP,IAAIQ,YAAY,CACnB,CAACC,IAAK,yBAA0BC,UAAW,WAC3C,CAACD,IAAK,6BAA8BC,UAAW,WAC/C,CAACD,IAAK,8BAA+BC,UAAW,WAChD,CAACD,IAAK,6BAA8BC,UAAW,aAChDC,MAAK,SAASC,aACTC,SAAW,UACfA,SAASP,KAAKL,MAAQ,CAACa,KAAMR,KAAKL,KAAMc,KAAMH,QAAQ,IACtDC,SAASP,KAAKJ,UAAY,CAACY,KAAMR,KAAKJ,SAAUa,KAAMH,QAAQ,IAC9DC,SAASP,KAAKF,WAAa,CAACU,KAAMR,KAAKF,UAAWW,KAAMH,QAAQ,IAChEC,SAASP,KAAKH,UAAY,CAACW,KAAMR,KAAKH,SAAUY,KAAMH,QAAQ,IACvDC,aAWfG,UAAW,SAASC,WACLV,KACIF,SAEJM,MAAK,SAASE,sBACO,IAAjBA,SAASI,IACTlB,EAAEmB,WAAWC,SAASC,UAE1BP,SAASI,IAAIF"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competency_plan_navigation",["jquery"],function(a){var b=function(b,c,d,e,f){this._baseUrl=c;this._userId=d+"";this._competencyId=e+"";this._planId=f;this._ignoreFirstCompetency=!0;a(b).on("change",this._competencyChanged.bind(this))};b.prototype._competencyChanged=function(b){if(this._ignoreFirstCompetency){this._ignoreFirstCompetency=!1;return}var c=a(b.target).val(),d="?userid="+this._userId+"&planid="+this._planId+"&competencyid="+c;document.location=this._baseUrl+d};b.prototype._competencyId=null;b.prototype._userId=null;b.prototype._planId=null;b.prototype._baseUrl=null;b.prototype._ignoreFirstCompetency=null;return b});
|
||||
//# sourceMappingURL=competency_plan_navigation.min.js.map
|
||||
/**
|
||||
* Event click on selecting competency in the competency autocomplete.
|
||||
*
|
||||
* @module tool_lp/competency_plan_navigation
|
||||
* @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competency_plan_navigation",["jquery"],(function($){var CompetencyPlanNavigation=function(competencySelector,baseUrl,userId,competencyId,planId){this._baseUrl=baseUrl,this._userId=userId+"",this._competencyId=competencyId+"",this._planId=planId,this._ignoreFirstCompetency=!0,$(competencySelector).on("change",this._competencyChanged.bind(this))};return CompetencyPlanNavigation.prototype._competencyChanged=function(e){if(this._ignoreFirstCompetency)this._ignoreFirstCompetency=!1;else{var newCompetencyId=$(e.target).val(),queryStr="?userid="+this._userId+"&planid="+this._planId+"&competencyid="+newCompetencyId;document.location=this._baseUrl+queryStr}},CompetencyPlanNavigation.prototype._competencyId=null,CompetencyPlanNavigation.prototype._userId=null,CompetencyPlanNavigation.prototype._planId=null,CompetencyPlanNavigation.prototype._baseUrl=null,CompetencyPlanNavigation.prototype._ignoreFirstCompetency=null,CompetencyPlanNavigation}));
|
||||
|
||||
//# sourceMappingURL=competency_plan_navigation.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/competency_plan_navigation.js"],"names":["define","$","CompetencyPlanNavigation","competencySelector","baseUrl","userId","competencyId","planId","_baseUrl","_userId","_competencyId","_planId","_ignoreFirstCompetency","on","_competencyChanged","bind","prototype","e","newCompetencyId","target","val","queryStr","document","location"],"mappings":"AAuBAA,OAAM,sCAAC,CAAC,QAAD,CAAD,CAAa,SAASC,CAAT,CAAY,CAY3B,GAAIC,CAAAA,CAAwB,CAAG,SAASC,CAAT,CAA6BC,CAA7B,CAAsCC,CAAtC,CAA8CC,CAA9C,CAA4DC,CAA5D,CAAoE,CAC/F,KAAKC,QAAL,CAAgBJ,CAAhB,CACA,KAAKK,OAAL,CAAeJ,CAAM,CAAG,EAAxB,CACA,KAAKK,aAAL,CAAqBJ,CAAY,CAAG,EAApC,CACA,KAAKK,OAAL,CAAeJ,CAAf,CACA,KAAKK,sBAAL,IAEAX,CAAC,CAACE,CAAD,CAAD,CAAsBU,EAAtB,CAAyB,QAAzB,CAAmC,KAAKC,kBAAL,CAAwBC,IAAxB,CAA6B,IAA7B,CAAnC,CACH,CARD,CAgBAb,CAAwB,CAACc,SAAzB,CAAmCF,kBAAnC,CAAwD,SAASG,CAAT,CAAY,CAChE,GAAI,KAAKL,sBAAT,CAAiC,CAC7B,KAAKA,sBAAL,IACA,MACH,CAJ+D,GAK5DM,CAAAA,CAAe,CAAGjB,CAAC,CAACgB,CAAC,CAACE,MAAH,CAAD,CAAYC,GAAZ,EAL0C,CAM5DC,CAAQ,CAAG,WAAa,KAAKZ,OAAlB,CAA4B,UAA5B,CAAyC,KAAKE,OAA9C,CAAwD,gBAAxD,CAA2EO,CAN1B,CAOhEI,QAAQ,CAACC,QAAT,CAAoB,KAAKf,QAAL,CAAgBa,CACvC,CARD,CAWAnB,CAAwB,CAACc,SAAzB,CAAmCN,aAAnC,CAAmD,IAAnD,CAEAR,CAAwB,CAACc,SAAzB,CAAmCP,OAAnC,CAA6C,IAA7C,CAEAP,CAAwB,CAACc,SAAzB,CAAmCL,OAAnC,CAA6C,IAA7C,CAEAT,CAAwB,CAACc,SAAzB,CAAmCR,QAAnC,CAA8C,IAA9C,CAEAN,CAAwB,CAACc,SAAzB,CAAmCJ,sBAAnC,CAA4D,IAA5D,CAEA,MAAOV,CAAAA,CACV,CAlDK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Event click on selecting competency in the competency autocomplete.\n *\n * @module tool_lp/competency_plan_navigation\n * @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery'], function($) {\n\n /**\n * CompetencyPlanNavigation\n *\n * @class\n * @param {String} competencySelector The selector of the competency element.\n * @param {String} baseUrl The base url for the page (no params).\n * @param {Number} userId The user id\n * @param {Number} competencyId The competency id\n * @param {Number} planId The plan id\n */\n var CompetencyPlanNavigation = function(competencySelector, baseUrl, userId, competencyId, planId) {\n this._baseUrl = baseUrl;\n this._userId = userId + '';\n this._competencyId = competencyId + '';\n this._planId = planId;\n this._ignoreFirstCompetency = true;\n\n $(competencySelector).on('change', this._competencyChanged.bind(this));\n };\n\n /**\n * The competency was changed in the select list.\n *\n * @method _competencyChanged\n * @param {Event} e\n */\n CompetencyPlanNavigation.prototype._competencyChanged = function(e) {\n if (this._ignoreFirstCompetency) {\n this._ignoreFirstCompetency = false;\n return;\n }\n var newCompetencyId = $(e.target).val();\n var queryStr = '?userid=' + this._userId + '&planid=' + this._planId + '&competencyid=' + newCompetencyId;\n document.location = this._baseUrl + queryStr;\n };\n\n /** @property {Number} The id of the competency. */\n CompetencyPlanNavigation.prototype._competencyId = null;\n /** @property {Number} The id of the user. */\n CompetencyPlanNavigation.prototype._userId = null;\n /** @property {Number} The id of the plan. */\n CompetencyPlanNavigation.prototype._planId = null;\n /** @property {String} Plugin base url. */\n CompetencyPlanNavigation.prototype._baseUrl = null;\n /** @property {Boolean} Ignore the first change event for competencies. */\n CompetencyPlanNavigation.prototype._ignoreFirstCompetency = null;\n\n return CompetencyPlanNavigation;\n});\n"],"file":"competency_plan_navigation.min.js"}
|
||||
{"version":3,"file":"competency_plan_navigation.min.js","sources":["../src/competency_plan_navigation.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Event click on selecting competency in the competency autocomplete.\n *\n * @module tool_lp/competency_plan_navigation\n * @copyright 2016 Issam Taboubi <issam.taboubi@umontreal.ca>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery'], function($) {\n\n /**\n * CompetencyPlanNavigation\n *\n * @class\n * @param {String} competencySelector The selector of the competency element.\n * @param {String} baseUrl The base url for the page (no params).\n * @param {Number} userId The user id\n * @param {Number} competencyId The competency id\n * @param {Number} planId The plan id\n */\n var CompetencyPlanNavigation = function(competencySelector, baseUrl, userId, competencyId, planId) {\n this._baseUrl = baseUrl;\n this._userId = userId + '';\n this._competencyId = competencyId + '';\n this._planId = planId;\n this._ignoreFirstCompetency = true;\n\n $(competencySelector).on('change', this._competencyChanged.bind(this));\n };\n\n /**\n * The competency was changed in the select list.\n *\n * @method _competencyChanged\n * @param {Event} e\n */\n CompetencyPlanNavigation.prototype._competencyChanged = function(e) {\n if (this._ignoreFirstCompetency) {\n this._ignoreFirstCompetency = false;\n return;\n }\n var newCompetencyId = $(e.target).val();\n var queryStr = '?userid=' + this._userId + '&planid=' + this._planId + '&competencyid=' + newCompetencyId;\n document.location = this._baseUrl + queryStr;\n };\n\n /** @property {Number} The id of the competency. */\n CompetencyPlanNavigation.prototype._competencyId = null;\n /** @property {Number} The id of the user. */\n CompetencyPlanNavigation.prototype._userId = null;\n /** @property {Number} The id of the plan. */\n CompetencyPlanNavigation.prototype._planId = null;\n /** @property {String} Plugin base url. */\n CompetencyPlanNavigation.prototype._baseUrl = null;\n /** @property {Boolean} Ignore the first change event for competencies. */\n CompetencyPlanNavigation.prototype._ignoreFirstCompetency = null;\n\n return CompetencyPlanNavigation;\n});\n"],"names":["define","$","CompetencyPlanNavigation","competencySelector","baseUrl","userId","competencyId","planId","_baseUrl","_userId","_competencyId","_planId","_ignoreFirstCompetency","on","this","_competencyChanged","bind","prototype","e","newCompetencyId","target","val","queryStr","document","location"],"mappings":";;;;;;;AAuBAA,4CAAO,CAAC,WAAW,SAASC,OAYpBC,yBAA2B,SAASC,mBAAoBC,QAASC,OAAQC,aAAcC,aAClFC,SAAWJ,aACXK,QAAUJ,OAAS,QACnBK,cAAgBJ,aAAe,QAC/BK,QAAUJ,YACVK,wBAAyB,EAE9BX,EAAEE,oBAAoBU,GAAG,SAAUC,KAAKC,mBAAmBC,KAAKF,eASpEZ,yBAAyBe,UAAUF,mBAAqB,SAASG,MACzDJ,KAAKF,4BACAA,wBAAyB,WAG9BO,gBAAkBlB,EAAEiB,EAAEE,QAAQC,MAC9BC,SAAW,WAAaR,KAAKL,QAAU,WAAaK,KAAKH,QAAU,iBAAmBQ,gBAC1FI,SAASC,SAAWV,KAAKN,SAAWc,WAIxCpB,yBAAyBe,UAAUP,cAAgB,KAEnDR,yBAAyBe,UAAUR,QAAU,KAE7CP,yBAAyBe,UAAUN,QAAU,KAE7CT,yBAAyBe,UAAUT,SAAW,KAE9CN,yBAAyBe,UAAUL,uBAAyB,KAErDV"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competency_rule",["jquery"],function(a){var b=function(b){this._eventNode=a("<div>");this._ready=a.Deferred();this._tree=b};b.prototype._competency=null;b.prototype._eventNode=null;b.prototype._ready=null;b.prototype._tree=null;b.prototype.canConfig=function(){return this._tree.hasChildren(this._competency.id)};b.prototype.getConfig=function(){return null};b.prototype.getType=function(){throw new Error("Not implemented")};b.prototype.init=function(){return this._load()};b.prototype.injectTemplate=function(){return a.Deferred().reject().promise()};b.prototype.isValid=function(){return!1};b.prototype._load=function(){return a.when()};b.prototype.on=function(a,b){this._eventNode.on(a,b)};b.prototype.setTargetCompetency=function(a){this._competency=a};b.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])};b.prototype._triggerChange=function(){this._trigger("change",this)};return b});
|
||||
//# sourceMappingURL=competency_rule.min.js.map
|
||||
/**
|
||||
* Competency rule base module.
|
||||
*
|
||||
* @module tool_lp/competencyrule
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competency_rule",["jquery"],(function($){var Rule=function(tree){this._eventNode=$("<div>"),this._ready=$.Deferred(),this._tree=tree};return Rule.prototype._competency=null,Rule.prototype._eventNode=null,Rule.prototype._ready=null,Rule.prototype._tree=null,Rule.prototype.canConfig=function(){return this._tree.hasChildren(this._competency.id)},Rule.prototype.getConfig=function(){return null},Rule.prototype.getType=function(){throw new Error("Not implemented")},Rule.prototype.init=function(){return this._load()},Rule.prototype.injectTemplate=function(){return $.Deferred().reject().promise()},Rule.prototype.isValid=function(){return!1},Rule.prototype._load=function(){return $.when()},Rule.prototype.on=function(type,handler){this._eventNode.on(type,handler)},Rule.prototype.setTargetCompetency=function(competency){this._competency=competency},Rule.prototype._trigger=function(type,data){this._eventNode.trigger(type,[data])},Rule.prototype._triggerChange=function(){this._trigger("change",this)},Rule}));
|
||||
|
||||
//# sourceMappingURL=competency_rule.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competency_rule_all",["jquery","core/str","tool_lp/competency_rule"],function(a,b,c){var d=function(){c.apply(this,arguments)};d.prototype=Object.create(c.prototype);d.prototype.getType=function(){return"core_competency\\competency_rule_all"};d.prototype.isValid=function(){return!0};return d});
|
||||
//# sourceMappingURL=competency_rule_all.min.js.map
|
||||
/**
|
||||
* Competency rule all module.
|
||||
*
|
||||
* @module tool_lp/competency_rule_all
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competency_rule_all",["jquery","core/str","tool_lp/competency_rule"],(function($,Str,RuleBase){var Rule=function(){RuleBase.apply(this,arguments)};return(Rule.prototype=Object.create(RuleBase.prototype)).getType=function(){return"core_competency\\competency_rule_all"},Rule.prototype.isValid=function(){return!0},Rule}));
|
||||
|
||||
//# sourceMappingURL=competency_rule_all.min.js.map
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/competency_rule_all.js"],"names":["define","$","Str","RuleBase","Rule","apply","arguments","prototype","Object","create","getType","isValid"],"mappings":"AAuBAA,OAAM,+BAAC,CAAC,QAAD,CACC,UADD,CAEC,yBAFD,CAAD,CAIE,SAASC,CAAT,CAAYC,CAAZ,CAAiBC,CAAjB,CAA2B,CAO/B,GAAIC,CAAAA,CAAI,CAAG,UAAW,CAClBD,CAAQ,CAACE,KAAT,CAAe,IAAf,CAAqBC,SAArB,CACH,CAFD,CAGAF,CAAI,CAACG,SAAL,CAAiBC,MAAM,CAACC,MAAP,CAAcN,CAAQ,CAACI,SAAvB,CAAjB,CAQAH,CAAI,CAACG,SAAL,CAAeG,OAAf,CAAyB,UAAW,CAChC,MAAO,sCACV,CAFD,CAUAN,CAAI,CAACG,SAAL,CAAeI,OAAf,CAAyB,UAAW,CAChC,QACH,CAFD,CAIA,MAAOP,CAAAA,CACV,CArCK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Competency rule all module.\n *\n * @module tool_lp/competency_rule_all\n * @copyright 2015 Frédéric Massart - FMCorz.net\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery',\n 'core/str',\n 'tool_lp/competency_rule',\n ],\n function($, Str, RuleBase) {\n\n /**\n * Competency rule all class.\n *\n * @class tool_lp/competency_rule_all\n */\n var Rule = function() {\n RuleBase.apply(this, arguments);\n };\n Rule.prototype = Object.create(RuleBase.prototype);\n\n /**\n * Return the type of the module.\n *\n * @return {String}\n * @method getType\n */\n Rule.prototype.getType = function() {\n return 'core_competency\\\\competency_rule_all';\n };\n\n /**\n * Whether or not the current config is valid.\n *\n * @return {Boolean}\n * @method isValid\n */\n Rule.prototype.isValid = function() {\n return true;\n };\n\n return Rule;\n});\n"],"file":"competency_rule_all.min.js"}
|
||||
{"version":3,"file":"competency_rule_all.min.js","sources":["../src/competency_rule_all.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Competency rule all module.\n *\n * @module tool_lp/competency_rule_all\n * @copyright 2015 Frédéric Massart - FMCorz.net\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery',\n 'core/str',\n 'tool_lp/competency_rule',\n ],\n function($, Str, RuleBase) {\n\n /**\n * Competency rule all class.\n *\n * @class tool_lp/competency_rule_all\n */\n var Rule = function() {\n RuleBase.apply(this, arguments);\n };\n Rule.prototype = Object.create(RuleBase.prototype);\n\n /**\n * Return the type of the module.\n *\n * @return {String}\n * @method getType\n */\n Rule.prototype.getType = function() {\n return 'core_competency\\\\competency_rule_all';\n };\n\n /**\n * Whether or not the current config is valid.\n *\n * @return {Boolean}\n * @method isValid\n */\n Rule.prototype.isValid = function() {\n return true;\n };\n\n return Rule;\n});\n"],"names":["define","$","Str","RuleBase","Rule","apply","this","arguments","prototype","Object","create","getType","isValid"],"mappings":";;;;;;;AAuBAA,qCAAO,CAAC,SACA,WACA,4BAEA,SAASC,EAAGC,IAAKC,cAOjBC,KAAO,WACPD,SAASE,MAAMC,KAAMC,mBAEzBH,KAAKI,UAAYC,OAAOC,OAAOP,SAASK,YAQzBG,QAAU,iBACd,wCASXP,KAAKI,UAAUI,QAAU,kBACd,GAGJR"}
|
||||
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competency_rule_points",["jquery","core/str","core/templates","tool_lp/competency_rule"],function(a,b,c,d){var e=function(){d.apply(this,arguments)};e.prototype=Object.create(d.prototype);e.prototype._container=null;e.prototype._templateLoaded=!1;e.prototype.getConfig=function(){return JSON.stringify({base:{points:this._getRequiredPoints()},competencies:this._getCompetenciesConfig()})};e.prototype._getCompetenciesConfig=function(){var b=[];this._container.find("[data-competency]").each(function(){var c=a(this),d=c.data("competency"),e=parseInt(c.find("[name=\"points\"]").val(),10),f=c.find("[name=\"required\"]").prop("checked");b.push({id:d,points:e,required:f?1:0})});return b};e.prototype._getRequiredPoints=function(){return parseInt(this._container.find("[name=\"requiredpoints\"]").val()||1,10)};e.prototype.getType=function(){return"core_competency\\competency_rule_points"};e.prototype.injectTemplate=function(b){var d=this,e=this._tree.getChildren(this._competency.id),f,g={base:{points:2},competencies:[]};this._templateLoaded=!1;if(d._competency.ruletype==d.getType()){try{g=JSON.parse(d._competency.ruleconfig)}catch(a){}}f={requiredpoints:g&&g.base?g.base.points:2,competency:d._competency,children:[]};a.each(e,function(b,c){var d={id:c.id,shortname:c.shortname,required:!1,points:0};if(g){a.each(g.competencies,function(a,b){if(b.id==d.id){d.required=b.required?!0:!1;d.points=b.points}})}f.children.push(d)});return c.render("tool_lp/competency_rule_points",f).then(function(a){d._container=b;b.html(a);b.find("input").change(function(){d._triggerChange()});d._templateLoaded=!0;d._triggerChange()})};e.prototype.isValid=function(){if(!this._templateLoaded){return!1}var b=this._getRequiredPoints(),c=0,d=!0;a.each(this._getCompetenciesConfig(),function(a,b){if(0>b.points){d=!1}c+=b.points});d=d&&c>=b;return d};return e});
|
||||
//# sourceMappingURL=competency_rule_points.min.js.map
|
||||
/**
|
||||
* Competency rule points module.
|
||||
*
|
||||
* @module tool_lp/competency_rule_all
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competency_rule_points",["jquery","core/str","core/templates","tool_lp/competency_rule"],(function($,Str,Templates,RuleBase){var Rule=function(){RuleBase.apply(this,arguments)};return(Rule.prototype=Object.create(RuleBase.prototype))._container=null,Rule.prototype._templateLoaded=!1,Rule.prototype.getConfig=function(){return JSON.stringify({base:{points:this._getRequiredPoints()},competencies:this._getCompetenciesConfig()})},Rule.prototype._getCompetenciesConfig=function(){var competencies=[];return this._container.find("[data-competency]").each((function(){var node=$(this),id=node.data("competency"),points=parseInt(node.find('[name="points"]').val(),10),required=node.find('[name="required"]').prop("checked");competencies.push({id:id,points:points,required:required?1:0})})),competencies},Rule.prototype._getRequiredPoints=function(){return parseInt(this._container.find('[name="requiredpoints"]').val()||1,10)},Rule.prototype.getType=function(){return"core_competency\\competency_rule_points"},Rule.prototype.injectTemplate=function(container){var context,self=this,children=this._tree.getChildren(this._competency.id),config={base:{points:2},competencies:[]};if(this._templateLoaded=!1,self._competency.ruletype==self.getType())try{config=JSON.parse(self._competency.ruleconfig)}catch(e){}return context={requiredpoints:config&&config.base?config.base.points:2,competency:self._competency,children:[]},$.each(children,(function(index,child){var competency={id:child.id,shortname:child.shortname,required:!1,points:0};config&&$.each(config.competencies,(function(index,comp){comp.id==competency.id&&(competency.required=!!comp.required,competency.points=comp.points)})),context.children.push(competency)})),Templates.render("tool_lp/competency_rule_points",context).then((function(html){self._container=container,container.html(html),container.find("input").change((function(){self._triggerChange()})),self._templateLoaded=!0,self._triggerChange()}))},Rule.prototype.isValid=function(){if(!this._templateLoaded)return!1;var required=this._getRequiredPoints(),max=0,valid=!0;return $.each(this._getCompetenciesConfig(),(function(index,competency){competency.points<0&&(valid=!1),max+=competency.points})),valid=valid&&max>=required},Rule}));
|
||||
|
||||
//# sourceMappingURL=competency_rule_points.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competencydialogue",["jquery","core/notification","core/ajax","core/templates","core/str","tool_lp/dialogue"],function(a,b,c,d,e,f){var g,h=function(){};h.prototype.triggerCompetencyViewedEvent=function(a){c.call([{methodname:"core_competency_competency_viewed",args:{id:a}}])};h.prototype.showDialogue=function(a,c){var e=this.getCompetencyDataPromise(a,c),g=this;e.done(function(c){d.render("tool_lp/competency_summary",c).done(function(b){g.triggerCompetencyViewedEvent(a);new f(c.competency.shortname,b)}).fail(b.exception)}).fail(b.exception)};h.prototype.showDialogueFromData=function(a){var c=this;d.render("tool_lp/competency_summary",a).done(function(b){c.triggerCompetencyViewedEvent(a.id);new f(a.shortname,b,c.enhanceDialogue)}).fail(b.exception)};h.prototype.clickEventHandler=function(b){var c=b.data.compdialogue,d=a(b.currentTarget),e=d.data("id"),f=!d.data("excluderelated"),g=d.data("includecourses");c.showDialogue(e,{includerelated:f,includecourses:g});b.preventDefault()};h.prototype.getCompetencyDataPromise=function(a,d){var e=c.call([{methodname:"tool_lp_data_for_competency_summary",args:{competencyid:a,includerelated:d.includerelated||!1,includecourses:d.includecourses||!1}}]);return e[0].then(function(a){return a}).fail(b.exception)};return{init:function init(){if("undefined"!=typeof g){return}g=new h;a("body").delegate("[data-action=\"competency-dialogue\"]","click",{compdialogue:g},g.clickEventHandler.bind(g))}}});
|
||||
//# sourceMappingURL=competencydialogue.min.js.map
|
||||
/**
|
||||
* Display Competency in dialogue box.
|
||||
*
|
||||
* @module tool_lp/Competencydialogue
|
||||
* @copyright 2015 Issam Taboubi <issam.taboubi@umontreal.ca>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competencydialogue",["jquery","core/notification","core/ajax","core/templates","core/str","tool_lp/dialogue"],(function($,notification,ajax,templates,str,Dialogue){var instance,Competencydialogue=function(){};return Competencydialogue.prototype.triggerCompetencyViewedEvent=function(competencyId){ajax.call([{methodname:"core_competency_competency_viewed",args:{id:competencyId}}])},Competencydialogue.prototype.showDialogue=function(competencyid,options){var datapromise=this.getCompetencyDataPromise(competencyid,options),localthis=this;datapromise.done((function(data){templates.render("tool_lp/competency_summary",data).done((function(html){localthis.triggerCompetencyViewedEvent(competencyid),new Dialogue(data.competency.shortname,html)})).fail(notification.exception)})).fail(notification.exception)},Competencydialogue.prototype.showDialogueFromData=function(dataSource){var localthis=this;templates.render("tool_lp/competency_summary",dataSource).done((function(html){localthis.triggerCompetencyViewedEvent(dataSource.id),new Dialogue(dataSource.shortname,html,localthis.enhanceDialogue)})).fail(notification.exception)},Competencydialogue.prototype.clickEventHandler=function(e){var compdialogue=e.data.compdialogue,currentTarget=$(e.currentTarget),competencyid=currentTarget.data("id"),includerelated=!currentTarget.data("excluderelated"),includecourses=currentTarget.data("includecourses");compdialogue.showDialogue(competencyid,{includerelated:includerelated,includecourses:includecourses}),e.preventDefault()},Competencydialogue.prototype.getCompetencyDataPromise=function(competencyid,options){return ajax.call([{methodname:"tool_lp_data_for_competency_summary",args:{competencyid:competencyid,includerelated:options.includerelated||!1,includecourses:options.includecourses||!1}}])[0].then((function(context){return context})).fail(notification.exception)},{init:function(){void 0===instance&&(instance=new Competencydialogue,$("body").delegate('[data-action="competency-dialogue"]',"click",{compdialogue:instance},instance.clickEventHandler.bind(instance)))}}}));
|
||||
|
||||
//# sourceMappingURL=competencydialogue.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+14
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+15
-2
@@ -1,2 +1,15 @@
|
||||
define ("tool_lp/competencypicker_user_plans",["jquery","core/notification","core/ajax","core/templates","core/str","tool_lp/tree","tool_lp/competencypicker"],function(a,b,c,d,e,f,g){var h=function(a,b,c){g.prototype.constructor.apply(this,[1,!1,"self",c]);this._userId=a;this._plans=[];if(b){this._planId=b;this._singlePlan=!0}};h.prototype=Object.create(g.prototype);h.prototype._plans=null;h.prototype._planId=null;h.prototype._singlePlan=!1;h.prototype._userId=null;h.prototype._afterRender=function(){var c=this;g.prototype._afterRender.apply(c,arguments);if(!c._singlePlan){c._find("[data-action=\"chooseplan\"]").change(function(d){c._planId=a(d.target).val();c._loadCompetencies().then(c._refresh.bind(c)).catch(b.exception)})}};h.prototype._fetchCompetencies=function(a,d){var e=this;return c.call([{methodname:"core_competency_list_plan_competencies",args:{id:a}}])[0].done(function(a){var b,c,f=[];for(b=0;b<a.length;b++){c=a[b].competency;if(0>c.shortname.toLowerCase().indexOf(d.toLowerCase())){continue}c.children=[];c.haschildren=0;f.push(c)}e._competencies=f}).fail(b.exception)};h.prototype._getPlan=function(b){var c;a.each(this._plans,function(a,d){if(d.id==b){c=d}});return c};h.prototype._loadCompetencies=function(){return this._fetchCompetencies(this._planId,this._searchText)};h.prototype._loadPlans=function(){var d,e=this;if(0<e._plans.length){return a.when()}if(e._singlePlan){d=c.call([{methodname:"core_competency_read_plan",args:{id:this._planId}}])[0].then(function(a){return[a]})}else{d=c.call([{methodname:"core_competency_list_user_plans",args:{userid:e._userId}}])[0]}return d.done(function(a){e._plans=a}).fail(b.exception)};h.prototype._preRender=function(){var b=this;return b._loadPlans().then(function(){if(!b._planId&&0<b._plans.length){b._planId=b._plans[0].id}if(!b._planId){b._plans=[];return a.when()}return b._loadCompetencies()})};h.prototype._render=function(){var b=this;return b._preRender().then(function(){if(!b._singlePlan){a.each(b._plans,function(a,c){if(c.id==b._planId){c.selected=!0}else{c.selected=!1}})}var c={competencies:b._competencies,plan:b._getPlan(b._planId),plans:b._plans,search:b._searchText,singlePlan:b._singlePlan};return d.render("tool_lp/competency_picker_user_plans",c)})};return h});
|
||||
//# sourceMappingURL=competencypicker_user_plans.min.js.map
|
||||
/**
|
||||
* Competency picker from user plans.
|
||||
*
|
||||
* To handle 'save' events use: picker.on('save').
|
||||
*
|
||||
* This will receive a object with either a single 'competencyId', or an array in 'competencyIds'
|
||||
* depending on the value of multiSelect.
|
||||
*
|
||||
* @module tool_lp/competencypicker_user_plans
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competencypicker_user_plans",["jquery","core/notification","core/ajax","core/templates","core/str","tool_lp/tree","tool_lp/competencypicker"],(function($,Notification,Ajax,Templates,Str,Tree,PickerBase){var Picker=function(userId,singlePlan,multiSelect){PickerBase.prototype.constructor.apply(this,[1,!1,"self",multiSelect]),this._userId=userId,this._plans=[],singlePlan&&(this._planId=singlePlan,this._singlePlan=!0)};return(Picker.prototype=Object.create(PickerBase.prototype))._plans=null,Picker.prototype._planId=null,Picker.prototype._singlePlan=!1,Picker.prototype._userId=null,Picker.prototype._afterRender=function(){var self=this;PickerBase.prototype._afterRender.apply(self,arguments),self._singlePlan||self._find('[data-action="chooseplan"]').change((function(e){self._planId=$(e.target).val(),self._loadCompetencies().then(self._refresh.bind(self)).catch(Notification.exception)}))},Picker.prototype._fetchCompetencies=function(planId,searchText){var self=this;return Ajax.call([{methodname:"core_competency_list_plan_competencies",args:{id:planId}}])[0].done((function(competencies){var i,comp,tree=[];for(i=0;i<competencies.length;i++)(comp=competencies[i].competency).shortname.toLowerCase().indexOf(searchText.toLowerCase())<0||(comp.children=[],comp.haschildren=0,tree.push(comp));self._competencies=tree})).fail(Notification.exception)},Picker.prototype._getPlan=function(id){var plan;return $.each(this._plans,(function(i,f){f.id!=id||(plan=f)})),plan},Picker.prototype._loadCompetencies=function(){return this._fetchCompetencies(this._planId,this._searchText)},Picker.prototype._loadPlans=function(){var self=this;return self._plans.length>0?$.when():(self._singlePlan?Ajax.call([{methodname:"core_competency_read_plan",args:{id:this._planId}}])[0].then((function(plan){return[plan]})):Ajax.call([{methodname:"core_competency_list_user_plans",args:{userid:self._userId}}])[0]).done((function(plans){self._plans=plans})).fail(Notification.exception)},Picker.prototype._preRender=function(){var self=this;return self._loadPlans().then((function(){return!self._planId&&self._plans.length>0&&(self._planId=self._plans[0].id),self._planId?self._loadCompetencies():(self._plans=[],$.when())}))},Picker.prototype._render=function(){var self=this;return self._preRender().then((function(){self._singlePlan||$.each(self._plans,(function(i,plan){plan.id==self._planId?plan.selected=!0:plan.selected=!1}));var context={competencies:self._competencies,plan:self._getPlan(self._planId),plans:self._plans,search:self._searchText,singlePlan:self._singlePlan};return Templates.render("tool_lp/competency_picker_user_plans",context)}))},Picker}));
|
||||
|
||||
//# sourceMappingURL=competencypicker_user_plans.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/competencytree",["core/ajax","core/notification","core/templates","tool_lp/tree","tool_lp/competency_outcomes","jquery"],function(a,b,c,d,e,f){var g={},h=0,j="",k="",l="",m=!1,n=function(a,b){var c=0,d=!1;a.haschildren=!1;a.children=[];for(c=0;c<b.length;c++){d=b[c];if(d.parentid==a.id){a.haschildren=!0;a.children.push(d);n(d,b)}}},o=function(b){var e=f.Deferred();c.render("tool_lp/loading",{}).done(function(i,o){c.replaceNodeContents(f(k),i,o);var p=a.call([{methodname:"core_competency_search_competencies",args:{searchtext:b,competencyframeworkid:h}}]);p[0].done(function(a){g={};var b=0;for(b=0;b<a.length;b++){g[a[b].id]=a[b]}var h=[],o=!1;for(b=0;b<a.length;b++){o=a[b];if(0===parseInt(o.parentid,10)){h.push(o);n(o,a)}}var p={shortname:j,canmanage:m,competencies:h};c.render("tool_lp/competencies_tree_root",p).done(function(a,b){c.replaceNodeContents(f(k),f(a).html(),b);var h=new d(k,!1);if(l){var i=f(k).find("[data-id="+l+"]");if(i.length){h.selectItem(i);h.updateFocus(i)}}e.resolve(g)}).fail(e.reject)}).fail(e.reject)});return e.promise()},p=function(a,b){var c=b.selected;l=c.attr("data-id")};return{init:function init(a,c,d,e,f,g){h=a;j=c;m=f;k=e;o(d).fail(b.exception);if(0<g){l=g}this.on("selectionchanged",p)},on:function on(a,b){f(k).on(a,b)},getChildren:function getChildren(a){var b=[];f.each(g,function(c,d){if(d.parentid==a){b.push(d)}});return b},getCompetencyFrameworkId:function getCompetencyFrameworkId(){return h},getCompetency:function getCompetency(a){return g[a]},getCompetencyLevel:function getCompetencyLevel(a){var b=this.getCompetency(a),c=b.path.replace(/^\/|\/$/g,"").split("/").length;return c},hasChildren:function hasChildren(a){return 0<this.getChildren(a).length},hasRule:function hasRule(a){var b=this.getCompetency(a);if(b){return b.ruleoutcome!=e.OUTCOME_NONE&&b.ruletype}return!1},reloadCompetencies:function reloadCompetencies(){return o("").fail(b.exception)},listCompetencies:function listCompetencies(){return g}}});
|
||||
//# sourceMappingURL=competencytree.min.js.map
|
||||
/**
|
||||
* Handle selection changes on the competency tree.
|
||||
*
|
||||
* @module tool_lp/competencyselect
|
||||
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/competencytree",["core/ajax","core/notification","core/templates","tool_lp/tree","tool_lp/competency_outcomes","jquery"],(function(ajax,notification,templates,Ariatree,CompOutcomes,$){var competencies={},competencyFrameworkId=0,competencyFrameworkShortName="",treeSelector="",currentNodeId="",competencyFramworkCanManage=!1,addChildren=function addChildren(parent,all){var i=0,current=!1;for(parent.haschildren=!1,parent.children=[],i=0;i<all.length;i++)(current=all[i]).parentid==parent.id&&(parent.haschildren=!0,parent.children.push(current),addChildren(current,all))},loadCompetencies=function(searchtext){var deferred=$.Deferred();return templates.render("tool_lp/loading",{}).done((function(loadinghtml,loadingjs){templates.replaceNodeContents($(treeSelector),loadinghtml,loadingjs),ajax.call([{methodname:"core_competency_search_competencies",args:{searchtext:searchtext,competencyframeworkid:competencyFrameworkId}}])[0].done((function(result){competencies={};var i=0;for(i=0;i<result.length;i++)competencies[result[i].id]=result[i];var children=[],competency=!1;for(i=0;i<result.length;i++)competency=result[i],0===parseInt(competency.parentid,10)&&(children.push(competency),addChildren(competency,result));var context={shortname:competencyFrameworkShortName,canmanage:competencyFramworkCanManage,competencies:children};templates.render("tool_lp/competencies_tree_root",context).done((function(html,js){templates.replaceNodeContents($(treeSelector),$(html).html(),js);var tree=new Ariatree(treeSelector,!1);if(currentNodeId){var node=$(treeSelector).find("[data-id="+currentNodeId+"]");node.length&&(tree.selectItem(node),tree.updateFocus(node))}deferred.resolve(competencies)})).fail(deferred.reject)})).fail(deferred.reject)})),deferred.promise()},rememberCurrent=function(evt,params){var node=params.selected;currentNodeId=node.attr("data-id")};return{init:function(id,shortname,search,selector,canmanage,competencyid){competencyFrameworkId=id,competencyFrameworkShortName=shortname,competencyFramworkCanManage=canmanage,treeSelector=selector,loadCompetencies(search).fail(notification.exception),competencyid>0&&(currentNodeId=competencyid),this.on("selectionchanged",rememberCurrent)},on:function(eventname,handler){$(treeSelector).on(eventname,handler)},getChildren:function(id){var children=[];return $.each(competencies,(function(index,competency){competency.parentid==id&&children.push(competency)})),children},getCompetencyFrameworkId:function(){return competencyFrameworkId},getCompetency:function(id){return competencies[id]},getCompetencyLevel:function(id){return this.getCompetency(id).path.replace(/^\/|\/$/g,"").split("/").length},hasChildren:function(id){return this.getChildren(id).length>0},hasRule:function(id){var comp=this.getCompetency(id);return!!comp&&(comp.ruleoutcome!=CompOutcomes.OUTCOME_NONE&&comp.ruletype)},reloadCompetencies:function(){return loadCompetencies("").fail(notification.exception)},listCompetencies:function(){return competencies}}}));
|
||||
|
||||
//# sourceMappingURL=competencytree.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/course_competency_settings",["jquery","core/notification","tool_lp/dialogue","core/str","core/ajax","core/templates","core/pending"],function(a,b,c,d,f,g,h){var i=function(b){a(b).on("click",this.configureSettings.bind(this))};i.prototype._dialogue=null;i.prototype.configureSettings=function(f){var e=new h,i=a(f.target).closest("a").data("courseid"),j=a(f.target).closest("a").data("pushratingstouserplans");f.preventDefault();a.when(d.get_string("configurecoursecompetencysettings","tool_lp"),g.render("tool_lp/course_competency_settings",{courseid:i,settings:{pushratingstouserplans:j}})).then(function(a,b){this._dialogue=new c(a,b[0],this.addListeners.bind(this));return this._dialogue}.bind(this)).then(e.resolve).catch(b.exception)};i.prototype.addListeners=function(){var a=this._find("[data-action=\"save\"]");a.on("click",this.saveSettings.bind(this));var b=this._find("[data-action=\"cancel\"]");b.on("click",this.cancelChanges.bind(this))};i.prototype.cancelChanges=function(a){a.preventDefault();this._dialogue.close()};i.prototype._find=function(b){return a("[data-region=\"coursecompetencysettings\"]").find(b)};i.prototype.saveSettings=function(a){var c=new h;a.preventDefault();var d=this._find("input[name=\"pushratingstouserplans\"]:checked").val(),e=this._find("input[name=\"courseid\"]").val();f.call([{methodname:"core_competency_update_course_competency_settings",args:{courseid:e,settings:{pushratingstouserplans:d}}}])[0].then(function(){return this.refreshCourseCompetenciesPage()}.bind(this)).then(c.resolve).catch(b.exception)};i.prototype.refreshCourseCompetenciesPage=function(){var c=this._find("input[name=\"courseid\"]").val(),d=new h;f.call([{methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:c,moduleid:0}}])[0].then(function(a){return g.render("tool_lp/course_competencies_page",a)}).then(function(b,c){g.replaceNode(a("[data-region=\"coursecompetenciespage\"]"),b,c);this._dialogue.close()}.bind(this)).then(d.resolve).catch(b.exception)};return i});
|
||||
//# sourceMappingURL=course_competency_settings.min.js.map
|
||||
/**
|
||||
* Change the course competency settings in a popup.
|
||||
*
|
||||
* @module tool_lp/configurecoursecompetencysettings
|
||||
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/course_competency_settings",["jquery","core/notification","tool_lp/dialogue","core/str","core/ajax","core/templates","core/pending"],(function($,notification,Dialogue,str,ajax,templates,Pending){var settingsMod=function(selector){$(selector).on("click",this.configureSettings.bind(this))};return settingsMod.prototype._dialogue=null,settingsMod.prototype.configureSettings=function(e){var pendingPromise=new Pending,context={courseid:$(e.target).closest("a").data("courseid"),settings:{pushratingstouserplans:$(e.target).closest("a").data("pushratingstouserplans")}};e.preventDefault(),$.when(str.get_string("configurecoursecompetencysettings","tool_lp"),templates.render("tool_lp/course_competency_settings",context)).then(function(title,templateResult){return this._dialogue=new Dialogue(title,templateResult[0],this.addListeners.bind(this)),this._dialogue}.bind(this)).then(pendingPromise.resolve).catch(notification.exception)},settingsMod.prototype.addListeners=function(){this._find('[data-action="save"]').on("click",this.saveSettings.bind(this)),this._find('[data-action="cancel"]').on("click",this.cancelChanges.bind(this))},settingsMod.prototype.cancelChanges=function(e){e.preventDefault(),this._dialogue.close()},settingsMod.prototype._find=function(selector){return $('[data-region="coursecompetencysettings"]').find(selector)},settingsMod.prototype.saveSettings=function(e){var pendingPromise=new Pending;e.preventDefault();var newValue=this._find('input[name="pushratingstouserplans"]:checked').val(),courseId=this._find('input[name="courseid"]').val(),settings={pushratingstouserplans:newValue};ajax.call([{methodname:"core_competency_update_course_competency_settings",args:{courseid:courseId,settings:settings}}])[0].then(function(){return this.refreshCourseCompetenciesPage()}.bind(this)).then(pendingPromise.resolve).catch(notification.exception)},settingsMod.prototype.refreshCourseCompetenciesPage=function(){var courseId=this._find('input[name="courseid"]').val(),pendingPromise=new Pending;ajax.call([{methodname:"tool_lp_data_for_course_competencies_page",args:{courseid:courseId,moduleid:0}}])[0].then((function(context){return templates.render("tool_lp/course_competencies_page",context)})).then(function(html,js){templates.replaceNode($('[data-region="coursecompetenciespage"]'),html,js),this._dialogue.close()}.bind(this)).then(pendingPromise.resolve).catch(notification.exception)},settingsMod}));
|
||||
|
||||
//# sourceMappingURL=course_competency_settings.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+11
-2
@@ -1,2 +1,11 @@
|
||||
define ("tool_lp/dialogue",["core/yui"],function(a){var b=function(b,c,d,e,f){M.util.js_pending("tool_lp/dialogue:dialogue");this.yuiDialogue=null;var g=this;if("undefined"==typeof f){f=!1}a.use("moodle-core-notification","timers",function(){var h="480px";if(f){h="800px"}g.yuiDialogue=new M.core.dialogue({headerContent:b,bodyContent:c,draggable:!0,visible:!1,center:!0,modal:!0,width:h});g.yuiDialogue.before("visibleChange",function(){M.util.js_pending("tool_lp/dialogue:before:visibleChange")});g.yuiDialogue.after("visibleChange",function(b){if(b.newVal){if("undefined"!=typeof d){a.soon(function(){d(g);g.yuiDialogue.centerDialogue();M.util.js_complete("tool_lp/dialogue:before:visibleChange")})}else{M.util.js_complete("tool_lp/dialogue:before:visibleChange")}}else{if("undefined"!=typeof e){a.soon(function(){e(g);M.util.js_complete("tool_lp/dialogue:before:visibleChange")})}else{M.util.js_complete("tool_lp/dialogue:before:visibleChange")}}});g.yuiDialogue.show();M.util.js_complete("tool_lp/dialogue:dialogue")})};b.prototype.close=function(){this.yuiDialogue.hide();this.yuiDialogue.destroy()};b.prototype.getContent=function(){return this.yuiDialogue.bodyNode.getDOMNode()};return b});
|
||||
//# sourceMappingURL=dialogue.min.js.map
|
||||
/**
|
||||
* Wrapper for the YUI M.core.notification class. Allows us to
|
||||
* use the YUI version in AMD code until it is replaced.
|
||||
*
|
||||
* @module tool_lp/dialogue
|
||||
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/dialogue",["core/yui"],(function(Y){var dialogue=function(title,content,afterShow,afterHide,wide){M.util.js_pending("tool_lp/dialogue:dialogue"),this.yuiDialogue=null;var parent=this;void 0===wide&&(wide=!1),Y.use("moodle-core-notification","timers",(function(){var width="480px";wide&&(width="800px"),parent.yuiDialogue=new M.core.dialogue({headerContent:title,bodyContent:content,draggable:!0,visible:!1,center:!0,modal:!0,width:width}),parent.yuiDialogue.before("visibleChange",(function(){M.util.js_pending("tool_lp/dialogue:before:visibleChange")})),parent.yuiDialogue.after("visibleChange",(function(e){e.newVal?void 0!==afterShow?Y.soon((function(){afterShow(parent),parent.yuiDialogue.centerDialogue(),M.util.js_complete("tool_lp/dialogue:before:visibleChange")})):M.util.js_complete("tool_lp/dialogue:before:visibleChange"):void 0!==afterHide?Y.soon((function(){afterHide(parent),M.util.js_complete("tool_lp/dialogue:before:visibleChange")})):M.util.js_complete("tool_lp/dialogue:before:visibleChange")})),parent.yuiDialogue.show(),M.util.js_complete("tool_lp/dialogue:dialogue")}))};return dialogue.prototype.close=function(){this.yuiDialogue.hide(),this.yuiDialogue.destroy()},dialogue.prototype.getContent=function(){return this.yuiDialogue.bodyNode.getDOMNode()},dialogue}));
|
||||
|
||||
//# sourceMappingURL=dialogue.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/dragdrop-reorder",["core/str","core/yui"],function(a,b){var c=null,d=function(a){var b=a.drag.get("node"),c=a.drop.get("node");this.callback(b.getDOMNode(),c.getDOMNode())};return{dragdrop:function dragdrop(e,f,g,h,i,j,k,l){a.get_strings([{key:"emptydragdropregion",component:"moodle"},{key:"movecontent",component:"moodle"},{key:"tocontent",component:"moodle"}]).done(function(){b.use("moodle-tool_lp-dragdrop-reorder",function(){if(c){c.destroy()}c=M.tool_lp.dragdrop_reorder({group:e,dragHandleText:f,sameNodeText:g,parentNodeText:h,sameNodeClass:i,parentNodeClass:j,dragHandleInsertClass:k,callback:b.bind(d,{callback:l})})})})}}});
|
||||
//# sourceMappingURL=dragdrop-reorder.min.js.map
|
||||
/**
|
||||
* Drag and drop reorder via HTML5.
|
||||
*
|
||||
* @module tool_lp/dragdrop-reorder
|
||||
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/dragdrop-reorder",["core/str","core/yui"],(function(str,Y){var dragDropInstance=null,proxyCallback=function(e){var dragNode=e.drag.get("node"),dropNode=e.drop.get("node");this.callback(dragNode.getDOMNode(),dropNode.getDOMNode())};return{dragdrop:function(group,dragHandleText,sameNodeText,parentNodeText,sameNodeClass,parentNodeClass,dragHandleInsertClass,callback){str.get_strings([{key:"emptydragdropregion",component:"moodle"},{key:"movecontent",component:"moodle"},{key:"tocontent",component:"moodle"}]).done((function(){Y.use("moodle-tool_lp-dragdrop-reorder",(function(){var context={callback:callback};dragDropInstance&&dragDropInstance.destroy(),dragDropInstance=M.tool_lp.dragdrop_reorder({group:group,dragHandleText:dragHandleText,sameNodeText:sameNodeText,parentNodeText:parentNodeText,sameNodeClass:sameNodeClass,parentNodeClass:parentNodeClass,dragHandleInsertClass:dragHandleInsertClass,callback:Y.bind(proxyCallback,context)})}))}))}}}));
|
||||
|
||||
//# sourceMappingURL=dragdrop-reorder.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+10
-2
@@ -1,2 +1,10 @@
|
||||
define ("tool_lp/event_base",["jquery"],function(a){var b=function(){this._eventNode=a("<div></div>")};b.prototype._eventNode=null;b.prototype.on=function(a,b){this._eventNode.on(a,b)};b.prototype._trigger=function(a,b){this._eventNode.trigger(a,[b])};return b});
|
||||
//# sourceMappingURL=event_base.min.js.map
|
||||
/**
|
||||
* Event base javascript module.
|
||||
*
|
||||
* @module tool_lp/event_base
|
||||
* @copyright 2015 Frédéric Massart - FMCorz.net
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_lp/event_base",["jquery"],(function($){var Base=function(){this._eventNode=$("<div></div>")};return Base.prototype._eventNode=null,Base.prototype.on=function(type,handler){this._eventNode.on(type,handler)},Base.prototype._trigger=function(type,data){this._eventNode.trigger(type,[data])},Base}));
|
||||
|
||||
//# sourceMappingURL=event_base.min.js.map
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user