Compare commits
365 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b156b18c72 | |||
| 88459bba94 | |||
| b201bcb878 | |||
| b504d19c12 | |||
| 1c13aba0a2 | |||
| 8a2c1509d7 | |||
| 033f742e4a | |||
| 9e665137d4 | |||
| 53b33f7b0e | |||
| 7d7c342a2c | |||
| ce77250706 | |||
| 770b11c3d9 | |||
| a18da528cc | |||
| d4cec28c30 | |||
| 48dc9e6582 | |||
| 8390f1a03d | |||
| 2713f2ea17 | |||
| e726198d4d | |||
| a11938293e | |||
| cfe33b82e3 | |||
| cd95c30cb5 | |||
| da05f15e3b | |||
| efdf0e48c8 | |||
| 00e6ac4ad8 | |||
| 4de338f002 | |||
| 4732fa0b13 | |||
| 93ab65454a | |||
| d8c911ccb4 | |||
| e8eb8943e1 | |||
| 737f657bad | |||
| 8ce08d5cd1 | |||
| e250a61e40 | |||
| bc9138ecba | |||
| fe7a12a9fd | |||
| 75de5704de | |||
| 1347048659 | |||
| 86ff18c9fe | |||
| 961c7ef3e0 | |||
| 7b4d19308e | |||
| c9143efd7e | |||
| 52b234d69a | |||
| 896e87228c | |||
| 772236e08c | |||
| 614563082b | |||
| 0975a83b7a | |||
| f8691f2e28 | |||
| d25c0c5448 | |||
| cf393e9aae | |||
| e3dd019685 | |||
| ceb153b1c7 | |||
| 1967ccccc0 | |||
| 58836d7143 | |||
| d04d701c18 | |||
| 1b4ee84aee | |||
| 33d829716e | |||
| 73a08e3ccd | |||
| 8c8cb002c0 | |||
| ea6adbc72e | |||
| 2ba3b8b27e | |||
| affda87228 | |||
| ebe27cf615 | |||
| 27f453d6e9 | |||
| b98fb9032c | |||
| e953e71c54 | |||
| 3295c4bc1d | |||
| 13553c25da | |||
| c9fc2bfeb4 | |||
| dcd7261175 | |||
| bca23d5477 | |||
| 28aaa93df9 | |||
| 533ce56743 | |||
| e677d31003 | |||
| 5f35d838d1 | |||
| 61d3f1345a | |||
| 9cb8b3fa50 | |||
| 8eb8fb844a | |||
| 792530cfe6 | |||
| 974cbce6e8 | |||
| 9c47f4e461 | |||
| cbadd18581 | |||
| 97c95140c3 | |||
| 0311f95fee | |||
| f852e35976 | |||
| 05c485dc97 | |||
| 36918dfbfc | |||
| d0bef0b899 | |||
| ad5e75ddf1 | |||
| ba6143d1ac | |||
| 0c7a684fcc | |||
| 587ea4d3f3 | |||
| f6583c57c8 | |||
| f25ad012c5 | |||
| 272fdb321a | |||
| 962a3f866c | |||
| 0a6f40cb21 | |||
| 85232e735d | |||
| 90c15c62f4 | |||
| dcd80cff04 | |||
| e0dc36f27e | |||
| 73cce7054c | |||
| a6b769bddd | |||
| 94080683ba | |||
| 10cdb9c72d | |||
| 57af739134 | |||
| 8cf9b77cdb | |||
| 07ef1c6aa5 | |||
| b3820bdc44 | |||
| a80a370e0a | |||
| 4fbc7a28ae | |||
| 0202597261 | |||
| c589ced794 | |||
| 4abfc497e2 | |||
| 03a7d208f9 | |||
| 0ece3bcfc1 | |||
| f904f52240 | |||
| 173da3666c | |||
| 9a55a771c1 | |||
| c057bc092d | |||
| 5cecf47fd1 | |||
| f4e0c7d6bf | |||
| 231577e4b0 | |||
| cf0b6e06e2 | |||
| 43d00eaeba | |||
| 23c2c5d08e | |||
| 7961e169b1 | |||
| e0c28bebcb | |||
| 51dc88fa84 | |||
| 236f4654c0 | |||
| 031e583402 | |||
| e8897600a1 | |||
| e9191587be | |||
| 73939586b6 | |||
| f29f757f5f | |||
| 5246118a3b | |||
| 2ace3d54dc | |||
| 24b8efe27a | |||
| d9c911598c | |||
| 7a582cf628 | |||
| 0f7151e2ba | |||
| 082a862366 | |||
| d06d29ef5d | |||
| c7877e7bb3 | |||
| 6509d6d944 | |||
| 3601d38c01 | |||
| fa52ecfdf2 | |||
| 83748b3b19 | |||
| 461c0bd947 | |||
| ff652d5c2c | |||
| d584ca7b7f | |||
| c537169f84 | |||
| b3246582c4 | |||
| c3c39d78c4 | |||
| 2811bedd48 | |||
| ba32d69255 | |||
| 17b4837fb6 | |||
| f09241fafe | |||
| a9fe9bbb0c | |||
| e5f747ffa4 | |||
| 28263edd35 | |||
| 25432feda8 | |||
| e8058e6981 | |||
| d19936b1c6 | |||
| 1751f4e658 | |||
| 419db61006 | |||
| 48a4ad4d4c | |||
| daccd01a0e | |||
| a34591cc0b | |||
| 5db1843de2 | |||
| 241a8eb343 | |||
| 55ba6b010a | |||
| b90771ef97 | |||
| 7cf23d5396 | |||
| 0d5b8d1337 | |||
| bcf0112c36 | |||
| d88a8851ac | |||
| 73fcdb1bf4 | |||
| 0830ca48f9 | |||
| ed6054fdf8 | |||
| 3faf81d578 | |||
| 756d9fa18d | |||
| d73ad3b532 | |||
| 9c97536a9f | |||
| 1f6fa90a02 | |||
| 2d8c924d71 | |||
| ddb1b56f36 | |||
| f30316be5d | |||
| 2f108b6430 | |||
| ebe8674636 | |||
| 88f66617a0 | |||
| ba07bb42e1 | |||
| 315e8dd327 | |||
| 14d4f0aed3 | |||
| 213223d162 | |||
| be118c06b3 | |||
| 415de4b23e | |||
| 2f305e5a10 | |||
| 7ffbc23426 | |||
| f6c05b8980 | |||
| 32ad202b06 | |||
| 1d92fd1ed3 | |||
| 09a97ba0bf | |||
| cc4ed8ebb4 | |||
| 322e681c65 | |||
| 18dfb832d1 | |||
| 2a2dd08ff1 | |||
| 6628845087 | |||
| 9137b58fca | |||
| d949e40268 | |||
| 648aa897cf | |||
| d73c514909 | |||
| 2fd55eddff | |||
| 76ec26032e | |||
| de210a84e7 | |||
| 52cd821ac9 | |||
| 0c0b1ac1d6 | |||
| 07b0f65aac | |||
| fa9705a870 | |||
| 201c577a85 | |||
| edf6ad1ee2 | |||
| 54e62e6997 | |||
| ea900c4def | |||
| aa44a1643e | |||
| 8d3fd17313 | |||
| fff6af7c20 | |||
| 6f0dfe8b4b | |||
| d53b1b1cfe | |||
| 32f9d1eeb5 | |||
| 684889be8f | |||
| 29eb09287a | |||
| 31c2baeafd | |||
| 78ec9c1c12 | |||
| 8e965a9661 | |||
| d9745d9852 | |||
| 378eae6144 | |||
| 889e1d4e35 | |||
| 99d941bd6a | |||
| 904e04a14f | |||
| 3c99a0a9ec | |||
| e3c84dcb32 | |||
| eb1fab720a | |||
| 4e7a476651 | |||
| 84a7937643 | |||
| fd7e43ef34 | |||
| acb9789b89 | |||
| fd87f7b46d | |||
| 675ca18cfa | |||
| 1186e8a7e5 | |||
| 70a0c87fd3 | |||
| e67fd9663d | |||
| 0e3c4ad99b | |||
| de329f8268 | |||
| 3488b2ae01 | |||
| 2452db088e | |||
| 14079fa738 | |||
| 331f47a4f3 | |||
| e8526347a3 | |||
| 61ae9500d7 | |||
| 8cbf1bb945 | |||
| 9fee59de2a | |||
| 97b7c894f3 | |||
| c047801eb6 | |||
| e954482cb0 | |||
| e34bb395fc | |||
| f64e9f96aa | |||
| 39811c4b40 | |||
| 8bcadeff35 | |||
| 049815cd5f | |||
| 44f60f1b8e | |||
| a69d5ffe33 | |||
| 4001902464 | |||
| dea9c9534c | |||
| 71a818f0ff | |||
| d963201f0a | |||
| 64f4f58cb8 | |||
| 2060b48377 | |||
| 7f8d290022 | |||
| 07df782303 | |||
| 86a2213223 | |||
| 94b98082a3 | |||
| 7f6d6d240f | |||
| a6e11f20da | |||
| 1f553279d2 | |||
| c5471d260e | |||
| 301f556e41 | |||
| 38e53fdcb6 | |||
| 52e39db7ad | |||
| 0f052d1c35 | |||
| bc2fb3b5e8 | |||
| 64b701190d | |||
| 202e6a788f | |||
| e08630b394 | |||
| e4a8e344ba | |||
| 35f0386bd3 | |||
| a3692234ed | |||
| 460e2c0c1e | |||
| 4997295c38 | |||
| b66d82ccb4 | |||
| e2f07cf2b4 | |||
| dedfbb7e63 | |||
| 196ed7530b | |||
| 7e523dfff9 | |||
| 053ad4a57e | |||
| 46f3dc6538 | |||
| 68b6ca2f69 | |||
| 32a34f805f | |||
| 1adbb84d07 | |||
| b5fa1ee8dc | |||
| 5472d69233 | |||
| ba4f42dfff | |||
| 36a7924b64 | |||
| 4dcf2db446 | |||
| 86b030d671 | |||
| c461b4d8fc | |||
| b8f3aa4d12 | |||
| 29d1702f82 | |||
| 4c6e5c977d | |||
| 302d6f2a3e | |||
| beb0328060 | |||
| e460f1ed4e | |||
| c162f90445 | |||
| fdf7ea57f0 | |||
| b699da1461 | |||
| 02652c7651 | |||
| e0145522c9 | |||
| 43d715777a | |||
| 7e74ec4a3c | |||
| 673576142e | |||
| f6650607d6 | |||
| 789361ae13 | |||
| 6ceb137f04 | |||
| e60edbf0cb | |||
| f057a2aef9 | |||
| f5e4dcf609 | |||
| a4cc94f3d0 | |||
| c893e3f9b8 | |||
| 6664e73599 | |||
| fcdad9f31c | |||
| f0211bbfb1 | |||
| 73a55b6268 | |||
| d9c8e2561e | |||
| 99681d7df8 | |||
| 05074c1ca3 | |||
| 3215a7b190 | |||
| afe9d11746 | |||
| 9ed9a010d6 | |||
| eea061bc42 | |||
| 0596ff2d2b | |||
| 2d677835ec | |||
| 190db6962e | |||
| 8caeea5c47 | |||
| fc10598d63 | |||
| b67b10af29 | |||
| c4cd52ce5a | |||
| c49877c8f5 | |||
| 948ac8f62b | |||
| d7752f9576 | |||
| c38a977f3d | |||
| e076d036c2 | |||
| c6b52f6822 | |||
| d7194d3de0 | |||
| 282a908540 | |||
| 1450dade43 | |||
| 75ba439f5b | |||
| 159a131989 | |||
| a10f75360b |
@@ -57,6 +57,7 @@ Options:
|
||||
--fullname=STRING Name of the site
|
||||
--shortname=STRING Name of the site
|
||||
--summary=STRING The summary to be displayed on the front page
|
||||
--supportemail=STRING Email address for support and help.
|
||||
-h, --help Print out this help
|
||||
|
||||
Example:
|
||||
@@ -98,6 +99,7 @@ list($options, $unrecognized) = cli_get_params(
|
||||
'fullname' => '',
|
||||
'shortname' => '',
|
||||
'summary' => '',
|
||||
'supportemail' => '',
|
||||
'agree-license' => false,
|
||||
'help' => false
|
||||
),
|
||||
@@ -136,6 +138,15 @@ if (!empty($options['adminemail']) && !validate_email($options['adminemail'])) {
|
||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
||||
}
|
||||
|
||||
// Validate that the supportemail provided was an e-mail address.
|
||||
if (!empty($options['supportemail']) && !validate_email($options['supportemail'])) {
|
||||
$a = (object) [
|
||||
'option' => 'supportemail',
|
||||
'value' => $options['supportemail']
|
||||
];
|
||||
cli_error(get_string('cliincorrectvalueerror', 'admin', $a));
|
||||
}
|
||||
|
||||
$options['lang'] = clean_param($options['lang'], PARAM_SAFEDIR);
|
||||
if (!file_exists($CFG->dirroot.'/install/lang/'.$options['lang'])) {
|
||||
$options['lang'] = 'en';
|
||||
|
||||
@@ -4114,4 +4114,193 @@
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="4.3" 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>
|
||||
|
||||
+4
-8
@@ -96,20 +96,16 @@ function core_admin_pluginfile($course, $cm, $context, $filearea, $args, $forced
|
||||
send_file_not_found();
|
||||
}
|
||||
|
||||
// No need for resizing, but if the file should be cached we save it so we can serve it fast next time.
|
||||
if (empty($maxwidth) && empty($maxheight)) {
|
||||
// Check whether width/height are specified, and we can resize the image (some types such as ICO cannot be resized).
|
||||
if (($maxwidth === 0 && $maxheight === 0) ||
|
||||
!$filedata = $file->resize_image($maxwidth, $maxheight)) {
|
||||
|
||||
if ($lifetime) {
|
||||
file_safe_save_content($file->get_content(), $candidate);
|
||||
}
|
||||
send_stored_file($file, $lifetime, 0, false, $options);
|
||||
}
|
||||
|
||||
// Proceed with the resizing.
|
||||
$filedata = $file->resize_image($maxwidth, $maxheight);
|
||||
if (!$filedata) {
|
||||
send_file_not_found();
|
||||
}
|
||||
|
||||
// If we don't want to cached the file, serve now and quit.
|
||||
if (!$lifetime) {
|
||||
send_content_uncached($filedata, $filename);
|
||||
|
||||
@@ -34,8 +34,11 @@ Feature: Manage availability conditions
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
And the following "activity" exists:
|
||||
| activity | page |
|
||||
| course | C1 |
|
||||
| name | P1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
When I navigate to "Plugins > Availability restrictions > Manage restrictions" in site administration
|
||||
|
||||
# Check the icon is there (it should be a Hide icon, meaning is currently visible).
|
||||
@@ -51,8 +54,7 @@ Feature: Manage availability conditions
|
||||
|
||||
# OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked.
|
||||
And I click on "Hide" "icon" in the "Restriction by grade" "table_row"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
And I am on the "P1" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And "Add restriction..." "dialogue" should be visible
|
||||
|
||||
@@ -21,12 +21,15 @@ Feature: Edit capabilities
|
||||
|
||||
Scenario: Default system capabilities modification
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Teacher" role:
|
||||
And I navigate to "Users > Permissions > Define roles" in site administration
|
||||
And I click on "Edit Teacher role" "link"
|
||||
And I fill the capabilities form with the following permissions:
|
||||
| capability | permission |
|
||||
| block/mnet_hosts:myaddinstance | Allow |
|
||||
| moodle/site:messageanyuser | Inherit |
|
||||
| moodle/grade:managesharedforms | Prevent |
|
||||
| moodle/course:request | Prohibit |
|
||||
And I press "Save changes"
|
||||
When I follow "Edit Teacher role"
|
||||
Then "block/mnet_hosts:myaddinstance" capability has "Allow" permission
|
||||
And "moodle/site:messageanyuser" capability has "Not set" permission
|
||||
@@ -48,16 +51,12 @@ Feature: Edit capabilities
|
||||
And "mod/forum:addquestion" capability has "Allow" permission
|
||||
|
||||
Scenario: Module capabilities overrides
|
||||
Given I log in as "teacher1"
|
||||
And the following "activity" exists:
|
||||
Given the following "activity" exists:
|
||||
| activity | forum |
|
||||
| course | C1 |
|
||||
| idnumber | 00001 |
|
||||
| name | I'm the name |
|
||||
| intro | I'm the introduction |
|
||||
| section | 1 |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "I'm the name"
|
||||
And I am on the "I'm the name" "forum activity" page logged in as teacher1
|
||||
And I navigate to "Permissions" in current page administration
|
||||
And I override the system permissions of "Student" role with:
|
||||
| mod/forum:deleteanypost | Prohibit |
|
||||
|
||||
+44
-2
@@ -376,19 +376,61 @@ class brickfield_accessibility_test {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the newwindowphrases for all enabled language packs.
|
||||
* @return array of the newwindowphrases for all enabled language packs.
|
||||
*/
|
||||
public static function get_all_newwindowphrases(): array {
|
||||
// Need to process all enabled lang versions of newwindowphrases.
|
||||
return static::get_all_phrases('newwindowphrases');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the invalidlinkphrases for all enabled language packs.
|
||||
* @return array of the invalidlinkphrases for all enabled language packs.
|
||||
*/
|
||||
public static function get_all_invalidlinkphrases(): array {
|
||||
// Need to process all enabled lang versions of invalidlinkphrases.
|
||||
return static::get_all_phrases('invalidlinkphrases');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of the relevant phrases for all enabled language packs.
|
||||
* @param string $stringname the language string identifier you want get the phrases for.
|
||||
* @return array of the invalidlinkphrases for all enabled language packs.
|
||||
*/
|
||||
protected static function get_all_phrases(string $stringname): array {
|
||||
$stringmgr = get_string_manager();
|
||||
$allstrings = [];
|
||||
$enabledlangs = get_string_manager()->get_list_of_translations();
|
||||
|
||||
// Somehow, an invalid string was requested. Add exception handling for this in the future.
|
||||
if (!$stringmgr->string_exists($stringname, manager::PLUGINNAME)) {
|
||||
return $allstrings;
|
||||
}
|
||||
|
||||
// Need to process all enabled lang versions of invalidlinkphrases.
|
||||
$enabledlangs = $stringmgr->get_list_of_translations();
|
||||
foreach ($enabledlangs as $lang => $value) {
|
||||
$tmpstring = (string)new \lang_string('invalidlinkphrases', manager::PLUGINNAME, null, $lang);
|
||||
$tmpstring = (string)new \lang_string($stringname, manager::PLUGINNAME, null, $lang);
|
||||
$tmplangarray = explode('|', $tmpstring);
|
||||
$allstrings = array_merge($allstrings, $tmplangarray);
|
||||
}
|
||||
// Removing duplicates if a lang is enabled, yet using default 'en' due to no relevant lang file.
|
||||
$allstrings = array_unique($allstrings);
|
||||
return $allstrings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Assesses whether a string contains any readable text, which is text that
|
||||
* contains any characters other than whitespace characters.
|
||||
*
|
||||
* @param string $text
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_text_readable(string $text): bool {
|
||||
// These characters in order are a space, tab, line feed, carriage return,
|
||||
// NUL-byte, vertical tab and non-breaking space unicode character \xc2\xa0.
|
||||
$emptycharacters = " \t\n\r\0\x0B\xc2\xa0";
|
||||
return trim($text, $emptycharacters) != '';
|
||||
}
|
||||
}
|
||||
|
||||
+19
-1
@@ -39,9 +39,27 @@ class a_links_dont_open_new_window extends brickfield_accessibility_test {
|
||||
* The main check function. This is called by the parent class to actually check content.
|
||||
*/
|
||||
public function check(): void {
|
||||
|
||||
// Need to process all enabled lang versions of newwindowphrases.
|
||||
$text = brickfield_accessibility_test::get_all_newwindowphrases();
|
||||
|
||||
foreach ($this->get_all_elements('a') as $a) {
|
||||
if ($a->hasAttribute('target') && !in_array($a->getAttribute('target'), $this->allowedtargets)) {
|
||||
$this->add_report($a);
|
||||
$phrasefound = false;
|
||||
foreach ($text as $phrase) {
|
||||
// Sanity check for readable text.
|
||||
if (!brickfield_accessibility_test::is_text_readable($phrase)) {
|
||||
break;
|
||||
}
|
||||
$pos = stripos($a->nodeValue, $phrase);
|
||||
if ($pos !== false) {
|
||||
$phrasefound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$phrasefound) {
|
||||
$this->add_report($a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+18
-1
@@ -39,9 +39,26 @@ class area_dont_open_new_window extends brickfield_accessibility_test {
|
||||
* The main check function. This is called by the parent class to actually check content
|
||||
*/
|
||||
public function check(): void {
|
||||
// Need to process all enabled lang versions of newwindowphrases.
|
||||
$text = brickfield_accessibility_test::get_all_newwindowphrases();
|
||||
|
||||
foreach ($this->get_all_elements('area') as $area) {
|
||||
if ($area->hasAttribute('target') && !in_array($area->getAttribute('target'), $this->allowedtargets)) {
|
||||
$this->add_report($area);
|
||||
$phrasefound = false;
|
||||
foreach ($text as $phrase) {
|
||||
// Sanity check for readable text.
|
||||
if (!brickfield_accessibility_test::is_text_readable($phrase)) {
|
||||
break;
|
||||
}
|
||||
$pos = stripos($area->getAttribute('alt'), $phrase);
|
||||
if ($pos !== false) {
|
||||
$phrasefound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$phrasefound) {
|
||||
$this->add_report($area);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,6 +93,7 @@ $string['invalidcourseid'] = 'Invalid course, please check your input';
|
||||
$string['invalidlinkphrases'] = 'click|click here|here|more|more here|info|info here|information|information here|read more|read more here|further information|further information here|further details|further details here';
|
||||
$string['module'] = 'Module';
|
||||
$string['modulename'] = 'Name';
|
||||
$string['newwindowphrases'] = 'new window|new-window|new_window';
|
||||
$string['noerrorsfound'] = 'No common accessibility errors were found for your search parameters. Congratulations!';
|
||||
$string['norecords'] = 'No relevant records were found for your search parameters.';
|
||||
$string['notregistered'] = 'Your accessibility toolkit needs to be registered.';
|
||||
|
||||
+16
@@ -87,6 +87,19 @@ EOD;
|
||||
</html>
|
||||
EOD;
|
||||
|
||||
/** @var string Html pass 4 */
|
||||
private $htmlpass4 = <<<EOD
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>A link can indicate that it will open in a new window</title>
|
||||
</head>
|
||||
<body>
|
||||
<a href="www.youtube.com" target="_blank">This is youtube (opens in a new window)</a>
|
||||
</body>
|
||||
</html>
|
||||
EOD;
|
||||
|
||||
/**
|
||||
* Test for links opening a new tab or window
|
||||
*/
|
||||
@@ -102,5 +115,8 @@ EOD;
|
||||
|
||||
$results = $this->get_checker_results($this->htmlpass3);
|
||||
$this->assertEmpty($results);
|
||||
|
||||
$results = $this->get_checker_results($this->htmlpass4);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
}
|
||||
|
||||
+16
@@ -87,6 +87,19 @@ EOD;
|
||||
</html>
|
||||
EOD;
|
||||
|
||||
/** @var string Html pass 4 */
|
||||
private $htmlpass4 = <<<EOD
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN""http://www.w3.org/TR/REC-html40/loose.dtd">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>A link can indicate that it will open in a new window</title>
|
||||
</head>
|
||||
<body>
|
||||
<area target="_blank" alt="(opens in a new window)"></area>
|
||||
</body>
|
||||
</html>
|
||||
EOD;
|
||||
|
||||
/**
|
||||
* Test Area tags opening new window without warning
|
||||
*/
|
||||
@@ -102,5 +115,8 @@ EOD;
|
||||
|
||||
$results = $this->get_checker_results($this->htmlpass3);
|
||||
$this->assertEmpty($results);
|
||||
|
||||
$results = $this->get_checker_results($this->htmlpass4);
|
||||
$this->assertEmpty($results);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +285,7 @@ class data_requests_table extends table_sql {
|
||||
$actionsmenu = new action_menu($actions);
|
||||
$actionsmenu->set_menu_trigger(get_string('actions'));
|
||||
$actionsmenu->set_owner_selector('request-actions-' . $requestid);
|
||||
$actionsmenu->set_constraint('[data-region=data-requests-table] > .no-overflow');
|
||||
$actionsmenu->set_boundary('window');
|
||||
|
||||
return $OUTPUT->render($actionsmenu);
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
{{/filter}}
|
||||
</div>
|
||||
|
||||
<div class="mt-1 mb-1" data-region="data-requests-table">
|
||||
<div class="position-relative mt-1 mb-1" data-region="data-requests-table">
|
||||
{{{datarequests}}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -30,6 +30,12 @@ Feature: Protected data should not be deleted
|
||||
| Site purpose | PT1H | 0 |
|
||||
| prot | P1D | 1 |
|
||||
| unprot | P1D | 0 |
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| user | forum | name | message |
|
||||
| u1 | forump1 | Discussion subject | Test post in forump1 |
|
||||
| u1 | forumu1 | Discussion subject | Test post in forumu1 |
|
||||
| u1 | forump2 | Discussion subject | Test post in forump2 |
|
||||
| u1 | forumu2 | Discussion subject | Test post in forumu2 |
|
||||
And I set the category and purpose for the "forump1" "forum" in course "C1" to "CAT" and "prot"
|
||||
And I set the category and purpose for the "forump2" "forum" in course "C2" to "CAT" and "prot"
|
||||
And I set the category and purpose for the "forumu1" "forum" in course "C1" to "CAT" and "unprot"
|
||||
@@ -38,47 +44,25 @@ Feature: Protected data should not be deleted
|
||||
|
||||
@javascripta
|
||||
Scenario: Unexpired and protected data is not removed
|
||||
Given I log in as "u1"
|
||||
And I am on "C1" course homepage
|
||||
And I add a new discussion to "forump1" forum with:
|
||||
| Subject | Discussion subject |
|
||||
| Message | Test post in forump1 |
|
||||
And I am on "C1" course homepage
|
||||
And I add a new discussion to "forumu1" forum with:
|
||||
| Subject | Discussion subject |
|
||||
| Message | Test post in forumu1 |
|
||||
And I am on "C2" course homepage
|
||||
And I add a new discussion to "forump2" forum with:
|
||||
| Subject | Discussion subject |
|
||||
| Message | Test post in forump2 |
|
||||
And I am on "C2" course homepage
|
||||
And I add a new discussion to "forumu2" forum with:
|
||||
| Subject | Discussion subject |
|
||||
| Message | Test post in forumu2 |
|
||||
And I log out
|
||||
And I log in as "admin"
|
||||
Given I log in as "admin"
|
||||
And I create a dataprivacy "delete" request for "u1"
|
||||
And I approve a dataprivacy "delete" request for "u1"
|
||||
And I run all adhoc tasks
|
||||
And I navigate to "Users > Privacy and policies > Data requests" in site administration
|
||||
And I should see "Deleted" in the "u1" "table_row"
|
||||
|
||||
And I am on "C1" course homepage
|
||||
And I follow "forump1"
|
||||
And I am on the "forump1" "forum activity" page
|
||||
And I follow "Discussion subject"
|
||||
Then I should not see "Test post in forump1"
|
||||
|
||||
When I am on "C1" course homepage
|
||||
And I follow "forumu1"
|
||||
When I am on the "forumu1" "forum activity" page
|
||||
And I follow "Discussion subject"
|
||||
Then I should not see "Test post in forumu1"
|
||||
|
||||
And I am on "C2" course homepage
|
||||
And I follow "forump2"
|
||||
And I am on the "forump2" "forum activity" page
|
||||
And I follow "Discussion subject"
|
||||
Then I should see "Test post in forump2"
|
||||
|
||||
When I am on "C2" course homepage
|
||||
And I follow "forumu2"
|
||||
When I am on the "forumu2" "forum activity" page
|
||||
And I follow "Discussion subject"
|
||||
Then I should not see "Test post in forumu2"
|
||||
|
||||
@@ -15,6 +15,17 @@ Feature: Manage plan workflow
|
||||
| usermanageowndraftplan | User manage own draft plan role | user |
|
||||
| usermanageownplan | User manage own plan role | user |
|
||||
| manageplan | Manager all plans role | manager |
|
||||
And the following "role capabilities" exist:
|
||||
| role | moodle/competency:planmanageowndraft | moodle/competency:planmanageown |
|
||||
| usermanageowndraftplan | allow | |
|
||||
| usermanageownplan | allow | allow |
|
||||
| manageplan | allow | allow |
|
||||
And the following "role capability" exists:
|
||||
| role | manageplan |
|
||||
| moodle/competency:planmanage | allow |
|
||||
| moodle/competency:planview | allow |
|
||||
| moodle/competency:planreview | allow |
|
||||
| moodle/competency:planrequestreview | allow |
|
||||
And the following "role assigns" exist:
|
||||
| user | role | contextlevel | reference |
|
||||
| user1 | usermanageowndraftplan | System | |
|
||||
@@ -40,23 +51,6 @@ Feature: Manage plan workflow
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| lp | System | 1 | my-index | content |
|
||||
And I log in as "admin"
|
||||
And I set the following system permissions of "User manage own draft plan role" role:
|
||||
| capability | permission |
|
||||
| moodle/competency:planmanageowndraft | Allow |
|
||||
And I set the following system permissions of "User manage own plan role" role:
|
||||
| capability | permission |
|
||||
| moodle/competency:planmanageowndraft | Allow |
|
||||
| moodle/competency:planmanageown | Allow |
|
||||
And I set the following system permissions of "Manager all plans role" role:
|
||||
| capability | permission |
|
||||
| moodle/competency:planmanage | Allow |
|
||||
| moodle/competency:planmanagedraft | Allow |
|
||||
| moodle/competency:planmanageowndraft | Allow |
|
||||
| moodle/competency:planview | Allow |
|
||||
| moodle/competency:planreview | Allow |
|
||||
| moodle/competency:planrequestreview | Allow |
|
||||
And I log out
|
||||
|
||||
Scenario: User can manages his own plan draft
|
||||
Given I log in as "user1"
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('toollpexportcsv');
|
||||
|
||||
$pagetitle = get_string('exportnavlink', 'tool_lpimportcsv');
|
||||
|
||||
$context = context_system::instance();
|
||||
|
||||
@@ -25,6 +25,8 @@ define('NO_OUTPUT_BUFFERING', true);
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
admin_externalpage_setup('toollpimportcsv');
|
||||
|
||||
$pagetitle = get_string('pluginname', 'tool_lpimportcsv');
|
||||
|
||||
$context = context_system::instance();
|
||||
|
||||
@@ -222,7 +222,7 @@ function tool_mobile_standard_footer_html() {
|
||||
global $CFG;
|
||||
$output = '';
|
||||
if (!empty($CFG->enablemobilewebservice) && $url = tool_mobile_create_app_download_url()) {
|
||||
$output .= html_writer::link($url, get_string('getmoodleonyourmobile', 'tool_mobile'));
|
||||
$output .= html_writer::link($url, get_string('getmoodleonyourmobile', 'tool_mobile'), ['class' => 'mobilelink']);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ define('NO_DEBUG_DISPLAY', true);
|
||||
define('NO_MOODLE_COOKIES', true);
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
use tool_mobile\api;
|
||||
|
||||
header('Content-Type: application/json; charset: utf-8');
|
||||
|
||||
@@ -41,7 +40,9 @@ if (!empty($CFG->enablemobilewebservice) && !empty($mobilesettings->enablesmarta
|
||||
!empty($mobilesettings->androidappid)) {
|
||||
|
||||
$manifest = new StdClass;
|
||||
$manifest->short_name = format_string($SITE->shortname);
|
||||
$manifest->short_name = format_string($SITE->shortname, true, [
|
||||
'context' => context_system::instance(),
|
||||
]);
|
||||
$manifest->prefer_related_applications = true;
|
||||
$manifest->icons = [(object)
|
||||
[
|
||||
|
||||
@@ -194,10 +194,9 @@ class subscription_manager {
|
||||
if (!is_null($coursecontext)) {
|
||||
$context = $coursecontext;
|
||||
$courseid = $subscription->courseid;
|
||||
} else if (!empty($subscription->courseid) && ($coursecontext =
|
||||
} else if (!empty($subscription->courseid) && ($context =
|
||||
\context_course::instance($subscription->courseid, IGNORE_MISSING))) {
|
||||
$courseid = $subscription->courseid;
|
||||
$context = $coursecontext;
|
||||
} else {
|
||||
$courseid = 0;
|
||||
$context = \context_system::instance();
|
||||
|
||||
@@ -169,10 +169,9 @@ Feature: tool_monitor_subscriptions
|
||||
And I should not see "You can manage rules the from the Event monitoring rules page."
|
||||
|
||||
Scenario: No manage rules link when user does not have permission
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Non-editing teacher" role:
|
||||
| tool/monitor:managerules | Prohibit |
|
||||
And I log out
|
||||
Given the following "role capability" exists:
|
||||
| role | teacher |
|
||||
| tool/monitor:managerules | prohibit |
|
||||
And I log in as "teacher1"
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
|
||||
@@ -48,15 +48,18 @@ use tool_policy\policy_version;
|
||||
*/
|
||||
class page_viewalldoc implements renderable, templatable {
|
||||
|
||||
/** @var string Return url */
|
||||
private $returnurl;
|
||||
/** @var ?moodle_url Return url */
|
||||
private $returnurl = null;
|
||||
|
||||
/**
|
||||
* Prepare the page for rendering.
|
||||
*
|
||||
*/
|
||||
public function __construct($returnurl) {
|
||||
$this->returnurl = $returnurl;
|
||||
if (!empty($returnurl)) {
|
||||
$this->returnurl = new moodle_url($returnurl);
|
||||
}
|
||||
|
||||
$this->prepare_global_page_access();
|
||||
$this->prepare_policies();
|
||||
}
|
||||
|
||||
@@ -48,11 +48,9 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
And "Pending" "text" should exist in the "User Two" "table_row"
|
||||
|
||||
Scenario: Agree on behalf of another user as a manager, single policy, javascript off
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Manager" role:
|
||||
| capability | permission |
|
||||
| tool/policy:acceptbehalf | Allow |
|
||||
And I log out
|
||||
Given the following "role capability" exists:
|
||||
| role | manager |
|
||||
| tool/policy:acceptbehalf | allow |
|
||||
When I log in as "manager"
|
||||
And I press "Next"
|
||||
And I set the field "I agree to the This site policy" to "1"
|
||||
@@ -73,11 +71,9 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
|
||||
@javascript
|
||||
Scenario: Agree on behalf of another user as a manager, single policy, javascript on
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Manager" role:
|
||||
| capability | permission |
|
||||
| tool/policy:acceptbehalf | Allow |
|
||||
And I log out
|
||||
Given the following "role capability" exists:
|
||||
| role | manager |
|
||||
| tool/policy:acceptbehalf | allow |
|
||||
When I log in as "manager"
|
||||
And I press "Next"
|
||||
And I set the field "I agree to the This site policy" to "1"
|
||||
@@ -135,13 +131,13 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
And "Pending" "text" should exist in the "This privacy policy" "table_row"
|
||||
|
||||
Scenario: Agree on behalf of another user as a manager, multiple policies, javascript off
|
||||
Given I log in as "admin"
|
||||
Given the following "role capability" exists:
|
||||
| role | manager |
|
||||
| tool/policy:acceptbehalf | allow |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
|
||||
And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
|
||||
And I press "Continue"
|
||||
And I set the following system permissions of "Manager" role:
|
||||
| capability | permission |
|
||||
| tool/policy:acceptbehalf | Allow |
|
||||
And I log out
|
||||
When I log in as "manager"
|
||||
And I press "Next"
|
||||
@@ -167,14 +163,14 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
|
||||
@javascript
|
||||
Scenario: Agree on behalf of another user as a manager, multiple policies, javascript on
|
||||
Given I log in as "admin"
|
||||
Given the following "role capability" exists:
|
||||
| role | manager |
|
||||
| tool/policy:acceptbehalf | allow |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
|
||||
And I click on "Actions" "link_or_button" in the "This privacy policy" "table_row"
|
||||
And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
|
||||
And I press "Activate"
|
||||
And I set the following system permissions of "Manager" role:
|
||||
| capability | permission |
|
||||
| tool/policy:acceptbehalf | Allow |
|
||||
And I log out
|
||||
When I log in as "manager"
|
||||
And I press "Next"
|
||||
@@ -215,11 +211,9 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
And I should not see "Policies and agreements"
|
||||
|
||||
Scenario: Policies and agreements profile link visible also for users who can access on behalf of others
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Manager" role:
|
||||
| capability | permission |
|
||||
| tool/policy:acceptbehalf | Allow |
|
||||
And I log out
|
||||
Given the following "role capability" exists:
|
||||
| role | manager |
|
||||
| tool/policy:acceptbehalf | allow |
|
||||
And I log in as "manager"
|
||||
And I press "Next"
|
||||
And I set the field "I agree to the This site policy" to "1"
|
||||
@@ -231,11 +225,9 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
Then I should see "Policies and agreements"
|
||||
|
||||
Scenario: Agree on behalf of another user as an admin who is logged in as a manager
|
||||
Given I log in as "admin"
|
||||
And I set the following system permissions of "Manager" role:
|
||||
| capability | permission |
|
||||
| tool/policy:acceptbehalf | Allow |
|
||||
And I log out
|
||||
Given the following "role capability" exists:
|
||||
| role | manager |
|
||||
| tool/policy:acceptbehalf | allow |
|
||||
When I log in as "manager"
|
||||
And I press "Next"
|
||||
And I set the field "I agree to the This site policy" to "1"
|
||||
@@ -261,14 +253,14 @@ Feature: Viewing acceptances reports and accepting on behalf of other users
|
||||
|
||||
@javascript
|
||||
Scenario: Bulk agree on behalf of another users as a manager, multiple policies, javascript on
|
||||
Given I log in as "admin"
|
||||
Given the following "role capability" exists:
|
||||
| role | manager |
|
||||
| tool/policy:acceptbehalf | allow |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Users > Privacy and policies > Manage policies" in site administration
|
||||
And I click on "Actions" "link_or_button" in the "This privacy policy" "table_row"
|
||||
And I click on "Set status to \"Active\"" "link" in the "This privacy policy" "table_row"
|
||||
And I press "Activate"
|
||||
And I set the following system permissions of "Manager" role:
|
||||
| capability | permission |
|
||||
| tool/policy:acceptbehalf | Allow |
|
||||
And I log out
|
||||
When I log in as "manager"
|
||||
And I press "Next"
|
||||
|
||||
@@ -101,7 +101,7 @@ class tool_uploadcourse_course {
|
||||
/** @var array fields allowed as course data. */
|
||||
static protected $validfields = array('fullname', 'shortname', 'idnumber', 'category', 'visible', 'startdate', 'enddate',
|
||||
'summary', 'format', 'theme', 'lang', 'newsitems', 'showgrades', 'showreports', 'legacyfiles', 'maxbytes',
|
||||
'groupmode', 'groupmodeforce', 'enablecompletion', 'downloadcontent');
|
||||
'groupmode', 'groupmodeforce', 'enablecompletion', 'downloadcontent', 'showactivitydates');
|
||||
|
||||
/** @var array fields required on course creation. */
|
||||
static protected $mandatoryfields = array('fullname', 'category');
|
||||
|
||||
@@ -192,6 +192,10 @@ class tool_uploadcourse_step2_form extends tool_uploadcourse_base_form {
|
||||
$mform->addHelpButton('defaults[enablecompletion]', 'enablecompletion', 'completion');
|
||||
}
|
||||
|
||||
$mform->addElement('selectyesno', 'defaults[showactivitydates]', get_string('showactivitydates'));
|
||||
$mform->addHelpButton('defaults[showactivitydates]', 'showactivitydates');
|
||||
$mform->setDefault('defaults[showactivitydates]', $courseconfig->showactivitydates);
|
||||
|
||||
// Add custom fields to the form.
|
||||
$handler = \core_course\customfield\course_handler::create();
|
||||
$handler->instance_form_definition($mform, 0, 'defaultvaluescustomfieldcategory', 'tool_uploadcourse');
|
||||
|
||||
@@ -166,6 +166,7 @@ $defaults['groupmodeforce'] = $courseconfig->groupmodeforce;
|
||||
$defaults['visible'] = $courseconfig->visible;
|
||||
$defaults['lang'] = $courseconfig->lang;
|
||||
$defaults['enablecompletion'] = $courseconfig->enablecompletion;
|
||||
$defaults['showactivitydates'] = $courseconfig->showactivitydates;
|
||||
|
||||
// Course template.
|
||||
if (isset($options['templatecourse'])) {
|
||||
|
||||
@@ -425,6 +425,7 @@ class course_test extends \advanced_testcase {
|
||||
'groupmode' => '2',
|
||||
'groupmodeforce' => '1',
|
||||
'enablecompletion' => '1',
|
||||
'showactivitydates' => '1',
|
||||
'tags' => 'Cat, Dog',
|
||||
|
||||
'role_teacher' => 'Knight',
|
||||
@@ -478,6 +479,7 @@ class course_test extends \advanced_testcase {
|
||||
$this->assertEquals($data['groupmode'], $course->groupmode);
|
||||
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
|
||||
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
|
||||
$this->assertEquals($data['showactivitydates'], $course->showactivitydates);
|
||||
$this->assertEquals($data['tags'], join(', ', \core_tag_tag::get_item_tags_array('core', 'course', $course->id)));
|
||||
|
||||
// Roles.
|
||||
@@ -530,6 +532,7 @@ class course_test extends \advanced_testcase {
|
||||
'groupmode' => '1',
|
||||
'groupmodeforce' => '0',
|
||||
'enablecompletion' => '0',
|
||||
'showactivitydates' => '0',
|
||||
|
||||
'role_teacher' => 'Teacher',
|
||||
'role_manager' => 'Manager',
|
||||
@@ -583,6 +586,7 @@ class course_test extends \advanced_testcase {
|
||||
$this->assertEquals($data['groupmode'], $course->groupmode);
|
||||
$this->assertEquals($data['groupmodeforce'], $course->groupmodeforce);
|
||||
$this->assertEquals($data['enablecompletion'], $course->enablecompletion);
|
||||
$this->assertEquals($data['showactivitydates'], $course->showactivitydates);
|
||||
|
||||
// Roles.
|
||||
$roleids = array();
|
||||
@@ -644,6 +648,7 @@ class course_test extends \advanced_testcase {
|
||||
'groupmode' => '2',
|
||||
'groupmodeforce' => '1',
|
||||
'enablecompletion' => '1',
|
||||
'showactivitydates' => '1',
|
||||
);
|
||||
|
||||
$this->assertFalse($DB->record_exists('course', array('shortname' => 'c1')));
|
||||
@@ -673,6 +678,7 @@ class course_test extends \advanced_testcase {
|
||||
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
|
||||
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
|
||||
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
|
||||
$this->assertEquals($defaultdata['showactivitydates'], $course->showactivitydates);
|
||||
|
||||
// Update.
|
||||
$cat = $this->getDataGenerator()->create_category();
|
||||
@@ -701,6 +707,7 @@ class course_test extends \advanced_testcase {
|
||||
'groupmode' => '1',
|
||||
'groupmodeforce' => '0',
|
||||
'enablecompletion' => '0',
|
||||
'showactivitydates' => '0',
|
||||
);
|
||||
|
||||
$this->assertTrue($DB->record_exists('course', array('shortname' => 'c1')));
|
||||
@@ -730,6 +737,7 @@ class course_test extends \advanced_testcase {
|
||||
$this->assertEquals($defaultdata['groupmode'], $course->groupmode);
|
||||
$this->assertEquals($defaultdata['groupmodeforce'], $course->groupmodeforce);
|
||||
$this->assertEquals($defaultdata['enablecompletion'], $course->enablecompletion);
|
||||
$this->assertEquals($defaultdata['showactivitydates'], $course->showactivitydates);
|
||||
}
|
||||
|
||||
public function test_rename() {
|
||||
|
||||
@@ -153,14 +153,10 @@ Feature: Apply tour filters to a tour
|
||||
| Course 1 | C1 | topics | 1 |
|
||||
| Course 2 | C2 | topics | 1 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | firstpagetitle | wikimode |
|
||||
| wiki | C1 | Test wiki name | First page | collaborative |
|
||||
| activity | course | name | firstpagetitle | wikimode | idnumber | intro | type |
|
||||
| wiki | C1 | Test wiki name | First page | collaborative | | | |
|
||||
| forum | C2 | Test forum name | | | 001 | Test forum description | general |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 2" course homepage with editing mode on
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Forum type | Standard forum for general use |
|
||||
| Description | Test forum description |
|
||||
And I add a new user tour with:
|
||||
| Name | Wiki tour |
|
||||
| Description | A tour with both matches |
|
||||
|
||||
@@ -48,11 +48,7 @@ if ($confirmed) {
|
||||
throw new \moodle_exception('cannotfinduser', '', '', $userid);
|
||||
}
|
||||
|
||||
if (!$user->suspended) {
|
||||
complete_user_login($user);
|
||||
|
||||
\core\session\manager::apply_concurrent_login_limit($user->id, session_id());
|
||||
|
||||
if ($user->id == $USER->id) {
|
||||
// Check where to go, $redirect has a higher preference.
|
||||
if (empty($redirect) and !empty($SESSION->wantsurl) ) {
|
||||
$redirect = $SESSION->wantsurl;
|
||||
@@ -69,14 +65,24 @@ if ($confirmed) {
|
||||
$PAGE->set_heading($COURSE->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
|
||||
echo "<h3>".get_string("thanks").", ". fullname($USER) . "</h3>\n";
|
||||
echo "<h3>".get_string("thanks").", ". fullname($user) . "</h3>\n";
|
||||
echo "<p>".get_string("confirmed")."</p>\n";
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
|
||||
// If $wantsurl and $redirect are empty, then the button will navigate the identical user to the dashboard.
|
||||
if ($user->id == $USER->id) {
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/course/", get_string('courses'));
|
||||
} else if (!isloggedin() || isguestuser()) {
|
||||
echo $OUTPUT->single_button(get_login_url(), get_string('login'));
|
||||
} else {
|
||||
echo $OUTPUT->single_button("$CFG->wwwroot/login/logout.php", get_string('logout'));
|
||||
}
|
||||
echo $OUTPUT->box_end();
|
||||
echo $OUTPUT->footer();
|
||||
exit;
|
||||
} else {
|
||||
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
|
||||
// Avoid error if logged-in user visiting the page.
|
||||
if (!isloggedin()) {
|
||||
\core\notification::error(get_string('confirmationinvalid', 'auth_oauth2'));
|
||||
}
|
||||
}
|
||||
|
||||
redirect("$CFG->wwwroot/");
|
||||
|
||||
@@ -16,26 +16,15 @@ Feature: availability_completion
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | completion |
|
||||
| page | C1 | Page 1 | 1 |
|
||||
| page | C1 | Page 2 | |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
# Basic setup.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
# Add a Page with a completion tickbox.
|
||||
And I add a "Page" to section "1" and I fill the form with:
|
||||
| Name | Page 1 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
| Completion tracking | 1 |
|
||||
|
||||
# And another one that depends on it (hidden otherwise).
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | Page 2 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
Given I am on the "Page 2" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -44,9 +33,7 @@ Feature: availability_completion
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Log back in as student.
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" "course" page logged in as "student1"
|
||||
|
||||
# Page 2 should not appear yet.
|
||||
Then I should not see "Page 2" in the "region-main" "region"
|
||||
@@ -58,27 +45,12 @@ Feature: availability_completion
|
||||
@javascript
|
||||
Scenario: Test completion and course cache rebuild
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber |
|
||||
| forum | forum 1 | forum 1 | C1 | forum1 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I open "forum 1" actions menu
|
||||
And I click on "Edit settings" "link" in the "forum 1" activity
|
||||
And I set the following fields to these values:
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| completionview | 1 |
|
||||
| completionpostsenabled | 1 |
|
||||
| completionposts | 2 |
|
||||
And I press "Save and return to course"
|
||||
And I add a new discussion to "forum 1" forum with:
|
||||
| Subject | Forum post 1 |
|
||||
| Message | This is the body |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | Page 2 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
| activity | name | course | idnumber | completion | completionview | completionpostsenabled | completionposts |
|
||||
| forum | forum 1 | C1 | forum1 | 2 | 1 | 1 | 2 |
|
||||
And the following "mod_forum > discussions" exist:
|
||||
| forum | subject | message |
|
||||
| forum1 | Forum post 1 | This is the body |
|
||||
And I am on the "Page 2" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I press "Add restriction..."
|
||||
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -87,25 +59,18 @@ Feature: availability_completion
|
||||
| Required completion status | must be marked complete |
|
||||
| cm | forum 1 |
|
||||
And I press "Save and return to course"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
When I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" "course" page logged in as "student1"
|
||||
# Page 2 should not appear yet.
|
||||
Then I should not see "Page 2" in the "region-main" "region"
|
||||
And I click on "forum 1" "link" in the "region-main" "region"
|
||||
# Page 2 should not appear yet.
|
||||
And I should not see "Page 2" in the "region-main" "region"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "forum 1" "forum activity editing" page
|
||||
And I am on the "forum 1" "forum activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| completionpostsenabled | 0 |
|
||||
And I press "Save and display"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" "course" page logged in as "student1"
|
||||
And I click on "forum 1" "link" in the "region-main" "region"
|
||||
And I am on "Course 1" course homepage
|
||||
And I should see "Page 2" in the "region-main" "region"
|
||||
|
||||
@@ -18,21 +18,17 @@ Feature: Confirm that conditions on completion no longer cause a bug
|
||||
@javascript
|
||||
Scenario: Multiple completion conditions on glossary
|
||||
# Set up course.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" "course" page logged in as "teacher1"
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Enable completion tracking" to "Yes"
|
||||
And I press "Save and display"
|
||||
And I turn editing mode on
|
||||
|
||||
# Add a couple of Pages with manual completion.
|
||||
And I add a "Page" to section "1" and I fill the form with:
|
||||
| Name | Page1 |
|
||||
| Page content | x |
|
||||
And I add a "Page" to section "1" and I fill the form with:
|
||||
| Name | Page2 |
|
||||
| Page content | x |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | completion |
|
||||
| page | C1 | Page1 | 1 |
|
||||
| page | C1 | Page2 | 1 |
|
||||
|
||||
# Add a Glossary.
|
||||
When I add a "Glossary" to section "1"
|
||||
|
||||
@@ -16,19 +16,15 @@ Feature: availability_date
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| page | C1 | Page 1 |
|
||||
| page | C1 | Page 2 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
# Basic setup.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
# Add a Page with a date condition that does match (from the past).
|
||||
And I add a "Page" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | Page 1 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
Given I am on the "Page 1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -37,11 +33,7 @@ Feature: availability_date
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Add a Page with a date condition that doesn't match (until the past).
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | Page 2 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
And I am on the "Page 2" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -51,9 +43,7 @@ Feature: availability_date
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Log back in as student.
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" "course" page logged in as "student1"
|
||||
|
||||
# Page 1 should appear, but page 2 does not.
|
||||
Then I should see "Page 1" in the "region-main" "region"
|
||||
|
||||
@@ -17,26 +17,17 @@ Feature: availability_grade
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
# Add an assignment.
|
||||
And the following "activity" exists:
|
||||
| activity | assign |
|
||||
| course | C1 |
|
||||
| section | 1 |
|
||||
| name | A1 |
|
||||
| intro | x |
|
||||
| assignsubmission_onlinetext_enabled | 1 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name | assignsubmission_onlinetext_enabled |
|
||||
| assign | C1 | A1 | 1 |
|
||||
| page | C1 | P1 | |
|
||||
| page | C1 | P2 | |
|
||||
| page | C1 | P3 | |
|
||||
| page | C1 | P4 | |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
# Basic setup.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
# Add a Page with a grade condition for 'any grade'.
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | P2 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
Given I am on the "P2" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -45,11 +36,7 @@ Feature: availability_grade
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Add a Page with a grade condition for 50%.
|
||||
And I add a "Page" to section "3"
|
||||
And I set the following fields to these values:
|
||||
| Name | P3 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I am on the "P3" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -62,23 +49,16 @@ Feature: availability_grade
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Check if disabling a part of the restriction is get saved.
|
||||
And I open "P3" actions menu
|
||||
And I click on "Edit settings" "link" in the "P3" activity
|
||||
And I am on the "P3" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "max" "checkbox" in the ".availability-item" "css_element"
|
||||
And I press "Save and return to course"
|
||||
And I open "P3" actions menu
|
||||
And I click on "Edit settings" "link" in the "P3" activity
|
||||
And I expand all fieldsets
|
||||
And I am on the "P3" "page activity editing" page
|
||||
And the field "Maximum grade percentage (exclusive)" matches value ""
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
# Add a Page with a grade condition for 10%.
|
||||
And I add a "Page" to section "4"
|
||||
And I set the following fields to these values:
|
||||
| Name | P4 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I am on the "P4" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -88,8 +68,6 @@ Feature: availability_grade
|
||||
And I set the field "Minimum grade percentage (inclusive)" to "10"
|
||||
And I press "Save and return to course"
|
||||
|
||||
And I log out
|
||||
|
||||
# Log in as student without a grade yet.
|
||||
When I am on the "A1" "assign activity" page logged in as student1
|
||||
|
||||
@@ -104,7 +82,6 @@ Feature: availability_grade
|
||||
And I should not see "P3" in the "region-main" "region"
|
||||
And I should not see "P4" in the "region-main" "region"
|
||||
And I should see "A1" in the "region-main" "region"
|
||||
And I log out
|
||||
|
||||
# Log back in as teacher.
|
||||
When I am on the "A1" "assign activity" page logged in as teacher1
|
||||
@@ -143,12 +120,8 @@ Feature: availability_grade
|
||||
And the "activitynames" filter applies to "content and headings"
|
||||
And I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
And I am on the "P1" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Name | P1 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Grade" "button" in the "Add restriction..." "dialogue"
|
||||
And I set the field "Grade" to "A-One"
|
||||
|
||||
@@ -16,15 +16,16 @@ Feature: availability_group
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| page | C1 | P1 |
|
||||
| page | C1 | P2 |
|
||||
| page | C1 | P3 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
# Basic setup.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
# Start to add a Page. If there aren't any groups, there's no Group option.
|
||||
And I add a "Page" to section "1"
|
||||
Given I am on the "P1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
Then "Group" "button" should not exist in the "Add restriction..." "dialogue"
|
||||
@@ -37,8 +38,7 @@ Feature: availability_group
|
||||
| G2 | C1 | GI2 |
|
||||
# This step used to be 'And I follow "C1"', but Chrome thinks the breadcrumb
|
||||
# is not clickable, so we'll go via the home page instead.
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "Page" to section "1"
|
||||
And I am on the "P1" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
Then "Group" "button" should exist in the "Add restriction..." "dialogue"
|
||||
@@ -47,18 +47,10 @@ Feature: availability_group
|
||||
Given I click on "Group" "button" in the "Add restriction..." "dialogue"
|
||||
And I set the field "Group" to "(Any group)"
|
||||
And I click on ".availability-item .availability-eye img" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Name | P1 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
# Page P2 with group G1.
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | P2 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I am on the "P2" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Group" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -67,11 +59,7 @@ Feature: availability_group
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
# Page P3 with group G2
|
||||
And I add a "Page" to section "3"
|
||||
And I set the following fields to these values:
|
||||
| Name | P3 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I am on the "P3" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Group" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -80,9 +68,7 @@ Feature: availability_group
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
# Log back in as student.
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" "course" page logged in as "student1"
|
||||
|
||||
# No pages should appear yet.
|
||||
Then I should not see "P1" in the "region-main" "region"
|
||||
@@ -93,8 +79,6 @@ Feature: availability_group
|
||||
Given the following "group members" exist:
|
||||
| user | group |
|
||||
| student1 | GI1 |
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
# P1 (any groups) and P2 should show but not P3.
|
||||
@@ -113,19 +97,12 @@ Feature: availability_group
|
||||
# The activity names filter is enabled because it triggered a bug in older versions.
|
||||
And the "activitynames" filter is "on"
|
||||
And the "activitynames" filter applies to "content and headings"
|
||||
And I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
And I am on the "P1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Name | P1 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Group" "button" in the "Add restriction..." "dialogue"
|
||||
And I set the field "Group" to "G-One"
|
||||
And I click on "Save and return to course" "button"
|
||||
And I log out
|
||||
|
||||
# Student sees information about no access to group, with group name in correct language.
|
||||
When I am on the "C1" "Course" page logged in as "student1"
|
||||
|
||||
@@ -22,15 +22,16 @@ Feature: availability_grouping
|
||||
And the following "group members" exist:
|
||||
| user | group |
|
||||
| student1 | GI1 |
|
||||
# Basic setup.
|
||||
And the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| page | C1 | P1 |
|
||||
| page | C1 | P2 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
# Basic setup.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
# Start to add a Page. If there aren't any groupings, there's no Grouping option.
|
||||
And I add a "Page" to section "1"
|
||||
Given I am on the "P1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
Then "Grouping" "button" should not exist in the "Add restriction..." "dialogue"
|
||||
@@ -44,7 +45,7 @@ Feature: availability_grouping
|
||||
| name | course | idnumber |
|
||||
| GX1 | C1 | GXI1 |
|
||||
| GX2 | C1 | GXI2 |
|
||||
And I add a "Page" to section "1"
|
||||
And I am on the "P1" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
Then "Grouping" "button" should exist in the "Add restriction..." "dialogue"
|
||||
@@ -53,18 +54,10 @@ Feature: availability_grouping
|
||||
Given I click on "Grouping" "button"
|
||||
And I set the field "Grouping" to "GX1"
|
||||
And I click on ".availability-item .availability-eye img" "css_element"
|
||||
And I set the following fields to these values:
|
||||
| Name | P1 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
# Page P2 with grouping GX2.
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | P2 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I am on the "P2" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "Grouping" "button"
|
||||
@@ -73,21 +66,17 @@ Feature: availability_grouping
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
# Log back in as student.
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" "course" page logged in as "student1"
|
||||
|
||||
# No pages should appear yet.
|
||||
Then I should not see "P1" in the "region-main" "region"
|
||||
And I should not see "P2" in the "region-main" "region"
|
||||
|
||||
# Add group to grouping and log out/in again.
|
||||
And I log out
|
||||
And the following "grouping groups" exist:
|
||||
| grouping | group |
|
||||
| GXI1 | GI1 |
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" "course" page logged in as "student1"
|
||||
|
||||
# P1 should show but not B2.
|
||||
Then I should see "P1" in the "region-main" "region"
|
||||
@@ -129,14 +118,10 @@ Feature: availability_grouping
|
||||
# The activity names filter is enabled because it triggered a bug in older versions.
|
||||
And the "activitynames" filter is "on"
|
||||
And the "activitynames" filter applies to "content and headings"
|
||||
And I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I open "Test assign" actions menu
|
||||
And I choose "Edit settings" in the open action menu
|
||||
And I am on the "Test assign" "assign activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I press "Add group/grouping access restriction"
|
||||
And I press "Save and return to course"
|
||||
And I log out
|
||||
|
||||
# Student sees information about no access to group, with group name in correct language.
|
||||
When I am on the "C1" "Course" page logged in as "student1"
|
||||
|
||||
@@ -16,19 +16,15 @@ Feature: availability_profile
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| page | C1 | P1 |
|
||||
| page | C1 | P2 |
|
||||
|
||||
@javascript
|
||||
Scenario: Test condition
|
||||
# Basic setup.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
# Add
|
||||
And I add a "Page" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | P1 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
Given I am on the "P1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button"
|
||||
@@ -38,11 +34,7 @@ Feature: availability_profile
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
# Add
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | P2 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I am on the "P2" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button"
|
||||
@@ -52,9 +44,7 @@ Feature: availability_profile
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
# Log back in as student.
|
||||
When I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" "course" page logged in as "student1"
|
||||
|
||||
# I see P1 but not P2.
|
||||
Then I should see "P1" in the "region-main" "region"
|
||||
@@ -72,12 +62,7 @@ Feature: availability_profile
|
||||
And I click on "Update profile" "button"
|
||||
|
||||
# Set Page activity which has requirement on this field.
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | P1 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I am on the "P1" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button"
|
||||
@@ -94,9 +79,7 @@ Feature: availability_profile
|
||||
And the field "Value to compare against" matches value "Bananaman"
|
||||
|
||||
# Log out and back in as student. Should be able to see activity.
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" "course" page logged in as "student1"
|
||||
Then I should see "P1" in the "region-main" "region"
|
||||
|
||||
@javascript
|
||||
@@ -110,14 +93,8 @@ Feature: availability_profile
|
||||
# The activity names filter is enabled because it triggered a bug in older versions.
|
||||
And the "activitynames" filter is "on"
|
||||
And the "activitynames" filter applies to "content and headings"
|
||||
And I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
And I am on the "P1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Name | P1 |
|
||||
| Description | x |
|
||||
| Page content | x |
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button" in the "Add restriction..." "dialogue"
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -34,19 +34,16 @@ Feature: display_availability
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activities" exist:
|
||||
| activity | course | section | name |
|
||||
| page | C1 | 1 | Page 1 |
|
||||
| page | C1 | 2 | Page 2 |
|
||||
| page | C1 | 3 | Page 3 |
|
||||
|
||||
@javascript
|
||||
Scenario: Activity availability display
|
||||
# Set up.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
# Add a Page with 1 restriction.
|
||||
When I add a "Page" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Name | Page 1 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
Given I am on the "Page 1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
And I press "Add restriction..."
|
||||
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -56,11 +53,7 @@ Feature: display_availability
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Add a Page with 2 restrictions - one is set to hide from students if failed.
|
||||
And I add a "Page" to section "2"
|
||||
And I set the following fields to these values:
|
||||
| Name | Page 2 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
And I am on the "Page 2" "page activity editing" page
|
||||
And I expand all fieldsets
|
||||
And I press "Add restriction..."
|
||||
And I click on "Date" "button" in the "Add restriction..." "dialogue"
|
||||
@@ -75,12 +68,6 @@ Feature: display_availability
|
||||
And I set the field "Method of comparison" to "is equal to"
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Add another Page with no restrictions.
|
||||
And I add a "Page" to section "3" and I fill the form with:
|
||||
| Name | Page 3 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
|
||||
# Page 1 should show in single-line format, showing the date
|
||||
Then I should see "Available until" in the "#section-1 .availabilityinfo" "css_element"
|
||||
And I should see "2013" in the "#section-1 .availabilityinfo" "css_element"
|
||||
@@ -98,9 +85,7 @@ Feature: display_availability
|
||||
And "#section-3 .availabilityinfo" "css_element" should not exist
|
||||
|
||||
# Change to student view.
|
||||
Given I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "C1" "Course" page logged in as "student1"
|
||||
|
||||
# Page 1 display still there but should not be a link.
|
||||
Then I should see "Page 1" in the "#section-1" "css_element"
|
||||
@@ -119,8 +104,8 @@ Feature: display_availability
|
||||
@javascript
|
||||
Scenario: Section availability display
|
||||
# Set up.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
Given I am on the "C1" "Course" page logged in as "teacher1"
|
||||
And I turn editing mode on
|
||||
|
||||
# Add a restriction to section 1 (visible to students).
|
||||
When I edit the section "1"
|
||||
@@ -144,29 +129,13 @@ Feature: display_availability
|
||||
# This is necessary because otherwise it fails in Chrome, see MDL-44959
|
||||
And I am on "Course 1" course homepage
|
||||
|
||||
# Add Pages to each section.
|
||||
And I add a "Page" to section "1" and I fill the form with:
|
||||
| Name | Page 1 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
And I add a "Page" to section "2" and I fill the form with:
|
||||
| Name | Page 2 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
And I add a "Page" to section "3" and I fill the form with:
|
||||
| Name | Page 3 |
|
||||
| Description | Test |
|
||||
| Page content | Test |
|
||||
|
||||
# Check display
|
||||
Then I should see "Available until" in the "#section-1 .availabilityinfo" "css_element"
|
||||
And I should see "Available until" in the "#section-2 .availabilityinfo" "css_element"
|
||||
And I should see "hidden otherwise" in the "#section-2 .availabilityinfo" "css_element"
|
||||
|
||||
# Change to student view.
|
||||
Given I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" "Course" page logged in as "student1"
|
||||
|
||||
# The contents of both sections should be hidden.
|
||||
Then I should not see "Page 1" in the "region-main" "region"
|
||||
|
||||
@@ -27,6 +27,10 @@ Feature: edit_availability
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "activity" exists:
|
||||
| activity | forum |
|
||||
| course | C1 |
|
||||
| name | MyForum |
|
||||
|
||||
Scenario: Confirm the 'enable availability' option is working
|
||||
Given the following config values are set as admin:
|
||||
@@ -55,12 +59,8 @@ Feature: edit_availability
|
||||
| activity | page |
|
||||
| course | C1 |
|
||||
| idnumber | 0002 |
|
||||
| section | 1 |
|
||||
| name | Page2 |
|
||||
| intro | pageintro |
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Page2"
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I am on the "Page2" "page activity editing" page
|
||||
Then "Restrict access" "fieldset" should exist
|
||||
|
||||
Given I am on "Course 1" course homepage
|
||||
@@ -70,9 +70,12 @@ Feature: edit_availability
|
||||
@javascript
|
||||
Scenario: Edit availability using settings in activity form
|
||||
# Set up.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Page" to section "1"
|
||||
Given the following "activity" exists:
|
||||
| activity | page |
|
||||
| course | C1 |
|
||||
| section | 1 |
|
||||
| name | P1 |
|
||||
And I am on the "P1" "page activity editing" page logged in as "teacher1"
|
||||
And I expand all fieldsets
|
||||
Then I should see "None" in the "Restrict access" "fieldset"
|
||||
|
||||
@@ -178,9 +181,7 @@ Feature: edit_availability
|
||||
# Button does not exist when conditional access restrictions are turned off.
|
||||
Given the following config values are set as admin:
|
||||
| enableavailability | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Forum" to section "1"
|
||||
And I am on the "MyForum" "forum activity editing" page logged in as admin
|
||||
When I expand all fieldsets
|
||||
Then "Add group/grouping access restriction" "button" should not exist
|
||||
|
||||
@@ -190,12 +191,7 @@ Feature: edit_availability
|
||||
Given the following "groupings" exist:
|
||||
| name | course | idnumber |
|
||||
| GX1 | C1 | GXI1 |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Forum" to section "1"
|
||||
And I set the following fields to these values:
|
||||
| Forum name | MyForum |
|
||||
| Description | x |
|
||||
And I am on the "MyForum" "forum activity editing" page logged in as admin
|
||||
When I expand all fieldsets
|
||||
Then the "Add group/grouping access restriction" "button" should be disabled
|
||||
|
||||
|
||||
+17
-6
@@ -128,6 +128,7 @@ class core_backup_external extends external_api {
|
||||
array(
|
||||
'filename' => new external_value(PARAM_FILE, 'Backup filename', VALUE_REQUIRED, null, NULL_NOT_ALLOWED),
|
||||
'contextid' => new external_value(PARAM_INT, 'Context id', VALUE_REQUIRED, null, NULL_NOT_ALLOWED),
|
||||
'backupid' => new external_value(PARAM_ALPHANUMEXT, 'Backup id', VALUE_REQUIRED, null, NULL_NOT_ALLOWED),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -138,9 +139,10 @@ class core_backup_external extends external_api {
|
||||
*
|
||||
* @param string $filename The file name of the backup file.
|
||||
* @param int $contextid The context the backup relates to.
|
||||
* @param string $backupid The backup ID to get the backup settings.
|
||||
* @since Moodle 3.7
|
||||
*/
|
||||
public static function get_async_backup_links_backup($filename, $contextid) {
|
||||
public static function get_async_backup_links_backup($filename, $contextid, $backupid) {
|
||||
// Release session lock.
|
||||
\core\session\manager::write_close();
|
||||
|
||||
@@ -149,7 +151,8 @@ class core_backup_external extends external_api {
|
||||
self::get_async_backup_links_backup_parameters(),
|
||||
array(
|
||||
'filename' => $filename,
|
||||
'contextid' => $contextid
|
||||
'contextid' => $contextid,
|
||||
'backupid' => $backupid,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -158,10 +161,18 @@ class core_backup_external extends external_api {
|
||||
self::validate_context($context);
|
||||
require_capability('moodle/backup:backupcourse', $context);
|
||||
|
||||
if ($cm) {
|
||||
$filearea = 'activity';
|
||||
} else {
|
||||
$filearea = 'course';
|
||||
// Backups without user info or with the anonymise functionality enabled are sent
|
||||
// to user's "user_backup" file area.
|
||||
$filearea = 'backup';
|
||||
// Get useful info to render async status in correct area.
|
||||
$bc = \backup_controller::load_controller($backupid);
|
||||
list($hasusers, $isannon) = \async_helper::get_userdata_backup_settings($bc);
|
||||
if ($hasusers && !$isannon) {
|
||||
if ($cm) {
|
||||
$filearea = 'activity';
|
||||
} else {
|
||||
$filearea = 'course';
|
||||
}
|
||||
}
|
||||
|
||||
$results = \async_helper::get_backup_file_info($filename, $filearea, $contextid);
|
||||
|
||||
@@ -87,7 +87,7 @@ class async_backup_test extends \advanced_testcase {
|
||||
set_config('buffersize', 0, 'logstore_standard');
|
||||
get_log_manager(true);
|
||||
|
||||
// Start backup process.
|
||||
// Case 1: Make a course backup without users.
|
||||
$this->setUser($teacher->id);
|
||||
|
||||
// Make the backup controller for an async backup.
|
||||
@@ -132,6 +132,52 @@ class async_backup_test extends \advanced_testcase {
|
||||
'target' => 'course_backup'], '*', MUST_EXIST);
|
||||
$otherdata = json_decode($logrec->other);
|
||||
$this->assertEquals($backupid, $otherdata->backupid);
|
||||
|
||||
// Check backup was stored in correct area.
|
||||
$usercontextid = $DB->get_field('context', 'id', ['contextlevel' => CONTEXT_USER, 'instanceid' => $teacher->id]);
|
||||
$this->assertEquals(1, $DB->count_records('files', ['contextid' => $usercontextid,
|
||||
'component' => 'user', 'filearea' => 'backup', 'filename' => 'backup.mbz']));
|
||||
|
||||
// Case 2: Make a second backup with users and not anonymised.
|
||||
$this->setAdminUser();
|
||||
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id, backup::FORMAT_MOODLE,
|
||||
backup::INTERACTIVE_YES, backup::MODE_ASYNC, $USER->id);
|
||||
$bc->get_plan()->get_setting('users')->set_status(\backup_setting::NOT_LOCKED);
|
||||
$bc->get_plan()->get_setting('users')->set_value(true);
|
||||
$bc->get_plan()->get_setting('anonymize')->set_value(false);
|
||||
$bc->finish_ui();
|
||||
$backupid = $bc->get_backupid();
|
||||
$bc->destroy();
|
||||
|
||||
// Create the adhoc task.
|
||||
$asynctask = new \core\task\asynchronous_backup_task();
|
||||
$asynctask->set_blocking(false);
|
||||
$asynctask->set_custom_data(['backupid' => $backupid]);
|
||||
\core\task\manager::queue_adhoc_task($asynctask);
|
||||
|
||||
// Execute adhoc task.
|
||||
$now = time();
|
||||
$task = \core\task\manager::get_next_adhoc_task($now);
|
||||
$task->execute();
|
||||
\core\task\manager::adhoc_task_complete($task);
|
||||
|
||||
$postbackuprec = $DB->get_record('backup_controllers', ['backupid' => $backupid]);
|
||||
|
||||
// Check backup was created successfully.
|
||||
$this->assertEquals(backup::STATUS_FINISHED_OK, $postbackuprec->status);
|
||||
$this->assertEquals(1.0, $postbackuprec->progress);
|
||||
$this->assertEquals($USER->id, $postbackuprec->userid);
|
||||
|
||||
// Check that the backupid was logged correctly.
|
||||
$logrec = $DB->get_record('logstore_standard_log', ['userid' => $postbackuprec->userid,
|
||||
'target' => 'course_backup'], '*', MUST_EXIST);
|
||||
$otherdata = json_decode($logrec->other);
|
||||
$this->assertEquals($backupid, $otherdata->backupid);
|
||||
|
||||
// Check backup was stored in correct area.
|
||||
$coursecontextid = $DB->get_field('context', 'id', ['contextlevel' => CONTEXT_COURSE, 'instanceid' => $course->id]);
|
||||
$this->assertEquals(1, $DB->count_records('files', ['contextid' => $coursecontextid,
|
||||
'component' => 'backup', 'filearea' => 'course', 'filename' => 'backup.mbz']));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -313,39 +313,82 @@ class async_helper {
|
||||
* Get markup for in progress async backups,
|
||||
* to use in backup table UI.
|
||||
*
|
||||
* @param \core_backup_renderer $renderer The backup renderer object.
|
||||
* @param string $filearea The filearea to get backup data for.
|
||||
* @param integer $instanceid The context id to get backup data for.
|
||||
* @return array $tabledata the rows of table data.
|
||||
*/
|
||||
public static function get_async_backups($renderer, $instanceid) {
|
||||
public static function get_async_backups($filearea, $instanceid) {
|
||||
global $DB;
|
||||
|
||||
$tabledata = array();
|
||||
$backups = [];
|
||||
|
||||
// Get relevant backup ids based on context instance id.
|
||||
$select = 'itemid = :itemid AND execution = :execution AND status < :status1 AND status > :status2 ' .
|
||||
$table = 'backup_controllers';
|
||||
$select = 'execution = :execution AND status < :status1 AND status > :status2 ' .
|
||||
'AND operation = :operation';
|
||||
$params = [
|
||||
'itemid' => $instanceid,
|
||||
'execution' => backup::EXECUTION_DELAYED,
|
||||
'status1' => backup::STATUS_FINISHED_ERR,
|
||||
'status2' => backup::STATUS_NEED_PRECHECK,
|
||||
'operation' => 'backup',
|
||||
];
|
||||
$sort = 'timecreated DESC';
|
||||
$fields = 'id, backupid, status, timecreated';
|
||||
|
||||
$backups = $DB->get_records_select('backup_controllers', $select, $params, 'timecreated DESC', 'id, backupid, timecreated');
|
||||
foreach ($backups as $backup) {
|
||||
$bc = \backup_controller::load_controller($backup->backupid); // Get the backup controller.
|
||||
$filename = $bc->get_plan()->get_setting('filename')->get_value();
|
||||
$timecreated = $backup->timecreated;
|
||||
$status = $renderer->get_status_display($bc->get_status(), $bc->get_backupid());
|
||||
$bc->destroy();
|
||||
if ($filearea == 'backup') {
|
||||
// Get relevant backup ids based on user id.
|
||||
$params['userid'] = $instanceid;
|
||||
$select = 'userid = :userid AND ' . $select;
|
||||
$records = $DB->get_records_select($table, $select, $params, $sort, $fields);
|
||||
foreach ($records as $record) {
|
||||
$bc = \backup_controller::load_controller($record->backupid);
|
||||
|
||||
$tablerow = array($filename, userdate($timecreated), '-', '-', '-', $status);
|
||||
$tabledata[] = $tablerow;
|
||||
// Get useful info to render async status in correct area.
|
||||
list($hasusers, $isannon) = self::get_userdata_backup_settings($bc);
|
||||
// Backup has users and is not anonymised -> don't show it in users backup file area.
|
||||
if ($hasusers && !$isannon) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$record->filename = $bc->get_plan()->get_setting('filename')->get_value();
|
||||
$bc->destroy();
|
||||
array_push($backups, $record);
|
||||
}
|
||||
} else {
|
||||
if ($filearea == 'course' || $filearea == 'activity') {
|
||||
// Get relevant backup ids based on context instance id.
|
||||
$params['itemid'] = $instanceid;
|
||||
$select = 'itemid = :itemid AND ' . $select;
|
||||
$records = $DB->get_records_select($table, $select, $params, $sort, $fields);
|
||||
foreach ($records as $record) {
|
||||
$bc = \backup_controller::load_controller($record->backupid);
|
||||
|
||||
// Get useful info to render async status in correct area.
|
||||
list($hasusers, $isannon) = self::get_userdata_backup_settings($bc);
|
||||
// Backup has no user or is anonymised -> don't show it in course/activity backup file area.
|
||||
if (!$hasusers || $isannon) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$record->filename = $bc->get_plan()->get_setting('filename')->get_value();
|
||||
$bc->destroy();
|
||||
array_push($backups, $record);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $tabledata;
|
||||
return $backups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user data settings for backups.
|
||||
*
|
||||
* @param \backup_controller $backupcontroller The backup controller object.
|
||||
* @return array Array of user data settings.
|
||||
*/
|
||||
public static function get_userdata_backup_settings(\backup_controller $backupcontroller): array {
|
||||
$hasusers = (bool)$backupcontroller->get_plan()->get_setting('users')->get_value(); // Backup has users.
|
||||
$isannon = (bool)$backupcontroller->get_plan()->get_setting('anonymize')->get_value(); // Backup is anonymised.
|
||||
return [$hasusers, $isannon];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -331,7 +331,7 @@ abstract class backup_helper {
|
||||
// enabled are sent to user's "user_backup"
|
||||
// file area. Maintenance of such area is responsibility of
|
||||
// the user via corresponding file manager frontend
|
||||
if ($backupmode == backup::MODE_GENERAL && (!$hasusers || $isannon)) {
|
||||
if (($backupmode == backup::MODE_GENERAL || $backupmode == backup::MODE_ASYNC) && (!$hasusers || $isannon)) {
|
||||
$ctxid = context_user::instance($userid)->id;
|
||||
$component = 'user';
|
||||
$filearea = 'backup';
|
||||
|
||||
@@ -140,12 +140,11 @@ class async_helper_test extends \advanced_testcase {
|
||||
unset($bc);
|
||||
|
||||
$coursecontext = \context_course::instance($course->id);
|
||||
$renderer = $PAGE->get_renderer('core', 'backup');
|
||||
|
||||
$result = \async_helper::get_async_backups($renderer, $coursecontext->instanceid);
|
||||
$result = \async_helper::get_async_backups('course', $coursecontext->instanceid);
|
||||
|
||||
$this->assertEquals(1, count($result));
|
||||
$this->assertEquals('backup.mbz', $result[0][0]);
|
||||
$this->assertEquals('backup.mbz', $result[0]->filename);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -100,7 +100,8 @@ define(['jquery', 'core/ajax', 'core/str', 'core/notification', 'core/templates'
|
||||
methodname: 'core_backup_get_async_backup_links_backup',
|
||||
args: {
|
||||
'filename': filename,
|
||||
'contextid': contextid
|
||||
'contextid': contextid,
|
||||
'backupid': backupid
|
||||
},
|
||||
}])[0].done(function(response) {
|
||||
// We have the data now update the UI.
|
||||
|
||||
@@ -619,10 +619,10 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function render_backup_files_viewer(backup_files_viewer $viewer) {
|
||||
global $CFG;
|
||||
|
||||
$files = $viewer->files;
|
||||
|
||||
$async = async_helper::is_async_enabled();
|
||||
$async = \async_helper::is_async_enabled();
|
||||
|
||||
$tablehead = array(
|
||||
get_string('filename', 'backup'),
|
||||
@@ -638,16 +638,21 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
$table->attributes['class'] = 'backup-files-table generaltable';
|
||||
$table->head = $tablehead;
|
||||
$table->width = '100%';
|
||||
$table->data = array();
|
||||
$table->data = [];
|
||||
|
||||
// First add in progress asynchronous backups.
|
||||
// Only if asynchronous backups are enabled.
|
||||
// Also only render async status in correct area. Courese OR activity (not both).
|
||||
if ($async
|
||||
&& (($viewer->filearea == 'course' && $viewer->currentcontext->contextlevel == CONTEXT_COURSE)
|
||||
|| ($viewer->filearea == 'activity' && $viewer->currentcontext->contextlevel == CONTEXT_MODULE))
|
||||
) {
|
||||
$table->data = \async_helper::get_async_backups($this, $viewer->currentcontext->instanceid);
|
||||
if ($async) {
|
||||
$tabledata = [];
|
||||
$backups = \async_helper::get_async_backups($viewer->filearea, $viewer->filecontext->instanceid);
|
||||
// For each backup get, new item name, time restore created and progress.
|
||||
foreach ($backups as $backup) {
|
||||
$status = $this->get_status_display($backup->status, $backup->backupid);
|
||||
$timecreated = $backup->timecreated;
|
||||
$tablerow = [$backup->filename, userdate($timecreated), '-', '-', '-', $status];
|
||||
$tabledata[] = $tablerow;
|
||||
}
|
||||
$table->data = $tabledata;
|
||||
}
|
||||
|
||||
// Add completed backups.
|
||||
|
||||
@@ -85,6 +85,7 @@ abstract class restore_search_base implements renderable {
|
||||
public function __construct(array $config = array()) {
|
||||
|
||||
$this->search = optional_param($this->get_varsearch(), self::DEFAULT_SEARCH, PARAM_NOTAGS);
|
||||
$this->search = trim($this->search);
|
||||
$this->maxresults = get_config('backup', 'import_general_maxresults');
|
||||
|
||||
foreach ($config as $name => $value) {
|
||||
|
||||
@@ -20,13 +20,13 @@ Feature: Import course's contents into another course
|
||||
Scenario: Import course's contents to another course
|
||||
Given I log in as "teacher1"
|
||||
And the following "activities" exist:
|
||||
| activity | name | intro | course | idnumber | section |
|
||||
| data | Test database name | Test database description | C1 | database1 | 2 |
|
||||
| forum | Test forum name | Test forum name description | C1 | forum1 | 1 |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Comments" block
|
||||
And I add the "Recent blog entries" block
|
||||
And I turn editing mode off
|
||||
| activity | name | course | idnumber |
|
||||
| data | Test database name | C1 | database1 |
|
||||
| forum | Test forum name | C1 | forum1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | Course | C1 | course-view-* | side-pre |
|
||||
| blog_recent | Course | C1 | course-view-* | side-pre |
|
||||
When I import "Course 1" course into "Course 2" course using this options:
|
||||
Then I should see "Test database name"
|
||||
And I should see "Test forum name"
|
||||
|
||||
@@ -12,16 +12,16 @@ Feature: Restore Moodle 2 course backups
|
||||
| Course 3 | C3 | 0 | topics | 2 | 0 |
|
||||
| Course 4 | C4 | 0 | topics | 20 | 0 |
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro | section | externalurl |
|
||||
| assign | C3 | assign1 | Test assign name | Assign description | 1 | |
|
||||
| data | C3 | data1 | Test database name | Database description | 2 | |
|
||||
| url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org |
|
||||
| activity | course | idnumber | name | intro | section | externalurl |
|
||||
| assign | C3 | assign1 | Test assign name | Assign description | 1 | |
|
||||
| data | C3 | data1 | Test database name | Database description | 2 | |
|
||||
| forum | C1 | 0001 | Test forum name | | 1 | |
|
||||
| url | C1 | url1 | Test URL name | Test URL description | 3 | http://www.moodle.org |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| activity_modules | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
And I add the "Activities" block
|
||||
|
||||
@javascript
|
||||
Scenario: Restore a course in another existing course
|
||||
@@ -63,10 +63,11 @@ Feature: Restore Moodle 2 course backups
|
||||
Scenario: Restore a backup into the same course removing it's contents before that
|
||||
When I backup "Course 1" course using this options:
|
||||
| Confirmation | Filename | test_backup.mbz |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum post backup name |
|
||||
| Description | Test forum post backup description |
|
||||
And the following "activity" exists:
|
||||
| activity | forum |
|
||||
| course | C1 |
|
||||
| section | 1 |
|
||||
| name | Test forum post backup name |
|
||||
And I am on the "Course 1" "restore" page
|
||||
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
|
||||
| Schema | Section 3 | 0 |
|
||||
|
||||
@@ -50,7 +50,7 @@ if (!is_null($storedsecret)) {
|
||||
// Make sure we have all the required information before trying to save the connection.
|
||||
$backpackuid = $bp->authenticate();
|
||||
if (empty($backpackuid) || !empty($backpackuid->error)) {
|
||||
redirect(new moodle_url($redirect), get_string('backpackconnectionunexpectedresult', 'badges'),
|
||||
redirect(new moodle_url($redirect), get_string('backpackconnectionunexpectedresult', 'badges', $backpackuid->error),
|
||||
null, \core\output\notification::NOTIFY_ERROR);
|
||||
}
|
||||
|
||||
|
||||
@@ -272,8 +272,34 @@ class backpack_api2p1 {
|
||||
$msg['status'] = \core\output\notification::NOTIFY_SUCCESS;
|
||||
$msg['message'] = get_string('addedtobackpack', 'badges');
|
||||
} else {
|
||||
if ($response) {
|
||||
// Although the specification defines that status error is a string, some providers, like Badgr, are wrongly
|
||||
// returning an array. It has been reported, but adding these extra checks doesn't hurt, just in case.
|
||||
if (
|
||||
property_exists($response, 'status') &&
|
||||
is_object($response->status) &&
|
||||
property_exists($response->status, 'error')
|
||||
) {
|
||||
$statuserror = $response->status->error;
|
||||
if (is_array($statuserror)) {
|
||||
$statuserror = implode($statuserror);
|
||||
}
|
||||
} else if (property_exists($response, 'error')) {
|
||||
$statuserror = $response->error;
|
||||
if (property_exists($response, 'message')) {
|
||||
$statuserror .= '. Message: ' . $response->message;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$statuserror = 'Empty response';
|
||||
}
|
||||
$data = [
|
||||
'badgename' => $data['assertion']['badge']['name'],
|
||||
'error' => $statuserror,
|
||||
];
|
||||
|
||||
$msg['status'] = \core\output\notification::NOTIFY_ERROR;
|
||||
$msg['message'] = get_string('backpackexporterror', 'badges', $data['assertion']['badge']['name']);
|
||||
$msg['message'] = get_string('backpackexporterrorwithinfo', 'badges', $data);
|
||||
}
|
||||
return $msg;
|
||||
}
|
||||
|
||||
@@ -125,29 +125,38 @@ class backpack extends external_backpack {
|
||||
* Validates form data
|
||||
*/
|
||||
public function validation($data, $files) {
|
||||
global $CFG;
|
||||
|
||||
$errors = parent::validation($data, $files);
|
||||
if (badges_open_badges_backpack_api() == OPEN_BADGES_V2P1) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// We don't need to verify the email address if we're clearing a pending email verification attempt.
|
||||
if (isset($data['revertbutton'])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$errors = [];
|
||||
// Email and password can't be blank.
|
||||
if (empty($data['backpackemail'])) {
|
||||
$errors['backpackemail'] = get_string('backpackemail_required', 'badges');
|
||||
}
|
||||
if (empty($data['password'])) {
|
||||
$errors['password'] = get_string('password_required', 'badges');
|
||||
}
|
||||
if (!empty($errors)) {
|
||||
return $errors;
|
||||
}
|
||||
// We don't need to verify the email address if we're clearing a pending email verification attempt.
|
||||
if (!isset($data['revertbutton'])) {
|
||||
$check = new stdClass();
|
||||
$check->email = $data['backpackemail'];
|
||||
$check->password = $data['password'];
|
||||
$sitebackpack = badges_get_site_backpack($data['externalbackpackid']);
|
||||
$bp = new \core_badges\backpack_api($sitebackpack, $check);
|
||||
|
||||
$result = $bp->authenticate();
|
||||
if ($result === false || !empty($result->error)) {
|
||||
$errors['backpackemail'] = get_string('backpackconnectionunexpectedresult', 'badges');
|
||||
$msg = $bp->get_authentication_error();
|
||||
if (!empty($msg)) {
|
||||
$errors['backpackemail'] .= '<br/><br/>';
|
||||
$errors['backpackemail'] .= get_string('backpackconnectionunexpectedmessage', 'badges', $msg);
|
||||
}
|
||||
}
|
||||
// Check the given credentials (email and password) are valid for this backpack.
|
||||
$check = new stdClass();
|
||||
$check->email = $data['backpackemail'];
|
||||
$check->password = $data['password'];
|
||||
$sitebackpack = badges_get_site_backpack($data['externalbackpackid']);
|
||||
$bp = new \core_badges\backpack_api($sitebackpack, $check);
|
||||
|
||||
$result = $bp->authenticate();
|
||||
if ($result === false || !empty($result->error)) {
|
||||
$msg = $bp->get_authentication_error();
|
||||
$errors['backpackemail'] = get_string('backpackconnectionunexpectedresult', 'badges', $msg);
|
||||
}
|
||||
return $errors;
|
||||
}
|
||||
|
||||
@@ -236,6 +236,7 @@ class award_criteria_activity extends award_criteria {
|
||||
* @return array list($join, $where, $params)
|
||||
*/
|
||||
public function get_completed_criteria_sql() {
|
||||
global $DB;
|
||||
$join = '';
|
||||
$where = '';
|
||||
$params = array();
|
||||
@@ -257,18 +258,41 @@ class award_criteria_activity extends award_criteria {
|
||||
}
|
||||
return array($join, $where, $params);
|
||||
} else {
|
||||
foreach ($this->params as $param) {
|
||||
$join .= " LEFT JOIN {course_modules_completion} cmc{$param['module']} ON
|
||||
cmc{$param['module']}.userid = u.id AND
|
||||
cmc{$param['module']}.coursemoduleid = :completedmodule{$param['module']} AND
|
||||
( cmc{$param['module']}.completionstate = :completionpass{$param['module']} OR
|
||||
cmc{$param['module']}.completionstate = :completionfail{$param['module']} OR
|
||||
cmc{$param['module']}.completionstate = :completioncomplete{$param['module']} )";
|
||||
$where .= " AND cmc{$param['module']}.coursemoduleid IS NOT NULL ";
|
||||
$params["completedmodule{$param['module']}"] = $param['module'];
|
||||
$params["completionpass{$param['module']}"] = COMPLETION_COMPLETE_PASS;
|
||||
$params["completionfail{$param['module']}"] = COMPLETION_COMPLETE_FAIL;
|
||||
$params["completioncomplete{$param['module']}"] = COMPLETION_COMPLETE;
|
||||
// Get all cmids of modules related to the criteria.
|
||||
$cmids = array_map(fn ($x) => $x['module'], $this->params);
|
||||
list($cmcmodulessql, $paramscmc) = $DB->get_in_or_equal($cmids, SQL_PARAMS_NAMED);
|
||||
|
||||
// Create a sql query to get all users who have worked on these course modules.
|
||||
$sql = "SELECT DISTINCT userid FROM {course_modules_completion} cmc "
|
||||
. "WHERE coursemoduleid " . $cmcmodulessql . " AND "
|
||||
. "( cmc.completionstate IN ( :completionpass, :completionfail, :completioncomplete ) )";
|
||||
$paramscmcs = [
|
||||
'completionpass' => COMPLETION_COMPLETE_PASS,
|
||||
'completionfail' => COMPLETION_COMPLETE_FAIL,
|
||||
'completioncomplete' => COMPLETION_COMPLETE
|
||||
];
|
||||
$paramscmc = array_merge($paramscmc, $paramscmcs);
|
||||
$userids = $DB->get_records_sql($sql, $paramscmc);
|
||||
|
||||
// Now check each user if the user has a completion of each module.
|
||||
$useridsbadgeable = array_keys(array_filter(
|
||||
$userids,
|
||||
function ($user) use ($cmcmodulessql, $paramscmc, $cmids) {
|
||||
global $DB;
|
||||
$params = array_merge($paramscmc, ['userid' => $user->userid]);
|
||||
$select = "coursemoduleid " . $cmcmodulessql . " AND userid = :userid";
|
||||
$cmidsuser = $DB->get_fieldset_select('course_modules_completion', 'coursemoduleid', $select, $params);
|
||||
return empty(array_diff($cmidsuser, $cmids));
|
||||
}
|
||||
));
|
||||
|
||||
// Finally create a where statement (if neccessary) with all userids who are allowed to get the badge.
|
||||
// This list also includes all users who have previously received the badge. These are filtered out in the badge.php.
|
||||
$join = "";
|
||||
$where = "";
|
||||
if (!empty($useridsbadgeable)) {
|
||||
list($wherepart, $params) = $DB->get_in_or_equal($useridsbadgeable, SQL_PARAMS_NAMED);
|
||||
$where = " AND u.id " . $wherepart;
|
||||
}
|
||||
return array($join, $where, $params);
|
||||
}
|
||||
|
||||
@@ -139,6 +139,7 @@ if ($backpack) {
|
||||
badges_disconnect_user_backpack($USER->id);
|
||||
redirect(new moodle_url('/badges/mybackpack.php'));
|
||||
} else if (isset($data->backpackemail)) {
|
||||
// There are no errors, so the verification email can be sent.
|
||||
if (badges_send_verification_email($data->backpackemail, $data->externalbackpackid, $data->password)) {
|
||||
$a = get_user_preferences('badges_email_verify_backpackid');
|
||||
redirect(new moodle_url('/badges/mybackpack.php'),
|
||||
|
||||
@@ -31,6 +31,7 @@ require_once($CFG->libdir . '/badgeslib.php');
|
||||
require_once($CFG->dirroot . '/badges/lib.php');
|
||||
|
||||
use core_badges\helper;
|
||||
use core\task\manager;
|
||||
|
||||
class badgeslib_test extends advanced_testcase {
|
||||
protected $badgeid;
|
||||
@@ -511,6 +512,84 @@ class badgeslib_test extends advanced_testcase {
|
||||
$this->assertEquals(badge_message_from_template($message, $params), $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for working around the 61 tables join limit of mysql in award_criteria_activity in combination with the scheduled task.
|
||||
*
|
||||
* @covers \core_badges\badge::review_all_criteria
|
||||
*/
|
||||
public function test_badge_activity_criteria_with_a_huge_number_of_coursemodules() {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot.'/completion/criteria/completion_criteria_activity.php');
|
||||
|
||||
if (!PHPUNIT_LONGTEST) {
|
||||
$this->markTestSkipped('PHPUNIT_LONGTEST is not defined');
|
||||
}
|
||||
|
||||
// Messaging is not compatible with transactions.
|
||||
$this->preventResetByRollback();
|
||||
|
||||
// Create more than 61 modules to potentially trigger an mysql db error.
|
||||
$assigncount = 75;
|
||||
$assigns = [];
|
||||
for ($i = 1; $i <= $assigncount; $i++) {
|
||||
$assigns[] = $this->getDataGenerator()->create_module('assign', ['course' => $this->course->id], ['completion' => 1]);
|
||||
}
|
||||
$assigncmids = array_flip(array_map(fn ($assign) => $assign->cmid, $assigns));
|
||||
$criteriaactivityarray = array_fill_keys(array_keys($assigncmids), 1);
|
||||
|
||||
// Set completion criteria.
|
||||
$criteriadata = (object) [
|
||||
'id' => $this->course->id,
|
||||
'criteria_activity' => $criteriaactivityarray,
|
||||
];
|
||||
$criterion = new completion_criteria_activity();
|
||||
$criterion->update_config($criteriadata);
|
||||
|
||||
$badge = new badge($this->coursebadge);
|
||||
|
||||
$criteriaoverall = award_criteria::build(array('criteriatype' => BADGE_CRITERIA_TYPE_OVERALL, 'badgeid' => $badge->id));
|
||||
$criteriaoverall->save(array('agg' => BADGE_CRITERIA_AGGREGATION_ANY));
|
||||
$criteriaactivity = award_criteria::build(['criteriatype' => BADGE_CRITERIA_TYPE_ACTIVITY, 'badgeid' => $badge->id]);
|
||||
|
||||
$modulescrit = ['agg' => BADGE_CRITERIA_AGGREGATION_ALL];
|
||||
foreach ($assigns as $assign) {
|
||||
$modulescrit['module_' . $assign->cmid] = $assign->cmid;
|
||||
}
|
||||
$criteriaactivity->save($modulescrit);
|
||||
|
||||
// Take one assign to complete it later.
|
||||
$assigntemp = array_shift($assigns);
|
||||
|
||||
// Mark the user to complete the modules.
|
||||
foreach ($assigns as $assign) {
|
||||
$cmassign = get_coursemodule_from_id('assign', $assign->cmid);
|
||||
$completion = new \completion_info($this->course);
|
||||
$completion->update_state($cmassign, COMPLETION_COMPLETE, $this->user->id);
|
||||
}
|
||||
|
||||
// Run the scheduled task to issue the badge. But the badge should not be issued.
|
||||
ob_start();
|
||||
$task = manager::get_scheduled_task('core\task\badges_cron_task');
|
||||
$task->execute();
|
||||
ob_end_clean();
|
||||
|
||||
$this->assertFalse($badge->is_issued($this->user->id));
|
||||
|
||||
// Now complete the last uncompleted module.
|
||||
$cmassign = get_coursemodule_from_id('assign', $assigntemp->cmid);
|
||||
$completion = new \completion_info($this->course);
|
||||
$completion->update_state($cmassign, COMPLETION_COMPLETE, $this->user->id);
|
||||
|
||||
// Run the scheduled task to issue the badge. Now the badge schould be issued.
|
||||
ob_start();
|
||||
$task = manager::get_scheduled_task('core\task\badges_cron_task');
|
||||
$task->execute();
|
||||
ob_end_clean();
|
||||
|
||||
$this->assertDebuggingCalled('Error baking badge image!');
|
||||
$this->assertTrue($badge->is_issued($this->user->id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test badges observer when course module completion event id fired.
|
||||
*/
|
||||
|
||||
@@ -181,3 +181,18 @@ Feature: Backpack badges
|
||||
And I set the field "externalbackpackid" to "https://test.com/"
|
||||
And I should see "Email address"
|
||||
And I should see "Password"
|
||||
|
||||
@javascript
|
||||
Scenario: Check backpack form validation as a student
|
||||
Given I log in as "student1"
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Backpack settings"
|
||||
And I set the field "externalbackpackid" to "https://test.com/"
|
||||
And I set the field "password" to ""
|
||||
When I click on "Connect to backpack" "button"
|
||||
Then I should see "Password can't be blank"
|
||||
And I should not see "Email address can't be blank"
|
||||
And I set the field "backpackemail" to ""
|
||||
And I click on "Connect to backpack" "button"
|
||||
And I should see "Email address can't be blank"
|
||||
And I should see "Password can't be blank"
|
||||
|
||||
@@ -21,8 +21,10 @@ Feature: The activity results block doesn't display student scores for unsupport
|
||||
Given the following "activities" exist:
|
||||
| activity | name | intro | course | section | idnumber | assignsubmission_file_enabled |
|
||||
| assign | Test assignment | Offline text | C1 | 1 | assign1 | 0 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| activity_results | Course | C1 | course-view-* | side-pre |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add the "Activity results" block
|
||||
And I configure the "Activity results" block
|
||||
And I set the following fields to these values:
|
||||
| config_showbest | 1 |
|
||||
@@ -30,8 +32,7 @@ Feature: The activity results block doesn't display student scores for unsupport
|
||||
| config_gradeformat | Percentages |
|
||||
| config_nameformat | Display full names |
|
||||
And I press "Save changes"
|
||||
When I follow "Test assignment"
|
||||
And I navigate to "Settings" in current page administration
|
||||
When I am on the "Test assignment" "assign activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| id_grade_modgrade_type | None |
|
||||
And I press "Save and return to course"
|
||||
|
||||
@@ -21,8 +21,6 @@ Feature: The activity results block can have administrator set defaults
|
||||
| course | C1 |
|
||||
| idnumber | 0001 |
|
||||
| name | Test assignment |
|
||||
| intro | Offline text |
|
||||
| section | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
@@ -50,8 +48,10 @@ Feature: The activity results block can have administrator set defaults
|
||||
| config_showbest_locked | 1 | block_activity_results |
|
||||
| config_showworst | 0 | block_activity_results |
|
||||
| config_showworst_locked | 1 | block_activity_results |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| activity_results | Course | C1 | course-view-* | side-pre |
|
||||
And I am on "Course 1" course homepage
|
||||
And I add the "Activity results" block
|
||||
When I configure the "Activity results" block
|
||||
And the following fields match these values:
|
||||
| config_showbest | 0 |
|
||||
|
||||
@@ -14,13 +14,10 @@ Feature: Enable Block Badges on the frontpage and view awarded badges
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Latest badges" block
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| badges | System | 1 | site-index | side-pre |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
# Issue badge 1 of 2
|
||||
And I navigate to "Badges > Add a new badge" in current page administration
|
||||
And I set the following fields to these values:
|
||||
@@ -37,7 +34,5 @@ Feature: Enable Block Badges on the frontpage and view awarded badges
|
||||
And I press "Award badge"
|
||||
And I set the field "potentialrecipients[]" to "Teacher 1 (teacher1@example.com)"
|
||||
And I press "Award badge"
|
||||
And I log out
|
||||
When I log in as "teacher1"
|
||||
And I am on site homepage
|
||||
When I am on site homepage
|
||||
Then I should see "Badge 1" in the "Latest badges" "block"
|
||||
|
||||
@@ -26,16 +26,12 @@ Feature: Enable Block blog menu in an activity
|
||||
| idnumber | 0001 |
|
||||
| section | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "Test assignment 1"
|
||||
And I add the "Blog menu" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| blog_menu | Activity module | 0001 | mod-assign-view | side-pre |
|
||||
|
||||
Scenario: Students use the blog menu block to post blogs
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
Given I am on the "Test assignment 1" "assign activity" page logged in as student1
|
||||
And I follow "Add a new entry"
|
||||
When I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -43,16 +39,13 @@ Feature: Enable Block blog menu in an activity
|
||||
And I press "Save changes"
|
||||
Then I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog!"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
And I follow "Blog entries"
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog!"
|
||||
|
||||
Scenario: Students use the blog menu block to view their blogs about the activity
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
Given I am on the "Test assignment 1" "assign activity" page logged in as student1
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -61,10 +54,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this Assignment!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -73,8 +63,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 Second Blog"
|
||||
And I should see "My unrelated blog!"
|
||||
And I should not see "Associated Assignment: Test assignment 1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 First Blog |
|
||||
@@ -83,17 +72,14 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 First Blog"
|
||||
And I should see "My course blog is better!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
When I follow "View my entries about this Assignment"
|
||||
Then I should see "S2 First Blog"
|
||||
And I should not see "S2 Second Blog"
|
||||
And I should not see "S1 First Blog"
|
||||
|
||||
Scenario: Students use the blog menu block to view all blogs about the assignment
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
Given I am on the "Test assignment 1" "assign activity" page logged in as student1
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -102,10 +88,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this Assignment!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -114,8 +97,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 Second Blog"
|
||||
And I should see "My unrelated blog!"
|
||||
And I should not see "Associated Assignment: Test assignment 1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 First Blog |
|
||||
@@ -124,17 +106,14 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 First Blog"
|
||||
And I should see "My course blog is better!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
When I follow "View all entries about this Assignment"
|
||||
Then I should see "S1 First Blog"
|
||||
And I should see "S2 First Blog"
|
||||
And I should not see "S2 Second Blog"
|
||||
|
||||
Scenario: Students use the blog menu block to view all their blog entries
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
Given I am on the "Test assignment 1" "assign activity" page logged in as student1
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -143,10 +122,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this Assignment!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -155,8 +131,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 Second Blog"
|
||||
And I should see "My unrelated blog!"
|
||||
And I should not see "Associated Assignment: Test assignment 1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 First Blog |
|
||||
@@ -165,17 +140,14 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 First Blog"
|
||||
And I should see "My course blog is better!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
When I follow "Blog entries"
|
||||
Then I should see "S2 First Blog"
|
||||
And I should see "S2 Second Blog"
|
||||
And I should not see "S1 First Blog"
|
||||
|
||||
Scenario: Teacher searches for student blogs
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
Given I am on the "Test assignment 1" "assign activity" page logged in as student1
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -184,10 +156,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this Assignment!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -196,8 +165,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 Second Blog"
|
||||
And I should see "My unrelated blog!"
|
||||
And I should not see "Associated Assignment: Test assignment 1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
And I am on the "Test assignment 1" "assign activity" page
|
||||
And I follow "Add an entry about this Assignment"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 First Blog |
|
||||
@@ -206,10 +174,7 @@ Feature: Enable Block blog menu in an activity
|
||||
And I should see "S2 First Blog"
|
||||
And I should see "My course blog is better!"
|
||||
And I should see "Associated Assignment: Test assignment 1"
|
||||
And I log out
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
When I am on the "Test assignment 1" "assign activity" page logged in as teacher1
|
||||
And I set the field "Search" to "First"
|
||||
And I press "Search"
|
||||
Then I should see "S1 First Blog"
|
||||
|
||||
@@ -18,14 +18,12 @@ Feature: Students can use block blog menu in a course
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Blog menu" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| blog_menu | Course | C1 | course-view-* | side-pre |
|
||||
|
||||
Scenario: Students use the blog menu block to post blogs
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Add a new entry"
|
||||
When I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -39,8 +37,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should see "This is my awesome blog!"
|
||||
|
||||
Scenario: Students use the blog menu block to view their blogs about the course
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Add an entry about this course"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -49,9 +46,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this course!"
|
||||
And I should see "Associated Course: C1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -76,8 +71,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should not see "S1 First Blog"
|
||||
|
||||
Scenario: Students use the blog menu block to view all blogs about the course
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Add an entry about this course"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -86,9 +80,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this course!"
|
||||
And I should see "Associated Course: C1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -113,8 +105,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should not see "S2 Second Blog"
|
||||
|
||||
Scenario: Students use the blog menu block to view all their blog entries
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Add an entry about this course"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -123,9 +114,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this course!"
|
||||
And I should see "Associated Course: C1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -150,8 +139,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should not see "S1 First Blog"
|
||||
|
||||
Scenario: Teacher searches for student blogs
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Add an entry about this course"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -160,9 +148,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should see "S1 First Blog"
|
||||
And I should see "This is my awesome blog about this course!"
|
||||
And I should see "Associated Course: C1"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student2
|
||||
And I follow "Add a new entry"
|
||||
And I set the following fields to these values:
|
||||
| Entry title | S2 Second Blog |
|
||||
@@ -180,9 +166,7 @@ Feature: Students can use block blog menu in a course
|
||||
And I should see "S2 First Blog"
|
||||
And I should see "My course blog is better!"
|
||||
And I should see "Associated Course: C1"
|
||||
And I log out
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as teacher1
|
||||
And I set the field "Search" to "First"
|
||||
And I press "Search"
|
||||
Then I should see "S1 First Blog"
|
||||
|
||||
@@ -8,11 +8,9 @@ Feature: Enable Block blog menu on the frontpage
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Blog menu" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| blog_menu | System | 1 | site-index | side-pre |
|
||||
|
||||
Scenario: Students use the blog menu block to post blogs
|
||||
Given I log in as "student1"
|
||||
|
||||
@@ -26,17 +26,13 @@ Feature: Students can use the recent blog entries block to view recent entries o
|
||||
| intro | Offline text |
|
||||
| section | 1 |
|
||||
| assignsubmission_file_enabled | 0 |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "Test assignment 1"
|
||||
And I add the "Blog menu" block
|
||||
And I add the "Recent blog entries" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| blog_menu | Activity module | 0001 | mod-assign-view | side-pre |
|
||||
| blog_recent | Activity module | 0001 | mod-assign-view | side-pre |
|
||||
|
||||
Scenario: Students use the recent blog entries block to view blogs
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
Given I am on the "Test assignment 1" "assign activity" page logged in as student1
|
||||
And I follow "Add an entry about this Assignment"
|
||||
When I set the following fields to these values:
|
||||
| Entry title | S1 First Blog |
|
||||
@@ -50,9 +46,7 @@ Feature: Students can use the recent blog entries block to view recent entries o
|
||||
And I should see "This is my awesome blog!"
|
||||
|
||||
Scenario: Students only see a few entries in the recent blog entries block
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test assignment 1"
|
||||
Given I am on the "Test assignment 1" "assign activity" page logged in as student1
|
||||
And I follow "Add an entry about this Assignment"
|
||||
# Blog 1 of 5
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -16,17 +16,15 @@ Feature: Students can use the recent blog entries block to view recent entries o
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| blog_menu | Course | C1 | course-view-* | side-pre |
|
||||
| blog_recent | Course | C1 | course-view-* | side-pre |
|
||||
And the "multilang" filter is "on"
|
||||
And the "multilang" filter applies to "content and headings"
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Blog menu" block
|
||||
And I add the "Recent blog entries" block
|
||||
And I log out
|
||||
|
||||
Scenario: Students use the recent blog entries block to view blogs
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Add an entry about this course"
|
||||
When I set the following fields to these values:
|
||||
| Entry title | S1 First Blog <span lang="RU" class="multilang">RUSSIAN</span><span lang="EN" class="multilang">ENGLISH</span> |
|
||||
@@ -40,8 +38,7 @@ Feature: Students can use the recent blog entries block to view recent entries o
|
||||
And I should see "This is my awesome blog!"
|
||||
|
||||
Scenario: Students only see a few entries in the recent blog entries block
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Add an entry about this course"
|
||||
# Blog 1 of 5
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -8,12 +8,14 @@ Feature: Feature: Students can use the recent blog entries block to view recent
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| blog_recent | System | 1 | site-index | side-pre |
|
||||
And the following config values are set as admin:
|
||||
| unaddableblocks | | theme_boost|
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Recent blog entries" block
|
||||
And the following config values are set as admin:
|
||||
| unaddableblocks | | theme_boost|
|
||||
# TODO MDL-57120 site "Blogs" link not accessible without navigation block.
|
||||
And I add the "Navigation" block if not present
|
||||
And I log out
|
||||
|
||||
@@ -52,9 +52,10 @@ Feature: Enable the calendar block in a course and test it's functionality
|
||||
|
||||
@javascript
|
||||
Scenario: View a user event in the calendar block
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Calendar" block
|
||||
Given the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| calendar_month | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "teacher1"
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | User |
|
||||
| id_name | User Event |
|
||||
@@ -72,9 +73,7 @@ Feature: Enable the calendar block in a course and test it's functionality
|
||||
| user | group |
|
||||
| student1 | G1 |
|
||||
| student2 | G2 |
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Settings" in current page administration
|
||||
When I am on the "Course 1" "course editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| id_groupmode | Separate groups |
|
||||
| id_groupmodeforce | Yes |
|
||||
@@ -87,12 +86,8 @@ Feature: Enable the calendar block in a course and test it's functionality
|
||||
| Type of event | group |
|
||||
| Group | Group 1 |
|
||||
| Event title | Group Event |
|
||||
And I log out
|
||||
Then I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I hover over today in the mini-calendar block
|
||||
And I should see "Group Event"
|
||||
And I log out
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I should see "Group Event"
|
||||
And I am on the "Course 1" course page logged in as student2
|
||||
And I should not see "Group Event"
|
||||
|
||||
@@ -9,10 +9,10 @@ Feature: Enable the calendar block on the site front page
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| calendar_month | System | 1 | site-index | side-pre |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Calendar" block
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | Site |
|
||||
| id_name | Site Event |
|
||||
|
||||
@@ -8,6 +8,9 @@ Feature: View a site event on the frontpage
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| calendar_upcoming | System | 1 | site-index | side-pre |
|
||||
|
||||
@javascript
|
||||
Scenario: View a site event in the upcoming events block on the frontpage
|
||||
@@ -15,9 +18,6 @@ Feature: View a site event on the frontpage
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | Site |
|
||||
| id_name | My Site Event |
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Upcoming events" block
|
||||
And I log out
|
||||
When I log in as "teacher1"
|
||||
And I am on site homepage
|
||||
|
||||
@@ -16,12 +16,10 @@ Feature: Add a comment to the comments block
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Comments" block
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
|
||||
@javascript
|
||||
Scenario: Add a comment with Javascript enabled
|
||||
|
||||
@@ -19,15 +19,12 @@ Feature: Enable Block comments on an activity page and view comments
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro |
|
||||
| page | C1 | page1 | Test page name | Test page description |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "Test page name"
|
||||
And I add the "Comments" block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | Activity module | page1 | mod-page-* | side-pre |
|
||||
And I am on the "Test page name" "page activity" page logged in as teacher1
|
||||
And I follow "Show comments"
|
||||
And I add "I'm a comment from the teacher" comment to comments block
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Test page name"
|
||||
When I am on the "Test page name" "page activity" page logged in as student1
|
||||
And I follow "Show comments"
|
||||
Then I should see "I'm a comment from the teacher"
|
||||
|
||||
@@ -16,13 +16,12 @@ Feature: Enable Block comments on a course page and view comments
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Comments" block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I follow "Show comments"
|
||||
And I add "I'm a comment from the teacher" comment to comments block
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
And I follow "Show comments"
|
||||
Then I should see "I'm a comment from the teacher"
|
||||
|
||||
@@ -8,10 +8,11 @@ Feature: Enable Block comments on the frontpage and view comments
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | System | 1 | site-index | side-pre |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Comments" block
|
||||
And I follow "Show comments"
|
||||
And I add "I'm a comment from admin" comment to comments block
|
||||
And I log out
|
||||
|
||||
@@ -17,16 +17,12 @@ Feature: Delete comment block messages
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Comments" block
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I add "Comment from student1" comment to comments block
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I add "Comment from teacher1" comment to comments block
|
||||
When I delete "Comment from student1" comment from comments block
|
||||
Then I should not see "Comment from student1"
|
||||
|
||||
@@ -18,24 +18,21 @@ Feature: Enable Block Completion in a course using manual completion by others
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| teacher2 | C1 | teacher |
|
||||
| student1 | C1 | student |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| completionstatus | Course | C1 | course-view-* | side-pre |
|
||||
|
||||
Scenario: Add the block to a the course and mark a student complete.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Course completion status" block
|
||||
Given I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Course completion" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Teacher | 1 |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Status: Not yet started" in the "Course completion status" "block"
|
||||
And I should see "No" in the "Teacher" "table_row"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Reports" in current page administration
|
||||
And I click on "Course completion" "link" in the "region-main" "region"
|
||||
And I follow "Click to mark user complete"
|
||||
@@ -44,18 +41,14 @@ Feature: Enable Block Completion in a course using manual completion by others
|
||||
And I wait "1" seconds
|
||||
And I run the scheduled task "core\task\completion_regular_task"
|
||||
And I am on site homepage
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
Then I should see "Status: Complete" in the "Course completion status" "block"
|
||||
And I should see "Yes" in the "Teacher" "table_row"
|
||||
And I follow "More details"
|
||||
And I should see "Yes" in the "Marked complete by Teacher" "table_row"
|
||||
|
||||
Scenario: Add the block to a the course and require multiple roles to mark a student complete.
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Course completion status" block
|
||||
Given I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Course completion" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
@@ -63,30 +56,22 @@ Feature: Enable Block Completion in a course using manual completion by others
|
||||
| Non-editing teacher | 1 |
|
||||
| id_role_aggregation | ALL selected roles to mark when the condition is met |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Status: Not yet started" in the "Course completion status" "block"
|
||||
And I should see "No" in the "Teacher" "table_row"
|
||||
And I should see "No" in the "Non-editing teacher" "table_row"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Reports" in current page administration
|
||||
And I click on "Course completion" "link" in the "region-main" "region"
|
||||
And I follow "Click to mark user complete"
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Status: In progress" in the "Course completion status" "block"
|
||||
And I should see "Yes" in the "Teacher" "table_row"
|
||||
And I should see "No" in the "Non-editing teacher" "table_row"
|
||||
And I follow "More details"
|
||||
And I should see "Yes" in the "Marked complete by Teacher" "table_row"
|
||||
And I should see "No" in the "Marked complete by Non-editing teacher" "table_row"
|
||||
And I log out
|
||||
And I log in as "teacher2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as teacher2
|
||||
And I navigate to "Reports" in current page administration
|
||||
And I click on "Course completion" "link" in the "region-main" "region"
|
||||
And I follow "Click to mark user complete"
|
||||
@@ -95,9 +80,7 @@ Feature: Enable Block Completion in a course using manual completion by others
|
||||
And I wait "1" seconds
|
||||
And I run the scheduled task "core\task\completion_regular_task"
|
||||
And I am on site homepage
|
||||
And I log out
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
Then I should see "Status: Complete" in the "Course completion status" "block"
|
||||
And I should see "Yes" in the "Teacher" "table_row"
|
||||
And I should see "Yes" in the "Non-editing teacher" "table_row"
|
||||
|
||||
@@ -17,18 +17,17 @@ Feature: Enable Block Completion in a course using manual self completion
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I enable "selfcompletion" "block" plugin
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Course completion status" block
|
||||
And I add the "Self completion" block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| completionstatus | Course | C1 | course-view-* | side-pre |
|
||||
| selfcompletion | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I navigate to "Course completion" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| id_criteria_self | 1 |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Status: Not yet started" in the "Course completion status" "block"
|
||||
And I should see "No" in the "Self completion" "table_row"
|
||||
And I follow "Complete course"
|
||||
|
||||
@@ -17,21 +17,18 @@ Feature: Course summary block used in a course
|
||||
| student1 | C101 | student |
|
||||
| teacher1 | C101 | editingteacher |
|
||||
And I enable "course_summary" "block" plugin
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Course/site summary" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| course_summary | Course | C101 | course-view-* | side-pre |
|
||||
|
||||
Scenario: Student can view course summary
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then "Course summary" "block" should exist
|
||||
And I should see "Course summary" in the "Course summary" "block"
|
||||
And I should see "Proved the course summary block works!" in the "Course summary" "block"
|
||||
|
||||
Scenario: Teacher can not see edit icon when edit mode is off
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as teacher1
|
||||
Then I should see "Proved the course summary block works!" in the "Course summary" "block"
|
||||
And I should see "Course summary" in the "Course summary" "block"
|
||||
And "Edit" "link" should not exist in the "Course summary" "block"
|
||||
|
||||
@@ -7,9 +7,10 @@ Feature: Course summary block used on the frontpage
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
And I enable "course_summary" "block" plugin
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| course_summary | System | 1 | site-index | side-pre |
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Course/site summary" block
|
||||
And I navigate to "Site home > Site home settings" in site administration
|
||||
And I set the following fields to these values:
|
||||
| summary | Proved the summary block works! |
|
||||
|
||||
@@ -8,19 +8,16 @@ Feature: Login from a block
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testpass | Test | User | student1@example.com |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Login" block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| login | System | 1 | site-index | side-pre |
|
||||
|
||||
Scenario: Login block visible to non-logged in users
|
||||
Given I log out
|
||||
When I am on homepage
|
||||
Then "Login" "block" should exist
|
||||
|
||||
Scenario: Login as student through login block
|
||||
Given I log out
|
||||
And I am on homepage
|
||||
Given I am on homepage
|
||||
When I set the field "Username" to "testuser"
|
||||
And I set the field "Password" to "testpass"
|
||||
And I click on "Log in" "button" in the "Login" "block"
|
||||
|
||||
@@ -8,9 +8,9 @@ Feature: Add the network servers block when main feature is disabled
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Plugins > Authentication > Manage authentication" in site administration
|
||||
And I click on "Enable" "icon" in the "MNet authentication" "table_row"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Network servers" block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| mnet_hosts | System | 1 | site-index | side-pre |
|
||||
When I navigate to "Plugins > Authentication > Manage authentication" in site administration
|
||||
And I click on "Disable" "icon" in the "MNet authentication" "table_row"
|
||||
And I am on site homepage
|
||||
@@ -21,10 +21,11 @@ Feature: Add the network servers block when main feature is disabled
|
||||
Given I log in as "admin"
|
||||
And I navigate to "Plugins > Authentication > Manage authentication" in site administration
|
||||
And I click on "Enable" "icon" in the "MNet authentication" "table_row"
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| mnet_hosts | System | 1 | site-index | side-pre |
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Network servers" block
|
||||
And I turn editing mode on
|
||||
And I open the "Network servers" blocks action menu
|
||||
And I click on "Delete Network servers block" "link" in the "Network servers" "block"
|
||||
And "Delete block?" "dialogue" should exist
|
||||
|
||||
@@ -59,13 +59,14 @@ Feature: The my overview block allows users to hide their courses
|
||||
And I click on "Removed from view" "link" in the "Course overview" "block"
|
||||
And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
|
||||
And I click on "Restore to view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
|
||||
And I reload the page
|
||||
And I should not see "Course 2" in the "Course overview" "block"
|
||||
And I click on "Removed from view" "button" in the "Course overview" "block"
|
||||
When I click on "All" "link" in the "Course overview" "block"
|
||||
And I reload the page
|
||||
Then I should see "Course 2" in the "Course overview" "block"
|
||||
|
||||
Scenario: Test show toggle functionality w/ favorites
|
||||
Scenario: Test star and unstar functionality
|
||||
Given I am on the "My courses" page logged in as "student1"
|
||||
And I click on "All" "button" in the "Course overview" "block"
|
||||
And I click on "All" "link" in the "Course overview" "block"
|
||||
|
||||
@@ -17,8 +17,8 @@ Feature: The logged in user block allows users to view their profile information
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro |
|
||||
| page | C1 | page1 | Test page name | Test page description |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I follow "Test page name"
|
||||
When I add the "Logged in user" block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| myprofile | Activity module | page1 | mod-page-* | side-pre |
|
||||
When I am on the "Test page name" "page activity" page logged in as teacher1
|
||||
Then I should see "Teacher One" in the "Logged in user" "block"
|
||||
|
||||
@@ -8,11 +8,9 @@ Feature: The logged in user block allows users to view their profile information
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | One | teacher1@example.com | T1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Logged in user" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| myprofile | System | 1 | site-index | side-pre |
|
||||
|
||||
Scenario: Try to view the logged in user block as a guest
|
||||
Given I log in as "guest"
|
||||
|
||||
@@ -39,29 +39,23 @@ Feature: Displaying the link to the Participants page
|
||||
|
||||
@javascript
|
||||
Scenario: Course participants link is displayed to users depending on role permissions settings
|
||||
And I log in as "admin"
|
||||
And I am on "Course1" course homepage with editing mode on
|
||||
And I add a "Forum" to section "1" and I fill the form with:
|
||||
| Forum name | Test forum name |
|
||||
| Description | Test forum description |
|
||||
And I am on the "Course1" "enrolment methods" page
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| forum | C1 | Test forum name |
|
||||
And I am on the "Course1" "enrolment methods" page logged in as admin
|
||||
And I click on "Edit" "link" in the "Guest access" "table_row"
|
||||
And I set the following fields to these values:
|
||||
| Allow guest access | Yes |
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
When I log in as "guest"
|
||||
And I am on "Course1" course homepage
|
||||
When I am on the "Course1" course page logged in as guest
|
||||
Then I should not see "Participants" in the "Navigation" "block"
|
||||
And I am on the "Test forum name" "forum activity" page
|
||||
And I should not see "Participants" in the "Navigation" "block"
|
||||
And I log out
|
||||
And I log in as "admin"
|
||||
And I set the following system permissions of "Guest" role:
|
||||
| capability | permission |
|
||||
| moodle/course:viewparticipants | Allow |
|
||||
And I log in as "guest"
|
||||
And I am on "Course1" course homepage
|
||||
And the following "role capability" exists:
|
||||
| role | guest |
|
||||
| moodle/course:viewparticipants | allow |
|
||||
And I am on the "Course1" course page logged in as guest
|
||||
And I should see "Participants" in the "Navigation" "block"
|
||||
And I am on the "Test forum name" "forum activity" page
|
||||
And I should see "Participants" in the "Navigation" "block"
|
||||
|
||||
@@ -9,17 +9,16 @@ Feature: Latest announcements block displays the course latest news
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And I log in as "admin"
|
||||
And I create a course with:
|
||||
| Course full name | Course 1 |
|
||||
| Course short name | C1 |
|
||||
| Number of announcements | 5 |
|
||||
And I enrol "Teacher 1" user as "Teacher"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Latest announcements" block
|
||||
And I turn editing mode off
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | newsitems |
|
||||
| Course 1 | C1 | 0 | 5 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| news_items | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" Course page logged in as teacher1
|
||||
When I add a new topic to "Announcements" forum with:
|
||||
| Subject | Discussion One |
|
||||
| Message | Not important |
|
||||
|
||||
@@ -17,10 +17,10 @@ Feature: The private files block allows users to store files privately in moodle
|
||||
And the following "activities" exist:
|
||||
| activity | course | idnumber | name | intro |
|
||||
| page | C1 | page1 | Test page name | Test page description |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I am on the "Test page name" "page activity" page
|
||||
And I add the "Private files" block
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | Activity module | page1 | mod-page-* | side-pre |
|
||||
And I am on the "Test page name" "page activity" page logged in as teacher1
|
||||
And I should see "No files available" in the "Private files" "block"
|
||||
When I follow "Manage private files..."
|
||||
And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager
|
||||
|
||||
@@ -14,9 +14,11 @@ Feature: The private files block allows users to store files privately in moodle
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Private files" block
|
||||
And I should see "No files available" in the "Private files" "block"
|
||||
When I follow "Manage private files..."
|
||||
And I upload "blocks/private_files/tests/fixtures/testfile.txt" file to "Files" filemanager
|
||||
|
||||
@@ -11,11 +11,9 @@ Feature: The private files block allows users to store files privately in moodle
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Private files" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | site-index | side-pre |
|
||||
|
||||
Scenario: Try to view the private files block as a guest
|
||||
Given I log in as "guest"
|
||||
|
||||
@@ -47,38 +47,33 @@ Feature: View structural changes in recent activity block
|
||||
|
||||
Scenario: Check that Added module information is displayed respecting view capability
|
||||
Given the following "activities" exist:
|
||||
| activity | course | section | name | idnumber | description | groupmode | grouping | visible |
|
||||
| forum | C1 | 1 | ForumVisibleGroups | forum1 | No description | 2 | | 1 |
|
||||
| forum | C1 | 1 | ForumSeparateGroups | forum2 | No description | 1 | | 1 |
|
||||
| forum | C1 | 1 | ForumHidden | forum3 | No description | 1 | | 0 |
|
||||
| forum | C1 | 1 | ForumNoGroups | forum4 | No description | 0 | | 1 |
|
||||
| forum | C1 | 2 | ForumVisibleGroupsG1 | forum5 | No description | 2 | GG1 | 1 |
|
||||
| forum | C1 | 2 | ForumSeparateGroupsG1 | forum6 | No description | 1 | GG1 | 1 |
|
||||
| forum | C1 | 3 | ForumVisibleGroupsG2 | forum7 | No description | 2 | GG2 | 1 |
|
||||
| forum | C1 | 3 | ForumSeparateGroupsG2 | forum8 | No description | 1 | GG2 | 1 |
|
||||
And I log in as "teacher1"
|
||||
| activity | course | name | idnumber | groupmode | grouping | visible |
|
||||
| forum | C1 | ForumVisibleGroups | forum1 | 2 | | 1 |
|
||||
| forum | C1 | ForumSeparateGroups | forum2 | 1 | | 1 |
|
||||
| forum | C1 | ForumHidden | forum3 | 1 | | 0 |
|
||||
| forum | C1 | ForumNoGroups | forum4 | 0 | | 1 |
|
||||
| forum | C1 | ForumVisibleGroupsG1 | forum5 | 2 | GG1 | 1 |
|
||||
| forum | C1 | ForumSeparateGroupsG1 | forum6 | 1 | GG1 | 1 |
|
||||
| forum | C1 | ForumVisibleGroupsG2 | forum7 | 2 | GG2 | 1 |
|
||||
| forum | C1 | ForumSeparateGroupsG2 | forum8 | 1 | GG2 | 1 |
|
||||
|
||||
And I am on "Course 1" course homepage
|
||||
And I click on "ForumVisibleGroupsG1" "link"
|
||||
And I click on "Settings" "link"
|
||||
And I am on the "ForumVisibleGroupsG1" "forum activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| Access restrictions | Grouping: Grouping 1 |
|
||||
And I press "Save and return to course"
|
||||
|
||||
And I click on "ForumSeparateGroupsG1" "link"
|
||||
And I click on "Settings" "link"
|
||||
And I am on the "ForumSeparateGroupsG1" "forum activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Access restrictions | Grouping: Grouping 1 |
|
||||
And I press "Save and return to course"
|
||||
|
||||
And I click on "ForumVisibleGroupsG2" "link"
|
||||
And I click on "Settings" "link"
|
||||
And I am on the "ForumVisibleGroupsG2" "forum activity editing" page
|
||||
And I set the following fields to these values:
|
||||
| Access restrictions | Grouping: Grouping 2 |
|
||||
And I press "Save and return to course"
|
||||
|
||||
And I click on "ForumSeparateGroupsG2" "link"
|
||||
And I click on "Settings" "link"
|
||||
And I am on the "ForumSeparateGroupsG2" "forum activity editing" page
|
||||
|
||||
And I set the following fields to these values:
|
||||
| Access restrictions | Grouping: Grouping 2 |
|
||||
And I press "Save and return to course"
|
||||
@@ -94,10 +89,8 @@ Feature: View structural changes in recent activity block
|
||||
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
|
||||
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
|
||||
And I log out
|
||||
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "ForumVisibleGroups" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroups" in the "Recent activity" "block"
|
||||
And I should see "ForumNoGroups" in the "Recent activity" "block"
|
||||
@@ -106,10 +99,8 @@ Feature: View structural changes in recent activity block
|
||||
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
|
||||
And I should not see "ForumVisibleGroupsG2" in the "Recent activity" "block"
|
||||
And I should not see "ForumSeparateGroupsG2" in the "Recent activity" "block"
|
||||
And I log out
|
||||
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student2
|
||||
And I should see "ForumVisibleGroups" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroups" in the "Recent activity" "block"
|
||||
And I should see "ForumNoGroups" in the "Recent activity" "block"
|
||||
@@ -118,10 +109,8 @@ Feature: View structural changes in recent activity block
|
||||
And I should not see "ForumSeparateGroupsG1" in the "Recent activity" "block"
|
||||
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
|
||||
And I log out
|
||||
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student3
|
||||
And I should see "ForumVisibleGroups" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroups" in the "Recent activity" "block"
|
||||
And I should see "ForumNoGroups" in the "Recent activity" "block"
|
||||
@@ -130,17 +119,14 @@ Feature: View structural changes in recent activity block
|
||||
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
|
||||
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
|
||||
And I log out
|
||||
|
||||
# Teachers have capability to see all groups and hidden activities
|
||||
And I log in as "assistant1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as assistant1
|
||||
And I should see "ForumHidden" in the "Recent activity" "block"
|
||||
And I should see "ForumVisibleGroupsG1" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroupsG1" in the "Recent activity" "block"
|
||||
And I should see "ForumVisibleGroupsG2" in the "Recent activity" "block"
|
||||
And I should see "ForumSeparateGroupsG2" in the "Recent activity" "block"
|
||||
And I log out
|
||||
|
||||
Scenario: Updates and deletes in recent activity block
|
||||
Given the following "activity" exists:
|
||||
@@ -148,7 +134,6 @@ Feature: View structural changes in recent activity block
|
||||
| course | C1 |
|
||||
| idnumber | forum1 |
|
||||
| name | ForumNew |
|
||||
| description | No description |
|
||||
When I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Recent activity" block
|
||||
@@ -158,8 +143,7 @@ Feature: View structural changes in recent activity block
|
||||
|
||||
# Update forum as a teacher after a second to ensure we have a new timestamp for recent activity.
|
||||
And I wait "1" seconds
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should see "Added Forum" in the "Recent activity" "block"
|
||||
And I should see "ForumNew" in the "Recent activity" "block"
|
||||
And I log out
|
||||
@@ -167,10 +151,7 @@ Feature: View structural changes in recent activity block
|
||||
And I wait "1" seconds
|
||||
|
||||
# Update forum as a teacher
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "ForumNew"
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I am on the "ForumNew" "forum activity editing" page logged in as teacher1
|
||||
And I set the following fields to these values:
|
||||
| name | ForumUpdated |
|
||||
And I press "Save and return to course"
|
||||
@@ -178,8 +159,7 @@ Feature: View structural changes in recent activity block
|
||||
And I wait "1" seconds
|
||||
# Student 1 already saw that forum was created, now he can see that forum was updated
|
||||
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should not see "Added Forum" in the "Recent activity" "block"
|
||||
And I should not see "ForumNew" in the "Recent activity" "block"
|
||||
And I should see "Updated Forum" in the "Recent activity" "block"
|
||||
@@ -188,8 +168,7 @@ Feature: View structural changes in recent activity block
|
||||
And I wait "1" seconds
|
||||
# Student 2 has bigger interval and he can see one entry that forum was created but with the new name
|
||||
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student2
|
||||
And I should see "Added Forum" in the "Recent activity" "block"
|
||||
And I should not see "ForumNew" in the "Recent activity" "block"
|
||||
And I should not see "Updated Forum" in the "Recent activity" "block"
|
||||
@@ -206,8 +185,7 @@ Feature: View structural changes in recent activity block
|
||||
And I wait "1" seconds
|
||||
# Students 1 and 2 see that forum was deleted
|
||||
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student1
|
||||
And I should not see "Added Forum" in the "Recent activity" "block"
|
||||
And I should not see "ForumNew" in the "Recent activity" "block"
|
||||
And I should not see "Updated Forum" in the "Recent activity" "block"
|
||||
@@ -217,8 +195,7 @@ Feature: View structural changes in recent activity block
|
||||
And I wait "1" seconds
|
||||
# Student 3 never knew that forum was created, so he does not see anything
|
||||
|
||||
And I log in as "student3"
|
||||
And I am on "Course 1" course homepage
|
||||
And I am on the "Course 1" course page logged in as student3
|
||||
And I should not see "Added Forum" in the "Recent activity" "block"
|
||||
And I should not see "ForumNew" in the "Recent activity" "block"
|
||||
And I should not see "Updated Forum" in the "Recent activity" "block"
|
||||
|
||||
@@ -16,27 +16,22 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
| student1 | C1 | student |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Settings" in current page administration
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| news_items | Course | C1 | course-view-* | side-pre |
|
||||
| search_forums | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" "course editing" page logged in as teacher1
|
||||
And I set the field "id_newsitems" to "1"
|
||||
And I press "Save and display"
|
||||
And I turn editing mode on
|
||||
And I add the "Latest announcements" block
|
||||
And I add the "Search forums" block
|
||||
And I log out
|
||||
|
||||
Scenario: Use the search forum block in a course without any forum posts
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
Given I am on the "Course 1" course page logged in as student1
|
||||
When I set the field "Search" to "Moodle"
|
||||
And I press "Search"
|
||||
Then I should see "No posts"
|
||||
|
||||
Scenario: Use the search forum block in a course with a hidden forum and search for posts
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
Given I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
@@ -45,24 +40,18 @@ Feature: The search forums block allows users to search for forum posts on cours
|
||||
And I expand all fieldsets
|
||||
And I set the field "id_visible" to "0"
|
||||
And I press "Save and return to course"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
And "Search forums" "block" should exist
|
||||
When I set the field "Search" to "message"
|
||||
And I set the field "Search" to "message"
|
||||
And I press "Search"
|
||||
Then I should see "No posts"
|
||||
|
||||
Scenario: Use the search forum block in a course and search for posts
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I add a new topic to "Announcements" forum with:
|
||||
Given I add a new topic to "Announcements" forum with:
|
||||
| Subject | My subject |
|
||||
| Message | My message |
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
And "Search forums" "block" should exist
|
||||
When I set the field "Search" to "message"
|
||||
And I set the field "Search" to "message"
|
||||
And I press "Search"
|
||||
Then I should see "My subject"
|
||||
|
||||
@@ -8,11 +8,9 @@ Feature: The search forums block allows users to search for forum posts on front
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Search forums" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| search_forums | System | 1 | site-index | side-pre |
|
||||
|
||||
Scenario: Use the search forum block on the frontpage and search for posts as a user
|
||||
Given I log in as "student1"
|
||||
|
||||
@@ -18,16 +18,13 @@ Feature: The Section links block can be configured to display section name in ad
|
||||
| student1 | C1 | student |
|
||||
And the following config values are set as admin:
|
||||
| showsectionname | 1 | block_section_links |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And the following config values are set as admin:
|
||||
| unaddableblocks | | theme_boost|
|
||||
And I add the "Section links" block
|
||||
And I log out
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| section_links | Course | C1 | course-view-* | side-pre |
|
||||
|
||||
Scenario: Student can see section name under the Section links block
|
||||
Given I log in as "student1"
|
||||
When I am on "Course 1" course homepage
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then I should see "7: Topic 7" in the "Section links" "block"
|
||||
And I follow "7: Topic 7"
|
||||
And I should see "First assignment"
|
||||
|
||||
@@ -4,12 +4,19 @@ Feature: Add URL to main menu block
|
||||
As a admin
|
||||
I need to add URLs to the main menu block and check it works.
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category | enablecompletion |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
| Course 2 | C2 | 0 | |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| site_main_menu | System | 1 | site-index | side-pre |
|
||||
|
||||
@javascript
|
||||
Scenario: Add a URL in menu block and ensure it appears
|
||||
Given I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Main menu" block
|
||||
And the following "activity" exists:
|
||||
| activity | url |
|
||||
| course | Acceptance test site |
|
||||
@@ -22,20 +29,15 @@ Feature: Add URL to main menu block
|
||||
And I set the following fields to these values:
|
||||
| id_display | In pop-up |
|
||||
And I press "Save and return to course"
|
||||
And I turn editing mode on
|
||||
Then "reference link" "link" should exist in the "Main menu" "block"
|
||||
And "Add an activity or resource" "button" should exist in the "Main menu" "block"
|
||||
|
||||
@javascript
|
||||
Scenario: Add a URL in menu block can appear in the entire site
|
||||
Given the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| category | 0 |
|
||||
| enablecompletion | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Main menu" block
|
||||
And I configure the "Main menu" block
|
||||
And I set the following fields to these values:
|
||||
| Page contexts | Display throughout the entire site |
|
||||
@@ -61,15 +63,9 @@ Feature: Add URL to main menu block
|
||||
|
||||
@javascript
|
||||
Scenario: Add a URL in menu block can appear in any front page
|
||||
Given the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| category | 0 |
|
||||
| enablecompletion | 1 |
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Main menu" block
|
||||
And I configure the "Main menu" block
|
||||
And I set the following fields to these values:
|
||||
| Page contexts | Display on the site home and any pages added to the site home. |
|
||||
@@ -95,22 +91,17 @@ Feature: Add URL to main menu block
|
||||
|
||||
@javascript
|
||||
Scenario: When the "Main Menu" block is displayed throrought the entire site, adding an URL in a course
|
||||
results in adding it in the course and not in the frontpage
|
||||
Given the following "course" exists:
|
||||
| fullname | Course 1 |
|
||||
| shortname | C1 |
|
||||
| category | 0 |
|
||||
And I log in as "admin"
|
||||
results in adding it in the course and not in the frontpage
|
||||
Given I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Main menu" block
|
||||
And I configure the "Main menu" block
|
||||
And I set the following fields to these values:
|
||||
| Page contexts | Display throughout the entire site |
|
||||
And I press "Save changes"
|
||||
When the following "activity" exists:
|
||||
| activity | url |
|
||||
| course | C1 |
|
||||
| course | C2 |
|
||||
| name | reference link |
|
||||
| intro | mooooooooodle |
|
||||
| externalurl | http://www.moodle.com |
|
||||
|
||||
@@ -11,10 +11,12 @@ Feature: Edit activities in main menu block
|
||||
| course | Acceptance test site |
|
||||
| name | My forum name |
|
||||
| idnumber | forum |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| site_main_menu | System | 1 | site-index | side-pre |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Main menu" block
|
||||
When I set the field "Edit title" in the "My forum name" "block_site_main_menu > Activity" to "New forum name"
|
||||
Then I should not see "My forum name"
|
||||
And I should see "New forum name"
|
||||
@@ -26,14 +28,16 @@ Feature: Edit activities in main menu block
|
||||
Scenario: Activities in main menu block can be made available but not visible on a course page
|
||||
Given the following config values are set as admin:
|
||||
| allowstealth | 1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| site_main_menu | System | 1 | site-index | side-post |
|
||||
And the following "activities" exist:
|
||||
| activity | course | section | name |
|
||||
| forum | Acceptance test site | 0 | Visible forum |
|
||||
| forum | Acceptance test site | 0 | My forum name |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Main menu" block
|
||||
When I add a "Forum" to section "0" and I fill the form with:
|
||||
| Forum name | Visible forum |
|
||||
When I add a "Forum" to section "0" and I fill the form with:
|
||||
| Forum name | My forum name |
|
||||
And "My forum name" activity in site main menu block should have "Hide" editing icon
|
||||
And "My forum name" activity in site main menu block should not have "Show" editing icon
|
||||
And "My forum name" activity in site main menu block should not have "Make available" editing icon
|
||||
|
||||
@@ -19,12 +19,11 @@ Feature: Edit activities in social activities block
|
||||
|
||||
@javascript
|
||||
Scenario: Edit name of activity in-place in social activities block
|
||||
Given I log in as "user1"
|
||||
Given the following "activities" exist:
|
||||
| activity | course | name |
|
||||
| forum | C1 | My forum name |
|
||||
And I log in as "user1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I press "Add an activity or resource"
|
||||
And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I set the field "Forum name" to "My forum name"
|
||||
And I press "Save and return to course"
|
||||
When I set the field "Edit title" in the "My forum name" "block_social_activities > Activity" to "New forum name"
|
||||
Then I should not see "My forum name" in the "Social activities" "block"
|
||||
And I should see "New forum name"
|
||||
@@ -36,9 +35,11 @@ Feature: Edit activities in social activities block
|
||||
Scenario: Activities in social activities block can be made available but not visible on a course page
|
||||
Given the following config values are set as admin:
|
||||
| allowstealth | 1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| recent_activity | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "user1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Recent activity" block
|
||||
And I press "Add an activity or resource"
|
||||
And I click on "Add a new Forum" "link" in the "Add an activity or resource" "dialogue"
|
||||
And I set the field "Forum name" to "My forum name"
|
||||
@@ -75,8 +76,7 @@ Feature: Edit activities in social activities block
|
||||
And "My forum name" activity in social activities block should be available but hidden from course page
|
||||
And I log out
|
||||
# Student will not see the module on the course page but can access it from other reports and blocks:
|
||||
And I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I should not see "My forum name" in the "Social activities" "block"
|
||||
When I am on the "Course 1" course page logged in as student1
|
||||
Then I should not see "My forum name" in the "Social activities" "block"
|
||||
And I click on "My forum name" "link" in the "Recent activity" "block"
|
||||
And I should see "My forum name" in the ".breadcrumb" "css_element"
|
||||
|
||||
@@ -8,10 +8,11 @@ Feature: Block removal via modal
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| search_forums | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Search forums" block
|
||||
And "Search forums" "block" should exist
|
||||
|
||||
@javascript
|
||||
Scenario: Removing a block via modal should remove the block on the page
|
||||
|
||||
@@ -11,12 +11,14 @@ Feature: Show hidden blocks in a docked block region when editing
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| admin | C1 | editingteacher |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| search_forums | Course | C1 | course-view-* | side-pre |
|
||||
| news_items | Course | C1 | course-view-* | side-pre |
|
||||
| calendar_upcoming | Course | C1 | course-view-* | side-pre |
|
||||
| recent_activity | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Search forums" block
|
||||
And I add the "Latest announcements" block
|
||||
And I add the "Upcoming events" block
|
||||
And I add the "Recent activity" block
|
||||
# Hide all the blocks in the non-default region
|
||||
And I configure the "Search forums" block
|
||||
And I set the following fields to these values:
|
||||
|
||||
@@ -8,18 +8,20 @@ Feature: Block visibility
|
||||
Given the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| search_forums | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "admin"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
|
||||
@javascript
|
||||
Scenario: Hiding all blocks on the page should remove the column they're in
|
||||
Given I add the "Search forums" block
|
||||
And I open the "Search forums" blocks action menu
|
||||
When I open the "Search forums" blocks action menu
|
||||
And I click on "Configure Search forums block" "link" in the "Search forums" "block"
|
||||
And I set the field "Region" to "Right"
|
||||
And I press "Save changes"
|
||||
And I turn editing mode off
|
||||
And ".empty-region-side-post" "css_element" should not exist in the "body" "css_element"
|
||||
Then ".empty-region-side-post" "css_element" should not exist in the "body" "css_element"
|
||||
And I turn editing mode on
|
||||
And I open the "Search forums" blocks action menu
|
||||
And I click on "Hide Search forums block" "link" in the "Search forums" "block"
|
||||
|
||||
@@ -22,9 +22,11 @@ Feature: Block appearances
|
||||
| book | Test book name |
|
||||
| title | Book title |
|
||||
| content | Book content test test |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | Course | C1 | course-view-* | side-pre |
|
||||
And I am on the "Course 1" course page logged in as teacher1
|
||||
And I turn editing mode on
|
||||
And I add the "Comments" block
|
||||
And I configure the "Comments" block
|
||||
And I set the following fields to these values:
|
||||
| Display on page types | Any page |
|
||||
|
||||
@@ -22,9 +22,11 @@ Feature: Block region moving
|
||||
| book | Test book name |
|
||||
| title | Book title |
|
||||
| content | Book content test test |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| comments | Course | C1 | course-view-* | side-pre |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage with editing mode on
|
||||
And I add the "Comments" block
|
||||
And I configure the "Comments" block
|
||||
And I set the following fields to these values:
|
||||
| Display on page types | Any page |
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user