Compare commits
498 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c40a5e030 | |||
| 59e3c69754 | |||
| bcc6fa863e | |||
| 0695bf0d31 | |||
| 9b7aec5f8f | |||
| 8e5a14947d | |||
| 33c05e98e1 | |||
| 511c36ae30 | |||
| b0389d2785 | |||
| d0d7d578c5 | |||
| 2c42e4ca95 | |||
| c60d769026 | |||
| 31f6d9ccc5 | |||
| 81e5662cb0 | |||
| a1428eb9cf | |||
| 3860a59298 | |||
| e6dabb77a2 | |||
| a353ca34f5 | |||
| 27c9fe993a | |||
| d2c98b6b88 | |||
| e5187812a5 | |||
| dda5919426 | |||
| 2fa4da9aa4 | |||
| ba790c87a3 | |||
| e8cd8fce88 | |||
| d8d09c9465 | |||
| b90b0e6a8a | |||
| 58a55fcd40 | |||
| c37dd0ecbd | |||
| 84462c3e71 | |||
| 129b2186ac | |||
| 7eb6482266 | |||
| 9e4c3f858f | |||
| a7bbba41bf | |||
| bfc911b928 | |||
| 9766906cc5 | |||
| 0864e3adb3 | |||
| 86de73cb14 | |||
| b3e6ce7cfe | |||
| 94836d56b6 | |||
| 3477b9c1c5 | |||
| 6ee405e107 | |||
| 869b26f3e3 | |||
| d1f085a771 | |||
| 22ac74f686 | |||
| 72a51148e9 | |||
| 7e6d3caab7 | |||
| 0b15830a44 | |||
| 6c34850db6 | |||
| ed81c8df64 | |||
| efa1cab75a | |||
| aa99d2ebac | |||
| 9c4d90cb52 | |||
| 6a15f3890e | |||
| 4a4bf70e8b | |||
| 3aba658a40 | |||
| ed154e71b0 | |||
| 06d46b875b | |||
| 478b7146e5 | |||
| 5febdbe6a2 | |||
| 09e068e8bb | |||
| d17d7263fd | |||
| 0afaaad6dd | |||
| 556cdde71a | |||
| f24eb73cc5 | |||
| 01576f2100 | |||
| f39e564141 | |||
| ef1ecd2ad3 | |||
| c7e549cda4 | |||
| 5ab0e5351b | |||
| 1eacff88b1 | |||
| e3189a8d18 | |||
| c7a9221ef2 | |||
| c95773e2e3 | |||
| b61fae245c | |||
| a69cf7f929 | |||
| 147b16d552 | |||
| ce1a7659bc | |||
| 6c7b5a35a6 | |||
| 601e5c6d83 | |||
| 89b16e0bef | |||
| dc1d2cbc73 | |||
| 6be0f7be06 | |||
| 78fd0486c8 | |||
| 88e822b7aa | |||
| ba484e50c8 | |||
| 3667cf8429 | |||
| 6de86a8a2b | |||
| 3521e03fd2 | |||
| 16534d538e | |||
| 5c32629d04 | |||
| f99ae1651a | |||
| d4389e4a0e | |||
| 11acdd8532 | |||
| 5a9cc63733 | |||
| 1632e59179 | |||
| 1056e8ba25 | |||
| bb7163fc2b | |||
| eb5037adaf | |||
| e25151c437 | |||
| 9d3320dd6f | |||
| 2f8fd40195 | |||
| 72f1926ed9 | |||
| 121012741d | |||
| 457d2b5e2e | |||
| c696306936 | |||
| ef80cb5890 | |||
| 5ecae9254a | |||
| 05f35b612d | |||
| 45947bca5f | |||
| bf99f67aae | |||
| 6cd8ffb6c0 | |||
| b64c2aeb13 | |||
| 8ed6cc973c | |||
| 7d58caa23a | |||
| 3bf5ec446f | |||
| e2c7dd3d43 | |||
| daa7fe6afa | |||
| 4f2e19bb73 | |||
| 81ad3f094d | |||
| 9f83c03275 | |||
| 2cfb12db0e | |||
| d6ac705d63 | |||
| 0872d00857 | |||
| f6559c6eaf | |||
| 9ebd08c452 | |||
| e1a05fd2ee | |||
| 260d45cdb1 | |||
| 63c3cb0312 | |||
| 9e1671f1ea | |||
| a20cab3aad | |||
| 687f8a8479 | |||
| f3dc49171b | |||
| bc72c006b1 | |||
| 75103c45dc | |||
| a0e0aaadcc | |||
| 7f6ea348ef | |||
| 3977956e75 | |||
| 34d69085c0 | |||
| 88cef90bec | |||
| f077d83df1 | |||
| 0a7e544418 | |||
| b235008ebe | |||
| 9c13055211 | |||
| 28bbf01761 | |||
| 33467d709c | |||
| f3142c10a7 | |||
| e23d81ca40 | |||
| 1f81646cbb | |||
| 6417d9c239 | |||
| 398323186d | |||
| 7e0858ce24 | |||
| 1f0b64e4b8 | |||
| 2170957e21 | |||
| 47c28805bf | |||
| 52705b73f5 | |||
| cd4916f0e7 | |||
| 8f942e6e59 | |||
| 2fb08b1a82 | |||
| f4be9af77e | |||
| 9c06ad7c0e | |||
| 98b361c489 | |||
| 0f635409c2 | |||
| b4489cb423 | |||
| c0b23f5e20 | |||
| 9f5c27e117 | |||
| 9f02db13e2 | |||
| 3cd414a328 | |||
| e675506687 | |||
| b460bbc0c5 | |||
| cf48a979ae | |||
| 873fbf39c7 | |||
| 138ff31ef0 | |||
| d8e2154b8c | |||
| b3da8767ad | |||
| 1d74ef1255 | |||
| fc01a52823 | |||
| 70bb1b7d0a | |||
| 871e392987 | |||
| d84283e8cc | |||
| 9f1768c098 | |||
| 4babd8cdb7 | |||
| 312318201b | |||
| 3d9ac7137e | |||
| 838e230d54 | |||
| c26ac2e85d | |||
| ee3504f673 | |||
| 31256fae74 | |||
| 0c91f5a454 | |||
| 1ab21607a5 | |||
| 05fc7360c9 | |||
| 4c3211871d | |||
| 95f7d16801 | |||
| 400b2086ff | |||
| 7ef99eb8cf | |||
| ab4b2404c7 | |||
| d859c2875c | |||
| d14ff96dfa | |||
| bc53f961e7 | |||
| 91b2170fdb | |||
| fadadf8a64 | |||
| 65be624c43 | |||
| 3e5d4ba208 | |||
| dfea1a4f0d | |||
| 2409994d32 | |||
| 05dd1161a4 | |||
| 7ed61f310b | |||
| 15b8b5cdf0 | |||
| e6eb619c08 | |||
| 8826294d5d | |||
| cf2780d5c2 | |||
| 154bf3d9f5 | |||
| 768d683beb | |||
| 7f8aca035d | |||
| 8db1cdf462 | |||
| 48dc7ef01e | |||
| d782e76640 | |||
| e693c811f0 | |||
| d2f37aab56 | |||
| 8d08094ac3 | |||
| 8483f7adef | |||
| 4cffe42b56 | |||
| 84935b9585 | |||
| bf8f9164c0 | |||
| 64b5af4b58 | |||
| 959721b58a | |||
| 746fa817c1 | |||
| cfce223e9b | |||
| 375d8ffb56 | |||
| f89a47eff8 | |||
| 6a16596f78 | |||
| 7e22b75c28 | |||
| 7d547f726f | |||
| 75c9e608ce | |||
| fa8591ea3e | |||
| ae8c5e16e9 | |||
| 4fe95b0e61 | |||
| 5425233b37 | |||
| dcc561762b | |||
| 6307f8dd89 | |||
| 1a3e679835 | |||
| 6cfdd1bbae | |||
| 56a368facf | |||
| 4842ae967c | |||
| 6f62e05a96 | |||
| 6f23e028dd | |||
| ff013438d6 | |||
| 3e0941fb5b | |||
| e667c191f8 | |||
| 4566a44f14 | |||
| 8b2c0d969d | |||
| 32d337a934 | |||
| 4e1d36c8bc | |||
| 87c2aae85c | |||
| 8c6831f0fe | |||
| 5dbc672825 | |||
| b97d313c11 | |||
| ee0b0b4fc8 | |||
| 5b707aa422 | |||
| 519ba9e103 | |||
| c3a318e16a | |||
| faf63d076d | |||
| b1fe51cf0d | |||
| 651a97efc0 | |||
| cd8af2d23a | |||
| 8b75bb1772 | |||
| b672263e04 | |||
| 1b506c9639 | |||
| c463d72821 | |||
| 162053448e | |||
| 2034d440af | |||
| 70f7efe0fe | |||
| f1447db751 | |||
| 7fc01a94e2 | |||
| 568e72e7dc | |||
| 5d4db3dce3 | |||
| e5c7b50d85 | |||
| 9fda41582c | |||
| bddacfd5d7 | |||
| f3d9759375 | |||
| 1d776476b6 | |||
| fca9778023 | |||
| 482de4e370 | |||
| 91f43dd47f | |||
| fa9ba48533 | |||
| 141657a483 | |||
| c8be5a9ab3 | |||
| 507f737266 | |||
| 6d75761b94 | |||
| 52a9113c6d | |||
| 94f703e1d1 | |||
| d9ceef45de | |||
| 1ad332bbde | |||
| d23efa1ff2 | |||
| bf1ebf3b44 | |||
| 33e9b8c394 | |||
| 5bb0f00c0e | |||
| 670b636c47 | |||
| e48460c8cc | |||
| ad5bc5b5ca | |||
| 013cb2fb64 | |||
| c4df60bb8d | |||
| 786a4956dd | |||
| 323e272c85 | |||
| 6e769797fd | |||
| 0a48ddad8f | |||
| c939cd4b6d | |||
| fd27acfcb1 | |||
| 9ae0e4a58b | |||
| 874472a85d | |||
| 5f893f890f | |||
| 69e03eacba | |||
| d369112db4 | |||
| 62d603a054 | |||
| 4cb39164fa | |||
| d5e8561011 | |||
| 944455bcce | |||
| ee888615ea | |||
| 3f58d35337 | |||
| 6983a17fc0 | |||
| ce2d88a951 | |||
| 5a4f73d144 | |||
| 1c8396e2b5 | |||
| 5668055015 | |||
| 1dfd13841a | |||
| 405cd4fb35 | |||
| 2f4b6bd2d7 | |||
| acf70635c6 | |||
| 5d15e96a98 | |||
| e3b1e103bd | |||
| 8d1867cdcc | |||
| 2cfa9817b1 | |||
| 641b8c31ee | |||
| 6ce1d39f4e | |||
| 9d4fb0a3ad | |||
| 4110054b51 | |||
| dd4d110c9b | |||
| 017f8ff6bf | |||
| 1ff7beef8f | |||
| 35783784b3 | |||
| 194ca4970a | |||
| d4f3852dd2 | |||
| 3fbbc7a86b | |||
| 7cff4e8bc1 | |||
| 827803ea3d | |||
| ccb639002f | |||
| df62f09a4c | |||
| 7c0a982958 | |||
| 940e4da0fa | |||
| ae531ae852 | |||
| 84d3ae1b08 | |||
| d51f307ffa | |||
| a4018fbcdd | |||
| 2dd34c5ae4 | |||
| 71f83af13c | |||
| d587d8b242 | |||
| f1b1570b02 | |||
| f9ca67a78d | |||
| c8f9140e70 | |||
| 47c211ba0e | |||
| 9f270d956e | |||
| 32ee8e3d34 | |||
| 77a1413fa0 | |||
| 14760d9787 | |||
| 03b6b93589 | |||
| 47402416fd | |||
| 0087cede97 | |||
| 264c405192 | |||
| 1742e0c27c | |||
| 7371cb4838 | |||
| c1512e8d89 | |||
| e5aaeed609 | |||
| a950ed04a7 | |||
| 964c98c8d9 | |||
| 635389b235 | |||
| 1385e3bc09 | |||
| 2dc581f717 | |||
| 4f8369c3f1 | |||
| 730b405d68 | |||
| 87c04f1e0b | |||
| f4df13fb6c | |||
| 4a8abf77ac | |||
| 7e48ec1820 | |||
| 05087afd40 | |||
| 56afed9678 | |||
| af8c168f78 | |||
| 4c52746b41 | |||
| 7768a35366 | |||
| 05847affc1 | |||
| a63efe42d1 | |||
| f4b45aa02c | |||
| 0a2fdafe37 | |||
| fa855204af | |||
| 70cf2159d4 | |||
| 55e08c48c7 | |||
| 8f954b91f4 | |||
| bbd4540075 | |||
| 780a8aa0aa | |||
| c55b5aa305 | |||
| bb822f465a | |||
| ec1282cd7f | |||
| 9d0ac7d6ed | |||
| 9164c896c4 | |||
| 398bcbce55 | |||
| 7890567fad | |||
| 41b456e1a2 | |||
| ce9c32a016 | |||
| 600b2f01fa | |||
| c94868ba12 | |||
| db6f627bad | |||
| c61c666667 | |||
| b41d588695 | |||
| 48b4929c23 | |||
| 501a4fc35c | |||
| f652a2b613 | |||
| 04d4cbde78 | |||
| e9f0baf90e | |||
| 9ce9388c8d | |||
| 497f4ee8b9 | |||
| 6955a9b618 | |||
| b75b238591 | |||
| 4e2c4bfaed | |||
| 7c52eaaf18 | |||
| 47acac9180 | |||
| 351ad0c0e9 | |||
| 7c1a3ed76f | |||
| 1cdc2e81f8 | |||
| 5f1b314b50 | |||
| 861b56413f | |||
| adad13e029 | |||
| 0681ffb33a | |||
| 600029a98c | |||
| 5adfd0fa46 | |||
| 62031a875b | |||
| 3140ab71b8 | |||
| 6ce5070675 | |||
| 34638813f1 | |||
| 44de681d9e | |||
| 466ca1079d | |||
| 97e9f81aa0 | |||
| de97a73ede | |||
| bd7971aca9 | |||
| 9f40a833fb | |||
| bb743c2358 | |||
| 3c2dc443a6 | |||
| 97f2585ea4 | |||
| 392abd6324 | |||
| b72afc29a0 | |||
| 18a85f8cbd | |||
| e3240e8431 | |||
| 3bd1f38249 | |||
| 1c283d1105 | |||
| 983c94d341 | |||
| d340080d73 | |||
| d6aeb11f74 | |||
| 311d7ce594 | |||
| 3f91f38f54 | |||
| f64e54a2f3 | |||
| e03a5c24ca | |||
| 9a993a7bed | |||
| 63abb48e56 | |||
| 6c70a26c41 | |||
| 99c49bb067 | |||
| 504f784ae6 | |||
| 3b8eb088f3 | |||
| 7e5e4bd6c7 | |||
| 3adfa34acb | |||
| 61118a9796 | |||
| 2cf0f41cba | |||
| 80df50ae38 | |||
| 8e12159d85 | |||
| 1069559e8f | |||
| 55a40f54c2 | |||
| 17cc89b121 | |||
| 22bb5242b3 | |||
| e7823df844 | |||
| 6b18b86b4b | |||
| 55dfe56aae | |||
| 48b85b536e | |||
| 74a6ebbd7b | |||
| cee9f65fa6 | |||
| a367a3b412 | |||
| f2f320b763 | |||
| 0b27697301 | |||
| c80f562a4c | |||
| 43a7584e37 | |||
| 99611eff5f | |||
| 448a2aa60c | |||
| a3066f443a | |||
| 3723049a5c | |||
| be9a8bdacb | |||
| 88c0d68ffa | |||
| 2abc1a4130 | |||
| 530c2ac613 | |||
| a86e2db5bb | |||
| 623e72a092 | |||
| 64a540241c | |||
| 1aef32324f |
@@ -211,7 +211,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',
|
||||
@@ -242,7 +242,8 @@
|
||||
},
|
||||
parserOptions: {
|
||||
'ecmaVersion': 9,
|
||||
'sourceType': 'module'
|
||||
'sourceType': 'module',
|
||||
'requireConfigFile': false,
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -13,15 +13,16 @@ env:
|
||||
|
||||
jobs:
|
||||
Grunt:
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- name: Checking out code
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Configuring node & npm
|
||||
shell: bash -l {0}
|
||||
run: nvm install
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
|
||||
- name: Installing node stuff
|
||||
run: npm install
|
||||
@@ -53,17 +54,17 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-18.04
|
||||
- os: ubuntu-22.04
|
||||
php: 7.2
|
||||
db: mysqli
|
||||
- os: ubuntu-18.04
|
||||
- os: ubuntu-22.04
|
||||
php: 7.4
|
||||
db: pgsql
|
||||
|
||||
steps:
|
||||
- name: Setting up DB mysql
|
||||
if: ${{ matrix.db == 'mysqli' }}
|
||||
uses: johanmeiring/mysql-action@tmpfs-patch
|
||||
uses: moodlehq/mysql-action@v1
|
||||
with:
|
||||
collation server: utf8mb4_bin
|
||||
mysql version: 5.7
|
||||
@@ -71,6 +72,8 @@ jobs:
|
||||
mysql user: test
|
||||
mysql password: test
|
||||
use tmpfs: true
|
||||
tmpfs size: '1024M'
|
||||
extra conf: --skip-log-bin
|
||||
|
||||
- name: Setting up DB pgsql
|
||||
if: ${{ matrix.db == 'pgsql' }}
|
||||
@@ -82,7 +85,7 @@ jobs:
|
||||
postgresql password: test
|
||||
|
||||
- name: Configuring git vars
|
||||
uses: rlespinasse/github-slug-action@v3.x
|
||||
uses: rlespinasse/github-slug-action@v4
|
||||
|
||||
- name: Setting up PHP ${{ matrix.php }}
|
||||
uses: shivammathur/setup-php@v2
|
||||
@@ -91,7 +94,7 @@ jobs:
|
||||
coverage: none
|
||||
|
||||
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setting up PHPUnit
|
||||
env:
|
||||
|
||||
+5
-3
@@ -36,7 +36,7 @@ jobs:
|
||||
- php: 7.2
|
||||
env: DB=none TASK=CITEST
|
||||
- php: 7.2
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/gallium'
|
||||
|
||||
- if: env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present
|
||||
php: 7.2
|
||||
@@ -52,7 +52,7 @@ jobs:
|
||||
env: DB=none TASK=CITEST
|
||||
- if: env(MOODLE_PHP) = "all"
|
||||
php: 7.4
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/carbon'
|
||||
env: DB=none TASK=GRUNT NVM_VERSION='lts/gallium'
|
||||
|
||||
- if: env(MOODLE_PHP) = "all" AND (env(MOODLE_DATABASE) = "pgsql" OR env(MOODLE_DATABASE) = "all" OR env(MOODLE_DATABASE) IS NOT present)
|
||||
php: 7.4
|
||||
@@ -81,7 +81,8 @@ install:
|
||||
sudo service mysql stop
|
||||
sudo mv /var/lib/mysql /mnt/ramdisk
|
||||
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
|
||||
sudo service mysql restart
|
||||
echo -e "[mysqld]\nskip-log-bin" | sudo tee -a /etc/mysql/my.cnf
|
||||
sudo service mysql start
|
||||
fi
|
||||
- >
|
||||
if [ "$DB" = 'pgsql' ];
|
||||
@@ -92,6 +93,7 @@ install:
|
||||
sudo mv /var/lib/postgresql /mnt/ramdisk
|
||||
sudo ln -s /mnt/ramdisk/postgresql /var/lib/postgresql
|
||||
sudo service postgresql start 9.6
|
||||
sh -c 'until pg_isready -p 5432; do echo "Waiting for the DB to be up..."; sleep 2; done'
|
||||
fi
|
||||
- >
|
||||
if [ "$TASK" = 'PHPUNIT' ];
|
||||
|
||||
+126
-49
@@ -142,7 +142,7 @@ module.exports = function(grunt) {
|
||||
const path = require('path');
|
||||
const tasks = {};
|
||||
const async = require('async');
|
||||
const DOMParser = require('xmldom').DOMParser;
|
||||
const DOMParser = require('@xmldom/xmldom').DOMParser;
|
||||
const xpath = require('xpath');
|
||||
const semver = require('semver');
|
||||
const watchman = require('fb-watchman');
|
||||
@@ -229,8 +229,8 @@ module.exports = function(grunt) {
|
||||
* @return {String} The rewritten destination path.
|
||||
*/
|
||||
var babelRename = function(destPath, srcPath) {
|
||||
destPath = srcPath.replace('src', 'build');
|
||||
destPath = destPath.replace('.js', '.min.js');
|
||||
destPath = srcPath.replace(`amd/src`, `amd/build`);
|
||||
destPath = destPath.replace(/\.js$/, '.min.js');
|
||||
return destPath;
|
||||
};
|
||||
|
||||
@@ -285,6 +285,71 @@ module.exports = function(grunt) {
|
||||
return ['**/tests/behat/*.feature'];
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
eslint: {
|
||||
@@ -301,55 +366,66 @@ module.exports = function(grunt) {
|
||||
// Check YUI module source files.
|
||||
yui: {src: files ? files : yuiSrc},
|
||||
},
|
||||
babel: {
|
||||
options: {
|
||||
sourceMaps: true,
|
||||
comments: 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('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: [
|
||||
['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
|
||||
}]
|
||||
]
|
||||
},
|
||||
rollup: {
|
||||
dist: {
|
||||
options: {
|
||||
format: 'esm',
|
||||
dir: 'output',
|
||||
sourcemap: true,
|
||||
treeshake: false,
|
||||
context: 'window',
|
||||
plugins: [
|
||||
rateLimit({initialDelay: 0}),
|
||||
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('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,
|
||||
}),
|
||||
],
|
||||
},
|
||||
files: [{
|
||||
expand: true,
|
||||
src: files ? files : amdSrc,
|
||||
rename: babelRename
|
||||
}]
|
||||
}
|
||||
}],
|
||||
},
|
||||
},
|
||||
sass: {
|
||||
dist: {
|
||||
@@ -834,7 +910,8 @@ module.exports = function(grunt) {
|
||||
grunt.loadNpmTasks('grunt-sass');
|
||||
grunt.loadNpmTasks('grunt-eslint');
|
||||
grunt.loadNpmTasks('grunt-stylelint');
|
||||
grunt.loadNpmTasks('grunt-babel');
|
||||
grunt.loadNpmTasks('grunt-rollup');
|
||||
|
||||
|
||||
// Rename the grunt-contrib-watch "watch" task because we're going to wrap it.
|
||||
grunt.renameTask('watch', 'watch-grunt');
|
||||
@@ -845,7 +922,7 @@ module.exports = function(grunt) {
|
||||
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', tasks.ignorefiles);
|
||||
grunt.registerTask('watch', 'Run tasks on file changes', tasks.watch);
|
||||
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
|
||||
grunt.registerTask('amd', ['eslint:amd', 'babel']);
|
||||
grunt.registerTask('amd', ['eslint:amd', 'rollup']);
|
||||
grunt.registerTask('js', ['amd', 'yui']);
|
||||
|
||||
// Register CSS tasks.
|
||||
|
||||
+53
-35
@@ -1,48 +1,66 @@
|
||||
MOODLE TRADEMARKS POLICY
|
||||
========================
|
||||
|
||||
The word "Moodle" is trademarked in many countries around the world. The word
|
||||
was originally coined as an acronym: Modular Object-Oriented Dynamic Learning
|
||||
Environment. The trademark is owned by Martin Dougiamas, Founder and Director
|
||||
of Moodle.
|
||||
The Moodle Trademark
|
||||
--------------------
|
||||
|
||||
The law obligates trademark owners to police their marks and prevent the use of
|
||||
confusingly similar names by third parties. Through this policy we’d like to
|
||||
make it clear how Moodle-related projects, organisations, and people can use
|
||||
the Moodle trademark. We’d also like to be clear about how use of the word is
|
||||
restricted when used to promote commercial Moodle services. We do this to
|
||||
protect the very business model that allows us to continue developing Moodle
|
||||
for you.
|
||||
The brand and word "Moodle" has trade mark protection in many countries around
|
||||
the world. Various Moodle™ trade marks are owned by either Moodle Pty Ltd or
|
||||
one of its associated entities. The law obligates trade mark owners to police
|
||||
their trade marks and prevent the use of confusingly similar names by
|
||||
third parties.
|
||||
|
||||
Allowed uses
|
||||
------------
|
||||
We have created a more concise and thorough set of Trademark Guidelines
|
||||
(https://moodle.com/wp-content/uploads/2023/02/Moodle-Trademark-Guidelines-2023-4.pdf)
|
||||
to help you understand how to comply with Moodle's trade mark requirements.
|
||||
The Trademark Guidelines will also assist our Moodle Certified Partners and the
|
||||
community to understand some of the principles that inform Moodle's stance
|
||||
whenever potential infringement has been detected by us or our community.
|
||||
|
||||
The following uses don’t require any permission at all:
|
||||
We need to be clear about use of the word "Moodle" and how we restrict its use
|
||||
when promoting commercial Moodle™ branded services. The proper use of
|
||||
trade marks reliably assures consumers about the quality of the associated
|
||||
products or services and where they have been derived from. Because the
|
||||
Moodle LMS is made available under the open source ‘GNU General Public License'
|
||||
that permits you to modify the copyrighted software, the distribution of such
|
||||
modified software in combination with Moodle trade marks can potentially
|
||||
mislead others in the community. To be clear, the GNU GPL does not include an
|
||||
implied right or licence to use Moodle's trade marks.
|
||||
|
||||
* Referring to the software or the Moodle project.
|
||||
* Describing your own Moodle implementation (including within corporate
|
||||
settings).
|
||||
We do all this to protect the very business model that allows us to continue
|
||||
developing various Moodle software solutions for you.
|
||||
|
||||
Allowed uses of "Moodle"
|
||||
------------------------
|
||||
|
||||
The following uses don't require any permission at all:
|
||||
|
||||
* Referring to the software or the Moodle project as the "Moodle™ software"
|
||||
or the "Moodle™ project"
|
||||
* Describing your own implementation of the Moodle™ software platform
|
||||
(including within corporate settings).
|
||||
* Describing a Moodle-based community hub.
|
||||
* Describing some software you’ve made that integrates with Moodle
|
||||
(eg a Moodle integration feature on another system).
|
||||
* Describing certain software you've made that integrates with Moodle™
|
||||
branded software (e.g. a Moodle™ integration feature on another system).
|
||||
|
||||
Restricted uses
|
||||
---------------
|
||||
Restricted uses of "Moodle"
|
||||
---------------------------
|
||||
|
||||
The following uses are generally prohibited without explicit and direct
|
||||
permission being granted to you by Moodle Pty Ltd. We do this to protect the
|
||||
Moodle project from software and sites which could confuse people. Please
|
||||
contact us to ask for permission in writing.
|
||||
Moodle™ project from software and sites which could confuse people. If in
|
||||
doubt, reach out for clarification at <trademarks@moodle.com>
|
||||
|
||||
* You can’t use "Moodle" in the name of your software (including Mobile apps)
|
||||
* You can’t use "Moodle" in your company name
|
||||
* You can’t use "Moodle" in your domain name
|
||||
* You can’t use "Moodle" in advertising-related keywords (such as Adsense)
|
||||
* You can’t use "Moodle" to describe services around Moodle (such as hosting,
|
||||
training, support, consulting, course creation services, theme development,
|
||||
customisation, installation, integration and certification). This applies
|
||||
even if you do not charge for the services. Note that usually only Moodle
|
||||
Partners have this permission.
|
||||
|
||||
For information about the Moodle Partner Certification Mark as well as for how
|
||||
to contact us, please see <https://moodle.com/trademarks/>.
|
||||
* You can't use the word "Moodle" or any Moodle logos for commercial purposes
|
||||
without prior written permission from Moodle HQ.
|
||||
* You can't use "Moodle" in the name of your software (including Mobile apps).
|
||||
* You can't use "Moodle" in your company name.
|
||||
* You can't use "Moodle" in your domain name.
|
||||
* You can't use "Moodle" in advertising-related keywords (such as Adsense).
|
||||
* You can't use "Moodle" to describe services around Moodle
|
||||
(such as hosting, training, support, consulting, course creation services,
|
||||
theme development, customisation, installation, integration, analytics
|
||||
and certification) that cause consumers to be confused that you are
|
||||
associated with Moodle HQ if you are not.
|
||||
This applies even if you do not charge for the services.
|
||||
Note that usually only Moodle Partners have this permission.
|
||||
|
||||
@@ -3371,6 +3371,7 @@
|
||||
<VENDOR name="oracle" version="11.2" />
|
||||
</DATABASE>
|
||||
<PHP version="7.3.0" level="required">
|
||||
<RESTRICT function="restrict_php_version_81" message="unsupportedphpversion81" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -3539,6 +3540,8 @@
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.0" requires="3.6">
|
||||
@@ -3555,6 +3558,7 @@
|
||||
<VENDOR name="oracle" version="11.2" />
|
||||
</DATABASE>
|
||||
<PHP version="7.3.0" level="required">
|
||||
<RESTRICT function="restrict_php_version_81" message="unsupportedphpversion81" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -3729,6 +3733,385 @@
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.1" requires="3.9">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="10.4" />
|
||||
<VENDOR name="mysql" version="5.7" />
|
||||
<VENDOR name="postgres" version="12" />
|
||||
<VENDOR name="mssql" version="14.0" />
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="7.4.0" level="required">
|
||||
<RESTRICT function="restrict_php_version_82" message="unsupportedphpversion82" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mbstringrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="intlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
<PHP_EXTENSION name="fileinfo" level="required"/>
|
||||
<PHP_EXTENSION name="sodium" level="optional"/>
|
||||
<PHP_EXTENSION name="exif" level="optional"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="sixtyfourbitswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.2" requires="3.11.8">
|
||||
<UNICODE level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unicoderequired" />
|
||||
</FEEDBACK>
|
||||
</UNICODE>
|
||||
<DATABASE level="required">
|
||||
<VENDOR name="mariadb" version="10.6.7" />
|
||||
<VENDOR name="mysql" version="8.0" />
|
||||
<VENDOR name="postgres" version="13" />
|
||||
<VENDOR name="mssql" version="14.0" />
|
||||
<VENDOR name="oracle" version="19" />
|
||||
</DATABASE>
|
||||
<PHP version="8.0.0" level="required">
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="pcreunicodewarning" />
|
||||
</FEEDBACK>
|
||||
</PCREUNICODE>
|
||||
<PHP_EXTENSIONS>
|
||||
<PHP_EXTENSION name="iconv" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="iconvrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="mbstring" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="mbstringrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="curl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="curlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="openssl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="opensslrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="tokenizer" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="tokenizerrecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="soap" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="soaprecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="ctype" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ctyperequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zip" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="ziprequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="zlib" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="gd" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="gdrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="simplexml" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="simplexmlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="spl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="splrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="pcre" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="dom" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xml" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="xmlreader" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="intl" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="intlrequired" />
|
||||
</FEEDBACK>
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="json" level="required">
|
||||
</PHP_EXTENSION>
|
||||
<PHP_EXTENSION name="hash" level="required"/>
|
||||
<PHP_EXTENSION name="fileinfo" level="required"/>
|
||||
<PHP_EXTENSION name="sodium" level="required"/>
|
||||
<PHP_EXTENSION name="exif" level="optional"/>
|
||||
</PHP_EXTENSIONS>
|
||||
<PHP_SETTINGS>
|
||||
<PHP_SETTING name="memory_limit" value="96M" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="settingmemorylimit" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="file_uploads" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="settingfileuploads" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
<PHP_SETTING name="opcache.enable" value="1" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="opcacherecommended" />
|
||||
</FEEDBACK>
|
||||
</PHP_SETTING>
|
||||
</PHP_SETTINGS>
|
||||
<CUSTOM_CHECKS>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbstorageengine" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="quizattemptsupgradedmessage" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="slashargumentswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="unoconvwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfileformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddbfilepertable" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="unsupporteddblargeprefix" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="ishttpswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="incompleteunicodesupport" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="required">
|
||||
<FEEDBACK>
|
||||
<ON_ERROR message="sixtyfourbitsrequired" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_max_input_vars" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_admin_dir_usage" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="iscustomadminwarnings" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_xmlrpc_usage" level="optional">
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mod_assignment" level="required">
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -6,7 +6,7 @@ require_once(__DIR__ . '/../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
include_once($CFG->dirroot.'/mnet/lib.php');
|
||||
|
||||
$sort = optional_param('sort', 'username', PARAM_ALPHA);
|
||||
$sort = optional_param('sort', 'username', PARAM_ALPHAEXT);
|
||||
$dir = optional_param('dir', 'ASC', PARAM_ALPHA);
|
||||
$page = optional_param('page', 0, PARAM_INT);
|
||||
$perpage = optional_param('perpage', 30, PARAM_INT);
|
||||
@@ -153,7 +153,15 @@ foreach ($columns as $column) {
|
||||
$headings[$column] = "<a href=\"?sort=$column&dir=$columndir&\">".$string[$column]."</a>$columnicon";
|
||||
}
|
||||
$headings['delete'] = '';
|
||||
$acl = $DB->get_records('mnet_sso_access_control', null, "$sort $dir", '*'); //, $page * $perpage, $perpage);
|
||||
|
||||
$sortorder = get_safe_orderby([
|
||||
'username' => 'username',
|
||||
'mnet_host_id' => 'mnet_host_id',
|
||||
'access' => 'accessctrl',
|
||||
'default' => 'username',
|
||||
], $sort, $dir, false);
|
||||
|
||||
$acl = $DB->get_records('mnet_sso_access_control', null, $sortorder);
|
||||
$aclcount = $DB->count_records('mnet_sso_access_control');
|
||||
|
||||
if (!$acl) {
|
||||
|
||||
@@ -14,6 +14,10 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| Cohort 1 | CH1 |
|
||||
And the following "cohort members" exist:
|
||||
| user | cohort |
|
||||
| user2 | CH1 |
|
||||
| user3 | CH1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
@@ -23,8 +27,6 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
| user2 | C1 | student |
|
||||
| user3 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I add "User Two (two@example.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@example.com)" user to "CH1" cohort members
|
||||
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
||||
|
||||
Scenario: Filter user accounts by role and cohort
|
||||
|
||||
+12
-2
@@ -1,2 +1,12 @@
|
||||
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
|
||||
* @class log_info
|
||||
* @package tool_analytics
|
||||
* @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":"AAwBAA,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 * @class log_info\n * @package tool_analytics\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 * @class log_info\n * @package tool_analytics\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":";;;;;;;;;AAwBAA,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
+12
-2
@@ -1,2 +1,12 @@
|
||||
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
|
||||
* @class potential-contexts
|
||||
* @package tool_analytics
|
||||
* @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":"AAyBAA,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 * @class potential-contexts\n * @package tool_analytics\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 * @class potential-contexts\n * @package tool_analytics\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":";;;;;;;;;AAyBAA,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"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
define("tool_behat/steps",["exports","core/ajax","core/templates","core/pending"],(function(_exports,_ajax,_templates,_pending){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg),value=info.value}catch(error){return void reject(error)}info.done?resolve(value):Promise.resolve(value).then(_next,_throw)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_ajax=_interopRequireDefault(_ajax),_templates=_interopRequireDefault(_templates),_pending=_interopRequireDefault(_pending);
|
||||
/**
|
||||
* Enhancements for the step definitions page.
|
||||
*
|
||||
* @module tool_behat/steps
|
||||
* @copyright 2022 Catalyst IT EU
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
var getRequiredFieldsContent=function(entityData){var _entityData$required;return null!==(_entityData$required=entityData.required)&&void 0!==_entityData$required&&_entityData$required.length?_templates.default.renderForPromise("tool_behat/steprequiredfields",{fields:entityData.required}):Promise.resolve({html:"",js:""})};_exports.init=function(){var fn,_ref;document.addEventListener("change",(fn=regeneratorRuntime.mark((function _callee(e){var entityElement,stepElement,pendingPromise,entityData,_yield$getRequiredFie,html,js,stepRequiredFields;return regeneratorRuntime.wrap((function(_context){for(;;)switch(_context.prev=_context.next){case 0:if(entityElement=e.target.closest(".entities"),stepElement=e.target.closest(".stepcontent"),entityElement&&stepElement){_context.next=4;break}return _context.abrupt("return");case 4:return pendingPromise=new _pending.default("tool_behat/steps:change"),_context.next=7,entityType=e.target.value,_ajax.default.call([{methodname:"tool_behat_get_entity_generator",args:{entitytype:entityType}}])[0];case 7:return entityData=_context.sent,_context.next=10,getRequiredFieldsContent(entityData);case 10:if(_yield$getRequiredFie=_context.sent,html=_yield$getRequiredFie.html,js=_yield$getRequiredFie.js,!(stepRequiredFields=stepElement.querySelector(".steprequiredfields"))){_context.next=19;break}return _context.next=17,_templates.default.replaceNode(stepRequiredFields,html,js);case 17:_context.next=21;break;case 19:return _context.next=21,_templates.default.appendNodeContents(stepElement,html,js);case 21:pendingPromise.resolve();case 22:case"end":return _context.stop()}var entityType}),_callee)})),_ref=function(){var self=this,args=arguments;return new Promise((function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(void 0)}))},function(_x){return _ref.apply(this,arguments)}))}}));
|
||||
|
||||
//# sourceMappingURL=steps.min.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"steps.min.js","sources":["../src/steps.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\nimport Ajax from 'core/ajax';\nimport Templates from 'core/templates';\nimport PendingJS from 'core/pending';\n\n/**\n * Enhancements for the step definitions page.\n *\n * @module tool_behat/steps\n * @copyright 2022 Catalyst IT EU\n * @author Mark Johnson <mark.johnson@catalyst-eu.net>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\n/**\n * Call the get_entity_generator web service function\n *\n * Takes the name of an entity generator and returns an object containing a list of the required fields.\n *\n * @param {String} entityType\n * @returns {Promise}\n */\nconst getGeneratorEntities = (entityType) => Ajax.call([{\n methodname: 'tool_behat_get_entity_generator',\n args: {entitytype: entityType}\n}])[0];\n\n/**\n * Render HTML for required fields\n *\n * Takes the entity data returned from getGeneratorEntities and renders the HTML to display the required fields.\n *\n * @param {String} entityData\n * @return {Promise}\n */\nconst getRequiredFieldsContent = (entityData) => {\n if (!entityData.required?.length) {\n return Promise.resolve({\n html: '',\n js: ''\n });\n }\n return Templates.renderForPromise('tool_behat/steprequiredfields', {fields: entityData.required});\n};\n\nexport const init = () => {\n // When an entity is selected in the \"the following exist\" step, fetch and display the required fields.\n document.addEventListener('change', async(e) => {\n const entityElement = e.target.closest('.entities');\n const stepElement = e.target.closest('.stepcontent');\n if (!entityElement || !stepElement) {\n return;\n }\n\n const pendingPromise = new PendingJS('tool_behat/steps:change');\n\n const entityData = await getGeneratorEntities(e.target.value);\n const {html, js} = await getRequiredFieldsContent(entityData);\n\n const stepRequiredFields = stepElement.querySelector('.steprequiredfields');\n if (stepRequiredFields) {\n await Templates.replaceNode(stepRequiredFields, html, js);\n } else {\n await Templates.appendNodeContents(stepElement, html, js);\n }\n pendingPromise.resolve();\n });\n};\n"],"names":["getRequiredFieldsContent","entityData","required","_entityData$required","length","Templates","renderForPromise","fields","Promise","resolve","html","js","document","addEventListener","e","entityElement","target","closest","stepElement","pendingPromise","PendingJS","entityType","value","Ajax","call","methodname","args","entitytype","stepRequiredFields","querySelector","replaceNode","appendNodeContents"],"mappings":";;;;;;;;;IAiDMA,yBAA2B,SAACC,yEACzBA,WAAWC,0CAAXC,qBAAqBC,OAMnBC,mBAAUC,iBAAiB,gCAAiC,CAACC,OAAQN,WAAWC,WAL5EM,QAAQC,QAAQ,CACnBC,KAAM,GACNC,GAAI,oBAMI,uBAEhBC,SAASC,iBAAiB,sCAAU,iBAAMC,oNAChCC,cAAgBD,EAAEE,OAAOC,QAAQ,aACjCC,YAAcJ,EAAEE,OAAOC,QAAQ,gBAChCF,eAAkBG,kFAIjBC,eAAiB,IAAIC,iBAAU,2CAhCfC,WAkCwBP,EAAEE,OAAOM,MAlClBC,cAAKC,KAAK,CAAC,CACpDC,WAAY,kCACZC,KAAM,CAACC,WAAYN,eACnB,iBA+BUpB,0CACmBD,yBAAyBC,2DAA3CS,2BAAAA,KAAMC,yBAAAA,KAEPiB,mBAAqBV,YAAYW,cAAc,wEAE3CxB,mBAAUyB,YAAYF,mBAAoBlB,KAAMC,mEAEhDN,mBAAU0B,mBAAmBb,YAAaR,KAAMC,YAE1DQ,eAAeV,mDA3CM,IAACY"}
|
||||
@@ -0,0 +1,82 @@
|
||||
// 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/>.
|
||||
|
||||
import Ajax from 'core/ajax';
|
||||
import Templates from 'core/templates';
|
||||
import PendingJS from 'core/pending';
|
||||
|
||||
/**
|
||||
* Enhancements for the step definitions page.
|
||||
*
|
||||
* @module tool_behat/steps
|
||||
* @copyright 2022 Catalyst IT EU
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
/**
|
||||
* Call the get_entity_generator web service function
|
||||
*
|
||||
* Takes the name of an entity generator and returns an object containing a list of the required fields.
|
||||
*
|
||||
* @param {String} entityType
|
||||
* @returns {Promise}
|
||||
*/
|
||||
const getGeneratorEntities = (entityType) => Ajax.call([{
|
||||
methodname: 'tool_behat_get_entity_generator',
|
||||
args: {entitytype: entityType}
|
||||
}])[0];
|
||||
|
||||
/**
|
||||
* Render HTML for required fields
|
||||
*
|
||||
* Takes the entity data returned from getGeneratorEntities and renders the HTML to display the required fields.
|
||||
*
|
||||
* @param {String} entityData
|
||||
* @return {Promise}
|
||||
*/
|
||||
const getRequiredFieldsContent = (entityData) => {
|
||||
if (!entityData.required?.length) {
|
||||
return Promise.resolve({
|
||||
html: '',
|
||||
js: ''
|
||||
});
|
||||
}
|
||||
return Templates.renderForPromise('tool_behat/steprequiredfields', {fields: entityData.required});
|
||||
};
|
||||
|
||||
export const init = () => {
|
||||
// When an entity is selected in the "the following exist" step, fetch and display the required fields.
|
||||
document.addEventListener('change', async(e) => {
|
||||
const entityElement = e.target.closest('.entities');
|
||||
const stepElement = e.target.closest('.stepcontent');
|
||||
if (!entityElement || !stepElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
const pendingPromise = new PendingJS('tool_behat/steps:change');
|
||||
|
||||
const entityData = await getGeneratorEntities(e.target.value);
|
||||
const {html, js} = await getRequiredFieldsContent(entityData);
|
||||
|
||||
const stepRequiredFields = stepElement.querySelector('.steprequiredfields');
|
||||
if (stepRequiredFields) {
|
||||
await Templates.replaceNode(stepRequiredFields, html, js);
|
||||
} else {
|
||||
await Templates.appendNodeContents(stepElement, html, js);
|
||||
}
|
||||
pendingPromise.resolve();
|
||||
});
|
||||
};
|
||||
@@ -0,0 +1,92 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Return data about an entity generator.
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2022 onwards Catalyst IT EU {@link https://catalyst-eu.net}
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_behat\external;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/externallib.php');
|
||||
|
||||
/**
|
||||
* External function for getting properties of entity generators.
|
||||
*/
|
||||
class get_entity_generator extends \external_api {
|
||||
|
||||
/**
|
||||
* Define parameters for external function.
|
||||
*
|
||||
* The parameter is either in the format 'entity' or 'component_name > entity'. There is no appropriate param type for a
|
||||
* string like this containing angle brackets, so we will do PARAM_RAW. The value will be parsed by
|
||||
* behat_data_generators::parse_entity_type, which validates the format of the parameter and throws an exception if it is not
|
||||
* correct.
|
||||
*
|
||||
* @return \external_function_parameters
|
||||
*/
|
||||
public static function execute_parameters(): \external_function_parameters {
|
||||
return new \external_function_parameters([
|
||||
'entitytype' => new \external_value(PARAM_RAW, 'Entity type that can be created by a generator.'),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a list of the required fields for a given entity type.
|
||||
*
|
||||
* @param string $entitytype
|
||||
* @return array
|
||||
*/
|
||||
public static function execute(string $entitytype): array {
|
||||
global $CFG;
|
||||
|
||||
// Ensure we can load Behat and Facebook namespaces in behat libraries.
|
||||
require_once("{$CFG->dirroot}/vendor/autoload.php");
|
||||
require_once("{$CFG->libdir}/tests/behat/behat_data_generators.php");
|
||||
|
||||
$params = self::validate_parameters(self::execute_parameters(), ['entitytype' => $entitytype]);
|
||||
$context = \context_system::instance();
|
||||
self::validate_context($context);
|
||||
require_capability('moodle/site:config', $context);
|
||||
|
||||
$generators = new \behat_data_generators();
|
||||
$entity = $generators->get_entity($params['entitytype']);
|
||||
return ['required' => $entity['required']];
|
||||
}
|
||||
|
||||
/**
|
||||
* Define return values.
|
||||
*
|
||||
* Return required fields
|
||||
*
|
||||
* @return \external_single_structure
|
||||
*/
|
||||
public static function execute_returns(): \external_single_structure {
|
||||
return new \external_single_structure([
|
||||
'required' => new \external_multiple_structure(
|
||||
new \external_value(PARAM_TEXT, 'Required field'),
|
||||
'Required fields',
|
||||
VALUE_OPTIONAL
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Define web service functions for tool_behat
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2022 onwards Catalyst IT EU {@link https://catalyst-eu.net}
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$functions = [
|
||||
'tool_behat_get_entity_generator' => [
|
||||
'classname' => 'tool_behat\\external\\get_entity_generator',
|
||||
'methodname' => 'execute',
|
||||
'description' => 'Get the generator details for an entity',
|
||||
'type' => 'read',
|
||||
'ajax' => true,
|
||||
'capabilities' => 'moodle/site:config'
|
||||
]
|
||||
];
|
||||
@@ -56,6 +56,7 @@ if ($components) {
|
||||
$form = new steps_definitions_form(null, array('components' => $componentswithsteps));
|
||||
|
||||
// Output contents.
|
||||
$PAGE->requires->js_call_amd('tool_behat/steps', 'init');
|
||||
$renderer = $PAGE->get_renderer('tool_behat');
|
||||
echo $renderer->render_stepsdefinitions($steps, $form);
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/behat/classes/behat_generator_base.php');
|
||||
|
||||
/**
|
||||
* Renderer for behat tool web features
|
||||
*
|
||||
@@ -106,6 +108,32 @@ class tool_behat_renderer extends plugin_renderer_base {
|
||||
},
|
||||
$stepsdefinitions
|
||||
);
|
||||
|
||||
$elementstrings = [];
|
||||
$count = 1;
|
||||
$stepsdefinitions = preg_replace_callback('/(the following ")ELEMENT\d?_STRING(" exist:)/',
|
||||
function($matches) use (&$elementstrings, &$count) {
|
||||
// Replace element type arguments with a user-friendly select.
|
||||
if (empty($elementstrings)) {
|
||||
$behatgenerators = new behat_data_generators();
|
||||
$componententities = $behatgenerators->get_all_entities();
|
||||
ksort($componententities);
|
||||
$elementstrings = [];
|
||||
foreach ($componententities as $component => $entities) {
|
||||
asort($entities);
|
||||
foreach ($entities as $entity) {
|
||||
$string = ($component === 'core') ? $entity : $component . ' > ' . $entity;
|
||||
$elementstrings[$string] = $string;
|
||||
}
|
||||
}
|
||||
}
|
||||
$select = html_writer::select($elementstrings, 'entities' . $count, '', ['' => 'choosedots'],
|
||||
['class' => 'entities']);
|
||||
$count++;
|
||||
return $matches[1] . $select . $matches[2];
|
||||
},
|
||||
$stepsdefinitions
|
||||
);
|
||||
}
|
||||
|
||||
// Steps definitions.
|
||||
|
||||
@@ -29,3 +29,9 @@
|
||||
#page-admin-tool-behat-index .steps-definitions .stepregex {
|
||||
color: #060;
|
||||
}
|
||||
|
||||
#page-admin-tool-behat-index .steprequiredfields {
|
||||
font-weight: bold;
|
||||
font-size: 1em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
{{!
|
||||
This file is part of Moodle - https://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template tool_behat/steprequiredfields
|
||||
|
||||
Display a Gherkin-style table row showing required columns for a step.
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
"fields": [
|
||||
"user",
|
||||
"role",
|
||||
"context"
|
||||
]
|
||||
}
|
||||
}}
|
||||
<pre class="steprequiredfields">
|
||||
|{{#fields}} {{{.}}} |{{/fields}}
|
||||
</pre>
|
||||
@@ -30,10 +30,9 @@ Feature: Verify that all form fields values can be get and set
|
||||
| student2 | G2 |
|
||||
| student3 | G2 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro | firstpagetitle | wikimode | visible |
|
||||
| wiki | C1 | wiki1 | Test this one | Test this one | Test this one | collaborative | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
| activity | course | idnumber | name | firstpagetitle | wikimode | visible |
|
||||
| wiki | C1 | wiki1 | Test this one | Test this one | collaborative | 0 |
|
||||
And I am on the "Course 1" course page logged in as admin
|
||||
And I navigate to "Reset" in current page administration
|
||||
# Select (multi-select) - Checking "the select box should contain".
|
||||
And I expand all fieldsets
|
||||
@@ -61,16 +60,14 @@ Feature: Verify that all form fields values can be get and set
|
||||
# Checkbox - Checking "I set the field" and "The field matches value" ticked.
|
||||
And I set the field "Force format" to "1"
|
||||
And I press "Save and return to course"
|
||||
And I am on the "Test this one" "wiki activity" page
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I am on the "Test this one" "wiki activity editing" page
|
||||
And I expand all fieldsets
|
||||
And the field "Force format" matches value "1"
|
||||
And the field "Force format" does not match value ""
|
||||
# Checkbox - Checking "I set the field" and "The field matches value" unticked.
|
||||
And I set the field "Force format" to ""
|
||||
And I press "Save and return to course"
|
||||
And I am on the "Test this one" "wiki activity" page
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I am on the "Test this one" "wiki activity editing" page
|
||||
And I expand all fieldsets
|
||||
And the field "Force format" matches value ""
|
||||
And the field "Force format" does not match value "1"
|
||||
@@ -78,8 +75,7 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I set the following fields to these values:
|
||||
| Force format | 1 |
|
||||
And I press "Save and return to course"
|
||||
And I am on the "Test this one" "wiki activity" page
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I am on the "Test this one" "wiki activity editing" page
|
||||
And I expand all fieldsets
|
||||
And the following fields match these values:
|
||||
| Force format | 1 |
|
||||
@@ -89,8 +85,7 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I set the following fields to these values:
|
||||
| Force format | |
|
||||
And I press "Save and return to course"
|
||||
And I am on the "Test this one" "wiki activity" page
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I am on the "Test this one" "wiki activity editing" page
|
||||
And I expand all fieldsets
|
||||
And the following fields match these values:
|
||||
| Force format | |
|
||||
@@ -136,12 +131,13 @@ Feature: Verify that all form fields values can be get and set
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And the field "Course ID number" matches value "Course id number"
|
||||
|
||||
Scenario: with JS disabled all form fields getters and setters works as expected
|
||||
|
||||
@javascript
|
||||
Scenario: with JS enabled all form fields getters and setters works as expected
|
||||
Then I am on "Course 1" course homepage
|
||||
And I navigate to "Users > Groups" in current page administration
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| lesson | C1 | Test lesson |
|
||||
When I am on "Course 1" course homepage
|
||||
Then I navigate to "Users > Groups" in current page administration
|
||||
# Select (multi-select & AJAX) - Checking "I set the field" and "select box should contain".
|
||||
And I set the field "groups" to "Group 2"
|
||||
And the "members" select box should contain "Student 2 (s2@example.com)"
|
||||
@@ -152,11 +148,8 @@ Feature: Verify that all form fields values can be get and set
|
||||
And the "members" select box should contain "Student 2 (s2@example.com)"
|
||||
And the "members" select box should not contain "Student 3 (s3@example.com)"
|
||||
# Checkbox (AJAX) - Checking "I set the field" and "I set the following fields to these values".
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "Lesson" to section "1"
|
||||
And I am on the "Test lesson" "lesson activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Name | Test lesson |
|
||||
| Description | Test lesson description |
|
||||
| available[enabled] | 1 |
|
||||
And I set the field "deadline[enabled]" to "1"
|
||||
# Checkbox (AJAX) - Checking "the field matches value" before saving.
|
||||
|
||||
@@ -7,8 +7,8 @@ Feature: Behat steps for interacting with form work
|
||||
@javascript
|
||||
Scenario: Test fields in containers
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
| fullname | shortname | summary | summaryformat |
|
||||
| Course 1 | C1 | Red | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on "Course 1" course homepage
|
||||
# Just get to any form.
|
||||
@@ -17,11 +17,15 @@ Feature: Behat steps for interacting with form work
|
||||
And I set the following fields in the "Appearance" "fieldset" to these values:
|
||||
| Show activity reports | Yes |
|
||||
| Number of announcements | 1 |
|
||||
And I set the following fields in the "Description" "fieldset" to these values:
|
||||
| Course summary | Green |
|
||||
Then the field "Show activity reports" in the "Appearance" "fieldset" matches value "Yes"
|
||||
And the field "Show activity reports" in the "Appearance" "fieldset" does not match value "No"
|
||||
And the following fields in the "region-main" "region" match these values:
|
||||
| Course full name | Frog |
|
||||
| Number of announcements | 1 |
|
||||
| Course summary | Green |
|
||||
And the following fields in the "region-main" "region" do not match these values:
|
||||
| Course full name | Course 1 |
|
||||
| Number of announcements | 5 |
|
||||
| Course summary | Red |
|
||||
|
||||
@@ -13,6 +13,10 @@ Feature: List the system steps definitions
|
||||
Scenario: Accessing the list
|
||||
Then I should see "Step definitions"
|
||||
And I should not see "There aren't steps definitions matching this filter"
|
||||
And I should not see "the following \"ELEMENT_STRING\" exist:"
|
||||
And "entities1" "select" should exist
|
||||
And the "entities1" select box should contain "users"
|
||||
And the "entities1" select box should contain "mod_assign > submissions"
|
||||
|
||||
@javascript
|
||||
Scenario: Filtering by type
|
||||
@@ -34,3 +38,11 @@ Feature: List the system steps definitions
|
||||
Then I should not see "There aren't steps definitions matching this filter"
|
||||
And I should see "Checks the provided element and selector type exists in the current page."
|
||||
And I should see "Checks that an element and selector type exists in another element and selector type on the current page."
|
||||
|
||||
@javascript
|
||||
Scenario: Get required fields
|
||||
Given I set the field "entities1" to "users"
|
||||
And I should see "| username |"
|
||||
When I set the field "entities1" to "mod_quiz > user overrides"
|
||||
Then I should not see "| username |"
|
||||
And I should see "| quiz | user |"
|
||||
|
||||
@@ -20,9 +20,10 @@ Feature: Forms manipulation
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Quiz" to section "1"
|
||||
And the following "activities" exist:
|
||||
| activity | course | section | name |
|
||||
| quiz | C1 | 1 | Quiz 1 |
|
||||
And I am on the "Quiz 1" "quiz activity editing" page logged in as admin
|
||||
When I expand all fieldsets
|
||||
Then I should see "Close the quiz"
|
||||
And I should see "Group mode"
|
||||
|
||||
@@ -0,0 +1,104 @@
|
||||
<?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/>.
|
||||
|
||||
/**
|
||||
* Unit tests for get_entity_generator web service
|
||||
*
|
||||
* @package tool_behat
|
||||
* @copyright 2022 onwards Catalyst IT EU {@link https://catalyst-eu.net}
|
||||
* @author Mark Johnson <mark.johnson@catalyst-eu.net>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace tool_behat\external;
|
||||
|
||||
/**
|
||||
* Tests for get_entity_generator web service
|
||||
*
|
||||
* @covers \tool_behat\external\get_entity_generator
|
||||
*/
|
||||
class get_entity_generator_test extends \advanced_testcase {
|
||||
|
||||
/**
|
||||
* Log in as admin
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setUp(): void {
|
||||
$this->resetAfterTest();
|
||||
$this->setAdminUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the generator for a core entity.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_execute_core_entity(): void {
|
||||
$generator = get_entity_generator::execute('users');
|
||||
$this->assertEquals(['required' => ['username']], $generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the generator for the plugin entity.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_execute_plugin_entity(): void {
|
||||
$generator = get_entity_generator::execute('mod_book > chapters');
|
||||
$this->assertEquals(['required' => ['book', 'title', 'content']], $generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the generator for an entity with no required fields.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_execute_no_requried(): void {
|
||||
$generator = get_entity_generator::execute('mod_forum > posts');
|
||||
$this->assertEquals(['required' => []], $generator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to get the generator for a core entity that does not exist.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_execute_invalid_entity(): void {
|
||||
$this->expectException('coding_exception');
|
||||
get_entity_generator::execute('foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to get a generator form a plugin that does not exist.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_execute_invalid_plugin(): void {
|
||||
$this->expectException('coding_exception');
|
||||
get_entity_generator::execute('foo > bar');
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to get a generator for an entity that does not exist, from a plugin that does.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_execute_invalid_plugin_entity(): void {
|
||||
$this->expectException('coding_exception');
|
||||
get_entity_generator::execute('mod_book > bar');
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->version = 2020061501; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2020060900; // Requires this Moodle version
|
||||
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-tool_capability-search",function(i,t){var e=function(){e.superclass.constructor.apply(this,arguments)};e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=i.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=i.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),e=i.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=i.Node.create('<input type="text" id="capabilitysearch" />'),t.append(e).append(this.input),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,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"),i=0,s=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(i++,s=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===i?this.input.addClass("error"):(this.input.removeClass("error"),1===i&&s.set("selected",!0)),this.validate()}},i.extend(e,i.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(i,t){var e=function(){e.superclass.constructor.apply(this,arguments)};i.extend(e,i.Base,e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=i.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=i.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),e=i.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=i.Node.create('<input type="text" id="capabilitysearch" />'),t.append(e).append(this.input),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,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"),i=0,s=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(i++,s=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===i?this.input.addClass("error"):(this.input.removeClass("error"),1===i&&s.set("selected",!0)),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"]});
|
||||
@@ -36,7 +36,7 @@ class tool_customlang_utils {
|
||||
* Rough number of strings that are being processed during a full checkout.
|
||||
* This is used to estimate the progress of the checkout.
|
||||
*/
|
||||
const ROUGH_NUMBER_OF_STRINGS = 16500;
|
||||
const ROUGH_NUMBER_OF_STRINGS = 30000;
|
||||
|
||||
/** @var array cache of {@link self::list_components()} results */
|
||||
private static $components = null;
|
||||
@@ -91,9 +91,22 @@ class tool_customlang_utils {
|
||||
public static function checkout($lang, progress_bar $progressbar = null) {
|
||||
global $DB;
|
||||
|
||||
// For behat executions we are going to load only a few components in the
|
||||
// language customisation structures. Using the whole "en" langpack is
|
||||
// too much slow (leads to Selenium 30s timeouts, especially on slow
|
||||
// environments) and we don't really need the whole thing for tests. So,
|
||||
// apart from escaping from the timeouts, we are also saving some good minutes
|
||||
// in tests. See MDL-70014 and linked issues for more info.
|
||||
$behatneeded = ['core', 'core_langconfig', 'tool_customlang'];
|
||||
|
||||
// make sure that all components are registered
|
||||
$current = $DB->get_records('tool_customlang_components', null, 'name', 'name,version,id');
|
||||
foreach (self::list_components() as $component) {
|
||||
// Filter out unwanted components when running behat.
|
||||
if (defined('BEHAT_SITE_RUNNING') && !in_array($component, $behatneeded)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (empty($current[$component])) {
|
||||
$record = new stdclass();
|
||||
$record->name = $component;
|
||||
@@ -103,7 +116,7 @@ class tool_customlang_utils {
|
||||
$record->version = $version;
|
||||
}
|
||||
$DB->insert_record('tool_customlang_components', $record);
|
||||
} elseif ($version = get_component_version($component)) {
|
||||
} else if ($version = get_component_version($component)) {
|
||||
if (is_null($current[$component]->version) or ($version > $current[$component]->version)) {
|
||||
$DB->set_field('tool_customlang_components', 'version', $version, array('id' => $current[$component]->id));
|
||||
}
|
||||
|
||||
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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
+11
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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
+11
-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,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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":"AAuBAA,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 * @package tool_dataprivacy\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 * @package tool_dataprivacy\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":";;;;;;;;AAuBAA,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"}
|
||||
+12
-2
@@ -1,2 +1,12 @@
|
||||
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
|
||||
* @class events
|
||||
* @package tool_dataprivacy
|
||||
* @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":"AAwBAA,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 * @class events\n * @package tool_dataprivacy\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 * @class events\n * @package tool_dataprivacy\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":";;;;;;;;;AAwBAA,iCAAO,IAAI,iBACA,CACHC,QAAS,wCACTC,YAAa,6CACbC,KAAM,qCACNC,SAAU,0CACVC,SAAU"}
|
||||
+12
-2
@@ -1,2 +1,12 @@
|
||||
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
|
||||
* @class page-expand-contract
|
||||
* @package tool_dataprivacy
|
||||
* @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
+12
-2
@@ -1,2 +1,12 @@
|
||||
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
|
||||
* @class form-user-selector
|
||||
* @package tool_dataprivacy
|
||||
* @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":"AAyBAA,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 * @class form-user-selector\n * @package tool_dataprivacy\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 * @class form-user-selector\n * @package tool_dataprivacy\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":";;;;;;;;;AAyBAA,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"}
|
||||
+11
-2
@@ -1,2 +1,11 @@
|
||||
define ("tool_dataprivacy/myrequestactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events","core/templates","core/pending"],function(a,b,c,d,e,f,g,h){var j={CANCEL_REQUEST:"[data-action=\"cancel\"]",CONTACT_DPO:"[data-action=\"contactdpo\"]"},k=function(){this.registerEvents()};k.prototype.registerEvents=function(){a(j.CANCEL_REQUEST).click(function(g){g.preventDefault();var h=a(this).data("requestid");d.get_strings([{key:"cancelrequest",component:"tool_dataprivacy"},{key:"cancelrequestconfirmation",component:"tool_dataprivacy"}]).then(function(a){var d=a[0],g=a[1];return e.create({title:d,body:g,type:e.types.SAVE_CANCEL}).then(function(a){a.setSaveButtonText(d);a.getRoot().on(f.save,function(){b.call([{methodname:"tool_dataprivacy_cancel_data_request",args:{requestid:h}}])[0].done(function(a){if(a.result){window.location.reload()}else{c.addNotification({message:a.warnings[0].message,type:"error"})}}).fail(c.exception)});a.getRoot().on(f.hidden,function(){a.destroy()});return a})}).done(function(a){a.show()}).fail(c.exception)});a(j.CONTACT_DPO).click(function(b){var j=new h("dataprivacy/crud:initModal:contactdpo");b.preventDefault();var k=a(this).data("replytoemail"),l="";d.get_strings([{key:"contactdataprotectionofficer",component:"tool_dataprivacy"},{key:"send",component:"tool_dataprivacy"}]).then(function(a){var b=a[0];l=a[1];return e.create({title:b,body:g.render("tool_dataprivacy/contact_dpo",{replytoemail:k}),type:e.types.SAVE_CANCEL,large:!0})}).then(function(b){b.setSaveButtonText(l);b.show();b.getRoot().on(f.save,function(b){var c=a("#message").val().trim();if(0===c.length){b.preventDefault();a("[data-region=\"messageinput\"]").addClass("has-danger notifyproblem");a("#id_error_message").removeAttr("hidden")}else{i(c)}});b.getRoot().on(f.hidden,function(){b.destroy()})}).then(j.resolve).catch(c.exception)})};function i(a){var e="success";b.call([{methodname:"tool_dataprivacy_contact_dpo",args:{message:a}}])[0].then(function(a){if(a.result){return d.get_string("requestsubmitted","tool_dataprivacy")}e="error";return a.warnings.join("<br>")}).done(function(a){c.addNotification({message:a,type:e})}).fail(c.exception)}return{init:function init(){return new k}}});
|
||||
//# sourceMappingURL=myrequestactions.min.js.map
|
||||
/**
|
||||
* AMD module to enable users to manage their own data requests.
|
||||
*
|
||||
* @module tool_dataprivacy/myrequestactions
|
||||
* @package tool_dataprivacy
|
||||
* @copyright 2018 Jun Pataleta
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
define("tool_dataprivacy/myrequestactions",["jquery","core/ajax","core/notification","core/str","core/modal_factory","core/modal_events","core/templates","core/pending"],(function($,Ajax,Notification,Str,ModalFactory,ModalEvents,Templates,Pending){var ACTIONS_CANCEL_REQUEST='[data-action="cancel"]',ACTIONS_CONTACT_DPO='[data-action="contactdpo"]',MyRequestActions=function(){this.registerEvents()};return MyRequestActions.prototype.registerEvents=function(){$(ACTIONS_CANCEL_REQUEST).click((function(e){e.preventDefault();var requestId=$(this).data("requestid");Str.get_strings([{key:"cancelrequest",component:"tool_dataprivacy"},{key:"cancelrequestconfirmation",component:"tool_dataprivacy"}]).then((function(langStrings){var title=langStrings[0],confirmMessage=langStrings[1];return ModalFactory.create({title:title,body:confirmMessage,type:ModalFactory.types.SAVE_CANCEL}).then((function(modal){return modal.setSaveButtonText(title),modal.getRoot().on(ModalEvents.save,(function(){var request={methodname:"tool_dataprivacy_cancel_data_request",args:{requestid:requestId}};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_CONTACT_DPO).click((function(e){var pendingPromise=new Pending("dataprivacy/crud:initModal:contactdpo");e.preventDefault();var replyToEmail=$(this).data("replytoemail"),sendButtonText="";Str.get_strings([{key:"contactdataprotectionofficer",component:"tool_dataprivacy"},{key:"send",component:"tool_dataprivacy"}]).then((function(langStrings){var modalTitle=langStrings[0];sendButtonText=langStrings[1];var context={replytoemail:replyToEmail};return ModalFactory.create({title:modalTitle,body:Templates.render("tool_dataprivacy/contact_dpo",context),type:ModalFactory.types.SAVE_CANCEL,large:!0})})).then((function(modal){modal.setSaveButtonText(sendButtonText),modal.show(),modal.getRoot().on(ModalEvents.save,(function(e){var message=$("#message").val().trim();0===message.length?(e.preventDefault(),$('[data-region="messageinput"]').addClass("has-danger notifyproblem"),$("#id_error_message").removeAttr("hidden")):function(message){var request={methodname:"tool_dataprivacy_contact_dpo",args:{message:message}},requestType="success";Ajax.call([request])[0].then((function(data){return data.result?Str.get_string("requestsubmitted","tool_dataprivacy"):(requestType="error",data.warnings.join("<br>"))})).done((function(message){Notification.addNotification({message:message,type:requestType})})).fail(Notification.exception)}(message)})),modal.getRoot().on(ModalEvents.hidden,(function(){modal.destroy()}))})).then(pendingPromise.resolve).catch(Notification.exception)}))},{init:function(){return new MyRequestActions}}}));
|
||||
|
||||
//# sourceMappingURL=myrequestactions.min.js.map
|
||||
File diff suppressed because one or more lines are too long
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_dataprivacy
|
||||
* @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":"AAuBAA,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 * @package tool_dataprivacy\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 * @package tool_dataprivacy\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":";;;;;;;;AAuBAA,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"}
|
||||
+11
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -79,6 +79,19 @@ class locale {
|
||||
* @return string|false Returns the new current locale, or FALSE on error.
|
||||
*/
|
||||
protected function set_locale(int $category = LC_ALL, string $locale = '0') {
|
||||
return setlocale($category, $locale);
|
||||
if (strlen($locale) <= 255 || PHP_OS_FAMILY === 'BSD' || PHP_OS_FAMILY === 'Darwin') {
|
||||
// We can set the whole locale all together.
|
||||
return setlocale($category, $locale);
|
||||
}
|
||||
|
||||
// Too long locale with linux or windows, let's split it into known and supported categories.
|
||||
$split = explode(';', $locale);
|
||||
foreach ($split as $element) {
|
||||
[$category, $value] = explode('=', $element);
|
||||
if (defined($category)) { // Only if the category exists, there are OS differences.
|
||||
setlocale(constant($category), $value);
|
||||
}
|
||||
}
|
||||
return setlocale(LC_ALL, 0); // Finally, return the complete configured locale.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
/**
|
||||
* Tests for \tool_langimport\locale class.
|
||||
*
|
||||
* @coversDefaultClass \tool_langimport\locale
|
||||
* @copyright 2018 Université Rennes 2 {@link https://www.univ-rennes2.fr}
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
@@ -34,6 +35,7 @@ class locale_testcase extends \advanced_testcase {
|
||||
/**
|
||||
* Test that \tool_langimport\locale::check_locale_availability() works as expected.
|
||||
*
|
||||
* @covers ::check_locale_availability
|
||||
* @return void
|
||||
*/
|
||||
public function test_check_locale_availability() {
|
||||
@@ -68,4 +70,100 @@ class locale_testcase extends \advanced_testcase {
|
||||
$this->expectException(coding_exception::class);
|
||||
$locale->check_locale_availability('');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test \tool_langimport\locale::set_locale() own logic.
|
||||
*
|
||||
* We have to explicitly test set_locale() own logic and results,
|
||||
* that effectively sets the current locale, so we need to restore
|
||||
* the original locale after every test (ugly, from a purist unit test
|
||||
* point of view, but needed).
|
||||
*
|
||||
* @dataProvider set_locale_provider
|
||||
* @covers ::set_locale
|
||||
*
|
||||
* @param string $set locale string to be set.
|
||||
* @param string $ret expected results returned after setting the locale.
|
||||
*/
|
||||
public function test_set_locale(string $set, string $ret) {
|
||||
// Make set_locale() public.
|
||||
$loc = new \tool_langimport\locale();
|
||||
$rc = new \ReflectionClass(\tool_langimport\locale::class);
|
||||
$rm = $rc->getMethod('set_locale');
|
||||
$rm->setAccessible(true);
|
||||
|
||||
// Capture current locale for later restore (funnily, using the set_locale() method itself.
|
||||
$originallocale = $rm->invokeArgs($loc, [LC_ALL, 0]);
|
||||
|
||||
// Assert we get the locale defined as expected.
|
||||
$this->assertEquals($ret, $rm->invokeArgs($loc, [LC_ALL, $set]));
|
||||
|
||||
// We have finished, restore the original locale, so this doesn't affect other tests at distance.
|
||||
// (again, funnily, using the very same set_locale() method).
|
||||
$rm->invokeArgs($loc, [LC_ALL, $originallocale]);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Data provider for test_set_locale().
|
||||
*
|
||||
* Provides a locale to be set (as 'set') and a expected return value (as 'ret'). Note that
|
||||
* some of the locales are OS dependent, so only the ones matching the OS will be provided.
|
||||
*
|
||||
* We make extensive use of the en_AU.UTF-8/English_Australia.1252 locale that is mandatory to
|
||||
* be installed in any system running PHPUnit tests.
|
||||
*/
|
||||
public function set_locale_provider(): array {
|
||||
// Let's list the allowed categories by OS.
|
||||
$bsdallowed = ['LC_COLLATE', 'LC_CTYPE', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME'];
|
||||
$winallowed = ['LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME'];
|
||||
$linuxallowed = [
|
||||
'LC_COLLATE', 'LC_CTYPE', 'LC_MESSAGES', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME',
|
||||
'LC_PAPER', 'LC_NAME', 'LC_ADDRESS', 'LC_TELEPHONE', 'LC_MEASUREMENT', 'LC_IDENTIFICATION'
|
||||
];
|
||||
|
||||
// The base locale name is also OS dependent.
|
||||
$baselocale = get_string('locale', 'langconfig');
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
$baselocale = get_string('localewin', 'langconfig');
|
||||
}
|
||||
|
||||
// Here we'll go accumulating cases to be provided.
|
||||
$cases = [];
|
||||
|
||||
// First, the simplest case, just pass a locale name, without categories.
|
||||
$cases['rawlocale'] = [
|
||||
'set' => $baselocale,
|
||||
'ret' => $baselocale,
|
||||
];
|
||||
|
||||
// Now, let's fill ALL LC categories, we should get back the locale name if all them are set with same value.
|
||||
// Note that this case is the one that, under Linux only, covers the changes performed to the set_locale() method.
|
||||
// Pick the correct categories depending on the OS.
|
||||
$oscategories = $bsdallowed; // Default to BSD/Dawrwin ones because they are the standard 6 supported by PHP.
|
||||
if (PHP_OS_FAMILY === 'Windows') {
|
||||
$oscategories = $winallowed;
|
||||
} else if (PHP_OS_FAMILY === 'Linux') {
|
||||
$oscategories = $linuxallowed;
|
||||
}
|
||||
|
||||
$localestr = '';
|
||||
foreach ($oscategories as $category) {
|
||||
// Format is different by OS too, so let build the string conditionally.
|
||||
if (PHP_OS_FAMILY === 'BSD' || PHP_OS_FAMILY === 'Darwin') {
|
||||
// BSD uses slashes (/) separated list of the 6 values in exact order.
|
||||
$localestr .= '/' . $baselocale;
|
||||
} else {
|
||||
// Linux/Windows use semicolon (;) separated list of category=value pairs.
|
||||
$localestr .= ';' . $category . '=' . $baselocale;
|
||||
}
|
||||
}
|
||||
$cases['allcategories'] = [
|
||||
'set' => trim($localestr, ';/'),
|
||||
'ret' => $baselocale,
|
||||
];
|
||||
|
||||
// Return all the built cases.
|
||||
return $cases;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-2
@@ -1,2 +1,12 @@
|
||||
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
|
||||
* @class delete_license
|
||||
* @package tool_licensemanager
|
||||
* @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":"AAwBAA,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 * @class delete_license\n * @package tool_licensemanager\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 * @class delete_license\n * @package tool_licensemanager\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":";;;;;;;;;AAwBAA,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"}
|
||||
@@ -33,3 +33,27 @@ Feature: Licence manager
|
||||
And "This is the site default licence" "icon" should exist in the "cc" "table_row"
|
||||
And "Enable licence" "icon" should not exist in the "cc" "table_row"
|
||||
And "This is the site default licence" "icon" should not exist in the "public" "table_row"
|
||||
|
||||
@javascript @_file_upload
|
||||
Scenario Outline: User licence preference is remembered depending of setting value
|
||||
Given the following config values are set as admin:
|
||||
| sitedefaultlicense | cc |
|
||||
| rememberuserlicensepref | <rememberuserlicensepref> |
|
||||
And I log in as "admin"
|
||||
And I follow "Manage private files..."
|
||||
And I follow "Add..."
|
||||
And I follow "Upload a file"
|
||||
And the field with xpath "//select[@name='license']" matches value "Creative Commons"
|
||||
And I click on "Close" "button" in the "File picker" "dialogue"
|
||||
When I upload "lib/tests/fixtures/empty.txt" file to "Files" filemanager as:
|
||||
| Save as | empty_copy.txt |
|
||||
| license | Public domain |
|
||||
And I press "Save changes"
|
||||
And I follow "Manage private files..."
|
||||
And I follow "Add..."
|
||||
Then the field with xpath "//select[@name='license']" matches value "<expectedlicence>"
|
||||
|
||||
Examples:
|
||||
| rememberuserlicensepref | expectedlicence |
|
||||
| 0 | Creative Commons |
|
||||
| 1 | Public domain |
|
||||
|
||||
@@ -32,8 +32,7 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
* Tests log writing.
|
||||
*
|
||||
* @param bool $jsonformat True to test with JSON format
|
||||
* @dataProvider test_log_writing_provider
|
||||
* @throws moodle_exception
|
||||
* @dataProvider log_writing_provider
|
||||
*/
|
||||
public function test_log_writing(bool $jsonformat) {
|
||||
global $DB, $CFG;
|
||||
@@ -251,9 +250,9 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
* Returns different JSON format settings so the test can be run with JSON format either on or
|
||||
* off.
|
||||
*
|
||||
* @return [bool] Array of true/false
|
||||
* @return bool[] Array of true/false
|
||||
*/
|
||||
public static function test_log_writing_provider(): array {
|
||||
public static function log_writing_provider(): array {
|
||||
return [
|
||||
[false],
|
||||
[true]
|
||||
@@ -310,17 +309,16 @@ class logstore_database_store_testcase extends advanced_testcase {
|
||||
$logmanager = get_log_manager();
|
||||
$allreports = \core_component::get_plugin_list('report');
|
||||
|
||||
$supportedreports = array(
|
||||
'report_log' => '/report/log',
|
||||
'report_loglive' => '/report/loglive'
|
||||
);
|
||||
|
||||
// Make sure all supported reports are installed.
|
||||
$expectedreports = array_keys(array_intersect_key($allreports, $supportedreports));
|
||||
$reports = $logmanager->get_supported_reports('logstore_database');
|
||||
$reports = array_keys($reports);
|
||||
$expectedreports = array_intersect_key([
|
||||
'log' => 'report_log',
|
||||
'loglive' => 'report_loglive',
|
||||
], $allreports);
|
||||
|
||||
$supportedreports = $logmanager->get_supported_reports('logstore_database');
|
||||
|
||||
foreach ($expectedreports as $expectedreport) {
|
||||
$this->assertContains($expectedreport, $reports);
|
||||
$this->assertArrayHasKey($expectedreport, $supportedreports);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,20 +257,19 @@ class logstore_legacy_store_testcase extends advanced_testcase {
|
||||
$logmanager = get_log_manager();
|
||||
$allreports = \core_component::get_plugin_list('report');
|
||||
|
||||
$supportedreports = array(
|
||||
'report_log' => '/report/log',
|
||||
'report_loglive' => '/report/loglive',
|
||||
'report_outline' => '/report/outline',
|
||||
'report_participation' => '/report/participation',
|
||||
'report_stats' => '/report/stats'
|
||||
);
|
||||
|
||||
// Make sure all supported reports are installed.
|
||||
$expectedreports = array_keys(array_intersect_key($allreports, $supportedreports));
|
||||
$reports = $logmanager->get_supported_reports('logstore_legacy');
|
||||
$reports = array_keys($reports);
|
||||
$expectedreports = array_intersect_key([
|
||||
'log' => 'report_log',
|
||||
'loglive' => 'report_loglive',
|
||||
'outline' => 'report_outline',
|
||||
'participation' => 'report_participation',
|
||||
'stats' => 'report_stats'
|
||||
], $allreports);
|
||||
|
||||
$supportedreports = $logmanager->get_supported_reports('logstore_legacy');
|
||||
|
||||
foreach ($expectedreports as $expectedreport) {
|
||||
$this->assertContains($expectedreport, $reports);
|
||||
$this->assertArrayHasKey($expectedreport, $supportedreports);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -37,8 +37,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
* Tests log writing.
|
||||
*
|
||||
* @param bool $jsonformat True to test with JSON format
|
||||
* @dataProvider test_log_writing_provider
|
||||
* @throws moodle_exception
|
||||
* @dataProvider log_writing_provider
|
||||
*/
|
||||
public function test_log_writing(bool $jsonformat) {
|
||||
global $DB;
|
||||
@@ -222,9 +221,9 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
* Returns different JSON format settings so the test can be run with JSON format either on or
|
||||
* off.
|
||||
*
|
||||
* @return [bool] Array of true/false
|
||||
* @return bool[] Array of true/false
|
||||
*/
|
||||
public static function test_log_writing_provider(): array {
|
||||
public static function log_writing_provider(): array {
|
||||
return [
|
||||
[false],
|
||||
[true]
|
||||
@@ -238,20 +237,19 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
$logmanager = get_log_manager();
|
||||
$allreports = \core_component::get_plugin_list('report');
|
||||
|
||||
$supportedreports = array(
|
||||
'report_log' => '/report/log',
|
||||
'report_loglive' => '/report/loglive',
|
||||
'report_outline' => '/report/outline',
|
||||
'report_participation' => '/report/participation',
|
||||
'report_stats' => '/report/stats'
|
||||
);
|
||||
|
||||
// Make sure all supported reports are installed.
|
||||
$expectedreports = array_keys(array_intersect_key($allreports, $supportedreports));
|
||||
$reports = $logmanager->get_supported_reports('logstore_standard');
|
||||
$reports = array_keys($reports);
|
||||
$expectedreports = array_intersect_key([
|
||||
'log' => 'report_log',
|
||||
'loglive' => 'report_loglive',
|
||||
'outline' => 'report_outline',
|
||||
'participation' => 'report_participation',
|
||||
'stats' => 'report_stats'
|
||||
], $allreports);
|
||||
|
||||
$supportedreports = $logmanager->get_supported_reports('logstore_standard');
|
||||
|
||||
foreach ($expectedreports as $expectedreport) {
|
||||
$this->assertContains($expectedreport, $reports);
|
||||
$this->assertArrayHasKey($expectedreport, $supportedreports);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,7 +365,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
* Tests the decode_other function can cope with both JSON and PHP serialized format.
|
||||
*
|
||||
* @param mixed $value Value to encode and decode
|
||||
* @dataProvider test_decode_other_provider
|
||||
* @dataProvider decode_other_provider
|
||||
*/
|
||||
public function test_decode_other($value) {
|
||||
$this->assertEquals($value, \logstore_standard\log\store::decode_other(serialize($value)));
|
||||
@@ -386,7 +384,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
*
|
||||
* @return array Array of parameters
|
||||
*/
|
||||
public function test_decode_other_provider(): array {
|
||||
public function decode_other_provider(): array {
|
||||
return [
|
||||
[['info' => 'd2819896', 'logurl' => 'discuss.php?d=2819896']],
|
||||
[null],
|
||||
@@ -399,8 +397,7 @@ class logstore_standard_store_testcase extends advanced_testcase {
|
||||
* Checks that backup and restore of log data works correctly.
|
||||
*
|
||||
* @param bool $jsonformat True to test with JSON format
|
||||
* @dataProvider test_log_writing_provider
|
||||
* @throws moodle_exception
|
||||
* @dataProvider log_writing_provider
|
||||
*/
|
||||
public function test_backup_restore(bool $jsonformat) {
|
||||
global $DB;
|
||||
|
||||
+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}].
|
||||
*
|
||||
* @package tool_lp
|
||||
* @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
+11
-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.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @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,MAAwD,CAEpDC,IAAI,EAFgD,CAGpDC,QAAQ,EAH4C,CAIpDC,QAAQ,EAJ4C,CAKpDC,SAAS,EAL2C,CAapDC,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,CA5BmD,CAqCpDG,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/CmD,CAkD3D,CA3DK,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 * @package tool_lp\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 /** @alias module:tool_lp/competency_outcomes */ {\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});\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 * @package tool_lp\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 /** @alias module:tool_lp/competency_outcomes */ {\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});\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,WAOwC,CAEpDC,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.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @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,CAW3B,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,MAA+DV,CAAAA,CAElE,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 * @package tool_lp\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 * @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 /** @type {Number} The id of the competency. */\n CompetencyPlanNavigation.prototype._competencyId = null;\n /** @type {Number} The id of the user. */\n CompetencyPlanNavigation.prototype._userId = null;\n /** @type {Number} The id of the plan. */\n CompetencyPlanNavigation.prototype._planId = null;\n /** @type {String} Plugin base url. */\n CompetencyPlanNavigation.prototype._baseUrl = null;\n /** @type {Boolean} Ignore the first change event for competencies. */\n CompetencyPlanNavigation.prototype._ignoreFirstCompetency = null;\n\n return /** @alias module:tool_lp/competency_plan_navigation */ CompetencyPlanNavigation;\n\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 * @package tool_lp\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 * @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 /** @type {Number} The id of the competency. */\n CompetencyPlanNavigation.prototype._competencyId = null;\n /** @type {Number} The id of the user. */\n CompetencyPlanNavigation.prototype._userId = null;\n /** @type {Number} The id of the plan. */\n CompetencyPlanNavigation.prototype._planId = null;\n /** @type {String} Plugin base url. */\n CompetencyPlanNavigation.prototype._baseUrl = null;\n /** @type {Boolean} Ignore the first change event for competencies. */\n CompetencyPlanNavigation.prototype._ignoreFirstCompetency = null;\n\n return /** @alias module:tool_lp/competency_plan_navigation */ CompetencyPlanNavigation;\n\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,OAWpBC,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,KAEGV"}
|
||||
+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.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @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.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @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,CAK/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,MAAwDP,CAAAA,CAE3D,CApCK,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 * @package tool_lp\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 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 /** @alias module:tool_lp/competency_rule_all */ Rule;\n\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 * @package tool_lp\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 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 /** @alias module:tool_lp/competency_rule_all */ Rule;\n\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,cAKjBC,KAAO,WACPD,SAASE,MAAMC,KAAMC,mBAEzBH,KAAKI,UAAYC,OAAOC,OAAOP,SAASK,YAQzBG,QAAU,iBACd,wCASXP,KAAKI,UAAUI,QAAU,kBACd,GAG6CR"}
|
||||
+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.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @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
+11
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_lp
|
||||
* @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.
|
||||
*
|
||||
* @package tool_lp
|
||||
* @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
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_lp
|
||||
* @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
+11
-2
@@ -1,2 +1,11 @@
|
||||
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
|
||||
* @package tool_lp
|
||||
* @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
+12
-2
@@ -1,2 +1,12 @@
|
||||
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
|
||||
* @package tool_lp
|
||||
* @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
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user