Compare commits
452 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0fbe41f4cd | |||
| e122972d3f | |||
| 57bfb7c30a | |||
| 529e944a8c | |||
| 8d294e729f | |||
| 82f9746962 | |||
| cbca970ab7 | |||
| 282f0437f1 | |||
| 873a7e1e86 | |||
| 38a8590ed0 | |||
| 45e862c4bd | |||
| d51d8ca2af | |||
| f4565e7147 | |||
| 52a51514f6 | |||
| 42cf4a3470 | |||
| 5d03ab36b5 | |||
| 727145bf1c | |||
| d10ca75b8c | |||
| aacdf8e280 | |||
| aabebc7516 | |||
| 5009bcd9b4 | |||
| 4b2790c580 | |||
| 5e43ccd3b9 | |||
| 783ef76bfc | |||
| 4b631c2d87 | |||
| 7e81bd114e | |||
| 9446cb507c | |||
| 21a5c3c447 | |||
| 9557be1542 | |||
| 05551a935a | |||
| f7d76254fd | |||
| 28f2458448 | |||
| e283c6ca33 | |||
| 26fef01b6b | |||
| d9a9a87835 | |||
| e0ba33697f | |||
| f318b74b49 | |||
| 63531fff79 | |||
| 51e8968635 | |||
| e67c14053e | |||
| 30f023b1b3 | |||
| fce0f1c235 | |||
| 57c01bca0e | |||
| 7d432be4e9 | |||
| 2380daba7b | |||
| 2f5208ea1b | |||
| 1e9487092d | |||
| 3d3fb328b4 | |||
| 23bb1871b3 | |||
| 896718ef79 | |||
| dfe7cbe4cf | |||
| 25bfa25190 | |||
| e47d61e198 | |||
| 87799e9fba | |||
| 30cfed3731 | |||
| 406f1eb76d | |||
| 7f24e5e654 | |||
| 65eb39c0b4 | |||
| 1bce723292 | |||
| f48cc821db | |||
| 0a5cafcbe9 | |||
| 5084343b3f | |||
| a4abacc9a6 | |||
| ff687b9c15 | |||
| b0db945b11 | |||
| d0da94cdf4 | |||
| 02bb0c0637 | |||
| 8abfb7b1bb | |||
| 0840b3e687 | |||
| 6706c1cb12 | |||
| 835f1f9add | |||
| b3fd942b52 | |||
| cd4a6b8b0b | |||
| 644444829a | |||
| ff308ab4fb | |||
| 755b013fdf | |||
| af28ceb945 | |||
| 538ce414a5 | |||
| f2e599d51c | |||
| fe9864f488 | |||
| f4c39cb983 | |||
| 3d66b5a100 | |||
| cb3f67364d | |||
| b95a05a536 | |||
| 2da36b3750 | |||
| aab30ea828 | |||
| 74c21d51d0 | |||
| b14a04e0a4 | |||
| 8a668f75a8 | |||
| 3e5a1d8029 | |||
| 099a2aee68 | |||
| a7c01b5876 | |||
| e23e6c2f64 | |||
| f209d76b0d | |||
| abdffed5fc | |||
| 40e24fda5b | |||
| 486fac73f2 | |||
| 5ceb68d169 | |||
| a0c3ab0b30 | |||
| 009c57d730 | |||
| 820a43510f | |||
| 493ef66ecd | |||
| 41b973bcbb | |||
| 237af2ba61 | |||
| 79f15159da | |||
| 2f0cd733be | |||
| 4006e187f3 | |||
| 98f43f1b08 | |||
| 12d6dfc1ce | |||
| 25ca6f1638 | |||
| 7508e218d2 | |||
| 3d15dfc9d2 | |||
| c35ef2e9a0 | |||
| 96abc5f1cd | |||
| d78207b6c3 | |||
| d41b1ba49e | |||
| e938ea398c | |||
| 29dfbb422f | |||
| 9ecf0674ff | |||
| b5b7af96bb | |||
| 76acac80eb | |||
| a428cf4ac8 | |||
| 0915860e51 | |||
| b62bebbf1c | |||
| 75166d0627 | |||
| 6dc3a5b699 | |||
| c6b4421524 | |||
| 50e16a67ab | |||
| 7336ba40d5 | |||
| a813b0c3dc | |||
| 26dca05d02 | |||
| 920d7ffadd | |||
| 84c8c00959 | |||
| d48c0a1d9a | |||
| 7b0057b895 | |||
| 9574320a36 | |||
| 6670d28fbc | |||
| a4e2d64571 | |||
| 7489d697be | |||
| 1cca9a3479 | |||
| 310808b778 | |||
| e2fe3bc081 | |||
| 6eb6c5fd6d | |||
| 6182ec8901 | |||
| 16732d0631 | |||
| 7d3a7bbd1f | |||
| 3b195bfb81 | |||
| e3cb80f10c | |||
| 904fcbee8b | |||
| 6321934c73 | |||
| 751122dbc0 | |||
| c1e74a0937 | |||
| f882aed3b3 | |||
| e7b9ea226c | |||
| 1bf9d6ac92 | |||
| 35b48c7aed | |||
| 706e012fd6 | |||
| 660b51e013 | |||
| d76dd4d064 | |||
| 6dc4c68e4e | |||
| 4125ce046b | |||
| 7da7c1e24a | |||
| 3eb9cc2f6e | |||
| 393eccb077 | |||
| d3d0248afc | |||
| 8151761378 | |||
| faadaedb17 | |||
| 0064cb1193 | |||
| a435242491 | |||
| 70d2c9fcf8 | |||
| 12ebaf1c6b | |||
| 8712a50ec2 | |||
| 97279f8d5d | |||
| 90677673da | |||
| af5765b3fb | |||
| ffd7798c96 | |||
| fb1469d84f | |||
| 583278f070 | |||
| 901c0ea7de | |||
| 8898725385 | |||
| cee482ca4e | |||
| 7a9309f32e | |||
| 4642a8c593 | |||
| 4682f17c49 | |||
| 44002b183c | |||
| 4b371f9769 | |||
| e466786f78 | |||
| 6aefea74a4 | |||
| 4ea8f814a0 | |||
| 1c70e86b5e | |||
| 900a2c554e | |||
| ade30c673c | |||
| 930570b410 | |||
| 6027eaebc5 | |||
| 78b281b24d | |||
| 1efacd2b35 | |||
| e44bd69aaa | |||
| dad0b3bfeb | |||
| d030347bce | |||
| d25f96b766 | |||
| b4d6669dd0 | |||
| 90d00d0eae | |||
| efe57105d6 | |||
| 7f6accd448 | |||
| 0d02bb964b | |||
| 5cfaecac47 | |||
| 396edc0a5e | |||
| 998432c2c9 | |||
| 2f3ae73ab0 | |||
| 04fbba050d | |||
| 1e9f38a487 | |||
| 813afc6797 | |||
| c1584e154c | |||
| ebba556af7 | |||
| 7afc76fbd6 | |||
| 92ba7648fe | |||
| 2d45ac279d | |||
| 1cc10f3f67 | |||
| 0fef835188 | |||
| 7a677348e4 | |||
| 2589802489 | |||
| 5a9a2c61b9 | |||
| 39e7d46d89 | |||
| 2fd423721f | |||
| 4f1ba09334 | |||
| 642bbbdd10 | |||
| 4678592332 | |||
| 6dad38deed | |||
| d82aa0a2d9 | |||
| dc48cc0a79 | |||
| fcd412470a | |||
| d9a1d6834c | |||
| 5e5ce443fd | |||
| 946281d282 | |||
| ae9bbd9847 | |||
| f10ae4676d | |||
| f25185d7b0 | |||
| b09db258e5 | |||
| 857a0ab60e | |||
| d7978641dc | |||
| 6f0efcc891 | |||
| d163d37593 | |||
| de7e277e1f | |||
| 852264ad23 | |||
| 3745973281 | |||
| 3a14f060d1 | |||
| 204413187e | |||
| 4b96878ab6 | |||
| 181b5922ce | |||
| 493ec714fd | |||
| 729132fa6a | |||
| f6dabb3194 | |||
| cead8a8138 | |||
| 8bcc2cbd8a | |||
| 20f576629b | |||
| 585ba846da | |||
| 55e54953a4 | |||
| 8d857d0ecc | |||
| 0b96b9c5c2 | |||
| 449e15f092 | |||
| 2dcb3746b0 | |||
| 4af34676f7 | |||
| e7bba8ce4d | |||
| dd24216a3b | |||
| ed81eab309 | |||
| 95bfa52549 | |||
| ea70612b00 | |||
| 51d9431e48 | |||
| cf199b4448 | |||
| 0ffe8d2f0c | |||
| d017e3fb48 | |||
| 337b723b07 | |||
| 6b8c8f4bc2 | |||
| f93bdccab7 | |||
| f34df17977 | |||
| 04165cd446 | |||
| 125bd58ff9 | |||
| 1093b461f6 | |||
| f31e1e8b25 | |||
| 2f3f8e45da | |||
| f619064b9b | |||
| cfade93cb8 | |||
| fd887df697 | |||
| fe3db0ca08 | |||
| 87264a2022 | |||
| 622c84f630 | |||
| 27a5b91f45 | |||
| 8f3a295c6e | |||
| 9444636cb8 | |||
| 49ae3661d3 | |||
| cf2bc26911 | |||
| c1ae9079db | |||
| 7dbc501811 | |||
| 7135bbb188 | |||
| bf5dcc8abb | |||
| eaf45bce09 | |||
| 7d41ccf0fb | |||
| 0f76052836 | |||
| f2405a5f5c | |||
| a7bebd0638 | |||
| 7b02521c39 | |||
| c2e123355d | |||
| 974573b4ea | |||
| 6b6a2ec439 | |||
| f31d0fff2e | |||
| 4827eaa744 | |||
| 5222cb1ce8 | |||
| b5f3e90e1c | |||
| b1f3de5793 | |||
| 0b8e0c374f | |||
| e9eec33560 | |||
| 9fa6d4e04e | |||
| 058edbafc8 | |||
| ea10a0319b | |||
| fe86e2f034 | |||
| 259d3742f9 | |||
| 56fb91bc38 | |||
| 51f3693cdb | |||
| 9c56f904d2 | |||
| 3ecf492a75 | |||
| 6b7b3e59f2 | |||
| 06cca0158c | |||
| 7becb39f63 | |||
| a044ff57a1 | |||
| f46fab0ea1 | |||
| e57c0f41ad | |||
| f65db49765 | |||
| dbd8cadb5c | |||
| 51c6d25b3b | |||
| 6063f62e7d | |||
| a3ead7172b | |||
| e3cc23ae86 | |||
| 213fc325ad | |||
| f41218d9fd | |||
| 48ea715da0 | |||
| c220e6d8c7 | |||
| a4b0cfa3f7 | |||
| d5d6eda93c | |||
| 158ab03e12 | |||
| 55f171a1d6 | |||
| f670b39e69 | |||
| b0f00b3166 | |||
| d6a25bc49a | |||
| 445aa472b9 | |||
| 2e1c739a28 | |||
| 560a43f24c | |||
| 930ce60550 | |||
| 398be7c897 | |||
| e85fda95c6 | |||
| 1572a39251 | |||
| 1e17258b66 | |||
| face152176 | |||
| cf0b9432d8 | |||
| 42778e124e | |||
| fd9eb89022 | |||
| f43155b65a | |||
| da55f3582b | |||
| 1954b9d5c9 | |||
| 6fe0b5bd9b | |||
| e7bda18de6 | |||
| 69ba7bf659 | |||
| b86c685075 | |||
| a6fa0d9c97 | |||
| 16076f1e3d | |||
| 8b3a8fa707 | |||
| 096a418d01 | |||
| f2330472f0 | |||
| 3302e8bfa5 | |||
| 002ea88630 | |||
| 700ef87691 | |||
| 3b77723701 | |||
| 5473943cac | |||
| af49935a53 | |||
| eea9f10900 | |||
| 763f7b05ae | |||
| 96eba6b982 | |||
| ff1fc4d9f4 | |||
| 426bb5ae0f | |||
| b8af6c1ef0 | |||
| 743f9c8c42 | |||
| a6f85967e0 | |||
| 9d75a519f3 | |||
| d456bd42c3 | |||
| 6406431537 | |||
| 757aef2334 | |||
| 2c212753fe | |||
| bc2aaef4fa | |||
| 224789b79c | |||
| 678555b499 | |||
| 793fe29014 | |||
| 82f5802a94 | |||
| a2567336df | |||
| 4cc6477198 | |||
| b8396c335a | |||
| eacf30e61f | |||
| 55a3911408 | |||
| 4e2ae9caee | |||
| 33788800ec | |||
| 3f066469af | |||
| f2dab83445 | |||
| 38b74ef717 | |||
| d514d25e0a | |||
| f87084f8f1 | |||
| 26ca972e9e | |||
| ba4173384d | |||
| bd955bfea7 | |||
| 6e986b2919 | |||
| 0c499e0a5c | |||
| 7ecf7511f8 | |||
| 16f9660cfe | |||
| c02778ac30 | |||
| 50302c404a | |||
| cfa4b26231 | |||
| cff1f90adf | |||
| 64a5bc94e9 | |||
| 43bdbbf682 | |||
| 3ae54e045a | |||
| 6c5ee657a7 | |||
| 0cbfb7ff2a | |||
| 3bf46ee717 | |||
| 3a2f9a2ea4 | |||
| 231e2ec99a | |||
| e20c8ddc80 | |||
| 674c4f6891 | |||
| 93f4f3494a | |||
| 6a6f2e1ca6 | |||
| 9d92a3a6ba | |||
| db8514bcff | |||
| 20ab51fdbc | |||
| 605bab84ce | |||
| f6d9efefaa | |||
| 067268942c | |||
| d138d6e2ac | |||
| 9280f62e38 | |||
| 3d979f9676 | |||
| 592c691c8f | |||
| c448ab3f44 | |||
| 0c6c86643e | |||
| f928c24dcc | |||
| 55af4309f7 | |||
| f8b56ac904 | |||
| abcd53444b | |||
| 3c7387722d | |||
| bd305a3973 | |||
| c10bfee49f | |||
| a053229f0f | |||
| 88e709ae43 | |||
| 8385163bab | |||
| a620c573bc | |||
| c5176b2968 | |||
| 97223bb356 | |||
| 9ff8cdd971 |
+1
-1
@@ -120,7 +120,7 @@ foreach ($settingspage->children as $childpage) {
|
||||
}
|
||||
if ($savebutton) {
|
||||
$outputhtml .= html_writer::start_tag('div', array('class' => 'form-buttons'));
|
||||
$outputhtml .= html_writer::empty_tag('input', array('class' => 'form-submit', 'type' => 'submit', 'value' => get_string('savechanges','admin')));
|
||||
$outputhtml .= html_writer::empty_tag('input', array('class' => 'btn btn-primary form-submit', 'type' => 'submit', 'value' => get_string('savechanges','admin')));
|
||||
$outputhtml .= html_writer::end_tag('div');
|
||||
}
|
||||
|
||||
|
||||
@@ -1145,6 +1145,11 @@
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="2.8" requires="2.2">
|
||||
@@ -1418,6 +1423,11 @@
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.0" requires="2.2">
|
||||
@@ -1434,6 +1444,7 @@
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
<RESTRICT function="restrict_php_version_71" message="unsupportedphpversion71" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -1556,6 +1567,11 @@
|
||||
<ON_CHECK message="unsupporteddbtablerowformat" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.1" requires="2.7">
|
||||
@@ -1572,6 +1588,7 @@
|
||||
<VENDOR name="oracle" version="10.2" />
|
||||
</DATABASE>
|
||||
<PHP version="5.4.4" level="required">
|
||||
<RESTRICT function="restrict_php_version_71" message="unsupportedphpversion71" />
|
||||
</PHP>
|
||||
<PCREUNICODE level="optional">
|
||||
<FEEDBACK>
|
||||
@@ -1701,6 +1718,11 @@
|
||||
<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_CHECKS>
|
||||
</MOODLE>
|
||||
<MOODLE version="3.2" requires="2.7">
|
||||
@@ -1851,6 +1873,11 @@
|
||||
<ON_CHECK message="tlswarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
|
||||
<FEEDBACK>
|
||||
<ON_CHECK message="libcurlwarning" />
|
||||
</FEEDBACK>
|
||||
</CUSTOM_CHECK>
|
||||
</CUSTOM_CHECKS>
|
||||
</MOODLE>
|
||||
</COMPATIBILITY_MATRIX>
|
||||
|
||||
@@ -315,6 +315,11 @@ if (!$cache and $version > $CFG->version) { // upgrade
|
||||
$testsite = 'behat';
|
||||
}
|
||||
|
||||
if (isset($CFG->themerev)) {
|
||||
// Store the themerev to restore after purging caches.
|
||||
$themerev = $CFG->themerev;
|
||||
}
|
||||
|
||||
// We purge all of MUC's caches here.
|
||||
// Caches are disabled for upgrade by CACHE_DISABLE_ALL so we must set the first arg to true.
|
||||
// This ensures a real config object is loaded and the stores will be purged.
|
||||
@@ -324,6 +329,11 @@ if (!$cache and $version > $CFG->version) { // upgrade
|
||||
// We then purge the regular caches.
|
||||
purge_all_caches();
|
||||
|
||||
if (isset($themerev)) {
|
||||
// Restore the themerev
|
||||
set_config('themerev', $themerev);
|
||||
}
|
||||
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
|
||||
if (upgrade_stale_php_files_present()) {
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ if (!empty($disable) && confirm_sesskey()) {
|
||||
if (!$processor = $DB->get_record('message_processors', array('id'=>$disable))) {
|
||||
print_error('outputdoesnotexist', 'message');
|
||||
}
|
||||
$DB->set_field('message_processors', 'enabled', '0', array('id'=>$processor->id)); // Disable output
|
||||
\core_message\api::update_processor_status($processor, 0); // Disable output.
|
||||
core_plugin_manager::reset_caches();
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ if (!empty($enable) && confirm_sesskey()) {
|
||||
if (!$processor = $DB->get_record('message_processors', array('id'=>$enable))) {
|
||||
print_error('outputdoesnotexist', 'message');
|
||||
}
|
||||
$DB->set_field('message_processors', 'enabled', '1', array('id'=>$processor->id)); // Enable output
|
||||
\core_message\api::update_processor_status($processor, 1); // Enable output.
|
||||
core_plugin_manager::reset_caches();
|
||||
}
|
||||
|
||||
|
||||
@@ -133,9 +133,12 @@ echo $OUTPUT->header();
|
||||
</td>
|
||||
<td id="buttonscell">
|
||||
<p class="arrow_button">
|
||||
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$OUTPUT->rarrow(); ?>" title="<?php print_string('remove'); ?>" />
|
||||
<input name="main" id="main" type="submit" value="<?php echo get_string('mainadminset', 'core_role'); ?>" title="<?php print_string('mainadminset', 'core_role'); ?>" />
|
||||
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().' '.get_string('add'); ?>"
|
||||
title="<?php print_string('add'); ?>" class="btn btn-secondary"/><br />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$OUTPUT->rarrow(); ?>"
|
||||
title="<?php print_string('remove'); ?>" class="btn btn-secondary"/><br />
|
||||
<input name="main" id="main" type="submit" value="<?php echo get_string('mainadminset', 'core_role'); ?>"
|
||||
title="<?php print_string('mainadminset', 'core_role'); ?>" class="btn btn-secondary"/>
|
||||
</p>
|
||||
</td>
|
||||
<td id="potentialcell">
|
||||
|
||||
@@ -80,7 +80,8 @@ echo $OUTPUT->box($controller->get_intro_text());
|
||||
echo '<form action="' . $baseurl . '" method="post">';
|
||||
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
|
||||
echo html_writer::table($table);
|
||||
echo '<div class="buttons"><input type="submit" name="submit" value="'.get_string('savechanges').'"/>';
|
||||
echo '<div class="buttons">';
|
||||
echo '<input type="submit" class="btn btn-primary" name="submit" value="' . get_string('savechanges') . '"/>';
|
||||
echo '</div></form>';
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
||||
@@ -201,11 +201,13 @@ if ($roleid) {
|
||||
</td>
|
||||
<td id="buttonscell">
|
||||
<div id="addcontrols">
|
||||
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
|
||||
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().' '.get_string('add'); ?>"
|
||||
title="<?php print_string('add'); ?>" class="btn btn-secondary"/><br />
|
||||
</div>
|
||||
|
||||
<div id="removecontrols">
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$OUTPUT->rarrow(); ?>" title="<?php print_string('remove'); ?>" />
|
||||
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$OUTPUT->rarrow(); ?>"
|
||||
title="<?php print_string('remove'); ?>" class="btn btn-secondary"/>
|
||||
</div>
|
||||
</td>
|
||||
<td id="potentialcell">
|
||||
|
||||
@@ -172,7 +172,8 @@ echo $OUTPUT->heading('<label for="reportuser">' . $selectheading . '</label>',
|
||||
$userselector->display();
|
||||
|
||||
// Submit button and the end of the form.
|
||||
echo '<p id="chooseusersubmit"><input type="submit" value="' . get_string('showthisuserspermissions', 'core_role') . '" /></p>';
|
||||
echo '<p id="chooseusersubmit"><input type="submit" value="' . get_string('showthisuserspermissions', 'core_role') . '" ' .
|
||||
'class="btn btn-primary"/></p>';
|
||||
echo '</form>';
|
||||
echo $OUTPUT->box_end();
|
||||
|
||||
|
||||
@@ -471,15 +471,17 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
}
|
||||
|
||||
protected function get_name_field($id) {
|
||||
return '<input type="text" id="' . $id . '" name="' . $id . '" maxlength="254" value="' . s($this->role->name) . '" />';
|
||||
return '<input type="text" id="' . $id . '" name="' . $id . '" maxlength="254" value="' . s($this->role->name) . '"' .
|
||||
' class="form-control"/>';
|
||||
}
|
||||
|
||||
protected function get_shortname_field($id) {
|
||||
return '<input type="text" id="' . $id . '" name="' . $id . '" maxlength="254" value="' . s($this->role->shortname) . '" />';
|
||||
return '<input type="text" id="' . $id . '" name="' . $id . '" maxlength="254" value="' . s($this->role->shortname) . '"' .
|
||||
' class="form-control"/>';
|
||||
}
|
||||
|
||||
protected function get_description_field($id) {
|
||||
return '<textarea class="form-textarea" id="'. s($id) .'" name="description" rows="10" cols="50">' .
|
||||
return '<textarea class="form-textarea form-control" id="'. s($id) .'" name="description" rows="10" cols="50">' .
|
||||
htmlspecialchars($this->role->description) .
|
||||
'</textarea>';
|
||||
}
|
||||
@@ -490,7 +492,8 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
foreach (get_role_archetypes() as $type) {
|
||||
$options[$type] = get_string('archetype'.$type, 'role');
|
||||
}
|
||||
return html_writer::select($options, 'archetype', $this->role->archetype, false);
|
||||
return html_writer::select($options, 'archetype', $this->role->archetype, false,
|
||||
array('class' => 'custom-select'));
|
||||
}
|
||||
|
||||
protected function get_assignable_levels_control() {
|
||||
@@ -563,7 +566,8 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
if ($this->roleid == 0) {
|
||||
$options[-1] = get_string('thisnewrole', 'core_role');
|
||||
}
|
||||
return html_writer::select($options, 'allow'.$type.'[]', $selected, false, array('multiple'=>'multiple', 'size'=>10));
|
||||
return html_writer::select($options, 'allow'.$type.'[]', $selected, false, array('multiple' => 'multiple',
|
||||
'size' => 10, 'class' => 'form-control'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -575,11 +579,19 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
return '';
|
||||
}
|
||||
|
||||
protected function print_field($name, $caption, $field) {
|
||||
/**
|
||||
* Print labels, fields and help icon on role administration page.
|
||||
*
|
||||
* @param string $name The field name.
|
||||
* @param string $caption The field caption.
|
||||
* @param string $field The field type.
|
||||
* @param null|string $helpicon The help icon content.
|
||||
*/
|
||||
protected function print_field($name, $caption, $field, $helpicon = null) {
|
||||
global $OUTPUT;
|
||||
// Attempt to generate HTML like formslib.
|
||||
echo '<div class="fitem">';
|
||||
echo '<div class="fitemtitle">';
|
||||
echo '<div class="fitem row form-group">';
|
||||
echo '<div class="fitemtitle col-md-3">';
|
||||
if ($name) {
|
||||
echo '<label for="' . $name . '">';
|
||||
}
|
||||
@@ -587,13 +599,16 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
if ($name) {
|
||||
echo "</label>\n";
|
||||
}
|
||||
if ($helpicon) {
|
||||
echo '<span class="pull-xs-right text-nowrap">'.$helpicon.'</span>';
|
||||
}
|
||||
echo '</div>';
|
||||
if (isset($this->errors[$name])) {
|
||||
$extraclass = ' error';
|
||||
} else {
|
||||
$extraclass = '';
|
||||
}
|
||||
echo '<div class="felement' . $extraclass . '">';
|
||||
echo '<div class="felement col-md-9 form-inline' . $extraclass . '">';
|
||||
echo $field;
|
||||
if (isset($this->errors[$name])) {
|
||||
echo $OUTPUT->error_text($this->errors[$name]);
|
||||
@@ -605,7 +620,8 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
protected function print_show_hide_advanced_button() {
|
||||
echo '<p class="definenotice">' . get_string('highlightedcellsshowdefault', 'core_role') . ' </p>';
|
||||
echo '<div class="advancedbutton">';
|
||||
echo '<input type="submit" name="toggleadvanced" value="' . get_string('hideadvanced', 'form') . '" />';
|
||||
echo '<input type="submit" class="btn btn-secondary" name="toggleadvanced" value="' .
|
||||
get_string('hideadvanced', 'form') . '" />';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
@@ -613,11 +629,14 @@ class core_role_define_role_table_advanced extends core_role_capability_table_wi
|
||||
global $OUTPUT;
|
||||
// Extra fields at the top of the page.
|
||||
echo '<div class="topfields clearfix">';
|
||||
$this->print_field('shortname', get_string('roleshortname', 'core_role').' '.$OUTPUT->help_icon('roleshortname', 'core_role'), $this->get_shortname_field('shortname'));
|
||||
$this->print_field('name', get_string('customrolename', 'core_role').' '.$OUTPUT->help_icon('customrolename', 'core_role'), $this->get_name_field('name'));
|
||||
$this->print_field('edit-description', get_string('customroledescription', 'core_role').' '.$OUTPUT->help_icon('customroledescription', 'core_role'),
|
||||
$this->get_description_field('description'));
|
||||
$this->print_field('menuarchetype', get_string('archetype', 'core_role').' '.$OUTPUT->help_icon('archetype', 'core_role'), $this->get_archetype_field('archetype'));
|
||||
$this->print_field('shortname', get_string('roleshortname', 'core_role'),
|
||||
$this->get_shortname_field('shortname'), $OUTPUT->help_icon('roleshortname', 'core_role'));
|
||||
$this->print_field('name', get_string('customrolename', 'core_role'), $this->get_name_field('name'),
|
||||
$OUTPUT->help_icon('customrolename', 'core_role'));
|
||||
$this->print_field('edit-description', get_string('customroledescription', 'core_role'),
|
||||
$this->get_description_field('description'), $OUTPUT->help_icon('customroledescription', 'core_role'));
|
||||
$this->print_field('menuarchetype', get_string('archetype', 'core_role'), $this->get_archetype_field('archetype'),
|
||||
$OUTPUT->help_icon('archetype', 'core_role'));
|
||||
$this->print_field('', get_string('maybeassignedin', 'core_role'), $this->get_assignable_levels_control());
|
||||
$this->print_field('menuallowassign', get_string('allowassign', 'core_role'), $this->get_allow_role_control('assign'));
|
||||
$this->print_field('menuallowoverride', get_string('allowoverride', 'core_role'), $this->get_allow_role_control('override'));
|
||||
|
||||
@@ -37,7 +37,8 @@ class core_role_define_role_table_basic extends core_role_define_role_table_adva
|
||||
|
||||
protected function print_show_hide_advanced_button() {
|
||||
echo '<div class="advancedbutton">';
|
||||
echo '<input type="submit" name="toggleadvanced" value="' . get_string('showadvanced', 'form') . '" />';
|
||||
echo '<input type="submit" class="btn btn-secondary" name="toggleadvanced"
|
||||
value="' . get_string('showadvanced', 'form') . '" />';
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
||||
@@ -252,7 +252,7 @@ if ($action === 'view') {
|
||||
echo '<div class="mform">';
|
||||
} else {
|
||||
?>
|
||||
<form id="rolesform" class="mform" action="<?php p($baseurl->out(false)); ?>" method="post"><div>
|
||||
<form id="rolesform" class="mform fcontainer" action="<?php p($baseurl->out(false)); ?>" method="post"><div>
|
||||
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
|
||||
<input type="hidden" name="return" value="<?php p($return); ?>" />
|
||||
<input type="hidden" name="resettype" value="none" />
|
||||
|
||||
@@ -45,17 +45,20 @@ M.core_role.init_cap_table_filter = function(Y, tableid, contextid) {
|
||||
this.table = Y.one('#'+this.tableid);
|
||||
|
||||
// Create a div to hold the search UI.
|
||||
this.div = Y.Node.create('<div class="capabilitysearchui"></div>').setStyles({
|
||||
this.div = Y.Node.create('<div class="capabilitysearchui form-inline"></div>').setStyles({
|
||||
width : this.table.get('offsetWidth'),
|
||||
marginLeft : 'auto',
|
||||
marginRight : 'auto'
|
||||
});
|
||||
// Create the capability search input.
|
||||
this.input = Y.Node.create('<input type="text" id="'+this.table.get('id')+'capabilitysearch" value="'+Y.Escape.html(filtervalue)+'" />');
|
||||
this.input = Y.Node.create('<input class="form-control m-x-1" type="text"' +
|
||||
' id="'+this.table.get('id')+'capabilitysearch" value="'+Y.Escape.html(filtervalue)+'" />');
|
||||
// Create a label for the search input.
|
||||
this.label = Y.Node.create('<label for="'+this.input.get('id')+'">'+M.util.get_string('filter', 'moodle')+' </label>');
|
||||
this.label = Y.Node.create('<label for="' + this.input.get('id') + '">' +
|
||||
M.util.get_string('filter', 'moodle') + ' </label>');
|
||||
// Create a clear button to clear the input.
|
||||
this.button = Y.Node.create('<input type="button" value="'+M.util.get_string('clear', 'moodle')+'" />').set('disabled', filtervalue=='');
|
||||
this.button = Y.Node.create('<input type="button" class="btn btn-primary"' +
|
||||
' value="'+M.util.get_string('clear', 'moodle')+'" />').set('disabled', filtervalue=='');
|
||||
|
||||
// Tie it all together
|
||||
this.div.append(this.label).append(this.input).append(this.button);
|
||||
|
||||
@@ -177,8 +177,10 @@ if (!empty($capabilities)) {
|
||||
}
|
||||
|
||||
echo html_writer::start_tag('div', array('class'=>'submit_buttons'));
|
||||
echo html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'savechanges', 'value'=>get_string('savechanges')));
|
||||
echo html_writer::empty_tag('input', array('type'=>'submit', 'name'=>'cancel', 'value'=>get_string('cancel')));
|
||||
$attrs = array('type'=>'submit', 'name'=>'savechanges', 'value'=>get_string('savechanges'), 'class'=>'btn btn-primary');
|
||||
echo html_writer::empty_tag('input', $attrs);
|
||||
$attrs = array('type'=>'submit', 'name'=>'cancel', 'value'=>get_string('cancel'), 'class' => 'btn btn-secondary');
|
||||
echo html_writer::empty_tag('input', $attrs);
|
||||
echo html_writer::end_tag('div');
|
||||
echo html_writer::end_tag('div');
|
||||
echo html_writer::end_tag('form');
|
||||
|
||||
@@ -181,7 +181,7 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
$temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
|
||||
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
|
||||
$temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('navshowfrontpagemods', new lang_string('navshowfrontpagemods', 'admin'), new lang_string('navshowfrontpagemods_help', 'admin'), 1));
|
||||
$temp->add(new admin_setting_configcheckbox('navadduserpostslinks', new lang_string('navadduserpostslinks', 'admin'), new lang_string('navadduserpostslinks_help', 'admin'), 1));
|
||||
@@ -236,8 +236,11 @@ preferences,moodle|/user/preferences.php|preferences',
|
||||
$temp->add(new admin_setting_configcheckbox('modchooserdefault', new lang_string('modchooserdefault', 'admin'), new lang_string('configmodchooserdefault', 'admin'), 1));
|
||||
$ADMIN->add('appearance', $temp);
|
||||
|
||||
// link to tag management interface
|
||||
$ADMIN->add('appearance', new admin_externalpage('managetags', new lang_string('managetags', 'tag'), $CFG->wwwroot.'/tag/manage.php', 'moodle/tag:manage'));
|
||||
// Link to tag management interface.
|
||||
$url = new moodle_url('/tag/manage.php');
|
||||
$hidden = empty($CFG->usetags);
|
||||
$page = new admin_externalpage('managetags', new lang_string('managetags', 'tag'), $url, 'moodle/tag:manage', $hidden);
|
||||
$ADMIN->add('appearance', $page);
|
||||
|
||||
$temp = new admin_settingpage('additionalhtml', new lang_string('additionalhtml', 'admin'));
|
||||
$temp->add(new admin_setting_heading('additionalhtml_heading', new lang_string('additionalhtml_heading', 'admin'), new lang_string('additionalhtml_desc', 'admin')));
|
||||
|
||||
@@ -118,8 +118,15 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
|
||||
$temp->add(new admin_setting_configcheckbox('cookiehttponly', new lang_string('cookiehttponly', 'admin'), new lang_string('configcookiehttponly', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('allowframembedding', new lang_string('allowframembedding', 'admin'), new lang_string('allowframembedding_help', 'admin'), 0));
|
||||
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', new lang_string('loginpasswordautocomplete', 'admin'), new lang_string('loginpasswordautocomplete_help', 'admin'), 0));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
// Settings elements used by the \core\files\curl_security_helper class.
|
||||
$temp->add(new admin_setting_configmixedhostiplist('curlsecurityblockedhosts',
|
||||
new lang_string('curlsecurityblockedhosts', 'admin'),
|
||||
new lang_string('curlsecurityblockedhostssyntax', 'admin'), ""));
|
||||
$temp->add(new admin_setting_configportlist('curlsecurityallowedport',
|
||||
new lang_string('curlsecurityallowedport', 'admin'),
|
||||
new lang_string('curlsecurityallowedportsyntax', 'admin'), ""));
|
||||
$ADMIN->add('security', $temp);
|
||||
|
||||
// "notifications" settingpage
|
||||
$temp = new admin_settingpage('notifications', new lang_string('notifications', 'admin'));
|
||||
|
||||
@@ -26,7 +26,6 @@ if (isset($_SERVER['REMOTE_ADDR'])) {
|
||||
die(); // No access from web!
|
||||
}
|
||||
|
||||
define('BEHAT_UTIL', true);
|
||||
define('CLI_SCRIPT', true);
|
||||
define('ABORT_AFTER_CONFIG', true);
|
||||
define('CACHE_DISABLE_ALL', true);
|
||||
|
||||
@@ -31,9 +31,8 @@ Feature: Transform steps arguments
|
||||
And I press "Update profile"
|
||||
And I click on "Edit profile" "link" in the "region-main" "region"
|
||||
Then I should not see "NASTYSTRING"
|
||||
# BEHAT Transformation regression - See MDL-56397
|
||||
#And the field "Surname" matches value "$NASTYSTRING1"
|
||||
#And the field "City/town" matches value "$NASTYSTRING3"
|
||||
And the field "Surname" matches value "$NASTYSTRING1"
|
||||
And the field "City/town" matches value "$NASTYSTRING3"
|
||||
|
||||
Scenario: Use double quotes
|
||||
When I set the following fields to these values:
|
||||
@@ -57,5 +56,4 @@ Feature: Transform steps arguments
|
||||
And I should see "My Firstname"
|
||||
And I should see "My Surname"
|
||||
And the field "First name" matches value "My Firstname $NASTYSTRING1"
|
||||
# BEHAT Transformation regression - See MDL-56397
|
||||
#And the field "Surname" matches value "My Surname $NASTYSTRING2"
|
||||
And the field "Surname" matches value "My Surname $NASTYSTRING2"
|
||||
|
||||
@@ -184,6 +184,8 @@ class controller {
|
||||
|
||||
if ($updated) {
|
||||
$this->info[] = get_string('langupdatecomplete', 'tool_langimport');
|
||||
// The strings have been changed so we need to purge their cache to ensure users see the changes.
|
||||
get_string_manager()->reset_caches();
|
||||
} else {
|
||||
$this->info[] = get_string('nolangupdateneeded', 'tool_langimport');
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
@@ -794,6 +794,7 @@ define(['jquery'], function($) {
|
||||
this.allItems.addClass('tool-lp-menu-item');
|
||||
this.rootMenus.addClass('tool-lp-root-menu');
|
||||
this.subMenus.addClass('tool-lp-sub-menu');
|
||||
this.subMenuItems.addClass('dropdown-item');
|
||||
};
|
||||
|
||||
return /** @alias module:tool_lp/menubar */ {
|
||||
|
||||
@@ -50,7 +50,8 @@ class cohort_summary_exporter extends \core_competency\external\exporter {
|
||||
),
|
||||
'idnumber' => array(
|
||||
'type' => PARAM_RAW, // ID numbers are plain text.
|
||||
'default' => ''
|
||||
'default' => '',
|
||||
'null' => NULL_ALLOWED
|
||||
),
|
||||
'visible' => array(
|
||||
'type' => PARAM_BOOL,
|
||||
|
||||
@@ -91,7 +91,7 @@ class framework_autocomplete extends MoodleQuickForm_autocomplete {
|
||||
$ids = array();
|
||||
|
||||
foreach ($values as $onevalue) {
|
||||
if ((!$this->optionExists($onevalue)) &&
|
||||
if (!empty($onevalue) && (!$this->optionExists($onevalue)) &&
|
||||
($onevalue !== '_qf__force_multiselect_submission')) {
|
||||
array_push($ids, $onevalue);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,12 @@ class manage_competency_frameworks_page implements renderable, templatable {
|
||||
'get'
|
||||
);
|
||||
$this->navigation[] = $addpage;
|
||||
$competenciesrepository = new single_button(
|
||||
new moodle_url('https://moodle.net/competencies'),
|
||||
get_string('competencyframeworksrepository', 'tool_lp'),
|
||||
'get'
|
||||
);
|
||||
$this->navigation[] = $competenciesrepository;
|
||||
}
|
||||
|
||||
$this->competencyframeworks = api::list_frameworks('shortname', 'ASC', 0, 0, $this->pagecontext);
|
||||
|
||||
@@ -61,6 +61,7 @@ $string['competencyframeworkcreated'] = 'Competency framework created.';
|
||||
$string['competencyframeworkname'] = 'Name';
|
||||
$string['competencyframeworkroot'] = 'No parent (top-level competency)';
|
||||
$string['competencyframeworks'] = 'Competency frameworks';
|
||||
$string['competencyframeworksrepository'] = 'Competency frameworks repository';
|
||||
$string['competencyframeworkupdated'] = 'Competency framework updated.';
|
||||
$string['competencyoutcome_complete'] = 'Mark as complete';
|
||||
$string['competencyoutcome_evidence'] = 'Attach an evidence';
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
{{#hascompetencies}}
|
||||
<span>
|
||||
<label for="competency-nav-{{uniqid}}" class="accesshide">{{#str}}jumptocompetency, tool_lp{{/str}}</label>
|
||||
<select id="competency-nav-{{uniqid}}">
|
||||
<select class="custom-select" id="competency-nav-{{uniqid}}">
|
||||
{{#competencies}}
|
||||
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{{shortname}}} {{idnumber}}</option>
|
||||
{{/competencies}}
|
||||
|
||||
@@ -85,7 +85,7 @@
|
||||
<div data-region="coursecompetency-ruleoutcome">
|
||||
<label>
|
||||
{{#str}}uponcoursecompletion, tool_lp{{/str}}
|
||||
<select data-field="ruleoutcome" data-id="{{coursecompetency.id}}">
|
||||
<select data-field="ruleoutcome" data-id="{{coursecompetency.id}}" class="custom-select">
|
||||
{{#ruleoutcomeoptions}}
|
||||
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{text}}</option>
|
||||
{{/ruleoutcomeoptions}}
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
<ul title="{{#str}}edit{{/str}}" class="competencyactionsmenu">
|
||||
<li>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown dropdown-menu">
|
||||
<li class="dropdown-item">
|
||||
<a href="#" data-action="edit">
|
||||
{{#pix}}t/edit{{/pix}} {{#str}}edit{{/str}}
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<ul title="{{#str}}edit{{/str}}" class="competencyframeworkactions">
|
||||
<li>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown dropdown-menu">
|
||||
<li class="dropdown-item">
|
||||
<a href="{{pluginbaseurl}}/editcompetencyframework.php?id={{id}}&pagecontextid={{pagecontextid}}">
|
||||
{{#pix}}t/edit{{/pix}} {{#str}}edit{{/str}}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
<ul class="templateactions">
|
||||
<li>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown dropdown-menu">
|
||||
<li class="dropdown-item">
|
||||
<a href="{{pluginbaseurl}}/edittemplate.php?id={{id}}&pagecontextid={{pagecontextid}}&return=templates">
|
||||
{{#pix}}t/edit{{/pix}} {{#str}}edit{{/str}}
|
||||
|
||||
@@ -152,7 +152,7 @@
|
||||
<ul title="{{#str}}edit{{/str}}" class="user-competency-actions">
|
||||
<li>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown dropdown-menu">
|
||||
{{#usercompetency.isrequestreviewallowed}}
|
||||
<li class="dropdown-item">
|
||||
<a href="#" data-action="request-review">{{#pix}}t/edit, core{{/pix}} {{#str}}requestreview, tool_lp{{/str}}</a>
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
<ul title="{{#str}}edit{{/str}}" class="planactions">
|
||||
<li>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown dropdown-menu">
|
||||
<li class="{{^canbeedited}} disabled {{/canbeedited}} dropdown-item">
|
||||
<a href="{{#canbeedited}}
|
||||
{{pluginbaseurl}}/editplan.php?id={{id}}&userid={{userid}}&return=plans
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
{{#hasusers}}
|
||||
<span>
|
||||
<label for="user-nav-{{uniqid}}" class="accesshide">{{#str}}jumptouser, tool_lp{{/str}}</label>
|
||||
<select id="user-nav-{{uniqid}}">
|
||||
<select id="user-nav-{{uniqid}}" class="custom-select">
|
||||
{{#users}}
|
||||
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{fullname}}</option>
|
||||
{{/users}}
|
||||
@@ -52,7 +52,7 @@
|
||||
{{#hascompetencies}}
|
||||
<span>
|
||||
<label for="competency-nav-{{uniqid}}" class="accesshide">{{#str}}jumptocompetency, tool_lp{{/str}}</label>
|
||||
<select id="competency-nav-{{uniqid}}">
|
||||
<select id="competency-nav-{{uniqid}}" class="custom-select">
|
||||
{{#competencies}}
|
||||
<option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{{shortname}}} {{idnumber}}</option>
|
||||
{{/competencies}}
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<ul title="{{#str}}edit{{/str}}" class="user-evidence-actions">
|
||||
<li>
|
||||
<a href="#">{{#str}}edit{{/str}}</a><b class="caret"></b>
|
||||
<ul class="dropdown-menu">
|
||||
<ul class="dropdown dropdown-menu">
|
||||
<li class="dropdown-item">
|
||||
<a href="{{pluginbaseurl}}/user_evidence_edit.php?id={{id}}&userid={{userid}}&return=list">
|
||||
{{#pix}}t/edit{{/pix}} {{#str}}editthisuserevidence, tool_lp{{/str}}
|
||||
|
||||
@@ -52,6 +52,7 @@ class import extends moodleform {
|
||||
$mform = $this->_form;
|
||||
$element = $mform->createElement('filepicker', 'importfile', get_string('importfile', 'tool_lpimportcsv'));
|
||||
$mform->addElement($element);
|
||||
$mform->addHelpButton('importfile', 'importfile', 'tool_lpimportcsv');
|
||||
$mform->addRule('importfile', null, 'required');
|
||||
$mform->addElement('hidden', 'confirm', 0);
|
||||
$mform->setType('confirm', PARAM_BOOL);
|
||||
@@ -65,12 +66,10 @@ class import extends moodleform {
|
||||
} else {
|
||||
$mform->setDefault('delimiter_name', 'comma');
|
||||
}
|
||||
$mform->addHelpButton('delimiter_name', 'csvdelimiter', 'tool_lpimportcsv');
|
||||
|
||||
$choices = core_text::get_encodings();
|
||||
$mform->addElement('select', 'encoding', get_string('encoding', 'tool_lpimportcsv'), $choices);
|
||||
$mform->setDefault('encoding', 'UTF-8');
|
||||
$mform->addHelpButton('encoding', 'encoding', 'tool_lpimportcsv');
|
||||
|
||||
$this->add_action_buttons(false, get_string('import', 'tool_lpimportcsv'));
|
||||
}
|
||||
|
||||
@@ -27,16 +27,16 @@ $string['competencyscaledescription'] = 'Competency scale created by import';
|
||||
$string['confirmcolumnmappings'] = 'Confirm the column mappings';
|
||||
$string['confirm'] = 'Confirm';
|
||||
$string['csvdelimiter'] = 'CSV delimiter';
|
||||
$string['csvdelimiter_help'] = 'The CSV delimiter is normally a comma.';
|
||||
$string['description'] = 'Description';
|
||||
$string['descriptionformat'] = 'Description format';
|
||||
$string['encoding'] = 'Encoding';
|
||||
$string['encoding_help'] = 'The CSV file encoding is usually UTF-8.';
|
||||
$string['export'] = 'Export';
|
||||
$string['exportid'] = 'Exported ID (optional)';
|
||||
$string['exportnavlink'] = 'Export competency framework';
|
||||
$string['idnumber'] = 'ID number';
|
||||
$string['importfile'] = 'CSV framework description file';
|
||||
$string['importfile_help'] = 'A competency framework may be imported via text file. The format of the file can be determined by creating a new competency framework on the site and then exporting it.';
|
||||
$string['importfile_link'] = 'admin/tool/lpimportcsv';
|
||||
$string['import'] = 'Import';
|
||||
$string['invalidimportfile'] = 'File format is invalid.';
|
||||
$string['isframework'] = 'Is framework';
|
||||
|
||||
@@ -396,12 +396,8 @@ class tool_lpmigrate_framework_processor_testcase extends advanced_testcase {
|
||||
}
|
||||
|
||||
public function test_permission_exception() {
|
||||
global $DB;
|
||||
if ($DB->get_dbfamily() === 'postgres' or $DB->get_dbfamily() === 'mssql') {
|
||||
$this->markTestSkipped('The processor is having issues with the transaction initialised in '
|
||||
. 'advanced_testcase::runBare().');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->preventResetByRollback(); // Test uses transactions, so we cannot use them for speedy reset.
|
||||
|
||||
$dg = $this->getDataGenerator();
|
||||
$u = $dg->create_user();
|
||||
|
||||
@@ -31,7 +31,7 @@ use moodle_url;
|
||||
use moodle_exception;
|
||||
|
||||
/**
|
||||
* API exposed by tool_mobile
|
||||
* API exposed by tool_mobile, to be used mostly by external functions.
|
||||
*
|
||||
* @copyright 2016 Juan Leyva
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
@@ -106,6 +106,8 @@ class api {
|
||||
// We need this to make work the format text functions.
|
||||
$PAGE->set_context($context);
|
||||
|
||||
list($authinstructions, $notusedformat) = external_format_text($CFG->auth_instructions, FORMAT_MOODLE, $context->id);
|
||||
list($maintenancemessage, $notusedformat) = external_format_text($CFG->maintenance_message, FORMAT_MOODLE, $context->id);
|
||||
$settings = array(
|
||||
'wwwroot' => $CFG->wwwroot,
|
||||
'httpswwwroot' => $CFG->httpswwwroot,
|
||||
@@ -115,12 +117,12 @@ class api {
|
||||
'authloginviaemail' => $CFG->authloginviaemail,
|
||||
'registerauth' => $CFG->registerauth,
|
||||
'forgottenpasswordurl' => $CFG->forgottenpasswordurl,
|
||||
'authinstructions' => format_text($CFG->auth_instructions),
|
||||
'authinstructions' => $authinstructions,
|
||||
'authnoneenabled' => (int) is_enabled_auth('none'),
|
||||
'enablewebservices' => $CFG->enablewebservices,
|
||||
'enablemobilewebservice' => $CFG->enablemobilewebservice,
|
||||
'maintenanceenabled' => $CFG->maintenance_enabled,
|
||||
'maintenancemessage' => format_text($CFG->maintenance_message),
|
||||
'maintenancemessage' => $maintenancemessage,
|
||||
);
|
||||
|
||||
$typeoflogin = get_config('tool_mobile', 'typeoflogin');
|
||||
@@ -162,9 +164,15 @@ class api {
|
||||
if (empty($section) or $section == 'frontpagesettings') {
|
||||
require_once($CFG->dirroot . '/course/format/lib.php');
|
||||
// First settings that anyone can deduce.
|
||||
$settings->fullname = $SITE->fullname;
|
||||
$settings->shortname = $SITE->shortname;
|
||||
$settings->summary = $SITE->summary;
|
||||
$settings->fullname = external_format_string($SITE->fullname, $context->id);
|
||||
$settings->shortname = external_format_string($SITE->shortname, $context->id);
|
||||
|
||||
// Return to a var instead of directly to $settings object because of differences between
|
||||
// list() in php5 and php7. {@link http://php.net/manual/en/function.list.php}
|
||||
$formattedsummary = external_format_text($SITE->summary, $SITE->summaryformat,
|
||||
$context->id);
|
||||
$settings->summary = $formattedsummary[0];
|
||||
$settings->summaryformat = $formattedsummary[1];
|
||||
$settings->frontpage = $CFG->frontpage;
|
||||
$settings->frontpageloggedin = $CFG->frontpageloggedin;
|
||||
$settings->maxcategorydepth = $CFG->maxcategorydepth;
|
||||
|
||||
@@ -246,15 +246,9 @@ class external extends external_api {
|
||||
// We must toletare these two exceptions: forcepasswordchangenotice and usernotfullysetup.
|
||||
try {
|
||||
self::validate_context($context);
|
||||
} catch (Exception $e) {
|
||||
if ($e instanceof moodle_exception) {
|
||||
if (($e->errorcode != 'usernotfullysetup') and
|
||||
($e->errorcode != 'forcepasswordchangenotice')) {
|
||||
|
||||
// In case we receive a different exception, throw it.
|
||||
throw $e;
|
||||
}
|
||||
} else {
|
||||
} catch (moodle_exception $e) {
|
||||
if ($e->errorcode != 'usernotfullysetup' && $e->errorcode != 'forcepasswordchangenotice') {
|
||||
// In case we receive a different exception, throw it.
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['autologinkeygenerationlockout'] = 'Auto-login key generation is locked out, too much requests in an hour.';
|
||||
$string['autologinnotallowedtoadmins'] = 'Auto-login is not allowed to site admins';
|
||||
$string['autologinkeygenerationlockout'] = 'Auto-login key generation is blocked because of too many requests within an hour.';
|
||||
$string['autologinnotallowedtoadmins'] = 'Auto-login is not allowed for site admins.';
|
||||
$string['clickheretolaunchtheapp'] = 'Click here if the app does not open automatically.';
|
||||
$string['configmobilecssurl'] = 'A CSS file to customise your mobile app interface.';
|
||||
$string['enablesmartappbanners'] = 'Enable Smart App Banners';
|
||||
$string['enablesmartappbanners_desc'] = 'This will display a banner promoting the Moodle Mobile app when visiting the site in Mobile Safari.';
|
||||
$string['forcedurlscheme'] = 'If you want to allow only your custom branded app to be opened via a browser window, then specify its URL scheme here; otherwise leave the field empty.';
|
||||
@@ -36,6 +37,11 @@ $string['iosappid_desc'] = 'This setting may be left as default unless you have
|
||||
$string['loginintheapp'] = 'Via the app';
|
||||
$string['logininthebrowser'] = 'Via a browser window (for SSO plugins)';
|
||||
$string['loginintheembeddedbrowser'] = 'Via an embedded browser (for SSO plugins)';
|
||||
$string['mobileapp'] = 'Mobile app';
|
||||
$string['mobileappearance'] = 'Mobile appearance';
|
||||
$string['mobileauthentication'] = 'Mobile authentication';
|
||||
$string['mobilecssurl'] = 'CSS';
|
||||
$string['mobilesettings'] = 'Mobile settings';
|
||||
$string['pluginname'] = 'Moodle Mobile tools';
|
||||
$string['smartappbanners'] = 'Smart App Banners (iOS only)';
|
||||
$string['pluginnotenabledorconfigured'] = 'Plugin not enabled or configured.';
|
||||
|
||||
@@ -31,6 +31,7 @@ require_once($CFG->libdir . '/externallib.php');
|
||||
$serviceshortname = required_param('service', PARAM_ALPHANUMEXT);
|
||||
$passport = required_param('passport', PARAM_RAW); // Passport send from the app to validate the response URL.
|
||||
$urlscheme = optional_param('urlscheme', 'moodlemobile', PARAM_NOTAGS); // The URL scheme the app supports.
|
||||
$confirmed = optional_param('confirmed', false, PARAM_BOOL); // If we are being redirected after user confirmation.
|
||||
|
||||
// Check web services enabled.
|
||||
if (!$CFG->enablewebservices) {
|
||||
@@ -39,7 +40,8 @@ if (!$CFG->enablewebservices) {
|
||||
|
||||
// Check if the plugin is properly configured.
|
||||
$typeoflogin = get_config('tool_mobile', 'typeoflogin');
|
||||
if ($typeoflogin != tool_mobile\api::LOGIN_VIA_BROWSER and
|
||||
if (empty($SESSION->justloggedin) and
|
||||
$typeoflogin != tool_mobile\api::LOGIN_VIA_BROWSER and
|
||||
$typeoflogin != tool_mobile\api::LOGIN_VIA_EMBEDDED_BROWSER) {
|
||||
throw new moodle_exception('pluginnotenabledorconfigured', 'tool_mobile');
|
||||
}
|
||||
@@ -61,8 +63,8 @@ $token = external_generate_token_for_current_user($service);
|
||||
$privatetoken = $token->privatetoken;
|
||||
external_log_token_request($token);
|
||||
|
||||
// Invalidate the private token if external_generate_token_for_current_user did not create a new token.
|
||||
if ($token->timecreated < $timenow) {
|
||||
// Don't return the private token if the user didn't just log in and a new token wasn't created.
|
||||
if (empty($SESSION->justloggedin) and $token->timecreated < $timenow) {
|
||||
$privatetoken = null;
|
||||
}
|
||||
|
||||
@@ -87,11 +89,25 @@ if (!empty($forcedurlscheme)) {
|
||||
$location = "$urlscheme://token=$apptoken";
|
||||
|
||||
// For iOS 10 onwards, we have to simulate a user click.
|
||||
if (core_useragent::is_ios()) {
|
||||
$PAGE->set_context(null);
|
||||
$PAGE->set_url('/local/mobile/launch.php', array('service' => $serviceshortname, 'passport' => $passport, 'urlscheme' => $urlscheme));
|
||||
// If we come from the confirmation page, we should display a nicer page.
|
||||
$isios = core_useragent::is_ios();
|
||||
if ($confirmed or $isios) {
|
||||
$PAGE->set_context(context_system::instance());
|
||||
$PAGE->set_heading($COURSE->fullname);
|
||||
$params = array('service' => $serviceshortname, 'passport' => $passport, 'urlscheme' => $urlscheme, 'confirmed' => $confirmed);
|
||||
$PAGE->set_url("/$CFG->admin/tool/mobile/launch.php", $params);
|
||||
|
||||
echo $OUTPUT->header();
|
||||
if ($confirmed) {
|
||||
$confirmedstr = get_string('confirmed');
|
||||
$PAGE->navbar->add($confirmedstr);
|
||||
$PAGE->set_title($confirmedstr);
|
||||
echo $OUTPUT->notification($confirmedstr, \core\output\notification::NOTIFY_SUCCESS);
|
||||
echo $OUTPUT->box_start('generalbox centerpara boxwidthnormal boxaligncenter');
|
||||
echo $OUTPUT->single_button(new moodle_url('/course/'), get_string('courses'));
|
||||
echo $OUTPUT->box_end();
|
||||
}
|
||||
|
||||
$notice = get_string('clickheretolaunchtheapp', 'tool_mobile');
|
||||
echo html_writer::link($location, $notice, array('id' => 'launchapp'));
|
||||
echo html_writer::script(
|
||||
|
||||
@@ -28,7 +28,9 @@ defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
if ($hassiteconfig) {
|
||||
|
||||
$temp = new admin_settingpage('mobile', new lang_string('mobile', 'admin'), 'moodle/site:config', false);
|
||||
$ADMIN->add('root', new admin_category('mobileapp', new lang_string('mobileapp', 'tool_mobile')), 'development');
|
||||
|
||||
$temp = new admin_settingpage('mobilesettings', new lang_string('mobilesettings', 'tool_mobile'), 'moodle/site:config', false);
|
||||
|
||||
// We should wait to the installation to finish since we depend on some configuration values that are set once
|
||||
// the admin user profile is configured.
|
||||
@@ -41,32 +43,43 @@ if ($hassiteconfig) {
|
||||
new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), $default));
|
||||
}
|
||||
|
||||
$temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'admin'),
|
||||
new lang_string('configmobilecssurl', 'admin'), '', PARAM_URL));
|
||||
$ADMIN->add('mobileapp', $temp);
|
||||
|
||||
// Type of login.
|
||||
$options = array(
|
||||
tool_mobile\api::LOGIN_VIA_APP => new lang_string('loginintheapp', 'tool_mobile'),
|
||||
tool_mobile\api::LOGIN_VIA_BROWSER => new lang_string('logininthebrowser', 'tool_mobile'),
|
||||
tool_mobile\api::LOGIN_VIA_EMBEDDED_BROWSER => new lang_string('loginintheembeddedbrowser', 'tool_mobile'),
|
||||
);
|
||||
$temp->add(new admin_setting_configselect('tool_mobile/typeoflogin',
|
||||
new lang_string('typeoflogin', 'tool_mobile'),
|
||||
new lang_string('typeoflogin_desc', 'tool_mobile'), 1, $options));
|
||||
// Show only mobile settings if the mobile service is enabled.
|
||||
if (!empty($CFG->enablemobilewebservice)) {
|
||||
// Type of login.
|
||||
$temp = new admin_settingpage('mobileauthentication', new lang_string('mobileauthentication', 'tool_mobile'));
|
||||
$options = array(
|
||||
tool_mobile\api::LOGIN_VIA_APP => new lang_string('loginintheapp', 'tool_mobile'),
|
||||
tool_mobile\api::LOGIN_VIA_BROWSER => new lang_string('logininthebrowser', 'tool_mobile'),
|
||||
tool_mobile\api::LOGIN_VIA_EMBEDDED_BROWSER => new lang_string('loginintheembeddedbrowser', 'tool_mobile'),
|
||||
);
|
||||
$temp->add(new admin_setting_configselect('tool_mobile/typeoflogin',
|
||||
new lang_string('typeoflogin', 'tool_mobile'),
|
||||
new lang_string('typeoflogin_desc', 'tool_mobile'), 1, $options));
|
||||
|
||||
$temp->add(new admin_setting_configtext('tool_mobile/forcedurlscheme',
|
||||
new lang_string('forcedurlscheme_key', 'tool_mobile'),
|
||||
new lang_string('forcedurlscheme', 'tool_mobile'), '', PARAM_NOTAGS));
|
||||
$temp->add(new admin_setting_configtext('tool_mobile/forcedurlscheme',
|
||||
new lang_string('forcedurlscheme_key', 'tool_mobile'),
|
||||
new lang_string('forcedurlscheme', 'tool_mobile'), '', PARAM_NOTAGS));
|
||||
|
||||
$temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
|
||||
new lang_string('smartappbanners', 'tool_mobile'), ''));
|
||||
$ADMIN->add('mobileapp', $temp);
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners',
|
||||
new lang_string('enablesmartappbanners', 'tool_mobile'),
|
||||
new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0));
|
||||
// Appearance related settings.
|
||||
$temp = new admin_settingpage('mobileappearance', new lang_string('mobileappearance', 'tool_mobile'));
|
||||
|
||||
$temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'),
|
||||
new lang_string('iosappid_desc', 'tool_mobile'), '633359593', PARAM_ALPHANUM));
|
||||
$temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'tool_mobile'),
|
||||
new lang_string('configmobilecssurl', 'tool_mobile'), '', PARAM_URL));
|
||||
|
||||
$ADMIN->add('webservicesettings', $temp);
|
||||
$temp->add(new admin_setting_heading('tool_mobile/smartappbanners',
|
||||
new lang_string('smartappbanners', 'tool_mobile'), ''));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox('tool_mobile/enablesmartappbanners',
|
||||
new lang_string('enablesmartappbanners', 'tool_mobile'),
|
||||
new lang_string('enablesmartappbanners_desc', 'tool_mobile'), 0));
|
||||
|
||||
$temp->add(new admin_setting_configtext('tool_mobile/iosappid', new lang_string('iosappid', 'tool_mobile'),
|
||||
new lang_string('iosappid_desc', 'tool_mobile'), '633359593', PARAM_ALPHANUM));
|
||||
|
||||
$ADMIN->add('mobileapp', $temp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,9 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Test default values.
|
||||
$context = context_system::instance();
|
||||
list($authinstructions, $notusedformat) = external_format_text($CFG->auth_instructions, FORMAT_MOODLE, $context->id);
|
||||
list($maintenancemessage, $notusedformat) = external_format_text($CFG->maintenance_message, FORMAT_MOODLE, $context->id);
|
||||
|
||||
$expected = array(
|
||||
'wwwroot' => $CFG->wwwroot,
|
||||
'httpswwwroot' => $CFG->httpswwwroot,
|
||||
@@ -73,12 +76,12 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
'authloginviaemail' => $CFG->authloginviaemail,
|
||||
'registerauth' => $CFG->registerauth,
|
||||
'forgottenpasswordurl' => $CFG->forgottenpasswordurl,
|
||||
'authinstructions' => format_text($CFG->auth_instructions),
|
||||
'authinstructions' => $authinstructions,
|
||||
'authnoneenabled' => (int) is_enabled_auth('none'),
|
||||
'enablewebservices' => $CFG->enablewebservices,
|
||||
'enablemobilewebservice' => $CFG->enablemobilewebservice,
|
||||
'maintenanceenabled' => $CFG->maintenance_enabled,
|
||||
'maintenancemessage' => format_text($CFG->maintenance_message),
|
||||
'maintenancemessage' => $maintenancemessage,
|
||||
'typeoflogin' => api::LOGIN_VIA_APP,
|
||||
'warnings' => array()
|
||||
);
|
||||
@@ -92,8 +95,9 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
set_config('logo', 'mock.png', 'core_admin');
|
||||
set_config('logocompact', 'mock.png', 'core_admin');
|
||||
|
||||
list($authinstructions, $notusedformat) = external_format_text($authinstructions, FORMAT_MOODLE, $context->id);
|
||||
$expected['registerauth'] = 'email';
|
||||
$expected['authinstructions'] = format_text($authinstructions);
|
||||
$expected['authinstructions'] = $authinstructions;
|
||||
$expected['typeoflogin'] = api::LOGIN_VIA_BROWSER;
|
||||
$expected['launchurl'] = "$CFG->wwwroot/$CFG->admin/tool/mobile/launch.php";
|
||||
|
||||
@@ -120,12 +124,16 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
$result = external::get_config();
|
||||
$result = external_api::clean_returnvalue(external::get_config_returns(), $result);
|
||||
|
||||
// SITE summary is null in phpunit which gets transformed to an empty string by format_text.
|
||||
list($sitesummary, $unused) = external_format_text($SITE->summary, $SITE->summaryformat, context_system::instance()->id);
|
||||
|
||||
// Test default values.
|
||||
$context = context_system::instance();
|
||||
$expected = array(
|
||||
array('name' => 'fullname', 'value' => $SITE->fullname),
|
||||
array('name' => 'shortname', 'value' => $SITE->shortname),
|
||||
array('name' => 'summary', 'value' => $SITE->summary),
|
||||
array('name' => 'summary', 'value' => $sitesummary),
|
||||
array('name' => 'summaryformat', 'value' => FORMAT_HTML),
|
||||
array('name' => 'frontpage', 'value' => $CFG->frontpage),
|
||||
array('name' => 'frontpageloggedin', 'value' => $CFG->frontpageloggedin),
|
||||
array('name' => 'maxcategorydepth', 'value' => $CFG->maxcategorydepth),
|
||||
@@ -141,9 +149,9 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
|
||||
// Change a value and retrieve filtering by section.
|
||||
set_config('commentsperpage', 1);
|
||||
$expected[9]['value'] = 1;
|
||||
unset($expected[10]);
|
||||
$expected[10]['value'] = 1;
|
||||
unset($expected[11]);
|
||||
unset($expected[12]);
|
||||
|
||||
$result = external::get_config('frontpagesettings');
|
||||
$result = external_api::clean_returnvalue(external::get_config_returns(), $result);
|
||||
@@ -174,6 +182,9 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
$CFG->enablemobilewebservice = 1;
|
||||
$_GET['wstoken'] = $token->token; // Mock parameters.
|
||||
|
||||
// Even if we force the password change for the current user we should be able to retrieve the key.
|
||||
set_user_preference('auth_forcepasswordchange', 1, $user->id);
|
||||
|
||||
$this->setCurrentTimeStart();
|
||||
$result = external::get_autologin_key($token->privatetoken);
|
||||
$result = external_api::clean_returnvalue(external::get_autologin_key_returns(), $result);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot . '/admin/tool/monitor/lib.php');
|
||||
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/monitor/lib.php');
|
||||
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1586
-1300
File diff suppressed because it is too large
Load Diff
@@ -37,6 +37,20 @@ function Tour(config) {
|
||||
*/
|
||||
Tour.prototype.tourName;
|
||||
|
||||
/**
|
||||
* The name of the tour storage key.
|
||||
*
|
||||
* @property {String} storageKey
|
||||
*/
|
||||
Tour.prototype.storageKey;
|
||||
|
||||
/**
|
||||
* The session storage object
|
||||
*
|
||||
* @property {Storage} storage
|
||||
*/
|
||||
Tour.prototype.storage;
|
||||
|
||||
/**
|
||||
* The original configuration as passed into the constructor.
|
||||
*
|
||||
@@ -120,6 +134,14 @@ Tour.prototype.init = function (config) {
|
||||
// Apply configuration.
|
||||
this.configure.apply(this, arguments);
|
||||
|
||||
try {
|
||||
this.storage = window.sessionStorage;
|
||||
this.storageKey = 'tourstate_' + this.tourName;
|
||||
} catch (e) {
|
||||
this.storage = false;
|
||||
this.storageKey = '';
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -280,6 +302,15 @@ Tour.prototype.getCurrentStepNumber = function () {
|
||||
*/
|
||||
Tour.prototype.setCurrentStepNumber = function (stepNumber) {
|
||||
this.currentStepNumber = stepNumber;
|
||||
if (this.storage) {
|
||||
try {
|
||||
this.storage.setItem(this.storageKey, stepNumber);
|
||||
} catch (e) {
|
||||
if (e.code === DOMException.QUOTA_EXCEEDED_ERR) {
|
||||
this.storage.removeItem(this.storageKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -521,6 +552,10 @@ Tour.prototype.normalizeStepConfig = function (stepConfig) {
|
||||
attachPoint: 'after'
|
||||
}, stepConfig);
|
||||
|
||||
if (stepConfig.attachTo) {
|
||||
stepConfig.attachTo = $(stepConfig.attachTo).first();
|
||||
}
|
||||
|
||||
return stepConfig;
|
||||
};
|
||||
|
||||
@@ -612,7 +647,7 @@ Tour.prototype.processStepListeners = function (stepConfig) {
|
||||
args: ['click', $.proxy(function (e) {
|
||||
if ($(e.target).parents('[data-flexitour="container"]').length === 0) {
|
||||
// Ignore clicks when they are in the flexitour.
|
||||
window.setTimeout($.proxy(this.next, this), 100);
|
||||
window.setTimeout($.proxy(this.next, this), 500);
|
||||
}
|
||||
}, this)]
|
||||
});
|
||||
@@ -739,10 +774,10 @@ Tour.prototype.addStepToPage = function (stepConfig) {
|
||||
this.positionBackdrop(stepConfig);
|
||||
|
||||
if (stepConfig.attachPoint === 'append') {
|
||||
$(stepConfig.attachTo).append(currentStepNode);
|
||||
stepConfig.attachTo.append(currentStepNode);
|
||||
this.currentStepNode = currentStepNode;
|
||||
} else {
|
||||
this.currentStepNode = currentStepNode.insertAfter($(stepConfig.attachTo));
|
||||
this.currentStepNode = currentStepNode.insertAfter(stepConfig.attachTo);
|
||||
}
|
||||
|
||||
// Ensure that the step node is positioned.
|
||||
@@ -754,15 +789,15 @@ Tour.prototype.addStepToPage = function (stepConfig) {
|
||||
|
||||
animationTarget.animate({
|
||||
scrollTop: this.calculateScrollTop(stepConfig)
|
||||
}).promise().then($.proxy(function () {
|
||||
}).promise().then(function () {
|
||||
this.positionStep(stepConfig);
|
||||
this.revealStep(stepConfig);
|
||||
}, this));
|
||||
}.bind(this));
|
||||
} else if (stepConfig.orphan) {
|
||||
stepConfig.isOrphan = true;
|
||||
|
||||
// This will be appended to the body instead.
|
||||
stepConfig.attachTo = 'body';
|
||||
stepConfig.attachTo = $('body').first();
|
||||
stepConfig.attachPoint = 'append';
|
||||
|
||||
// Add the backdrop.
|
||||
@@ -772,17 +807,26 @@ Tour.prototype.addStepToPage = function (stepConfig) {
|
||||
currentStepNode.addClass('orphan');
|
||||
|
||||
// It lives in the body.
|
||||
$(stepConfig.attachTo).append(currentStepNode);
|
||||
stepConfig.attachTo.append(currentStepNode);
|
||||
this.currentStepNode = currentStepNode;
|
||||
|
||||
this.currentStepNode.offset(this.calculateStepPositionInPage());
|
||||
this.currentStepNode.css('position', 'fixed');
|
||||
|
||||
this.currentStepPopper = new Popper($('body'), this.currentStepNode[0], {
|
||||
removeOnDestroy: true,
|
||||
placement: stepConfig.placement + '-start',
|
||||
arrowElement: '[data-role="arrow"]',
|
||||
// Empty the modifiers. We've already placed the step and don't want it moved.
|
||||
modifiers: []
|
||||
modifiers: {
|
||||
hide: {
|
||||
enabled: false
|
||||
},
|
||||
applyStyle: {
|
||||
onLoad: null,
|
||||
enabled: false
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.revealStep(stepConfig);
|
||||
@@ -802,7 +846,7 @@ Tour.prototype.revealStep = function (stepConfig) {
|
||||
window.setTimeout($.proxy(function () {
|
||||
// After a brief delay, focus again.
|
||||
// There seems to be an issue with Jaws where it only reads the dialogue title initially.
|
||||
// This second focus causes it to read the full dialogue.
|
||||
// This second focus helps it to read the full dialogue.
|
||||
if (this.currentStepNode) {
|
||||
this.currentStepNode.focus();
|
||||
}
|
||||
@@ -944,6 +988,16 @@ Tour.prototype.handleKeyDown = function (e) {
|
||||
* @chainable
|
||||
*/
|
||||
Tour.prototype.startTour = function (startAt) {
|
||||
if (this.storage && typeof startAt === 'undefined') {
|
||||
var storageStartValue = this.storage.getItem(this.storageKey);
|
||||
if (storageStartValue) {
|
||||
var storageStartAt = parseInt(storageStartValue, 10);
|
||||
if (storageStartAt <= this.steps.length) {
|
||||
startAt = storageStartAt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof startAt === 'undefined') {
|
||||
startAt = this.getCurrentStepNumber();
|
||||
}
|
||||
@@ -1120,15 +1174,13 @@ Tour.prototype.calculateScrollTop = function (stepConfig) {
|
||||
Tour.prototype.calculateStepPositionInPage = function () {
|
||||
var viewportHeight = $(window).height();
|
||||
var stepHeight = this.currentStepNode.height();
|
||||
var scrollTop = $(window).scrollTop();
|
||||
|
||||
var viewportWidth = $(window).width();
|
||||
var stepWidth = this.currentStepNode.width();
|
||||
var scrollLeft = $(window).scrollLeft();
|
||||
|
||||
return {
|
||||
top: Math.ceil(scrollTop + (viewportHeight - stepHeight) / 2),
|
||||
left: Math.ceil(scrollLeft + (viewportWidth - stepWidth) / 2)
|
||||
top: Math.ceil((viewportHeight - stepHeight) / 2),
|
||||
left: Math.ceil((viewportWidth - stepWidth) / 2)
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1166,18 +1218,29 @@ Tour.prototype.positionStep = function (stepConfig) {
|
||||
}
|
||||
|
||||
var target = this.getStepTarget(stepConfig);
|
||||
var config = {
|
||||
placement: stepConfig.placement + '-start',
|
||||
removeOnDestroy: true,
|
||||
modifiers: {
|
||||
flip: {
|
||||
behaviour: flipBehavior
|
||||
},
|
||||
arrow: {
|
||||
element: '[data-role="arrow"]'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var boundaryElement = target.closest('section');
|
||||
if (boundaryElement.length) {
|
||||
config.boundariesElement = boundaryElement[0];
|
||||
}
|
||||
|
||||
var background = $('[data-flexitour="step-background"]');
|
||||
if (background.length) {
|
||||
target = background;
|
||||
}
|
||||
|
||||
this.currentStepPopper = new Popper(target, content[0], {
|
||||
placement: stepConfig.placement + '-start',
|
||||
removeOnDestroy: true,
|
||||
flipBehavior: flipBehavior,
|
||||
arrowElement: '[data-role="arrow"]',
|
||||
modifiers: ['shift', 'offset', 'preventOverflow', 'keepTogether', this.centerPopper, 'arrow', 'flip', 'applyStyle']
|
||||
});
|
||||
this.currentStepPopper = new Popper(target, content[0], config);
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1196,9 +1259,9 @@ Tour.prototype.positionBackdrop = function (stepConfig) {
|
||||
|
||||
if (stepConfig.zIndex) {
|
||||
if (stepConfig.attachPoint === 'append') {
|
||||
$(stepConfig.attachTo).append(backdrop);
|
||||
stepConfig.attachTo.append(backdrop);
|
||||
} else {
|
||||
backdrop.insertAfter($(stepConfig.attachTo));
|
||||
backdrop.insertAfter(stepConfig.attachTo);
|
||||
}
|
||||
} else {
|
||||
$('body').append(backdrop);
|
||||
@@ -1259,10 +1322,10 @@ Tour.prototype.positionBackdrop = function (stepConfig) {
|
||||
|
||||
if (stepConfig.zIndex) {
|
||||
if (stepConfig.attachPoint === 'append') {
|
||||
$(stepConfig.attachTo).append(background);
|
||||
stepConfig.attachTo.append(background);
|
||||
} else {
|
||||
fader.insertAfter($(stepConfig.attachTo));
|
||||
background.insertAfter($(stepConfig.attachTo));
|
||||
fader.insertAfter(stepConfig.attachTo);
|
||||
background.insertAfter(stepConfig.attachTo);
|
||||
}
|
||||
} else {
|
||||
$('body').append(fader);
|
||||
@@ -1363,25 +1426,14 @@ Tour.prototype.calculatePosition = function (elem) {
|
||||
return null;
|
||||
};
|
||||
|
||||
Tour.prototype.centerPopper = function (data) {
|
||||
if (!this.isModifierRequired(Tour.prototype.centerPopper, this.modifiers.keepTogether)) {
|
||||
console.warn('WARNING: keepTogether modifier is required by centerPopper modifier in order to work, be sure to include it before arrow!');
|
||||
return data;
|
||||
}
|
||||
|
||||
var placement = data.placement.split('-')[0];
|
||||
var reference = data.offsets.reference;
|
||||
var isVertical = ['left', 'right'].indexOf(placement) !== -1;
|
||||
|
||||
var len = isVertical ? 'height' : 'width';
|
||||
var side = isVertical ? 'top' : 'left';
|
||||
|
||||
data.offsets.popper[side] += Math.max(reference[len] / 2 - data.offsets.popper[len] / 2, 0);
|
||||
|
||||
return data;
|
||||
};
|
||||
|
||||
Tour.prototype.accessibilityShow = function (stepConfig) {
|
||||
/**
|
||||
* Perform accessibility changes for step shown.
|
||||
*
|
||||
* This will add aria-hidden="true" to all siblings and parent siblings.
|
||||
*
|
||||
* @method accessibilityShow
|
||||
*/
|
||||
Tour.prototype.accessibilityShow = function () {
|
||||
var stateHolder = 'data-has-hidden';
|
||||
var attrName = 'aria-hidden';
|
||||
var hideFunction = function hideFunction(child) {
|
||||
@@ -1409,6 +1461,13 @@ Tour.prototype.accessibilityShow = function (stepConfig) {
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Perform accessibility changes for step hidden.
|
||||
*
|
||||
* This will remove any newly added aria-hidden="true".
|
||||
*
|
||||
* @method accessibilityHide
|
||||
*/
|
||||
Tour.prototype.accessibilityHide = function () {
|
||||
var stateHolder = 'data-has-hidden';
|
||||
var attrName = 'aria-hidden';
|
||||
|
||||
@@ -76,15 +76,22 @@ EOF;
|
||||
/**
|
||||
* Fetch all enabled tours matching the specified target.
|
||||
*
|
||||
* @param string $targetmatch The URL to match.
|
||||
* @param moodle_url $targetmatch The URL to match.
|
||||
*/
|
||||
public static function get_matching_tourdata($targetmatch) {
|
||||
public static function get_matching_tourdata(\moodle_url $targetmatch) {
|
||||
$tours = self::get_enabled_tourdata();
|
||||
|
||||
return array_filter($tours, function($tour) use ($targetmatch) {
|
||||
// Attempt to determine whether this is the front page.
|
||||
// This is a special case because the frontpage uses a shortened page path making it difficult to detect exactly.
|
||||
$isfrontpage = $targetmatch->compare(new \moodle_url('/'), URL_MATCH_BASE);
|
||||
$target = $targetmatch->out_as_local_url();
|
||||
return array_filter($tours, function($tour) use ($isfrontpage, $target) {
|
||||
if ($isfrontpage && $tour->pathmatch === 'FRONTPAGE') {
|
||||
return true;
|
||||
}
|
||||
$pattern = preg_quote($tour->pathmatch, '@');
|
||||
$pattern = str_replace('%', '.*', $pattern);
|
||||
return !!preg_match("@{$pattern}@", $targetmatch);
|
||||
return !!preg_match("@{$pattern}@", $target);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -241,9 +241,7 @@ class manager {
|
||||
'title' => get_string('importtour', 'tool_usertours'),
|
||||
],
|
||||
(object) [
|
||||
'link' => new \moodle_url('https://moodle.net/mod/data/view.php', [
|
||||
'id' => 17,
|
||||
]),
|
||||
'link' => new \moodle_url('https://moodle.net/tours'),
|
||||
'linkproperties' => [
|
||||
'target' => '_blank',
|
||||
],
|
||||
@@ -561,7 +559,7 @@ class manager {
|
||||
public static function get_matching_tours(\moodle_url $pageurl) {
|
||||
global $PAGE;
|
||||
|
||||
$tours = cache::get_matching_tourdata($pageurl->out_as_local_url());
|
||||
$tours = cache::get_matching_tourdata($pageurl);
|
||||
|
||||
foreach ($tours as $record) {
|
||||
$tour = tour::load_from_record($record);
|
||||
|
||||
@@ -608,6 +608,8 @@ class tour {
|
||||
* This is used in the session cookie to determine whether the user has seen this tour before.
|
||||
*/
|
||||
public function get_tour_key() {
|
||||
global $USER;
|
||||
|
||||
$tourtime = $this->get_config('majorupdatetime', null);
|
||||
|
||||
if ($tourtime === null) {
|
||||
@@ -622,7 +624,7 @@ class tour {
|
||||
$tourtime = max($tourtime, $userresetdate);
|
||||
}
|
||||
|
||||
return sprintf('tool_usertours_%d_%s', $this->get_id(), $tourtime);
|
||||
return sprintf('tool_usertours_%d_%d_%s', $USER->id, $this->get_id(), $tourtime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,8 +28,8 @@ $string['appliesto'] = 'Applies to';
|
||||
$string['below'] = 'Below';
|
||||
$string['block'] = 'Block';
|
||||
$string['block_named'] = 'Block named \'{$a}\'';
|
||||
$string['cachedef_stepdata'] = 'List of User Tour steps';
|
||||
$string['cachedef_tourdata'] = 'List of enabled User Tours information which are fetched on every page';
|
||||
$string['cachedef_stepdata'] = 'List of user tour steps';
|
||||
$string['cachedef_tourdata'] = 'List of enabled user tours information which is fetched on every page';
|
||||
$string['description'] = 'Description';
|
||||
$string['confirmstepremovalquestion'] = 'Are you sure that you wish to remove this step?';
|
||||
$string['confirmstepremovaltitle'] = 'Confirm step removal';
|
||||
@@ -37,16 +37,9 @@ $string['confirmtourremovalquestion'] = 'Are you sure that you wish to remove th
|
||||
$string['confirmtourremovaltitle'] = 'Confirm tour removal';
|
||||
$string['content'] = 'Content';
|
||||
$string['content_heading'] = 'Content';
|
||||
$string['content_help'] = 'This is the content of the step.
|
||||
You can enter a content in the following formats:
|
||||
<dl>
|
||||
<dt>Plain text</dt>
|
||||
<dd>A plain text description</dd>
|
||||
<dt>Moodle MultiLang</dt>
|
||||
<dd>A string which makes use of the Moodle MultiLang format</dd>
|
||||
<dt>Moodle Translated string</dt>
|
||||
<dd>A value found in a standard Moodle language file in the format identifier,component</dd>
|
||||
</dl>';
|
||||
$string['content_help'] = 'Content describing the step may be added as plain text, enclosed in multilang tags (for use with the multi-language content filter) if required.
|
||||
|
||||
Alternatively, a language string ID may be entered in the format identifier,component (with no brackets or space after the comma).';
|
||||
$string['cssselector'] = 'CSS selector';
|
||||
$string['defaultvalue'] = 'Default ({$a})';
|
||||
$string['delay'] = 'Delay before showing the step';
|
||||
@@ -86,41 +79,33 @@ Some example values include:
|
||||
* /my/% - to match the Dashboard
|
||||
* /course/view.php?id=2 - to match a specific course
|
||||
* /mod/forum/view.php% - to match the forum discussion list
|
||||
* /user/profile.php% - to match the user profile page';
|
||||
* /user/profile.php% - to match the user profile page
|
||||
|
||||
If you wish to display a tour on the Site Home page, you can use the value: "FRONTPAGE".
|
||||
';
|
||||
$string['placement'] = 'Placement';
|
||||
$string['pluginname'] = 'User tours';
|
||||
$string['resettouronpage'] = 'Reset user tour on this page';
|
||||
$string['right'] = 'Right';
|
||||
$string['select_block'] = 'Select a block';
|
||||
$string['targettype_help'] = 'Every step is associated with a part of the page which you must choose. To make this easier there are several types of target for different types of page content.
|
||||
<dl>
|
||||
<dt>Block</dt>
|
||||
<dd>Display the step next to the first matching block of the type on the page.</dd>
|
||||
<dt>Selector</dt>
|
||||
<dd>CSS Selectors are a powerful way which allow you to select different parts of the page based on metadata built into the page.</dd>
|
||||
<dt>Display in middle of the page</dt>
|
||||
<dd>Instead of associating the step with a specific part of the page you can have it displayed in the middle of the page.</dd>
|
||||
</dl>';
|
||||
$string['targettype_help'] = 'Each step is associated with a part of the page - the target. Target types are:
|
||||
|
||||
* Block - for displaying a step next to a specified block
|
||||
* CSS selector - for accurately defining the target area using CSS
|
||||
* Display in middle of page - for a step which does not need to be associated with a specific part of the page';
|
||||
$string['selector_defaulttitle'] = 'Enter a descriptive title';
|
||||
$string['selectordisplayname'] = 'A CSS selector matching \'{$a}\'';
|
||||
$string['skip'] = 'Skip';
|
||||
$string['target'] = 'Target';
|
||||
$string['target_heading'] = 'Step Target';
|
||||
$string['target_heading'] = 'Step target';
|
||||
$string['target_block'] = 'Block';
|
||||
$string['target_selector'] = 'Selector';
|
||||
$string['target_unattached'] = 'Display in middle of page';
|
||||
$string['targettype'] = 'Target type';
|
||||
$string['title'] = 'Title';
|
||||
$string['title_help'] = 'This is the title shown at the top of the step.
|
||||
You can enter a title in the following formats:
|
||||
<dl>
|
||||
<dt>Plain text</dt>
|
||||
<dd>A plain text description</dd>
|
||||
<dt>Moodle MultiLang</dt>
|
||||
<dd>A string which makes use of the Moodle MultiLang format</dd>
|
||||
<dt>Moodle Translated string</dt>
|
||||
<dd>A value found in a standard Moodle language file in the format identifier,component</dd>
|
||||
</dl>';
|
||||
$string['title_help'] = 'The title of a step may be added as plain text, enclosed in multilang tags (for use with the multi-language content filter) if required.
|
||||
|
||||
Alternatively, a language string ID may be entered in the format identifier,component (with no brackets or space after the comma).';
|
||||
$string['tourconfig'] = 'Tour configuration file to import';
|
||||
$string['tourlist_explanation'] = 'You can create as many tours as you like and enable them for different parts of Moodle. Only one tour can be created per page.';
|
||||
$string['tours'] = 'Tours';
|
||||
@@ -136,11 +121,9 @@ Note: Backdrops are not compatible with some parts of the page such as the navig
|
||||
';
|
||||
$string['reflex'] = 'Proceed on click';
|
||||
$string['reflex_help'] = 'Proceed to the next step when the target is clicked on.';
|
||||
$string['placement_help'] = 'You can place a step either above, below, to the left of, or to the right of the target.
|
||||
$string['placement_help'] = 'A step may be placed above, below, left or right of the target. Above or below is recommended, as these adjust better for mobile display.
|
||||
|
||||
The best options are above, or below as these adjust better for mobile display.
|
||||
|
||||
If the step does not fit into the page at at the placement you choose, it will be automatically be moved to give the best viewing experience. ';
|
||||
If the step does not fit on a particular page in the specified place, it will be automatically placed elsewhere.';
|
||||
$string['delay_help'] = 'You can optionally choose to add a delay before the step is displayed.
|
||||
|
||||
This delay is in milliseconds.';
|
||||
@@ -149,21 +132,7 @@ $string['sharedtourslink'] = 'Tour repository';
|
||||
$string['usertours'] = 'User tours';
|
||||
$string['usertours:managetours'] = 'Create, edit, and remove user tours';
|
||||
$string['target_selector_targetvalue'] = 'CSS selectors';
|
||||
$string['target_selector_targetvalue_help'] = 'You can use a "CSS Selector" to target almost any element on the page.
|
||||
|
||||
CSS Selectors are very powerful and you can easily find parts of the page by building up the selector gradually.
|
||||
|
||||
Mozilla provide some [very good
|
||||
documentation](https://developer.mozilla.org/en/docs/Web/Guide/CSS/Getting_started/Selectors)
|
||||
for selectors which may help you to build your selectors.
|
||||
|
||||
You will also find your browser\'s developer tools to be extremely useful in creating these selectors:
|
||||
|
||||
* [Google Chrome](https://developer.chrome.com/devtools#dom-and-styles)
|
||||
* [Mozilla Firefox](https://developer.mozilla.org/en-US/docs/Tools/DOM_Property_Viewer)
|
||||
* [Microsoft Edge](https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/f12-devtools-guide/)
|
||||
* [Apple Safari](https://developer.apple.com/library/iad/documentation/AppleApplications/Conceptual/Safari_Developer_Guide/ResourcesandtheDOM/ResourcesandtheDOM.html#//apple_ref/doc/uid/TP40007874-CH3-SW1)
|
||||
';
|
||||
$string['target_selector_targetvalue_help'] = 'A CSS selector can be used to target almost any element on the page. The appropriate selector can be easily found using the developer tools for your web browser.';
|
||||
$string['viewtour_info'] = 'This is the \'{$a->tourname}\' tour. It applies to the path \'{$a->path}\'.';
|
||||
$string['viewtour_edit'] = 'You can <a href="{$a->editlink}">edit the tour defaults</a> and <a href="{$a->resetlink}">force the tour to be displayed</a> to all users again.';
|
||||
$string['tour_resetforall'] = 'The state of the tour has been reset. It will be displayed to all users again.';
|
||||
|
||||
@@ -150,6 +150,14 @@ class cache_testcase extends advanced_testcase {
|
||||
'name' => 'my_glob_2',
|
||||
'pathmatch' => '/my/%'
|
||||
],
|
||||
(object) [
|
||||
'name' => 'frontpage_only',
|
||||
'pathmatch' => 'FRONTPAGE'
|
||||
],
|
||||
(object) [
|
||||
'name' => 'frontpage_match',
|
||||
'pathmatch' => '/?%'
|
||||
],
|
||||
];
|
||||
|
||||
return [
|
||||
@@ -163,6 +171,16 @@ class cache_testcase extends advanced_testcase {
|
||||
'/my/view.php',
|
||||
['my_exact_1', 'my_glob_1', 'my_glob_2'],
|
||||
],
|
||||
'Special constant FRONTPAGE must match front page only' => [
|
||||
$tourconfigs,
|
||||
'/',
|
||||
['frontpage_only'],
|
||||
],
|
||||
'Standard frontpage URL matches both the special constant, and a correctly formed pathmatch' => [
|
||||
$tourconfigs,
|
||||
'/?redirect=0',
|
||||
['frontpage_only', 'frontpage_match'],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -181,7 +199,7 @@ class cache_testcase extends advanced_testcase {
|
||||
$this->helper_create_step((object) ['tourid' => $tour->get_id()]);
|
||||
}
|
||||
|
||||
$matches = \tool_usertours\cache::get_matching_tourdata((new moodle_url($targetmatch))->out_as_local_url());
|
||||
$matches = \tool_usertours\cache::get_matching_tourdata(new moodle_url($targetmatch));
|
||||
$this->assertCount(count($expected), $matches);
|
||||
|
||||
for ($i = 0; $i < count($matches); $i++) {
|
||||
|
||||
@@ -729,7 +729,7 @@ class tour_testcase extends advanced_testcase {
|
||||
$this->greaterThanOrEqual($time),
|
||||
true,
|
||||
null,
|
||||
sprintf('tool_usertours_%d_%s', $id, $time),
|
||||
sprintf('tool_usertours_\d_%d_%s', $id, $time),
|
||||
],
|
||||
|
||||
'Initial tour time, no user pref' => [
|
||||
@@ -738,7 +738,7 @@ class tour_testcase extends advanced_testcase {
|
||||
null,
|
||||
false,
|
||||
null,
|
||||
sprintf('tool_usertours_%d_%s', $id, $time),
|
||||
sprintf('tool_usertours_\d_%d_%s', $id, $time),
|
||||
],
|
||||
'Initial tour time, with user reset lower' => [
|
||||
$id,
|
||||
@@ -746,7 +746,7 @@ class tour_testcase extends advanced_testcase {
|
||||
null,
|
||||
false,
|
||||
$time - DAYSECS,
|
||||
sprintf('tool_usertours_%d_%s', $id, $time),
|
||||
sprintf('tool_usertours_\d_%d_%s', $id, $time),
|
||||
],
|
||||
'Initial tour time, with user reset higher' => [
|
||||
$id,
|
||||
@@ -754,7 +754,7 @@ class tour_testcase extends advanced_testcase {
|
||||
null,
|
||||
false,
|
||||
$time + DAYSECS,
|
||||
sprintf('tool_usertours_%d_%s', $id, $time + DAYSECS),
|
||||
sprintf('tool_usertours_\d_%d_%s', $id, $time + DAYSECS),
|
||||
],
|
||||
];
|
||||
}
|
||||
@@ -823,8 +823,8 @@ class tour_testcase extends advanced_testcase {
|
||||
set_user_preference(\tool_usertours\tour::TOUR_REQUESTED_BY_USER . $id, $userpref);
|
||||
}
|
||||
|
||||
$this->assertEquals(
|
||||
$expectation,
|
||||
$this->assertRegExp(
|
||||
'/' . $expectation . '/',
|
||||
$tour->get_tour_key()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@
|
||||
<location>amd/src/tour.js</location>
|
||||
<name>Flexitour</name>
|
||||
<license>GPLv3</license>
|
||||
<version>0.9.7</version>
|
||||
<version>0.9.10</version>
|
||||
<licenseversion>3</licenseversion>
|
||||
</library>
|
||||
<library>
|
||||
<location>amd/src/popper.js</location>
|
||||
<name>Popper.js</name>
|
||||
<license>MIT</license>
|
||||
<version>v0.6.4</version>
|
||||
<version>v1.0.0-alpha.3</version>
|
||||
<licenseversion></licenseversion>
|
||||
</library>
|
||||
</libraries>
|
||||
|
||||
@@ -67,7 +67,7 @@ echo '<fieldset>';
|
||||
echo '<div class="clearer"><!-- --></div>';
|
||||
echo $newsettingshtml;
|
||||
echo '</fieldset>';
|
||||
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
echo '<div class="form-buttons"><input class="form-submit btn btn-primary" type="submit" value="'.get_string('savechanges','admin').'" /></div>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
|
||||
+20
-2
@@ -95,6 +95,24 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
* @param boolean $notify print notice with link and terminate
|
||||
*/
|
||||
function user_signup($user, $notify=true) {
|
||||
// Standard signup, without custom confirmatinurl.
|
||||
return $this->user_signup_with_confirmation($user, $notify);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sign up a new user ready for confirmation.
|
||||
*
|
||||
* Password is passed in plaintext.
|
||||
* A custom confirmationurl could be used.
|
||||
*
|
||||
* @param object $user new user object
|
||||
* @param boolean $notify print notice with link and terminate
|
||||
* @param string $confirmationurl user confirmation URL
|
||||
* @return boolean true if everything well ok and $notify is set to true
|
||||
* @throws moodle_exception
|
||||
* @since Moodle 3.2
|
||||
*/
|
||||
public function user_signup_with_confirmation($user, $notify=true, $confirmationurl = null) {
|
||||
global $CFG, $DB;
|
||||
require_once($CFG->dirroot.'/user/profile/lib.php');
|
||||
require_once($CFG->dirroot.'/user/lib.php');
|
||||
@@ -115,8 +133,8 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
// Trigger event.
|
||||
\core\event\user_created::create_from_userid($user->id)->trigger();
|
||||
|
||||
if (! send_confirmation_email($user)) {
|
||||
print_error('auth_emailnoemail','auth_email');
|
||||
if (! send_confirmation_email($user, $confirmationurl)) {
|
||||
print_error('auth_emailnoemail', 'auth_email');
|
||||
}
|
||||
|
||||
if ($notify) {
|
||||
|
||||
@@ -202,7 +202,9 @@ class auth_email_external extends external_api {
|
||||
'value' => new external_value(PARAM_RAW, 'Custom field value, can be an encoded json if required')
|
||||
)
|
||||
), 'User custom fields (also known as user profile fields)', VALUE_DEFAULT, array()
|
||||
)
|
||||
),
|
||||
'redirect' => new external_value(PARAM_LOCALURL, 'Redirect the user to this site url after confirmation.',
|
||||
VALUE_DEFAULT, ''),
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -220,13 +222,15 @@ class auth_email_external extends external_api {
|
||||
* @param string $recaptchachallengehash recaptcha challenge hash
|
||||
* @param string $recaptcharesponse recaptcha response
|
||||
* @param array $customprofilefields user custom fields (also known as user profile fields)
|
||||
* @param string $redirect Site url to redirect the user after confirmation
|
||||
* @return array settings and possible warnings
|
||||
* @since Moodle 3.2
|
||||
* @throws moodle_exception
|
||||
* @throws invalid_parameter_exception
|
||||
*/
|
||||
public static function signup_user($username, $password, $firstname, $lastname, $email, $city = '', $country = '',
|
||||
$recaptchachallengehash = '', $recaptcharesponse = '', $customprofilefields = array()) {
|
||||
$recaptchachallengehash = '', $recaptcharesponse = '', $customprofilefields = array(),
|
||||
$redirect = '') {
|
||||
global $CFG, $PAGE;
|
||||
|
||||
$warnings = array();
|
||||
@@ -243,6 +247,7 @@ class auth_email_external extends external_api {
|
||||
'recaptchachallengehash' => $recaptchachallengehash,
|
||||
'recaptcharesponse' => $recaptcharesponse,
|
||||
'customprofilefields' => $customprofilefields,
|
||||
'redirect' => $redirect,
|
||||
)
|
||||
);
|
||||
|
||||
@@ -324,7 +329,16 @@ class auth_email_external extends external_api {
|
||||
$user = signup_setup_new_user((object) $data);
|
||||
|
||||
$authplugin = get_auth_plugin('email');
|
||||
$authplugin->user_signup($user, false);
|
||||
|
||||
// Check if we should redirect the user once the user is confirmed.
|
||||
$confirmationurl = null;
|
||||
if (!empty($params['redirect'])) {
|
||||
// Pass via moodle_url to fix thinks like admin links.
|
||||
$redirect = new moodle_url($params['redirect']);
|
||||
|
||||
$confirmationurl = new moodle_url('/login/confirm.php', array('redirect' => $redirect->out()));
|
||||
}
|
||||
$authplugin->user_signup_with_confirmation($user, false, $confirmationurl);
|
||||
|
||||
$result = array(
|
||||
'success' => true,
|
||||
|
||||
@@ -61,18 +61,7 @@ class behat_auth extends behat_base {
|
||||
* @Given /^I log out$/
|
||||
*/
|
||||
public function i_log_out() {
|
||||
// There is no longer any need to worry about whether the navigation
|
||||
// bar needs to be expanded; user_menu now lives outside the
|
||||
// hamburger.
|
||||
|
||||
// However, the user menu *always* needs to be expanded. if running JS.
|
||||
if ($this->running_javascript()) {
|
||||
$xpath = "//div[@class='usermenu']//a[contains(concat(' ', @class, ' '), ' toggle-display ')]";
|
||||
|
||||
$this->execute('behat_general::i_click_on', array($xpath, "xpath_element"));
|
||||
}
|
||||
|
||||
// No need to check for exceptions as it will checked after this step execution.
|
||||
$this->execute('behat_general::click_link', get_string('logout'));
|
||||
// Click on logout link in footer, as it's much faster.
|
||||
$this->execute('behat_general::i_click_on_in_the', array(get_string('logout'), 'link', '#page-footer', "css_element"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ information provided here is intended especially for developers.
|
||||
This can be used to modify the user object before any authentication errors are raised.
|
||||
* The block_login now displays the loginpage_idp_list() links as well as main login page.
|
||||
* The authentication plugin auth_radius has been moved to https://github.com/moodlehq/moodle-auth_radius
|
||||
* New auth_email::user_signup_with_confirmation() method has a new optional parameter $confirmationurl to provide a different
|
||||
confirmation URL.
|
||||
|
||||
=== 3.0 ===
|
||||
|
||||
|
||||
@@ -34,6 +34,10 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
abstract class tree_node {
|
||||
|
||||
/** @var int Counter to be used in {@link tree_node::unique_sql_parameter()}. */
|
||||
protected static $uniquesqlparametercounter = 1;
|
||||
|
||||
/**
|
||||
* Determines whether this particular item is currently available
|
||||
* according to the availability criteria.
|
||||
@@ -242,10 +246,11 @@ abstract class tree_node {
|
||||
* @return SQL code for the parameter, e.g. ':pr1234'
|
||||
*/
|
||||
protected static function unique_sql_parameter(array &$params, $value) {
|
||||
static $count = 1;
|
||||
|
||||
// Note we intentionally do not use self:: here.
|
||||
$count = tree_node::$uniquesqlparametercounter++;
|
||||
$unique = 'usp' . $count;
|
||||
$params[$unique] = $value;
|
||||
$count++;
|
||||
return ':' . $unique;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ Feature: Confirm that conditions on completion no longer cause a bug
|
||||
And I set the field "Activity or resource" to "Page1"
|
||||
And I press "Add restriction..."
|
||||
And I click on "Activity completion" "button" in the "Add restriction..." "dialogue"
|
||||
And I set the field with xpath "//div[@class='availability-item'][preceding-sibling::div]//select[@name='cm']" to "Page2"
|
||||
And I set the field with xpath "//div[contains(concat(' ', normalize-space(@class), ' '), ' availability-item ')][preceding-sibling::div]//select[@name='cm']" to "Page2"
|
||||
And I press "Save and return to course"
|
||||
And I should see "Not available unless:" in the ".activity.glossary" "css_element"
|
||||
And I should see "The activity Page1 is marked complete" in the ".activity.glossary" "css_element"
|
||||
|
||||
+6
-4
@@ -25,9 +25,10 @@ M.availability_completion.form.initInner = function(cms) {
|
||||
|
||||
M.availability_completion.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
|
||||
var html = '<span class="col-form-label p-r-1"> ' + M.util.get_string('title', 'availability_completion') + '</span>' +
|
||||
' <span class="availability-group form-group"><label>' +
|
||||
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
|
||||
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
|
||||
'<select class="custom-select" name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
|
||||
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.cms.length; i++) {
|
||||
var cm = this.cms[i];
|
||||
@@ -36,13 +37,14 @@ M.availability_completion.form.getNode = function(json) {
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' +
|
||||
M.util.get_string('label_completion', 'availability_completion') +
|
||||
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
|
||||
' </span><select class="custom-select" ' +
|
||||
'name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
|
||||
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
|
||||
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
|
||||
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
|
||||
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
|
||||
'</select></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n=M.util.get_string("title","availability_completion")+' <span class="availability-group"><label>'+'<span class="accesshide">'+M.util.get_string("label_cm","availability_completion")+" </span>"+'<select name="cm" title="'+M.util.get_string("label_cm","availability_completion")+'">'+'<option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.cms.length;r++){var i=this.cms[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_completion","availability_completion")+' </span><select name="e" title="'+M.util.get_string("label_completion","availability_completion")+'">'+'<option value="1">'+M.util.get_string("option_complete","availability_completion")+"</option>"+'<option value="0">'+M.util.get_string("option_incomplete","availability_completion")+"</option>"+'<option value="2">'+M.util.get_string("option_pass","availability_completion")+"</option>"+'<option value="3">'+M.util.get_string("option_fail","availability_completion")+"</option>"+"</select></label></span>";var s=e.Node.create("<span>"+n+"</span>");t.cm!==undefined&&s.one("select[name=cm] > option[value="+t.cm+"]")&&s.one("select[name=cm]").set("value",""+t.cm),t.e!==undefined&&s.one("select[name=e]").set("value",""+t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return s},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_completion-form",function(e,t){M.availability_completion=M.availability_completion||{},M.availability_completion.form=e.Object(M.core_availability.plugin),M.availability_completion.form.initInner=function(e){this.cms=e},M.availability_completion.form.getNode=function(t){var n='<span class="col-form-label p-r-1"> '+M.util.get_string("title","availability_completion")+"</span>"+' <span class="availability-group form-group"><label>'+'<span class="accesshide">'+M.util.get_string("label_cm","availability_completion")+" </span>"+'<select class="custom-select" name="cm" title="'+M.util.get_string("label_cm","availability_completion")+'">'+'<option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.cms.length;r++){var i=this.cms[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_completion","availability_completion")+' </span><select class="custom-select" '+'name="e" title="'+M.util.get_string("label_completion","availability_completion")+'">'+'<option value="1">'+M.util.get_string("option_complete","availability_completion")+"</option>"+'<option value="0">'+M.util.get_string("option_incomplete","availability_completion")+"</option>"+'<option value="2">'+M.util.get_string("option_pass","availability_completion")+"</option>"+'<option value="3">'+M.util.get_string("option_fail","availability_completion")+"</option>"+"</select></label></span>";var s=e.Node.create('<span class="form-inline">'+n+"</span>");t.cm!==undefined&&s.one("select[name=cm] > option[value="+t.cm+"]")&&s.one("select[name=cm]").set("value",""+t.cm),t.e!==undefined&&s.one("select[name=e]").set("value",""+t.e);if(!M.availability_completion.form.addedEvents){M.availability_completion.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_completion select")}return s},M.availability_completion.form.fillValue=function(e,t){e.cm=parseInt(t.one("select[name=cm]").get("value"),10),e.e=parseInt(t.one("select[name=e]").get("value"),10)},M.availability_completion.form.fillErrors=function(e,t){var n=parseInt(t.one("select[name=cm]").get("value"),10);n===0&&e.push("availability_completion:error_selectcmid")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+6
-4
@@ -25,9 +25,10 @@ M.availability_completion.form.initInner = function(cms) {
|
||||
|
||||
M.availability_completion.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
|
||||
var html = '<span class="col-form-label p-r-1"> ' + M.util.get_string('title', 'availability_completion') + '</span>' +
|
||||
' <span class="availability-group form-group"><label>' +
|
||||
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
|
||||
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
|
||||
'<select class="custom-select" name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
|
||||
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.cms.length; i++) {
|
||||
var cm = this.cms[i];
|
||||
@@ -36,13 +37,14 @@ M.availability_completion.form.getNode = function(json) {
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' +
|
||||
M.util.get_string('label_completion', 'availability_completion') +
|
||||
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
|
||||
' </span><select class="custom-select" ' +
|
||||
'name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
|
||||
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
|
||||
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
|
||||
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
|
||||
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
|
||||
'</select></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
|
||||
@@ -23,9 +23,10 @@ M.availability_completion.form.initInner = function(cms) {
|
||||
|
||||
M.availability_completion.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = M.util.get_string('title', 'availability_completion') + ' <span class="availability-group"><label>' +
|
||||
var html = '<span class="col-form-label p-r-1"> ' + M.util.get_string('title', 'availability_completion') + '</span>' +
|
||||
' <span class="availability-group form-group"><label>' +
|
||||
'<span class="accesshide">' + M.util.get_string('label_cm', 'availability_completion') + ' </span>' +
|
||||
'<select name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
|
||||
'<select class="custom-select" name="cm" title="' + M.util.get_string('label_cm', 'availability_completion') + '">' +
|
||||
'<option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.cms.length; i++) {
|
||||
var cm = this.cms[i];
|
||||
@@ -34,13 +35,14 @@ M.availability_completion.form.getNode = function(json) {
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' +
|
||||
M.util.get_string('label_completion', 'availability_completion') +
|
||||
' </span><select name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
|
||||
' </span><select class="custom-select" ' +
|
||||
'name="e" title="' + M.util.get_string('label_completion', 'availability_completion') + '">' +
|
||||
'<option value="1">' + M.util.get_string('option_complete', 'availability_completion') + '</option>' +
|
||||
'<option value="0">' + M.util.get_string('option_incomplete', 'availability_completion') + '</option>' +
|
||||
'<option value="2">' + M.util.get_string('option_pass', 'availability_completion') + '</option>' +
|
||||
'<option value="3">' + M.util.get_string('option_fail', 'availability_completion') + '</option>' +
|
||||
'</select></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.cm !== undefined &&
|
||||
|
||||
@@ -151,7 +151,7 @@ class frontend extends \core_availability\frontend {
|
||||
// NOTE: The fields need to have these weird names in order that they
|
||||
// match the standard Moodle form control, otherwise the date selector
|
||||
// won't find them.
|
||||
$html .= \html_writer::start_tag('select', array('name' => 'x[' . $field . ']'));
|
||||
$html .= \html_writer::start_tag('select', array('name' => 'x[' . $field . ']', 'class' => 'custom-select'));
|
||||
foreach ($options as $key => $value) {
|
||||
$params = array('value' => $key);
|
||||
if ($current[$field] == $key) {
|
||||
|
||||
+3
-2
@@ -29,9 +29,10 @@ M.availability_date.form.initInner = function(html, defaultTime) {
|
||||
};
|
||||
|
||||
M.availability_date.form.getNode = function(json) {
|
||||
var html = M.util.get_string('direction_before', 'availability_date') + ' <span class="availability-group">' +
|
||||
var html = '<span class="col-form-label p-r-1">' +
|
||||
M.util.get_string('direction_before', 'availability_date') + '</span> <span class="availability-group">' +
|
||||
'<label><span class="accesshide">' + M.util.get_string('direction_label', 'availability_date') + ' </span>' +
|
||||
'<select name="direction">' +
|
||||
'<select name="direction" class="custom-select">' +
|
||||
'<option value=">=">' + M.util.get_string('direction_from', 'availability_date') + '</option>' +
|
||||
'<option value="<">' + M.util.get_string('direction_until', 'availability_date') + '</option>' +
|
||||
'</select></label></span> ' + this.html;
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n=M.util.get_string("direction_before","availability_date")+' <span class="availability-group">'+'<label><span class="accesshide">'+M.util.get_string("direction_label","availability_date")+" </span>"+'<select name="direction">'+'<option value=">=">'+M.util.get_string("direction_from","availability_date")+"</option>"+'<option value="<">'+M.util.get_string("direction_until","availability_date")+"</option>"+"</select></label></span> "+this.html,r=e.Node.create("<span>"+n+"</span>");if(t.t!==undefined){r.setData("time",t.t),r.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var i=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(i,{on:{success:function(t,n){var i=e.JSON.parse(n.responseText);for(var s in i){var o=r.one("select[name=x\\["+s+"\\]]");o.set("value",""+i[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})}else r.setData("time",this.defaultTime);t.d!==undefined&&r.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var s=e.one(".availability-field");s.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),s.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(r.one("a[href=#]")){M.form.dateselector.init_single_date_selector(r);var o=r.one("select[name=x\\[year\\]]"),u=o.set;o.set=function(e,t){u.call(o,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(r)},0)}}return r},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_date-form",function(e,t){M.availability_date=M.availability_date||{},M.availability_date.form=e.Object(M.core_availability.plugin),M.availability_date.form.initInner=function(e,t){this.html=e,this.defaultTime=t},M.availability_date.form.getNode=function(t){var n='<span class="col-form-label p-r-1">'+M.util.get_string("direction_before","availability_date")+'</span> <span class="availability-group">'+'<label><span class="accesshide">'+M.util.get_string("direction_label","availability_date")+" </span>"+'<select name="direction" class="custom-select">'+'<option value=">=">'+M.util.get_string("direction_from","availability_date")+"</option>"+'<option value="<">'+M.util.get_string("direction_until","availability_date")+"</option>"+"</select></label></span> "+this.html,r=e.Node.create("<span>"+n+"</span>");if(t.t!==undefined){r.setData("time",t.t),r.all("select:not([name=direction])").each(function(e){e.set("disabled",!0)});var i=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=fromtime"+"&time="+t.t;e.io(i,{on:{success:function(t,n){var i=e.JSON.parse(n.responseText);for(var s in i){var o=r.one("select[name=x\\["+s+"\\]]");o.set("value",""+i[s]),o.set("disabled",!1)}},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})}else r.setData("time",this.defaultTime);t.d!==undefined&&r.one("select[name=direction]").set("value",t.d);if(!M.availability_date.form.addedEvents){M.availability_date.form.addedEvents=!0;var s=e.one(".availability-field");s.delegate("change",function(){M.core_availability.form.update()},".availability_date select[name=direction]"),s.delegate("change",function(){M.availability_date.form.updateTime(this.ancestor("span.availability_date"))},".availability_date select:not([name=direction])")}if(r.one("a[href=#]")){M.form.dateselector.init_single_date_selector(r);var o=r.one("select[name=x\\[year\\]]"),u=o.set;o.set=function(e,t){u.call(o,e,t),e==="selectedIndex"&&setTimeout(function(){M.availability_date.form.updateTime(r)},0)}}return r},M.availability_date.form.updateTime=function(t){var n=M.cfg.wwwroot+"/availability/condition/date/ajax.php?action=totime"+"&year="+t.one("select[name=x\\[year\\]]").get("value")+"&month="+t.one("select[name=x\\[month\\]]").get("value")+"&day="+t.one("select[name=x\\[day\\]]").get("value")+"&hour="+t.one("select[name=x\\[hour\\]]").get("value")+"&minute="+t.one("select[name=x\\[minute\\]]").get("value");e.io(n,{on:{success:function(e,n){t.setData("time",n.responseText),M.core_availability.form.update()},failure:function(){window.alert(M.util.get_string("ajaxerror","availability_date"))}}})},M.availability_date.form.fillValue=function(e,t){e.d=t.one("select[name=direction]").get("value"),e.t=parseInt(t.getData("time"),10)}},"@VERSION@",{requires:["base","node","event","io","moodle-core_availability-form"]});
|
||||
|
||||
availability/condition/date/yui/build/moodle-availability_date-form/moodle-availability_date-form.js
Vendored
+3
-2
@@ -29,9 +29,10 @@ M.availability_date.form.initInner = function(html, defaultTime) {
|
||||
};
|
||||
|
||||
M.availability_date.form.getNode = function(json) {
|
||||
var html = M.util.get_string('direction_before', 'availability_date') + ' <span class="availability-group">' +
|
||||
var html = '<span class="col-form-label p-r-1">' +
|
||||
M.util.get_string('direction_before', 'availability_date') + '</span> <span class="availability-group">' +
|
||||
'<label><span class="accesshide">' + M.util.get_string('direction_label', 'availability_date') + ' </span>' +
|
||||
'<select name="direction">' +
|
||||
'<select name="direction" class="custom-select">' +
|
||||
'<option value=">=">' + M.util.get_string('direction_from', 'availability_date') + '</option>' +
|
||||
'<option value="<">' + M.util.get_string('direction_until', 'availability_date') + '</option>' +
|
||||
'</select></label></span> ' + this.html;
|
||||
|
||||
+3
-2
@@ -27,9 +27,10 @@ M.availability_date.form.initInner = function(html, defaultTime) {
|
||||
};
|
||||
|
||||
M.availability_date.form.getNode = function(json) {
|
||||
var html = M.util.get_string('direction_before', 'availability_date') + ' <span class="availability-group">' +
|
||||
var html = '<span class="col-form-label p-r-1">' +
|
||||
M.util.get_string('direction_before', 'availability_date') + '</span> <span class="availability-group">' +
|
||||
'<label><span class="accesshide">' + M.util.get_string('direction_label', 'availability_date') + ' </span>' +
|
||||
'<select name="direction">' +
|
||||
'<select name="direction" class="custom-select">' +
|
||||
'<option value=">=">' + M.util.get_string('direction_from', 'availability_date') + '</option>' +
|
||||
'<option value="<">' + M.util.get_string('direction_until', 'availability_date') + '</option>' +
|
||||
'</select></label></span> ' + this.html;
|
||||
|
||||
+13
-10
@@ -37,24 +37,27 @@ M.availability_grade.form.getNode = function(json) {
|
||||
this.nodesSoFar++;
|
||||
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_grade') + ' <span class="availability-group">' +
|
||||
'<select name="id"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
var html = '<label class="form-group"><span class="p-r-1">' + M.util.get_string('title', 'availability_grade') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.grades.length; i++) {
|
||||
var grade = this.grades[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + grade.id + '">' + grade.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label> <span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="min"/>' + M.util.get_string('option_min', 'availability_grade') +
|
||||
html += '</select></span></label> <br><span class="availability-group form-group">' +
|
||||
'<label><input type="checkbox" class="form-check-input m-x-1" name="min"/>' +
|
||||
M.util.get_string('option_min', 'availability_grade') +
|
||||
'</label> <label><span class="accesshide">' + M.util.get_string('label_min', 'availability_grade') +
|
||||
'</span><input type="text" name="minval" title="' +
|
||||
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span>' +
|
||||
'<span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="max"/>' + M.util.get_string('option_max', 'availability_grade') +
|
||||
'</span><input type="text" class="form-control m-x-1" name="minval" title="' +
|
||||
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span><br>' +
|
||||
'<span class="availability-group form-group">' +
|
||||
'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>' +
|
||||
M.util.get_string('option_max', 'availability_grade') +
|
||||
'</label> <label><span class="accesshide">' + M.util.get_string('label_max', 'availability_grade') +
|
||||
'</span><input type="text" name="maxval" title="' +
|
||||
'</span><input type="text" class="form-control m-x-1" name="maxval" title="' +
|
||||
M.util.get_string('label_max', 'availability_grade') + '"/></label>%</span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<div class="d-inline-block form-inline">' + html + '</div>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n="<label>"+M.util.get_string("title","availability_grade")+' <span class="availability-group">'+'<select name="id"><option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.grades.length;r++){var i=this.grades[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></span></label> <span class="availability-group"><label><input type="checkbox" name="min"/>'+M.util.get_string("option_min","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_min","availability_grade")+'</span><input type="text" name="minval" title="'+M.util.get_string("label_min","availability_grade")+'"/></label>%</span>'+'<span class="availability-group">'+'<label><input type="checkbox" name="max"/>'+M.util.get_string("option_max","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_max","availability_grade")+'</span><input type="text" name="maxval" title="'+M.util.get_string("label_max","availability_grade")+'"/></label>%</span>';var s=e.Node.create("<span>"+n+"</span>");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(s.one("input[name=min]").set("checked",!0),s.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(s.one("input[name=max]").set("checked",!0),s.one("input[name=maxval]").set("value",t.max));var o=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};s.all("input[type=checkbox]").each(o);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var u=e.one(".availability-field");u.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),u.delegate("click",function(){o(this,!0),M.core_availability.form.update()},".availability_grade input[type=checkbox]"),u.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return s},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_grade-form",function(e,t){M.availability_grade=M.availability_grade||{},M.availability_grade.form=e.Object(M.core_availability.plugin),M.availability_grade.form.grades=null,M.availability_grade.form.initInner=function(e){this.grades=e,this.nodesSoFar=0},M.availability_grade.form.getNode=function(t){this.nodesSoFar++;var n='<label class="form-group"><span class="p-r-1">'+M.util.get_string("title","availability_grade")+"</span> "+'<span class="availability-group">'+'<select name="id" class="custom-select"><option value="0">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.grades.length;r++){var i=this.grades[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+='</select></span></label> <br><span class="availability-group form-group"><label><input type="checkbox" class="form-check-input m-x-1" name="min"/>'+M.util.get_string("option_min","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_min","availability_grade")+'</span><input type="text" class="form-control m-x-1" name="minval" title="'+M.util.get_string("label_min","availability_grade")+'"/></label>%</span><br>'+'<span class="availability-group form-group">'+'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>'+M.util.get_string("option_max","availability_grade")+'</label> <label><span class="accesshide">'+M.util.get_string("label_max","availability_grade")+'</span><input type="text" class="form-control m-x-1" name="maxval" title="'+M.util.get_string("label_max","availability_grade")+'"/></label>%</span>';var s=e.Node.create('<div class="d-inline-block form-inline">'+n+"</div>");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id),t.min!==undefined&&(s.one("input[name=min]").set("checked",!0),s.one("input[name=minval]").set("value",t.min)),t.max!==undefined&&(s.one("input[name=max]").set("checked",!0),s.one("input[name=maxval]").set("value",t.max));var o=function(e,t){var n=e.ancestor("label").next("label").one("input"),r=e.get("checked");return n.set("disabled",!r),t&&r&&n.focus(),r};s.all("input[type=checkbox]").each(o);if(!M.availability_grade.form.addedEvents){M.availability_grade.form.addedEvents=!0;var u=e.one(".availability-field");u.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),u.delegate("click",function(){o(this,!0),M.core_availability.form.update()},".availability_grade input[type=checkbox]"),u.delegate("valuechange",function(){M.core_availability.form.update()},".availability_grade input[type=text]")}return s},M.availability_grade.form.fillValue=function(e,t){e.id=parseInt(t.one("select[name=id]").get("value"),10),t.one("input[name=min]").get("checked")&&(e.min=this.getValue("minval",t)),t.one("input[name=max]").get("checked")&&(e.max=this.getValue("maxval",t))},M.availability_grade.form.getValue=function(e,t){var n=t.one("input[name="+e+"]").get("value");if(!/^[0-9]+([.,][0-9]+)?$/.test(n))return n;var r=parseFloat(n.replace(",","."));return r<0||r>100?n:r},M.availability_grade.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id===0&&e.push("availability_grade:error_selectgradeid"),n.min!==undefined&&typeof n.min=="string"||n.max!==undefined&&typeof n.max=="string"?e.push("availability_grade:error_invalidnumber"):n.min!==undefined&&n.max!==undefined&&n.min>=n.max&&e.push("availability_grade:error_backwardrange")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+13
-10
@@ -37,24 +37,27 @@ M.availability_grade.form.getNode = function(json) {
|
||||
this.nodesSoFar++;
|
||||
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_grade') + ' <span class="availability-group">' +
|
||||
'<select name="id"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
var html = '<label class="form-group"><span class="p-r-1">' + M.util.get_string('title', 'availability_grade') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.grades.length; i++) {
|
||||
var grade = this.grades[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + grade.id + '">' + grade.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label> <span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="min"/>' + M.util.get_string('option_min', 'availability_grade') +
|
||||
html += '</select></span></label> <br><span class="availability-group form-group">' +
|
||||
'<label><input type="checkbox" class="form-check-input m-x-1" name="min"/>' +
|
||||
M.util.get_string('option_min', 'availability_grade') +
|
||||
'</label> <label><span class="accesshide">' + M.util.get_string('label_min', 'availability_grade') +
|
||||
'</span><input type="text" name="minval" title="' +
|
||||
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span>' +
|
||||
'<span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="max"/>' + M.util.get_string('option_max', 'availability_grade') +
|
||||
'</span><input type="text" class="form-control m-x-1" name="minval" title="' +
|
||||
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span><br>' +
|
||||
'<span class="availability-group form-group">' +
|
||||
'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>' +
|
||||
M.util.get_string('option_max', 'availability_grade') +
|
||||
'</label> <label><span class="accesshide">' + M.util.get_string('label_max', 'availability_grade') +
|
||||
'</span><input type="text" name="maxval" title="' +
|
||||
'</span><input type="text" class="form-control m-x-1" name="maxval" title="' +
|
||||
M.util.get_string('label_max', 'availability_grade') + '"/></label>%</span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<div class="d-inline-block form-inline">' + html + '</div>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
|
||||
+13
-10
@@ -35,24 +35,27 @@ M.availability_grade.form.getNode = function(json) {
|
||||
this.nodesSoFar++;
|
||||
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_grade') + ' <span class="availability-group">' +
|
||||
'<select name="id"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
var html = '<label class="form-group"><span class="p-r-1">' + M.util.get_string('title', 'availability_grade') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select"><option value="0">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.grades.length; i++) {
|
||||
var grade = this.grades[i];
|
||||
// String has already been escaped using format_string.
|
||||
html += '<option value="' + grade.id + '">' + grade.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label> <span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="min"/>' + M.util.get_string('option_min', 'availability_grade') +
|
||||
html += '</select></span></label> <br><span class="availability-group form-group">' +
|
||||
'<label><input type="checkbox" class="form-check-input m-x-1" name="min"/>' +
|
||||
M.util.get_string('option_min', 'availability_grade') +
|
||||
'</label> <label><span class="accesshide">' + M.util.get_string('label_min', 'availability_grade') +
|
||||
'</span><input type="text" name="minval" title="' +
|
||||
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span>' +
|
||||
'<span class="availability-group">' +
|
||||
'<label><input type="checkbox" name="max"/>' + M.util.get_string('option_max', 'availability_grade') +
|
||||
'</span><input type="text" class="form-control m-x-1" name="minval" title="' +
|
||||
M.util.get_string('label_min', 'availability_grade') + '"/></label>%</span><br>' +
|
||||
'<span class="availability-group form-group">' +
|
||||
'<label><input type="checkbox" class="form-check-input m-x-1" name="max"/>' +
|
||||
M.util.get_string('option_max', 'availability_grade') +
|
||||
'</label> <label><span class="accesshide">' + M.util.get_string('label_max', 'availability_grade') +
|
||||
'</span><input type="text" name="maxval" title="' +
|
||||
'</span><input type="text" class="form-control m-x-1" name="maxval" title="' +
|
||||
M.util.get_string('label_max', 'availability_grade') + '"/></label>%</span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<div class="d-inline-block form-inline">' + html + '</div>');
|
||||
|
||||
// Set initial values.
|
||||
if (json.id !== undefined &&
|
||||
|
||||
+4
-3
@@ -33,8 +33,9 @@ M.availability_group.form.initInner = function(groups) {
|
||||
|
||||
M.availability_group.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_group') + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_group') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>' +
|
||||
'<option value="any">' + M.util.get_string('anygroup', 'availability_group') + '</option>';
|
||||
for (var i = 0; i < this.groups.length; i++) {
|
||||
@@ -43,7 +44,7 @@ M.availability_group.form.getNode = function(json) {
|
||||
html += '<option value="' + group.id + '">' + group.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values (leave default 'choose' if creating afresh).
|
||||
if (json.creating === undefined) {
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n="<label>"+M.util.get_string("title","availability_group")+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>"+'<option value="any">'+M.util.get_string("anygroup","availability_group")+"</option>";for(var r=0;r<this.groups.length;r++){var i=this.groups[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create("<span>"+n+"</span>");t.creating===undefined&&(t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")?s.one("select[name=id]").set("value",""+t.id):t.id===undefined&&s.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return s},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_group-form",function(e,t){M.availability_group=M.availability_group||{},M.availability_group.form=e.Object(M.core_availability.plugin),M.availability_group.form.groups=null,M.availability_group.form.initInner=function(e){this.groups=e},M.availability_group.form.getNode=function(t){var n='<label><span class="p-r-1">'+M.util.get_string("title","availability_group")+"</span> "+'<span class="availability-group">'+'<select name="id" class="custom-select">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>"+'<option value="any">'+M.util.get_string("anygroup","availability_group")+"</option>";for(var r=0;r<this.groups.length;r++){var i=this.groups[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create('<span class="form-inline">'+n+"</span>");t.creating===undefined&&(t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")?s.one("select[name=id]").set("value",""+t.id):t.id===undefined&&s.one("select[name=id]").set("value","any"));if(!M.availability_group.form.addedEvents){M.availability_group.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_group select")}return s},M.availability_group.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":n!=="any"&&(e.id=parseInt(n,10))},M.availability_group.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id&&n.id==="choose"&&e.push("availability_group:error_selectgroup")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+4
-3
@@ -33,8 +33,9 @@ M.availability_group.form.initInner = function(groups) {
|
||||
|
||||
M.availability_group.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_group') + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_group') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>' +
|
||||
'<option value="any">' + M.util.get_string('anygroup', 'availability_group') + '</option>';
|
||||
for (var i = 0; i < this.groups.length; i++) {
|
||||
@@ -43,7 +44,7 @@ M.availability_group.form.getNode = function(json) {
|
||||
html += '<option value="' + group.id + '">' + group.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values (leave default 'choose' if creating afresh).
|
||||
if (json.creating === undefined) {
|
||||
|
||||
+4
-3
@@ -31,8 +31,9 @@ M.availability_group.form.initInner = function(groups) {
|
||||
|
||||
M.availability_group.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_group') + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_group') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>' +
|
||||
'<option value="any">' + M.util.get_string('anygroup', 'availability_group') + '</option>';
|
||||
for (var i = 0; i < this.groups.length; i++) {
|
||||
@@ -41,7 +42,7 @@ M.availability_group.form.getNode = function(json) {
|
||||
html += '<option value="' + group.id + '">' + group.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values (leave default 'choose' if creating afresh).
|
||||
if (json.creating === undefined) {
|
||||
|
||||
+4
-3
@@ -33,8 +33,9 @@ M.availability_grouping.form.initInner = function(groupings) {
|
||||
|
||||
M.availability_grouping.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_grouping') + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_grouping') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.groupings.length; i++) {
|
||||
var grouping = this.groupings[i];
|
||||
@@ -42,7 +43,7 @@ M.availability_grouping.form.getNode = function(json) {
|
||||
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial value if specified.
|
||||
if (json.id !== undefined &&
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_grouping-form",function(e,t){M.availability_grouping=M.availability_grouping||{},M.availability_grouping.form=e.Object(M.core_availability.plugin),M.availability_grouping.form.groupings=null,M.availability_grouping.form.initInner=function(e){this.groupings=e},M.availability_grouping.form.getNode=function(t){var n="<label>"+M.util.get_string("title","availability_grouping")+' <span class="availability-group">'+'<select name="id">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.groupings.length;r++){var i=this.groupings[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create("<span>"+n+"</span>");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id);if(!M.availability_grouping.form.addedEvents){M.availability_grouping.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_grouping select")}return s},M.availability_grouping.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":e.id=parseInt(n,10)},M.availability_grouping.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id==="choose"&&e.push("availability_grouping:error_selectgrouping")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_grouping-form",function(e,t){M.availability_grouping=M.availability_grouping||{},M.availability_grouping.form=e.Object(M.core_availability.plugin),M.availability_grouping.form.groupings=null,M.availability_grouping.form.initInner=function(e){this.groupings=e},M.availability_grouping.form.getNode=function(t){var n='<label><span class="p-r-1">'+M.util.get_string("title","availability_grouping")+"</span> "+'<span class="availability-group">'+'<select name="id" class="custom-select">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>";for(var r=0;r<this.groupings.length;r++){var i=this.groupings[r];n+='<option value="'+i.id+'">'+i.name+"</option>"}n+="</select></span></label>";var s=e.Node.create('<span class="form-inline">'+n+"</span>");t.id!==undefined&&s.one("select[name=id] > option[value="+t.id+"]")&&s.one("select[name=id]").set("value",""+t.id);if(!M.availability_grouping.form.addedEvents){M.availability_grouping.form.addedEvents=!0;var o=e.one(".availability-field");o.delegate("change",function(){M.core_availability.form.update()},".availability_grouping select")}return s},M.availability_grouping.form.fillValue=function(e,t){var n=t.one("select[name=id]").get("value");n==="choose"?e.id="choose":e.id=parseInt(n,10)},M.availability_grouping.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.id==="choose"&&e.push("availability_grouping:error_selectgrouping")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+4
-3
@@ -33,8 +33,9 @@ M.availability_grouping.form.initInner = function(groupings) {
|
||||
|
||||
M.availability_grouping.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_grouping') + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_grouping') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.groupings.length; i++) {
|
||||
var grouping = this.groupings[i];
|
||||
@@ -42,7 +43,7 @@ M.availability_grouping.form.getNode = function(json) {
|
||||
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial value if specified.
|
||||
if (json.id !== undefined &&
|
||||
|
||||
+4
-3
@@ -31,8 +31,9 @@ M.availability_grouping.form.initInner = function(groupings) {
|
||||
|
||||
M.availability_grouping.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<label>' + M.util.get_string('title', 'availability_grouping') + ' <span class="availability-group">' +
|
||||
'<select name="id">' +
|
||||
var html = '<label><span class="p-r-1">' + M.util.get_string('title', 'availability_grouping') + '</span> ' +
|
||||
'<span class="availability-group">' +
|
||||
'<select name="id" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
for (var i = 0; i < this.groupings.length; i++) {
|
||||
var grouping = this.groupings[i];
|
||||
@@ -40,7 +41,7 @@ M.availability_grouping.form.getNode = function(json) {
|
||||
html += '<option value="' + grouping.id + '">' + grouping.name + '</option>';
|
||||
}
|
||||
html += '</select></span></label>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial value if specified.
|
||||
if (json.id !== undefined &&
|
||||
|
||||
+7
-5
@@ -35,8 +35,9 @@ M.availability_profile.form.initInner = function(standardFields, customFields) {
|
||||
|
||||
M.availability_profile.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<span class="availability-group"><label>' + M.util.get_string('conditiontitle', 'availability_profile') + ' ' +
|
||||
'<select name="field">' +
|
||||
var html = '<span class="availability-group"><label><span class="p-r-1">' +
|
||||
M.util.get_string('conditiontitle', 'availability_profile') + '</span> ' +
|
||||
'<select name="field" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
var fieldInfo;
|
||||
for (var i = 0; i < this.standardFields.length; i++) {
|
||||
@@ -50,7 +51,8 @@ M.availability_profile.form.getNode = function(json) {
|
||||
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_operator', 'availability_profile') +
|
||||
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '">';
|
||||
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '"' +
|
||||
' class="custom-select">';
|
||||
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
|
||||
'isempty', 'isnotempty'];
|
||||
for (i = 0; i < operators.length; i++) {
|
||||
@@ -58,9 +60,9 @@ M.availability_profile.form.getNode = function(json) {
|
||||
M.util.get_string('op_' + operators[i], 'availability_profile') + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_value', 'availability_profile') +
|
||||
'</span><input name="value" type="text" style="width: 10em" title="' +
|
||||
'</span><input name="value" type="text" class="form-control" style="width: 10em" title="' +
|
||||
M.util.get_string('label_value', 'availability_profile') + '"/></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values if specified.
|
||||
if (json.sf !== undefined &&
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
YUI.add("moodle-availability_profile-form",function(e,t){M.availability_profile=M.availability_profile||{},M.availability_profile.form=e.Object(M.core_availability.plugin),M.availability_profile.form.profiles=null,M.availability_profile.form.initInner=function(e,t){this.standardFields=e,this.customFields=t},M.availability_profile.form.getNode=function(t){var n='<span class="availability-group"><label>'+M.util.get_string("conditiontitle","availability_profile")+" "+'<select name="field">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>",r;for(var i=0;i<this.standardFields.length;i++)r=this.standardFields[i],n+='<option value="sf_'+r.field+'">'+r.display+"</option>";for(i=0;i<this.customFields.length;i++)r=this.customFields[i],n+='<option value="cf_'+r.field+'">'+r.display+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_operator","availability_profile")+' </span><select name="op" title="'+M.util.get_string("label_operator","availability_profile")+'">';var s=["isequalto","contains","doesnotcontain","startswith","endswith","isempty","isnotempty"];for(i=0;i<s.length;i++)n+='<option value="'+s[i]+'">'+M.util.get_string("op_"+s[i],"availability_profile")+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_value","availability_profile")+'</span><input name="value" type="text" style="width: 10em" title="'+M.util.get_string("label_value","availability_profile")+'"/></label></span>';var o=e.Node.create("<span>"+n+"</span>");t.sf!==undefined&&o.one("select[name=field] > option[value=sf_"+t.sf+"]")?o.one("select[name=field]").set("value","sf_"+t.sf):t.cf!==undefined&&o.one("select[name=field] > option[value=cf_"+t.cf+"]")&&o.one("select[name=field]").set("value","cf_"+t.cf),t.op!==undefined&&o.one("select[name=op] > option[value="+t.op+"]")&&(o.one("select[name=op]").set("value",t.op),(t.op==="isempty"||t.op==="isnotempty")&&o.one("input[name=value]").set("disabled",!0)),t.v!==undefined&&o.one("input").set("value",t.v);if(!M.availability_profile.form.addedEvents){M.availability_profile.form.addedEvents=!0;var u=function(e){var t=e.ancestor("span.availability_profile"),n=t.one("select[name=op]"),r=n.get("value")==="isempty"||n.get("value")==="isnotempty";t.one("input[name=value]").set("disabled",r),M.core_availability.form.update()},a=e.one(".availability-field");a.delegate("change",function(){u(this)},".availability_profile select"),a.delegate("change",function(){u(this)},".availability_profile input[name=value]")}return o},M.availability_profile.form.fillValue=function(e,t){var n=t.one("select[name=field]").get("value");n.substr(0,3)==="sf_"?e.sf=n.substr(3):n.substr(0,3)==="cf_"&&(e.cf=n.substr(3)),e.op=t.one("select[name=op]").get("value");var r=t.one("input[name=value]");r.get("disabled")||(e.v=r.get("value"))},M.availability_profile.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.sf===undefined&&n.cf===undefined&&e.push("availability_profile:error_selectfield"),n.v!==undefined&&/^\s*$/.test(n.v)&&e.push("availability_profile:error_setvalue")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
YUI.add("moodle-availability_profile-form",function(e,t){M.availability_profile=M.availability_profile||{},M.availability_profile.form=e.Object(M.core_availability.plugin),M.availability_profile.form.profiles=null,M.availability_profile.form.initInner=function(e,t){this.standardFields=e,this.customFields=t},M.availability_profile.form.getNode=function(t){var n='<span class="availability-group"><label><span class="p-r-1">'+M.util.get_string("conditiontitle","availability_profile")+"</span> "+'<select name="field" class="custom-select">'+'<option value="choose">'+M.util.get_string("choosedots","moodle")+"</option>",r;for(var i=0;i<this.standardFields.length;i++)r=this.standardFields[i],n+='<option value="sf_'+r.field+'">'+r.display+"</option>";for(i=0;i<this.customFields.length;i++)r=this.customFields[i],n+='<option value="cf_'+r.field+'">'+r.display+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_operator","availability_profile")+' </span><select name="op" title="'+M.util.get_string("label_operator","availability_profile")+'"'+' class="custom-select">';var s=["isequalto","contains","doesnotcontain","startswith","endswith","isempty","isnotempty"];for(i=0;i<s.length;i++)n+='<option value="'+s[i]+'">'+M.util.get_string("op_"+s[i],"availability_profile")+"</option>";n+='</select></label> <label><span class="accesshide">'+M.util.get_string("label_value","availability_profile")+'</span><input name="value" type="text" class="form-control" style="width: 10em" title="'+M.util.get_string("label_value","availability_profile")+'"/></label></span>';var o=e.Node.create('<span class="form-inline">'+n+"</span>");t.sf!==undefined&&o.one("select[name=field] > option[value=sf_"+t.sf+"]")?o.one("select[name=field]").set("value","sf_"+t.sf):t.cf!==undefined&&o.one("select[name=field] > option[value=cf_"+t.cf+"]")&&o.one("select[name=field]").set("value","cf_"+t.cf),t.op!==undefined&&o.one("select[name=op] > option[value="+t.op+"]")&&(o.one("select[name=op]").set("value",t.op),(t.op==="isempty"||t.op==="isnotempty")&&o.one("input[name=value]").set("disabled",!0)),t.v!==undefined&&o.one("input").set("value",t.v);if(!M.availability_profile.form.addedEvents){M.availability_profile.form.addedEvents=!0;var u=function(e){var t=e.ancestor("span.availability_profile"),n=t.one("select[name=op]"),r=n.get("value")==="isempty"||n.get("value")==="isnotempty";t.one("input[name=value]").set("disabled",r),M.core_availability.form.update()},a=e.one(".availability-field");a.delegate("change",function(){u(this)},".availability_profile select"),a.delegate("change",function(){u(this)},".availability_profile input[name=value]")}return o},M.availability_profile.form.fillValue=function(e,t){var n=t.one("select[name=field]").get("value");n.substr(0,3)==="sf_"?e.sf=n.substr(3):n.substr(0,3)==="cf_"&&(e.cf=n.substr(3)),e.op=t.one("select[name=op]").get("value");var r=t.one("input[name=value]");r.get("disabled")||(e.v=r.get("value"))},M.availability_profile.form.fillErrors=function(e,t){var n={};this.fillValue(n,t),n.sf===undefined&&n.cf===undefined&&e.push("availability_profile:error_selectfield"),n.v!==undefined&&/^\s*$/.test(n.v)&&e.push("availability_profile:error_setvalue")}},"@VERSION@",{requires:["base","node","event","moodle-core_availability-form"]});
|
||||
|
||||
+7
-5
@@ -35,8 +35,9 @@ M.availability_profile.form.initInner = function(standardFields, customFields) {
|
||||
|
||||
M.availability_profile.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<span class="availability-group"><label>' + M.util.get_string('conditiontitle', 'availability_profile') + ' ' +
|
||||
'<select name="field">' +
|
||||
var html = '<span class="availability-group"><label><span class="p-r-1">' +
|
||||
M.util.get_string('conditiontitle', 'availability_profile') + '</span> ' +
|
||||
'<select name="field" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
var fieldInfo;
|
||||
for (var i = 0; i < this.standardFields.length; i++) {
|
||||
@@ -50,7 +51,8 @@ M.availability_profile.form.getNode = function(json) {
|
||||
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_operator', 'availability_profile') +
|
||||
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '">';
|
||||
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '"' +
|
||||
' class="custom-select">';
|
||||
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
|
||||
'isempty', 'isnotempty'];
|
||||
for (i = 0; i < operators.length; i++) {
|
||||
@@ -58,9 +60,9 @@ M.availability_profile.form.getNode = function(json) {
|
||||
M.util.get_string('op_' + operators[i], 'availability_profile') + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_value', 'availability_profile') +
|
||||
'</span><input name="value" type="text" style="width: 10em" title="' +
|
||||
'</span><input name="value" type="text" class="form-control" style="width: 10em" title="' +
|
||||
M.util.get_string('label_value', 'availability_profile') + '"/></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values if specified.
|
||||
if (json.sf !== undefined &&
|
||||
|
||||
+7
-5
@@ -33,8 +33,9 @@ M.availability_profile.form.initInner = function(standardFields, customFields) {
|
||||
|
||||
M.availability_profile.form.getNode = function(json) {
|
||||
// Create HTML structure.
|
||||
var html = '<span class="availability-group"><label>' + M.util.get_string('conditiontitle', 'availability_profile') + ' ' +
|
||||
'<select name="field">' +
|
||||
var html = '<span class="availability-group"><label><span class="p-r-1">' +
|
||||
M.util.get_string('conditiontitle', 'availability_profile') + '</span> ' +
|
||||
'<select name="field" class="custom-select">' +
|
||||
'<option value="choose">' + M.util.get_string('choosedots', 'moodle') + '</option>';
|
||||
var fieldInfo;
|
||||
for (var i = 0; i < this.standardFields.length; i++) {
|
||||
@@ -48,7 +49,8 @@ M.availability_profile.form.getNode = function(json) {
|
||||
html += '<option value="cf_' + fieldInfo.field + '">' + fieldInfo.display + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_operator', 'availability_profile') +
|
||||
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '">';
|
||||
' </span><select name="op" title="' + M.util.get_string('label_operator', 'availability_profile') + '"' +
|
||||
' class="custom-select">';
|
||||
var operators = ['isequalto', 'contains', 'doesnotcontain', 'startswith', 'endswith',
|
||||
'isempty', 'isnotempty'];
|
||||
for (i = 0; i < operators.length; i++) {
|
||||
@@ -56,9 +58,9 @@ M.availability_profile.form.getNode = function(json) {
|
||||
M.util.get_string('op_' + operators[i], 'availability_profile') + '</option>';
|
||||
}
|
||||
html += '</select></label> <label><span class="accesshide">' + M.util.get_string('label_value', 'availability_profile') +
|
||||
'</span><input name="value" type="text" style="width: 10em" title="' +
|
||||
'</span><input name="value" type="text" class="form-control" style="width: 10em" title="' +
|
||||
M.util.get_string('label_value', 'availability_profile') + '"/></label></span>';
|
||||
var node = Y.Node.create('<span>' + html + '</span>');
|
||||
var node = Y.Node.create('<span class="form-inline">' + html + '</span>');
|
||||
|
||||
// Set initial values if specified.
|
||||
if (json.sf !== undefined &&
|
||||
|
||||
@@ -675,6 +675,63 @@ class tree_testcase extends \advanced_testcase {
|
||||
json_encode(tree::get_root_json(array($child, $child), tree::OP_AND, array(true, false))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the behaviour of the counter in unique_sql_parameter().
|
||||
*
|
||||
* There was a problem with static counters used to implement a sequence of
|
||||
* parameter placeholders (MDL-53481). As always with static variables, it
|
||||
* is a bit tricky to unit test the behaviour reliably as it depends on the
|
||||
* actual tests executed and also their order.
|
||||
*
|
||||
* To minimise risk of false expected behaviour, this test method should be
|
||||
* first one where {@link core_availability\tree::get_user_list_sql()} is
|
||||
* used. We also use higher number of condition instances to increase the
|
||||
* risk of the counter collision, should there remain a problem.
|
||||
*/
|
||||
public function test_unique_sql_parameter_behaviour() {
|
||||
global $DB;
|
||||
$this->resetAfterTest();
|
||||
$generator = $this->getDataGenerator();
|
||||
|
||||
// Create a test course with multiple groupings and groups and a student in each of them.
|
||||
$course = $generator->create_course();
|
||||
$user = $generator->create_user();
|
||||
$studentroleid = $DB->get_field('role', 'id', array('shortname' => 'student'));
|
||||
$generator->enrol_user($user->id, $course->id, $studentroleid);
|
||||
// The total number of groupings and groups must not be greater than 61.
|
||||
// There is a limit in MySQL on the max number of joined tables.
|
||||
$groups = [];
|
||||
for ($i = 0; $i < 25; $i++) {
|
||||
$group = $generator->create_group(array('courseid' => $course->id));
|
||||
groups_add_member($group, $user);
|
||||
$groups[] = $group;
|
||||
}
|
||||
$groupings = [];
|
||||
for ($i = 0; $i < 25; $i++) {
|
||||
$groupings[] = $generator->create_grouping(array('courseid' => $course->id));
|
||||
}
|
||||
foreach ($groupings as $grouping) {
|
||||
foreach ($groups as $group) {
|
||||
groups_assign_grouping($grouping->id, $group->id);
|
||||
}
|
||||
}
|
||||
$info = new \core_availability\mock_info($course);
|
||||
|
||||
// Make a huge tree with 'AND' of all groups and groupings conditions.
|
||||
$conditions = [];
|
||||
foreach ($groups as $group) {
|
||||
$conditions[] = \availability_group\condition::get_json($group->id);
|
||||
}
|
||||
foreach ($groupings as $groupingid) {
|
||||
$conditions[] = \availability_grouping\condition::get_json($grouping->id);
|
||||
}
|
||||
shuffle($conditions);
|
||||
$tree = new tree(tree::get_root_json($conditions));
|
||||
list($sql, $params) = $tree->get_user_list_sql(false, $info, false);
|
||||
// This must not throw exception.
|
||||
$DB->fix_sql_params($sql, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests get_user_list_sql.
|
||||
*/
|
||||
|
||||
Vendored
+22
-18
@@ -358,21 +358,25 @@ M.core_availability.List = function(json, root, parentRoot) {
|
||||
// Create DIV structure (without kids).
|
||||
this.node = Y.Node.create('<div class="availability-list"><h3 class="accesshide"></h3>' +
|
||||
'<div class="availability-inner">' +
|
||||
'<div class="availability-header">' + M.util.get_string('listheader_sign_before', 'availability') +
|
||||
'<div class="availability-header"><span class="p-l-1">' +
|
||||
M.util.get_string('listheader_sign_before', 'availability') + '</span>' +
|
||||
' <label><span class="accesshide">' + M.util.get_string('label_sign', 'availability') +
|
||||
' </span><select class="availability-neg" title="' + M.util.get_string('label_sign', 'availability') + '">' +
|
||||
' </span><select class="availability-neg custom-select m-x-1"' +
|
||||
' title="' + M.util.get_string('label_sign', 'availability') + '">' +
|
||||
'<option value="">' + M.util.get_string('listheader_sign_pos', 'availability') + '</option>' +
|
||||
'<option value="!">' + M.util.get_string('listheader_sign_neg', 'availability') + '</option></select></label> ' +
|
||||
'<span class="availability-single">' + M.util.get_string('listheader_single', 'availability') + '</span>' +
|
||||
'<span class="availability-multi">' + M.util.get_string('listheader_multi_before', 'availability') +
|
||||
' <label><span class="accesshide">' + M.util.get_string('label_multi', 'availability') + ' </span>' +
|
||||
'<select class="availability-op" title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
|
||||
'<select class="availability-op custom-select m-x-1"' +
|
||||
' title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
|
||||
M.util.get_string('listheader_multi_and', 'availability') + '</option>' +
|
||||
'<option value="|">' + M.util.get_string('listheader_multi_or', 'availability') + '</option></select></label> ' +
|
||||
M.util.get_string('listheader_multi_after', 'availability') + '</span></div>' +
|
||||
'<div class="availability-children"></div>' +
|
||||
'<div class="availability-none">' + M.util.get_string('none', 'moodle') + '</div>' +
|
||||
'<div class="availability-button"></div></div></div>');
|
||||
'<div class="availability-none"><span class="p-x-1">' + M.util.get_string('none', 'moodle') + '</span></div>' +
|
||||
'<div class="clearfix m-t-1"></div>' +
|
||||
'<div class="availability-button"></div></div><div class="clearfix"></div></div>');
|
||||
if (!root) {
|
||||
this.node.addClass('availability-childlist');
|
||||
}
|
||||
@@ -406,12 +410,12 @@ M.core_availability.List = function(json, root, parentRoot) {
|
||||
noneNode.appendChild(deleteIcon.span);
|
||||
|
||||
// Also if it's not the root, none is actually invalid, so add a label.
|
||||
noneNode.appendChild(Y.Node.create('<span class="label label-warning">' +
|
||||
noneNode.appendChild(Y.Node.create('<span class="m-t-1 label label-warning">' +
|
||||
M.util.get_string('invalid', 'availability') + '</span>'));
|
||||
}
|
||||
|
||||
// Create the button and add it.
|
||||
var button = Y.Node.create('<button type="button" class="btn btn-default">' +
|
||||
var button = Y.Node.create('<button type="button" class="btn btn-default m-t-1">' +
|
||||
M.util.get_string('addrestriction', 'availability') + '</button>');
|
||||
button.on("click", function() {
|
||||
this.clickAdd();
|
||||
@@ -667,7 +671,7 @@ M.core_availability.List.prototype.deleteDescendant = function(descendant) {
|
||||
*/
|
||||
M.core_availability.List.prototype.clickAdd = function() {
|
||||
var content = Y.Node.create('<div>' +
|
||||
'<ul class="list-unstyled"></ul>' +
|
||||
'<ul class="list-unstyled container-fluid"></ul>' +
|
||||
'<div class="availability-buttons mdl-align">' +
|
||||
'<button type="button" class="btn btn-default">' + M.util.get_string('cancel', 'moodle') +
|
||||
'</button></div></div>');
|
||||
@@ -683,25 +687,25 @@ M.core_availability.List.prototype.clickAdd = function() {
|
||||
continue;
|
||||
}
|
||||
// Add entry for plugin.
|
||||
li = Y.Node.create('<li class="clearfix"></li>');
|
||||
li = Y.Node.create('<li class="clearfix row"></li>');
|
||||
id = 'availability_addrestriction_' + type;
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default"' +
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
|
||||
'id="' + id + '">' + M.util.get_string('title', 'availability_' + type) + '</button>');
|
||||
button.on('click', this.getAddHandler(type, dialogRef), this);
|
||||
li.appendChild(button);
|
||||
label = Y.Node.create('<label for="' + id + '">' +
|
||||
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
|
||||
M.util.get_string('description', 'availability_' + type) + '</label>');
|
||||
li.appendChild(label);
|
||||
ul.appendChild(li);
|
||||
}
|
||||
// Extra entry for lists.
|
||||
li = Y.Node.create('<li class="clearfix"></li>');
|
||||
li = Y.Node.create('<li class="clearfix row"></li>');
|
||||
id = 'availability_addrestriction_list_';
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default"' +
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
|
||||
'id="' + id + '">' + M.util.get_string('condition_group', 'availability') + '</button>');
|
||||
button.on('click', this.getAddHandler(null, dialogRef), this);
|
||||
li.appendChild(button);
|
||||
label = Y.Node.create('<label for="' + id + '">' +
|
||||
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
|
||||
M.util.get_string('condition_group_info', 'availability') + '</label>');
|
||||
li.appendChild(label);
|
||||
ul.appendChild(li);
|
||||
@@ -897,7 +901,7 @@ M.core_availability.Item = function(json, root) {
|
||||
this.pluginNode.addClass('availability_' + json.type);
|
||||
}
|
||||
|
||||
this.node = Y.Node.create('<div class="availability-item"><h3 class="accesshide"></h3></div>');
|
||||
this.node = Y.Node.create('<div class="availability-item d-inline-block"><h3 class="accesshide"></h3></div>');
|
||||
|
||||
// Add eye icon if required. This icon is added for root items, but may be
|
||||
// hidden depending on the selected list operator.
|
||||
@@ -920,7 +924,7 @@ M.core_availability.Item = function(json, root) {
|
||||
|
||||
// Add the invalid marker (empty).
|
||||
this.node.appendChild(document.createTextNode(' '));
|
||||
this.node.appendChild(Y.Node.create('<span class="label label-warning"/>'));
|
||||
this.node.appendChild(Y.Node.create('<span class="m-t-1 label label-warning"/>'));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1048,7 +1052,7 @@ M.core_availability.Item.prototype.pluginNode = null;
|
||||
*/
|
||||
M.core_availability.EyeIcon = function(individual, shown) {
|
||||
this.individual = individual;
|
||||
this.span = Y.Node.create('<a class="availability-eye" href="#" role="button">');
|
||||
this.span = Y.Node.create('<a class="availability-eye col-form-label" href="#" role="button">');
|
||||
var icon = Y.Node.create('<img />');
|
||||
this.span.appendChild(icon);
|
||||
|
||||
@@ -1128,7 +1132,7 @@ M.core_availability.EyeIcon.prototype.isHidden = function() {
|
||||
* @param {M.core_availability.Item|M.core_availability.List} toDelete Thing to delete
|
||||
*/
|
||||
M.core_availability.DeleteIcon = function(toDelete) {
|
||||
this.span = Y.Node.create('<a class="availability-delete" href="#" title="' +
|
||||
this.span = Y.Node.create('<a class="d-inline-block col-form-label availability-delete p-x-1" href="#" title="' +
|
||||
M.util.get_string('delete', 'moodle') + '" role="button">');
|
||||
var img = Y.Node.create('<img src="' + M.util.image_url('t/delete', 'core') +
|
||||
'" alt="' + M.util.get_string('delete', 'moodle') + '" />');
|
||||
|
||||
+3
-3
File diff suppressed because one or more lines are too long
+22
-18
@@ -358,21 +358,25 @@ M.core_availability.List = function(json, root, parentRoot) {
|
||||
// Create DIV structure (without kids).
|
||||
this.node = Y.Node.create('<div class="availability-list"><h3 class="accesshide"></h3>' +
|
||||
'<div class="availability-inner">' +
|
||||
'<div class="availability-header">' + M.util.get_string('listheader_sign_before', 'availability') +
|
||||
'<div class="availability-header"><span class="p-l-1">' +
|
||||
M.util.get_string('listheader_sign_before', 'availability') + '</span>' +
|
||||
' <label><span class="accesshide">' + M.util.get_string('label_sign', 'availability') +
|
||||
' </span><select class="availability-neg" title="' + M.util.get_string('label_sign', 'availability') + '">' +
|
||||
' </span><select class="availability-neg custom-select m-x-1"' +
|
||||
' title="' + M.util.get_string('label_sign', 'availability') + '">' +
|
||||
'<option value="">' + M.util.get_string('listheader_sign_pos', 'availability') + '</option>' +
|
||||
'<option value="!">' + M.util.get_string('listheader_sign_neg', 'availability') + '</option></select></label> ' +
|
||||
'<span class="availability-single">' + M.util.get_string('listheader_single', 'availability') + '</span>' +
|
||||
'<span class="availability-multi">' + M.util.get_string('listheader_multi_before', 'availability') +
|
||||
' <label><span class="accesshide">' + M.util.get_string('label_multi', 'availability') + ' </span>' +
|
||||
'<select class="availability-op" title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
|
||||
'<select class="availability-op custom-select m-x-1"' +
|
||||
' title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
|
||||
M.util.get_string('listheader_multi_and', 'availability') + '</option>' +
|
||||
'<option value="|">' + M.util.get_string('listheader_multi_or', 'availability') + '</option></select></label> ' +
|
||||
M.util.get_string('listheader_multi_after', 'availability') + '</span></div>' +
|
||||
'<div class="availability-children"></div>' +
|
||||
'<div class="availability-none">' + M.util.get_string('none', 'moodle') + '</div>' +
|
||||
'<div class="availability-button"></div></div></div>');
|
||||
'<div class="availability-none"><span class="p-x-1">' + M.util.get_string('none', 'moodle') + '</span></div>' +
|
||||
'<div class="clearfix m-t-1"></div>' +
|
||||
'<div class="availability-button"></div></div><div class="clearfix"></div></div>');
|
||||
if (!root) {
|
||||
this.node.addClass('availability-childlist');
|
||||
}
|
||||
@@ -406,12 +410,12 @@ M.core_availability.List = function(json, root, parentRoot) {
|
||||
noneNode.appendChild(deleteIcon.span);
|
||||
|
||||
// Also if it's not the root, none is actually invalid, so add a label.
|
||||
noneNode.appendChild(Y.Node.create('<span class="label label-warning">' +
|
||||
noneNode.appendChild(Y.Node.create('<span class="m-t-1 label label-warning">' +
|
||||
M.util.get_string('invalid', 'availability') + '</span>'));
|
||||
}
|
||||
|
||||
// Create the button and add it.
|
||||
var button = Y.Node.create('<button type="button" class="btn btn-default">' +
|
||||
var button = Y.Node.create('<button type="button" class="btn btn-default m-t-1">' +
|
||||
M.util.get_string('addrestriction', 'availability') + '</button>');
|
||||
button.on("click", function() {
|
||||
this.clickAdd();
|
||||
@@ -667,7 +671,7 @@ M.core_availability.List.prototype.deleteDescendant = function(descendant) {
|
||||
*/
|
||||
M.core_availability.List.prototype.clickAdd = function() {
|
||||
var content = Y.Node.create('<div>' +
|
||||
'<ul class="list-unstyled"></ul>' +
|
||||
'<ul class="list-unstyled container-fluid"></ul>' +
|
||||
'<div class="availability-buttons mdl-align">' +
|
||||
'<button type="button" class="btn btn-default">' + M.util.get_string('cancel', 'moodle') +
|
||||
'</button></div></div>');
|
||||
@@ -683,25 +687,25 @@ M.core_availability.List.prototype.clickAdd = function() {
|
||||
continue;
|
||||
}
|
||||
// Add entry for plugin.
|
||||
li = Y.Node.create('<li class="clearfix"></li>');
|
||||
li = Y.Node.create('<li class="clearfix row"></li>');
|
||||
id = 'availability_addrestriction_' + type;
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default"' +
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
|
||||
'id="' + id + '">' + M.util.get_string('title', 'availability_' + type) + '</button>');
|
||||
button.on('click', this.getAddHandler(type, dialogRef), this);
|
||||
li.appendChild(button);
|
||||
label = Y.Node.create('<label for="' + id + '">' +
|
||||
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
|
||||
M.util.get_string('description', 'availability_' + type) + '</label>');
|
||||
li.appendChild(label);
|
||||
ul.appendChild(li);
|
||||
}
|
||||
// Extra entry for lists.
|
||||
li = Y.Node.create('<li class="clearfix"></li>');
|
||||
li = Y.Node.create('<li class="clearfix row"></li>');
|
||||
id = 'availability_addrestriction_list_';
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default"' +
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
|
||||
'id="' + id + '">' + M.util.get_string('condition_group', 'availability') + '</button>');
|
||||
button.on('click', this.getAddHandler(null, dialogRef), this);
|
||||
li.appendChild(button);
|
||||
label = Y.Node.create('<label for="' + id + '">' +
|
||||
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
|
||||
M.util.get_string('condition_group_info', 'availability') + '</label>');
|
||||
li.appendChild(label);
|
||||
ul.appendChild(li);
|
||||
@@ -897,7 +901,7 @@ M.core_availability.Item = function(json, root) {
|
||||
this.pluginNode.addClass('availability_' + json.type);
|
||||
}
|
||||
|
||||
this.node = Y.Node.create('<div class="availability-item"><h3 class="accesshide"></h3></div>');
|
||||
this.node = Y.Node.create('<div class="availability-item d-inline-block"><h3 class="accesshide"></h3></div>');
|
||||
|
||||
// Add eye icon if required. This icon is added for root items, but may be
|
||||
// hidden depending on the selected list operator.
|
||||
@@ -920,7 +924,7 @@ M.core_availability.Item = function(json, root) {
|
||||
|
||||
// Add the invalid marker (empty).
|
||||
this.node.appendChild(document.createTextNode(' '));
|
||||
this.node.appendChild(Y.Node.create('<span class="label label-warning"/>'));
|
||||
this.node.appendChild(Y.Node.create('<span class="m-t-1 label label-warning"/>'));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1048,7 +1052,7 @@ M.core_availability.Item.prototype.pluginNode = null;
|
||||
*/
|
||||
M.core_availability.EyeIcon = function(individual, shown) {
|
||||
this.individual = individual;
|
||||
this.span = Y.Node.create('<a class="availability-eye" href="#" role="button">');
|
||||
this.span = Y.Node.create('<a class="availability-eye col-form-label" href="#" role="button">');
|
||||
var icon = Y.Node.create('<img />');
|
||||
this.span.appendChild(icon);
|
||||
|
||||
@@ -1128,7 +1132,7 @@ M.core_availability.EyeIcon.prototype.isHidden = function() {
|
||||
* @param {M.core_availability.Item|M.core_availability.List} toDelete Thing to delete
|
||||
*/
|
||||
M.core_availability.DeleteIcon = function(toDelete) {
|
||||
this.span = Y.Node.create('<a class="availability-delete" href="#" title="' +
|
||||
this.span = Y.Node.create('<a class="d-inline-block col-form-label availability-delete p-x-1" href="#" title="' +
|
||||
M.util.get_string('delete', 'moodle') + '" role="button">');
|
||||
var img = Y.Node.create('<img src="' + M.util.image_url('t/delete', 'core') +
|
||||
'" alt="' + M.util.get_string('delete', 'moodle') + '" />');
|
||||
|
||||
Vendored
+22
-18
@@ -356,21 +356,25 @@ M.core_availability.List = function(json, root, parentRoot) {
|
||||
// Create DIV structure (without kids).
|
||||
this.node = Y.Node.create('<div class="availability-list"><h3 class="accesshide"></h3>' +
|
||||
'<div class="availability-inner">' +
|
||||
'<div class="availability-header">' + M.util.get_string('listheader_sign_before', 'availability') +
|
||||
'<div class="availability-header"><span class="p-l-1">' +
|
||||
M.util.get_string('listheader_sign_before', 'availability') + '</span>' +
|
||||
' <label><span class="accesshide">' + M.util.get_string('label_sign', 'availability') +
|
||||
' </span><select class="availability-neg" title="' + M.util.get_string('label_sign', 'availability') + '">' +
|
||||
' </span><select class="availability-neg custom-select m-x-1"' +
|
||||
' title="' + M.util.get_string('label_sign', 'availability') + '">' +
|
||||
'<option value="">' + M.util.get_string('listheader_sign_pos', 'availability') + '</option>' +
|
||||
'<option value="!">' + M.util.get_string('listheader_sign_neg', 'availability') + '</option></select></label> ' +
|
||||
'<span class="availability-single">' + M.util.get_string('listheader_single', 'availability') + '</span>' +
|
||||
'<span class="availability-multi">' + M.util.get_string('listheader_multi_before', 'availability') +
|
||||
' <label><span class="accesshide">' + M.util.get_string('label_multi', 'availability') + ' </span>' +
|
||||
'<select class="availability-op" title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
|
||||
'<select class="availability-op custom-select m-x-1"' +
|
||||
' title="' + M.util.get_string('label_multi', 'availability') + '"><option value="&">' +
|
||||
M.util.get_string('listheader_multi_and', 'availability') + '</option>' +
|
||||
'<option value="|">' + M.util.get_string('listheader_multi_or', 'availability') + '</option></select></label> ' +
|
||||
M.util.get_string('listheader_multi_after', 'availability') + '</span></div>' +
|
||||
'<div class="availability-children"></div>' +
|
||||
'<div class="availability-none">' + M.util.get_string('none', 'moodle') + '</div>' +
|
||||
'<div class="availability-button"></div></div></div>');
|
||||
'<div class="availability-none"><span class="p-x-1">' + M.util.get_string('none', 'moodle') + '</span></div>' +
|
||||
'<div class="clearfix m-t-1"></div>' +
|
||||
'<div class="availability-button"></div></div><div class="clearfix"></div></div>');
|
||||
if (!root) {
|
||||
this.node.addClass('availability-childlist');
|
||||
}
|
||||
@@ -404,12 +408,12 @@ M.core_availability.List = function(json, root, parentRoot) {
|
||||
noneNode.appendChild(deleteIcon.span);
|
||||
|
||||
// Also if it's not the root, none is actually invalid, so add a label.
|
||||
noneNode.appendChild(Y.Node.create('<span class="label label-warning">' +
|
||||
noneNode.appendChild(Y.Node.create('<span class="m-t-1 label label-warning">' +
|
||||
M.util.get_string('invalid', 'availability') + '</span>'));
|
||||
}
|
||||
|
||||
// Create the button and add it.
|
||||
var button = Y.Node.create('<button type="button" class="btn btn-default">' +
|
||||
var button = Y.Node.create('<button type="button" class="btn btn-default m-t-1">' +
|
||||
M.util.get_string('addrestriction', 'availability') + '</button>');
|
||||
button.on("click", function() {
|
||||
this.clickAdd();
|
||||
@@ -665,7 +669,7 @@ M.core_availability.List.prototype.deleteDescendant = function(descendant) {
|
||||
*/
|
||||
M.core_availability.List.prototype.clickAdd = function() {
|
||||
var content = Y.Node.create('<div>' +
|
||||
'<ul class="list-unstyled"></ul>' +
|
||||
'<ul class="list-unstyled container-fluid"></ul>' +
|
||||
'<div class="availability-buttons mdl-align">' +
|
||||
'<button type="button" class="btn btn-default">' + M.util.get_string('cancel', 'moodle') +
|
||||
'</button></div></div>');
|
||||
@@ -681,25 +685,25 @@ M.core_availability.List.prototype.clickAdd = function() {
|
||||
continue;
|
||||
}
|
||||
// Add entry for plugin.
|
||||
li = Y.Node.create('<li class="clearfix"></li>');
|
||||
li = Y.Node.create('<li class="clearfix row"></li>');
|
||||
id = 'availability_addrestriction_' + type;
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default"' +
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
|
||||
'id="' + id + '">' + M.util.get_string('title', 'availability_' + type) + '</button>');
|
||||
button.on('click', this.getAddHandler(type, dialogRef), this);
|
||||
li.appendChild(button);
|
||||
label = Y.Node.create('<label for="' + id + '">' +
|
||||
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
|
||||
M.util.get_string('description', 'availability_' + type) + '</label>');
|
||||
li.appendChild(label);
|
||||
ul.appendChild(li);
|
||||
}
|
||||
// Extra entry for lists.
|
||||
li = Y.Node.create('<li class="clearfix"></li>');
|
||||
li = Y.Node.create('<li class="clearfix row"></li>');
|
||||
id = 'availability_addrestriction_list_';
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default"' +
|
||||
button = Y.Node.create('<button type="button" class="btn btn-default col-xs-6"' +
|
||||
'id="' + id + '">' + M.util.get_string('condition_group', 'availability') + '</button>');
|
||||
button.on('click', this.getAddHandler(null, dialogRef), this);
|
||||
li.appendChild(button);
|
||||
label = Y.Node.create('<label for="' + id + '">' +
|
||||
label = Y.Node.create('<label for="' + id + '" class="col-xs-6">' +
|
||||
M.util.get_string('condition_group_info', 'availability') + '</label>');
|
||||
li.appendChild(label);
|
||||
ul.appendChild(li);
|
||||
@@ -895,7 +899,7 @@ M.core_availability.Item = function(json, root) {
|
||||
this.pluginNode.addClass('availability_' + json.type);
|
||||
}
|
||||
|
||||
this.node = Y.Node.create('<div class="availability-item"><h3 class="accesshide"></h3></div>');
|
||||
this.node = Y.Node.create('<div class="availability-item d-inline-block"><h3 class="accesshide"></h3></div>');
|
||||
|
||||
// Add eye icon if required. This icon is added for root items, but may be
|
||||
// hidden depending on the selected list operator.
|
||||
@@ -918,7 +922,7 @@ M.core_availability.Item = function(json, root) {
|
||||
|
||||
// Add the invalid marker (empty).
|
||||
this.node.appendChild(document.createTextNode(' '));
|
||||
this.node.appendChild(Y.Node.create('<span class="label label-warning"/>'));
|
||||
this.node.appendChild(Y.Node.create('<span class="m-t-1 label label-warning"/>'));
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1046,7 +1050,7 @@ M.core_availability.Item.prototype.pluginNode = null;
|
||||
*/
|
||||
M.core_availability.EyeIcon = function(individual, shown) {
|
||||
this.individual = individual;
|
||||
this.span = Y.Node.create('<a class="availability-eye" href="#" role="button">');
|
||||
this.span = Y.Node.create('<a class="availability-eye col-form-label" href="#" role="button">');
|
||||
var icon = Y.Node.create('<img />');
|
||||
this.span.appendChild(icon);
|
||||
|
||||
@@ -1126,7 +1130,7 @@ M.core_availability.EyeIcon.prototype.isHidden = function() {
|
||||
* @param {M.core_availability.Item|M.core_availability.List} toDelete Thing to delete
|
||||
*/
|
||||
M.core_availability.DeleteIcon = function(toDelete) {
|
||||
this.span = Y.Node.create('<a class="availability-delete" href="#" title="' +
|
||||
this.span = Y.Node.create('<a class="d-inline-block col-form-label availability-delete p-x-1" href="#" title="' +
|
||||
M.util.get_string('delete', 'moodle') + '" role="button">');
|
||||
var img = Y.Node.create('<img src="' + M.util.image_url('t/delete', 'core') +
|
||||
'" alt="' + M.util.get_string('delete', 'moodle') + '" />');
|
||||
|
||||
@@ -4331,6 +4331,14 @@ class restore_create_categories_and_questions extends restore_structure_step {
|
||||
}
|
||||
$data->contextid = $mapping->parentitemid;
|
||||
|
||||
// Before 3.1, the 'stamp' field could be erroneously duplicated.
|
||||
// From 3.1 onwards, there's a unique index of (contextid, stamp).
|
||||
// If we encounter a duplicate in an old restore file, just generate a new stamp.
|
||||
// This is the same as what happens during an upgrade to 3.1+ anyway.
|
||||
if ($DB->record_exists('question_categories', ['stamp' => $data->stamp, 'contextid' => $data->contextid])) {
|
||||
$data->stamp = make_unique_id_code();
|
||||
}
|
||||
|
||||
// Let's create the question_category and save mapping
|
||||
$newitemid = $DB->insert_record('question_categories', $data);
|
||||
$this->set_mapping('question_category', $oldid, $newitemid);
|
||||
|
||||
@@ -628,7 +628,9 @@ abstract class backup_controller_dbops extends backup_dbops {
|
||||
$locked = $uselocks && (get_config('backup', $config.'_locked') == true);
|
||||
if ($plan->setting_exists($settingname)) {
|
||||
$setting = $plan->get_setting($settingname);
|
||||
if ($setting->get_value() != $value || 1==1) {
|
||||
// We can only update the setting if it isn't already locked by config or permission.
|
||||
if ($setting->get_status() !== base_setting::LOCKED_BY_CONFIG
|
||||
&& $setting->get_status() !== base_setting::LOCKED_BY_PERMISSION) {
|
||||
$setting->set_value($value);
|
||||
if ($locked) {
|
||||
$setting->set_status(base_setting::LOCKED_BY_CONFIG);
|
||||
|
||||
+69
-16
@@ -290,7 +290,8 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
} else {
|
||||
$html .= $selectacategoryhtml;
|
||||
}
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
|
||||
$attrs = array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'btn btn-primary');
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', $attrs));
|
||||
$html .= html_writer::end_tag('div');
|
||||
$html .= html_writer::end_tag('form');
|
||||
}
|
||||
@@ -306,7 +307,8 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
backup::TARGET_CURRENT_ADDING, array('checked' => 'checked'));
|
||||
$html .= $this->backup_detail_input(get_string('restoretocurrentcoursedeleting', 'backup'), 'radio', 'target',
|
||||
backup::TARGET_CURRENT_DELETING);
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
|
||||
$attrs = array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'btn btn-primary');
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', $attrs));
|
||||
$html .= html_writer::end_tag('div');
|
||||
$html .= html_writer::end_tag('form');
|
||||
}
|
||||
@@ -340,7 +342,8 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
} else {
|
||||
$html .= $selectacoursehtml;
|
||||
}
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
|
||||
$attrs = array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'btn btn-primary');
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', $attrs));
|
||||
$html .= html_writer::end_tag('div');
|
||||
$html .= html_writer::end_tag('form');
|
||||
}
|
||||
@@ -371,7 +374,8 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
$html .= html_writer::start_tag('div', array('class' => 'ics-existing-course backup-section'));
|
||||
$html .= $this->output->heading(get_string('importdatafrom'), 2, array('class' => 'header'));
|
||||
$html .= $this->backup_detail_pair(get_string('selectacourse', 'backup'), $this->render($courses));
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue'))));
|
||||
$attrs = array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'btn btn-primary');
|
||||
$html .= $this->backup_detail_pair('', html_writer::empty_tag('input', $attrs));
|
||||
$html .= html_writer::end_tag('div');
|
||||
$html .= html_writer::end_tag('form');
|
||||
$html .= html_writer::end_tag('div');
|
||||
@@ -470,9 +474,11 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
public function substage_buttons($haserrors) {
|
||||
$output = html_writer::start_tag('div', array('continuebutton'));
|
||||
if (!$haserrors) {
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('continue')));
|
||||
$attrs = array('type' => 'submit', 'value' => get_string('continue'), 'class' => 'btn btn-primary');
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
}
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('cancel')));
|
||||
$attrs = array('type' => 'submit', 'name' => 'cancel', 'value' => get_string('cancel'), 'class' => 'btn btn-secondary');
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$output .= html_writer::end_tag('div');
|
||||
return $output;
|
||||
}
|
||||
@@ -601,7 +607,7 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
public function render_restore_course_search(restore_course_search $component) {
|
||||
$url = $component->get_url();
|
||||
|
||||
$output = html_writer::start_tag('div', array('class' => 'restore-course-search'));
|
||||
$output = html_writer::start_tag('div', array('class' => 'restore-course-search form-inline m-b-1'));
|
||||
$output .= html_writer::start_tag('div', array('class' => 'rcs-results'));
|
||||
|
||||
$table = new html_table();
|
||||
@@ -641,8 +647,20 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$output .= html_writer::start_tag('div', array('class' => 'rcs-search'));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_course_search::$VAR_SEARCH, 'value' => $component->get_search()));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
|
||||
$attrs = array(
|
||||
'type' => 'text',
|
||||
'name' => restore_course_search::$VAR_SEARCH,
|
||||
'value' => $component->get_search(),
|
||||
'class' => 'form-control'
|
||||
);
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$attrs = array(
|
||||
'type' => 'submit',
|
||||
'name' => 'searchcourses',
|
||||
'value' => get_string('search'),
|
||||
'class' => 'btn btn-secondary'
|
||||
);
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$output .= html_writer::end_tag('div');
|
||||
@@ -663,8 +681,20 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
$output .= $this->output->notification(get_string('nomatchingcourses', 'backup'));
|
||||
|
||||
$output .= html_writer::start_tag('div', array('class' => 'ics-search'));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_course_search::$VAR_SEARCH, 'value' => $component->get_search()));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
|
||||
$attrs = array(
|
||||
'type' => 'text',
|
||||
'name' => restore_course_search::$VAR_SEARCH,
|
||||
'value' => $component->get_search(),
|
||||
'class' => 'form-control'
|
||||
);
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$attrs = array(
|
||||
'type' => 'submit',
|
||||
'name' => 'searchcourses',
|
||||
'value' => get_string('search'),
|
||||
'class' => 'btn btn-secondary'
|
||||
);
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$output .= html_writer::end_tag('div');
|
||||
@@ -709,8 +739,19 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$output .= html_writer::start_tag('div', array('class' => 'ics-search'));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_course_search::$VAR_SEARCH, 'value' => $component->get_search()));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
|
||||
$attrs = array(
|
||||
'type' => 'text',
|
||||
'name' => restore_course_search::$VAR_SEARCH,
|
||||
'value' => $component->get_search(),
|
||||
'class' => 'form-control');
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$attrs = array(
|
||||
'type' => 'submit',
|
||||
'name' => 'searchcourses',
|
||||
'value' => get_string('search'),
|
||||
'class' => 'btn btn-secondary'
|
||||
);
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$output .= html_writer::end_tag('div');
|
||||
@@ -726,7 +767,7 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
public function render_restore_category_search(restore_category_search $component) {
|
||||
$url = $component->get_url();
|
||||
|
||||
$output = html_writer::start_tag('div', array('class' => 'restore-course-search'));
|
||||
$output = html_writer::start_tag('div', array('class' => 'restore-course-search form-inline m-b-1'));
|
||||
$output .= html_writer::start_tag('div', array('class' => 'rcs-results'));
|
||||
|
||||
$table = new html_table();
|
||||
@@ -767,8 +808,20 @@ class core_backup_renderer extends plugin_renderer_base {
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$output .= html_writer::start_tag('div', array('class' => 'rcs-search'));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'text', 'name' => restore_category_search::$VAR_SEARCH, 'value' => $component->get_search()));
|
||||
$output .= html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'searchcourses', 'value' => get_string('search')));
|
||||
$attrs = array(
|
||||
'type' => 'text',
|
||||
'name' => restore_category_search::$VAR_SEARCH,
|
||||
'value' => $component->get_search(),
|
||||
'class' => 'form-control'
|
||||
);
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$attrs = array(
|
||||
'type' => 'submit',
|
||||
'name' => 'searchcourses',
|
||||
'value' => get_string('search'),
|
||||
'class' => 'btn btn-secondary'
|
||||
);
|
||||
$output .= html_writer::empty_tag('input', $attrs);
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
$output .= html_writer::end_tag('div');
|
||||
|
||||
@@ -216,7 +216,7 @@ class behat_backup extends behat_base {
|
||||
|
||||
// Selecting the specified course (we can not call behat_forms::select_radio here as is in another behat subcontext).
|
||||
$radionode = $this->find('xpath', "//div[contains(concat(' ', normalize-space(@class), ' '), ' bcs-existing-course ')]" .
|
||||
"/descendant::div[@class='restore-course-search']" .
|
||||
"/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' restore-course-search ')]" .
|
||||
"/descendant::tr[contains(., $existingcourse)]" .
|
||||
"/descendant::input[@type='radio']");
|
||||
$radionode->click();
|
||||
@@ -247,7 +247,7 @@ class behat_backup extends behat_base {
|
||||
|
||||
// The first category in the list.
|
||||
$radionode = $this->find('xpath', "//div[contains(concat(' ', normalize-space(@class), ' '), ' bcs-new-course ')]" .
|
||||
"/descendant::div[@class='restore-course-search']" .
|
||||
"/descendant::div[contains(concat(' ', normalize-space(@class), ' '), ' restore-course-search ')]" .
|
||||
"/descendant::input[@type='radio']");
|
||||
$radionode->click();
|
||||
|
||||
|
||||
@@ -65,14 +65,6 @@ class block_course_summary extends block_base {
|
||||
$context = context_course::instance($this->page->course->id);
|
||||
$this->page->course->summary = file_rewrite_pluginfile_urls($this->page->course->summary, 'pluginfile.php', $context->id, 'course', 'summary', NULL);
|
||||
$this->content->text = format_text($this->page->course->summary, $this->page->course->summaryformat, $options);
|
||||
if ($this->page->user_is_editing()) {
|
||||
if($this->page->course->id == SITEID) {
|
||||
$editpage = $CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=frontpagesettings';
|
||||
} else {
|
||||
$editpage = $CFG->wwwroot.'/course/edit.php?id='.$this->page->course->id;
|
||||
}
|
||||
$this->content->text .= "<div class=\"editbutton\"><a href=\"$editpage\"><img src=\"" . $OUTPUT->pix_url('t/edit') . "\" alt=\"".get_string('edit')."\" /></a></div>";
|
||||
}
|
||||
$this->content->footer = '';
|
||||
|
||||
return $this->content;
|
||||
|
||||
@@ -29,15 +29,6 @@ Feature: Course summary block used in a course
|
||||
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 see an edit icon when edit mode is on and follow it to the course edit page
|
||||
When I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
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 I click on ".editbutton a" "css_element" in the "Course summary" "block"
|
||||
Then I should see "Edit course settings" in the "h2" "css_element"
|
||||
|
||||
Scenario: Teacher can not see edit icon when edit mode is off
|
||||
When I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
|
||||
@@ -22,15 +22,6 @@ Feature: Course summary block used on the frontpage
|
||||
And I should not see "Course summary" in the "Course/site summary" "block"
|
||||
And I should see "Proved the summary block works!" in the "Course/site summary" "block"
|
||||
|
||||
Scenario: Admin can see an edit icon when edit mode is on and follow it to the front page settings
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Turn editing on"
|
||||
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
|
||||
And I should not see "Course summary" in the "Course/site summary" "block"
|
||||
And I click on ".editbutton a" "css_element" in the "Course/site summary" "block"
|
||||
Then I should see "Front page settings" in the "h2" "css_element"
|
||||
|
||||
Scenario: Admin can not see edit icon when edit mode is off
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
|
||||
@@ -78,20 +78,26 @@ class block_login extends block_base {
|
||||
|
||||
$this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.get_login_url().'" '.$autocomplete.'>';
|
||||
|
||||
$this->content->text .= '<div class="c1 fld username"><label for="login_username">'.$strusername.'</label>';
|
||||
$this->content->text .= '<input type="text" name="username" id="login_username" value="'.s($username).'" /></div>';
|
||||
$this->content->text .= '<div class="form-group"><label for="login_username">'.$strusername.'</label>';
|
||||
$this->content->text .= '<input type="text" name="username" id="login_username" class="form-control" value="'.s($username).'" /></div>';
|
||||
|
||||
$this->content->text .= '<div class="c1 fld password"><label for="login_password">'.get_string('password').'</label>';
|
||||
$this->content->text .= '<div class="form-group"><label for="login_password">'.get_string('password').'</label>';
|
||||
|
||||
$this->content->text .= '<input type="password" name="password" id="login_password" value="" '.$autocomplete.' /></div>';
|
||||
$this->content->text .= '<input type="password" name="password" id="login_password" class="form-control" value="" '.$autocomplete.' /></div>';
|
||||
|
||||
if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
|
||||
$checked = $username ? 'checked="checked"' : '';
|
||||
$this->content->text .= '<div class="c1 rememberusername"><input type="checkbox" name="rememberusername" id="rememberusername" value="1" '.$checked.'/>';
|
||||
$this->content->text .= ' <label for="rememberusername">'.get_string('rememberusername', 'admin').'</label></div>';
|
||||
$this->content->text .= '<div class="form-check">';
|
||||
$this->content->text .= '<label class="form-check-label">';
|
||||
$this->content->text .= '<input type="checkbox" name="rememberusername" id="rememberusername"
|
||||
class="form-check-input" value="1" '.$checked.'/> ';
|
||||
$this->content->text .= get_string('rememberusername', 'admin').'</label>';
|
||||
$this->content->text .= '</div>';
|
||||
}
|
||||
|
||||
$this->content->text .= '<div class="c1 btn"><input type="submit" value="'.get_string('login').'" /></div>';
|
||||
$this->content->text .= '<div class="form-group">';
|
||||
$this->content->text .= '<input type="submit" class="btn btn-primary btn-block" value="'.get_string('login').'" />';
|
||||
$this->content->text .= '</div>';
|
||||
|
||||
$this->content->text .= "</form>\n";
|
||||
|
||||
|
||||
+2
-2
@@ -211,7 +211,7 @@ function blog_rss_get_feed($context, $args) {
|
||||
if ($blogentries) {
|
||||
$items = array();
|
||||
foreach ($blogentries as $blogentry) {
|
||||
$item = null;
|
||||
$item = new stdClass();
|
||||
$item->author = fullname($DB->get_record('user', array('id' => $blogentry->userid))); // TODO: this is slow.
|
||||
$item->title = $blogentry->subject;
|
||||
$item->pubdate = $blogentry->lastmodified;
|
||||
@@ -234,7 +234,7 @@ function blog_rss_get_feed($context, $args) {
|
||||
|
||||
switch ($type) {
|
||||
case 'user':
|
||||
$info = fullname($DB->get_record('user', array('id' => $id), 'firstname,lastname'));
|
||||
$info = fullname($DB->get_record('user', array('id' => $id), get_all_user_name_fields(true)));
|
||||
break;
|
||||
case 'course':
|
||||
$info = $DB->get_field('course', 'fullname', array('id' => $id));
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user