Compare commits
253 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3ee8703317 | |||
| 60c6c510bd | |||
| 802dbbf882 | |||
| 217d7f6f24 | |||
| f9c14c6135 | |||
| a622bc1a96 | |||
| 2d07240f23 | |||
| cba92dc805 | |||
| f84a0d49c1 | |||
| 0ce090c09a | |||
| 7a69b19596 | |||
| 88ffe4020f | |||
| fad8ee28f1 | |||
| f459f29b6f | |||
| 5b3bda80db | |||
| 991efb8b1a | |||
| c36c3d07ad | |||
| 69a3587196 | |||
| a19c4b8dd0 | |||
| 0f510be763 | |||
| 0f186bd62d | |||
| 954f3f5aa8 | |||
| 546a58bcdc | |||
| 7ae030d54e | |||
| 85643ff6e0 | |||
| 92f47ae2f9 | |||
| eaec9cfec7 | |||
| a374769640 | |||
| 83679e0fb9 | |||
| 57fc76ab92 | |||
| 913784114d | |||
| 52802cf624 | |||
| 8b4568500b | |||
| 917bd02be5 | |||
| 683f717919 | |||
| 36c1cc4dc1 | |||
| 46be1d58ac | |||
| ae742f12c1 | |||
| 1bd3c5b846 | |||
| 43ef409276 | |||
| f236dcc35c | |||
| c4a150219a | |||
| 57d9a750e3 | |||
| 8e92f48c40 | |||
| 15005d91f0 | |||
| 07e09f2b29 | |||
| 84d6094685 | |||
| 26ea380d24 | |||
| 4f8b6d5674 | |||
| db200a8e9f | |||
| b2687a055d | |||
| dd0607b7bb | |||
| e51fdfe0cb | |||
| d031c2dcb9 | |||
| b3f5865eab | |||
| c12cfeac45 | |||
| 186747fd75 | |||
| 4c54bc6fe1 | |||
| 9542b15671 | |||
| b3cb726431 | |||
| 8b3ba5b370 | |||
| 48645e475b | |||
| aac6717056 | |||
| 6289c2ea94 | |||
| 36bbb0b70a | |||
| e67585f8ca | |||
| ce16ceb667 | |||
| ad13aff7c4 | |||
| d2bec50b7c | |||
| 96ec51bdec | |||
| 9f3adc943b | |||
| 3e5b4aa9bc | |||
| 172ed01a29 | |||
| e8cf6330c2 | |||
| 2b964e1d24 | |||
| a7f81bc72d | |||
| d29bfb25ca | |||
| 4ad43f2a2f | |||
| 8ac391b826 | |||
| 003577cd85 | |||
| 410034eef0 | |||
| fcc383db0f | |||
| 890078bf03 | |||
| d670f31fc7 | |||
| a4f19cfc95 | |||
| 7f9b8cf3a3 | |||
| 3454072f31 | |||
| dd636abf38 | |||
| 35ea78d2ba | |||
| eb42bb7e83 | |||
| bf06f672f4 | |||
| 119ff65c0e | |||
| 9787c4caba | |||
| 9996e8954b | |||
| d3f1cde59e | |||
| 3994812f38 | |||
| bdf899a503 | |||
| 327e68e69d | |||
| a7e98a6900 | |||
| 7193ea2cd2 | |||
| c1f97c777f | |||
| 298c9da5f1 | |||
| 6df7f2008b | |||
| 6e9abef568 | |||
| 4887d15228 | |||
| 23c4c76ff9 | |||
| 19452c99d7 | |||
| 44e2802555 | |||
| 5e4438b5c3 | |||
| 0174fa9bc0 | |||
| a8a742cb50 | |||
| aef3c18b76 | |||
| b861cc96f7 | |||
| 3c568cd3db | |||
| a75dbde04c | |||
| 24a2babdd3 | |||
| dc9b229d7a | |||
| 84d83fe7e1 | |||
| 600596fd6a | |||
| 04cb1103a6 | |||
| 864275788c | |||
| 46686eafeb | |||
| 7fb84d75ee | |||
| 2960eb4dd2 | |||
| f4b2a38728 | |||
| e841d654aa | |||
| 237ce46b3f | |||
| d567320928 | |||
| 388b0beec1 | |||
| 5c3b5143dc | |||
| d71feab8ae | |||
| c80270fe89 | |||
| 3056a260f6 | |||
| e89c5c203c | |||
| 9c54a0abad | |||
| 3b318d3e69 | |||
| 3759e7ae96 | |||
| 0634dc3b76 | |||
| 94e6f38fa6 | |||
| f60ea7d7df | |||
| cda2a8273a | |||
| dc769673fa | |||
| ccd3dd5bc9 | |||
| 3db610583e | |||
| 2296285748 | |||
| b647db20e1 | |||
| 2fac3c3c5f | |||
| 5c012a7426 | |||
| a916d557cf | |||
| 095ecde727 | |||
| a6dbe2fb1a | |||
| d4572c1716 | |||
| 299d77dd5a | |||
| c70c18c0e3 | |||
| 84ea226616 | |||
| c7d5ca8d16 | |||
| ca6f3a8b5f | |||
| 77a8c9aae3 | |||
| 1d47b81928 | |||
| 1f619e8d60 | |||
| 1c193d49f0 | |||
| b10d72f4e9 | |||
| 129d26aac4 | |||
| 6e972bdd34 | |||
| 12261113a9 | |||
| 9a3f7a484d | |||
| 99b679b385 | |||
| c5cdc8887a | |||
| ceeab15019 | |||
| 08c8fc50ce | |||
| 377ce9938b | |||
| 6e28c039cb | |||
| 2be9a45389 | |||
| 9f78349f58 | |||
| c914c92da0 | |||
| cb9d259dcd | |||
| 9fb9aa9c91 | |||
| 35cec798c2 | |||
| 170497cd22 | |||
| baba473b24 | |||
| d5d23acdf5 | |||
| 14c5b3a23f | |||
| b083e0f6f2 | |||
| 0264bb1ecb | |||
| 5975d9521a | |||
| 9548d1e058 | |||
| 9dbcdd8b1f | |||
| 1cbfb67789 | |||
| 4815e4c5b1 | |||
| 000d624cc4 | |||
| 1af4cced98 | |||
| b6e98dc8bd | |||
| 28d27e85d7 | |||
| 28343f0e12 | |||
| ccc1bc7e2e | |||
| 32498c28ea | |||
| e14388e3a7 | |||
| 8352aa50f3 | |||
| f99fe11045 | |||
| c8b4b67a2f | |||
| d9b5f9bb6c | |||
| b3b6588262 | |||
| ed8caffa5a | |||
| 6197497393 | |||
| a8d8783988 | |||
| 296a428776 | |||
| 1f23341f7d | |||
| 21e6aabce9 | |||
| e5c5ced912 | |||
| 9d72ae249c | |||
| 3a92084c6b | |||
| c8f1d8a026 | |||
| ac0f0f9dd9 | |||
| 9c1561ef83 | |||
| bacb7b1f6e | |||
| e284e1792c | |||
| 9e37d365d8 | |||
| f13a911317 | |||
| 5894432c50 | |||
| 42c92eef33 | |||
| 98177a4510 | |||
| e28767f414 | |||
| 2224f2c598 | |||
| d0704fd9e2 | |||
| df9981cfda | |||
| 4f6f5f1a10 | |||
| 0525a7a8f1 | |||
| e35bac3e80 | |||
| 9d745218e8 | |||
| 6866527275 | |||
| 7464939f6d | |||
| 793645a03f | |||
| cb2fc25ba0 | |||
| bd305d3dcb | |||
| 970d54d076 | |||
| 1577072b7b | |||
| 595b911a98 | |||
| 0fe86bbdbb | |||
| b9476466f1 | |||
| 508e756eaf | |||
| 08000e535d | |||
| cfff4da9f6 | |||
| ea2fa324d7 | |||
| a910e3885a | |||
| bf5eebe8f8 | |||
| 60de7df148 | |||
| 69c150cbda | |||
| 08f38358c8 | |||
| d2c64a7b5b | |||
| ada407159f | |||
| 8b3a10438f | |||
| af4e80ae69 | |||
| 6825560889 |
+1
-2
@@ -26,9 +26,8 @@ CVS
|
||||
/.buildpath
|
||||
/.cache
|
||||
phpunit.xml
|
||||
# Composer support - only composer.json is to be in git, the rest is installed in each checkout.
|
||||
# Composer support. Do not ignore composer.json, or composer.lock. These should be shipped by us.
|
||||
composer.phar
|
||||
composer.lock
|
||||
/vendor/
|
||||
/behat.yml
|
||||
*/yui/build/*/*-coverage.js
|
||||
|
||||
+12
-9
@@ -24,7 +24,8 @@
|
||||
|
||||
module.exports = function(grunt) {
|
||||
var path = require('path'),
|
||||
tasks = {};
|
||||
tasks = {},
|
||||
cwd = process.env.PWD || process.cwd();
|
||||
|
||||
// Project configuration.
|
||||
grunt.initConfig({
|
||||
@@ -38,11 +39,11 @@ module.exports = function(grunt) {
|
||||
['**/src/*.js', '!**/node_modules/**'],
|
||||
'',
|
||||
{
|
||||
cwd: process.env.PWD,
|
||||
cwd: cwd,
|
||||
rename: function(destBase, destPath) {
|
||||
destPath = destPath.replace('src', 'build');
|
||||
destPath = destPath.replace('.js', '.min.js');
|
||||
destPath = path.resolve(process.env.PWD, destPath);
|
||||
destPath = path.resolve(cwd, destPath);
|
||||
return destPath;
|
||||
}
|
||||
}
|
||||
@@ -63,13 +64,15 @@ module.exports = function(grunt) {
|
||||
},
|
||||
shifter;
|
||||
|
||||
args.push( path.normalize(__dirname + '/node_modules/shifter/bin/shifter'));
|
||||
|
||||
// Determine the most appropriate options to run with based upon the current location.
|
||||
if (path.basename(process.env.PWD) === 'src') {
|
||||
if (path.basename(cwd) === 'src') {
|
||||
// Detect whether we're in a src directory.
|
||||
grunt.log.debug('In a src directory');
|
||||
args.push('--walk');
|
||||
options.walk = true;
|
||||
} else if (path.basename(path.dirname(process.env.PWD)) === 'src') {
|
||||
} else if (path.basename(path.dirname(cwd)) === 'src') {
|
||||
// Detect whether we're in a module directory.
|
||||
grunt.log.debug('In a module directory');
|
||||
options.module = true;
|
||||
@@ -100,8 +103,8 @@ module.exports = function(grunt) {
|
||||
}
|
||||
|
||||
// Actually run shifter.
|
||||
shifter = exec(process.cwd() + '/node_modules/shifter/bin/shifter', args, {
|
||||
cwd: process.env.PWD,
|
||||
shifter = exec("node", args, {
|
||||
cwd: cwd,
|
||||
stdio: 'inherit',
|
||||
env: process.env
|
||||
});
|
||||
@@ -119,10 +122,10 @@ module.exports = function(grunt) {
|
||||
|
||||
tasks.startup = function() {
|
||||
// Are we in a YUI directory?
|
||||
if (path.basename(path.resolve(process.env.PWD, '../../')) == 'yui') {
|
||||
if (path.basename(path.resolve(cwd, '../../')) == 'yui') {
|
||||
grunt.task.run('shifter');
|
||||
// Are we in an AMD directory?
|
||||
} else if (path.basename(process.env.PWD) == 'amd') {
|
||||
} else if (path.basename(cwd) == 'amd') {
|
||||
grunt.task.run('jshint');
|
||||
grunt.task.run('uglify');
|
||||
} else {
|
||||
|
||||
+21
-16
@@ -556,31 +556,36 @@ $cronoverdue = ($lastcron < time() - 3600 * 24);
|
||||
$dbproblems = $DB->diagnose();
|
||||
$maintenancemode = !empty($CFG->maintenance_enabled);
|
||||
|
||||
// Available updates for Moodle core
|
||||
// Available updates for Moodle core.
|
||||
$updateschecker = \core\update\checker::instance();
|
||||
$availableupdates = array();
|
||||
$availableupdates['core'] = $updateschecker->get_update_info('core',
|
||||
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
|
||||
$availableupdatesfetch = null;
|
||||
|
||||
// Available updates for contributed plugins
|
||||
$pluginman = core_plugin_manager::instance();
|
||||
foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
|
||||
foreach ($plugintypeinstances as $pluginname => $plugininfo) {
|
||||
if (!empty($plugininfo->availableupdates)) {
|
||||
foreach ($plugininfo->availableupdates as $pluginavailableupdate) {
|
||||
if ($pluginavailableupdate->version > $plugininfo->versiondisk) {
|
||||
if (!isset($availableupdates[$plugintype.'_'.$pluginname])) {
|
||||
$availableupdates[$plugintype.'_'.$pluginname] = array();
|
||||
if (empty($CFG->disableupdatenotifications)) {
|
||||
// Only compute the update information when it is going to be displayed to the user.
|
||||
$availableupdates['core'] = $updateschecker->get_update_info('core',
|
||||
array('minmaturity' => $CFG->updateminmaturity, 'notifybuilds' => $CFG->updatenotifybuilds));
|
||||
|
||||
// Available updates for contributed plugins
|
||||
$pluginman = core_plugin_manager::instance();
|
||||
foreach ($pluginman->get_plugins() as $plugintype => $plugintypeinstances) {
|
||||
foreach ($plugintypeinstances as $pluginname => $plugininfo) {
|
||||
if (!empty($plugininfo->availableupdates)) {
|
||||
foreach ($plugininfo->availableupdates as $pluginavailableupdate) {
|
||||
if ($pluginavailableupdate->version > $plugininfo->versiondisk) {
|
||||
if (!isset($availableupdates[$plugintype.'_'.$pluginname])) {
|
||||
$availableupdates[$plugintype.'_'.$pluginname] = array();
|
||||
}
|
||||
$availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate;
|
||||
}
|
||||
$availableupdates[$plugintype.'_'.$pluginname][] = $pluginavailableupdate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The timestamp of the most recent check for available updates
|
||||
$availableupdatesfetch = $updateschecker->get_last_timefetched();
|
||||
// The timestamp of the most recent check for available updates
|
||||
$availableupdatesfetch = $updateschecker->get_last_timefetched();
|
||||
}
|
||||
|
||||
$buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
|
||||
//check if the site is registered on Moodle.org
|
||||
|
||||
@@ -58,7 +58,6 @@ if (!empty($registeredhub) and $registeredhub->token == $token) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
|
||||
$hublink = html_writer::tag('a', $hubname, array('href' => $url));
|
||||
|
||||
$registeredhub->token = $newtoken;
|
||||
$registeredhub->confirmed = 1;
|
||||
@@ -66,9 +65,7 @@ if (!empty($registeredhub) and $registeredhub->token == $token) {
|
||||
$registrationmanager->update_registeredhub($registeredhub);
|
||||
|
||||
// Display notification message.
|
||||
$notificationmessage = $OUTPUT->notification(
|
||||
get_string('registrationconfirmedon', 'hub', $hublink), 'notifysuccess');
|
||||
echo $notificationmessage;
|
||||
echo $OUTPUT->notification(get_string('registrationconfirmedon', 'hub'), 'notifysuccess');
|
||||
|
||||
//display continue button
|
||||
$registrationpage = new moodle_url('/admin/registration/index.php');
|
||||
|
||||
@@ -31,21 +31,16 @@
|
||||
class core_register_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Display Moodle.org registration message about benefit to register on Moodle.org
|
||||
* Display message about the benefits of registering on Moodle.org
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function moodleorg_registration_message() {
|
||||
|
||||
$moodleorgstatslink = html_writer::link('http://moodle.net/stats',
|
||||
get_string('statsmoodleorg', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$hublink = html_writer::link('https://moodle.net/mod/page/view.php?id=1',
|
||||
get_string('moodleorghubname', 'admin'),
|
||||
array('target' => '_blank'));
|
||||
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin', $hublink);
|
||||
$moodleorgregmsg = get_string('registermoodleorg', 'admin');
|
||||
$items = array(get_string('registermoodleorgli1', 'admin'),
|
||||
get_string('registermoodleorgli2', 'admin', $moodleorgstatslink));
|
||||
$moodleorgregmsg .= html_writer::alist($items);
|
||||
|
||||
@@ -27,9 +27,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
'customusermenuitems',
|
||||
new lang_string('customusermenuitems', 'admin'),
|
||||
new lang_string('configcustomusermenuitems', 'admin'),
|
||||
'mygrades,grades|/grade/report/mygrades.php|grades
|
||||
'grades,grades|/grade/report/mygrades.php|grades
|
||||
messages,message|/message/index.php|message
|
||||
mypreferences,moodle|/user/preferences.php|preferences',
|
||||
preferences,moodle|/user/preferences.php|preferences',
|
||||
PARAM_TEXT,
|
||||
'50',
|
||||
'10'
|
||||
|
||||
@@ -7,10 +7,10 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | auth | confirmed |
|
||||
| user1 | User | One | one@asd.com | manual | 0 |
|
||||
| user2 | User | Two | two@asd.com | ldap | 1 |
|
||||
| user3 | User | Three | three@asd.com | manual | 1 |
|
||||
| user4 | User | Four | four@asd.com | ldap | 0 |
|
||||
| user1 | User | One | one@example.com | manual | 0 |
|
||||
| user2 | User | Two | two@example.com | ldap | 1 |
|
||||
| user3 | User | Three | three@example.com | manual | 1 |
|
||||
| user4 | User | Four | four@example.com | ldap | 0 |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| Cohort 1 | CH1 |
|
||||
@@ -23,8 +23,8 @@ Feature: An administrator can filter user accounts by role, cohort and other pro
|
||||
| user2 | C1 | student |
|
||||
| user3 | C1 | student |
|
||||
And I log in as "admin"
|
||||
And I add "User Two (two@asd.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@asd.com)" user to "CH1" cohort members
|
||||
And I add "User Two (two@example.com)" user to "CH1" cohort members
|
||||
And I add "User Three (three@example.com)" user to "CH1" cohort members
|
||||
And I follow "Browse list of users"
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -21,7 +21,7 @@ Feature: Upload users
|
||||
And I should see "Tom"
|
||||
And I should see "Jones"
|
||||
And I should see "verysecret"
|
||||
And I should see "jonest@someplace.edu"
|
||||
And I should see "jonest@example.com"
|
||||
And I should see "Reznor"
|
||||
And I should see "course1"
|
||||
And I should see "math102"
|
||||
@@ -32,7 +32,7 @@ Feature: Upload users
|
||||
And I follow "Browse list of users"
|
||||
And I should see "Tom Jones"
|
||||
And I should see "Trent Reznor"
|
||||
And I should see "reznor@someplace.edu"
|
||||
And I should see "reznor@example.com"
|
||||
And I am on site homepage
|
||||
And I follow "Maths"
|
||||
And I expand "Users" node
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_assignmentupgrade';
|
||||
$plugin->dependencies = array('mod_assign' => 2014110400);
|
||||
$plugin->dependencies = array('mod_assign' => 2015050500);
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_availabilityconditions';
|
||||
|
||||
@@ -99,25 +99,13 @@ if ($options['parallel'] && $options['parallel'] > 1) {
|
||||
$cwd = getcwd();
|
||||
$output = null;
|
||||
|
||||
$installcomposer = true;
|
||||
// If behat dependencies not downloaded then do it first, else symfony/process can't be used.
|
||||
if ($options['parallel'] && !file_exists(__DIR__ . "/../../../../vendor/autoload.php")) {
|
||||
$installcomposer = false;
|
||||
testing_update_composer_dependencies();
|
||||
}
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
// Check whether the behat test environment needs to be updated.
|
||||
chdir(__DIR__);
|
||||
exec("php $utilfile --diag $paralleloption", $output, $code);
|
||||
|
||||
// Check if composer needs to be updated.
|
||||
if ($installcomposer &&
|
||||
($code == BEHAT_EXITCODE_INSTALL || $code == BEHAT_EXITCODE_REINSTALL || $code == BEHAT_EXITCODE_COMPOSER)) {
|
||||
testing_update_composer_dependencies();
|
||||
// Check again for behat test site and see if it's install or re-install.
|
||||
chdir(__DIR__);
|
||||
exec("php $utilfile --diag $paralleloption", $output, $code);
|
||||
}
|
||||
|
||||
if ($code == 0) {
|
||||
echo "Behat test environment already installed\n";
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ if (extension_loaded('pcntl')) {
|
||||
|
||||
$time = microtime(true);
|
||||
array_walk($unrecognised, function (&$v) {
|
||||
if ($x = preg_filter("#^(-+\w+)=(.+)#", "\$1='\$2'", $v)) {
|
||||
if ($x = preg_filter("#^(-+\w+)=(.+)#", "\$1=\"\$2\"", $v)) {
|
||||
$v = $x;
|
||||
} else if (!preg_match("#^-#", $v)) {
|
||||
$v = escapeshellarg($v);
|
||||
@@ -124,7 +124,7 @@ if ($options['profile']) {
|
||||
echo "Invalid profile passed: " . $profile;
|
||||
exit(1);
|
||||
}
|
||||
$extraopts[] = '--profile=\'' . $profile . "'";
|
||||
$extraopts[] = '--profile="' . $profile . '"';
|
||||
// By default, profile tags will be used.
|
||||
if (!empty($CFG->behat_config[$profile]['filters']['tags'])) {
|
||||
$tags = $CFG->behat_config[$profile]['filters']['tags'];
|
||||
|
||||
@@ -71,8 +71,8 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Role overrides
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
@@ -102,7 +102,7 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Add course enrolments
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | format |
|
||||
| Course 1 | C1 | topics |
|
||||
@@ -120,11 +120,11 @@ Feature: Set up contextual data for tests
|
||||
| Custom student | custom2 | | |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@moodlemoodle.com |
|
||||
| user2 | User | 2 | user2@moodlemoodle.com |
|
||||
| user3 | User | 3 | user3@moodlemoodle.com |
|
||||
| user4 | User | 4 | user4@moodlemoodle.com |
|
||||
| user5 | User | 5 | user5@moodlemoodle.com |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
| user3 | User | 3 | user3@example.com |
|
||||
| user4 | User | 4 | user4@example.com |
|
||||
| user5 | User | 5 | user5@example.com |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
@@ -238,8 +238,8 @@ Feature: Set up contextual data for tests
|
||||
Scenario: Add relations between users and groups
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
@@ -279,8 +279,8 @@ Feature: Set up contextual data for tests
|
||||
| Cat 1 | 0 | CAT1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@asd.com |
|
||||
| student2 | Student | 2 | student2@asd.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
And the following "cohorts" exist:
|
||||
| name | idnumber |
|
||||
| System cohort A | CHSA |
|
||||
@@ -349,7 +349,7 @@ Feature: Set up contextual data for tests
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I follow "Grades"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I expand "Setup" node
|
||||
And I follow "Categories and items"
|
||||
Then I should see "Test Grade Item 1"
|
||||
@@ -380,7 +380,7 @@ Feature: Set up contextual data for tests
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I follow "Grades"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I follow "Scales"
|
||||
Then I should see "Test Scale 1"
|
||||
And I should see "Disappointing, Good, Very good, Excellent"
|
||||
@@ -432,7 +432,7 @@ Feature: Set up contextual data for tests
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I follow "Course 1"
|
||||
And I follow "Grades"
|
||||
And I navigate to "Grades" node in "Course administration"
|
||||
And I expand "Setup" node
|
||||
And I follow "Categories and items"
|
||||
Then I should see "Test Outcome Grade Item 1"
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: Edit capabilities
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
|
||||
@@ -10,9 +10,9 @@ Feature: Verify that all form fields values can be get and set
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | email | firstname | lastname |
|
||||
| student1 | s1@asd.com | Student | 1 |
|
||||
| student2 | s2@asd.com | Student | 2 |
|
||||
| student3 | s3@asd.com | Student | 3 |
|
||||
| student1 | s1@example.com | Student | 1 |
|
||||
| student2 | s2@example.com | Student | 2 |
|
||||
| student3 | s3@example.com | Student | 3 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
|
||||
@@ -7,7 +7,7 @@ Feature: Forms manipulation
|
||||
@javascript
|
||||
Scenario: Basic forms manipulation
|
||||
Given I log in as "admin"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
When I set the field "First name" to "Field value"
|
||||
And I set the field "Select a country" to "Japan"
|
||||
|
||||
@@ -10,7 +10,7 @@ Feature: Transform steps arguments
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Edit profile"
|
||||
|
||||
@javascript
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014112700;
|
||||
$plugin->requires = 2014112700;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_filetypes';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_generator';
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->component = 'tool_installaddon';
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->maturity = MATURITY_STABLE;
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'logstore_legacy'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_log'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_messageinbound';
|
||||
|
||||
@@ -203,31 +203,24 @@ class rules extends \table_sql implements \renderable {
|
||||
/**
|
||||
* Gets a list of courses where the current user can subscribe to rules as a dropdown.
|
||||
*
|
||||
* @param bool $choose A flag for whether to show the 'choose...' option in the select box.
|
||||
* @return \single_select|bool returns the list of courses, or false if the select box
|
||||
* should not be displayed.
|
||||
*/
|
||||
public function get_user_courses_select() {
|
||||
global $DB;
|
||||
|
||||
// If the number of courses on the site exceed the maximum drop down limit do not display the select box.
|
||||
$numcourses = $DB->count_records('course');
|
||||
if ($numcourses > COURSE_MAX_COURSES_PER_DROPDOWN) {
|
||||
public function get_user_courses_select($choose = false) {
|
||||
$options = tool_monitor_get_user_courses();
|
||||
// If we have no options then don't create a select element.
|
||||
if (!$options) {
|
||||
return false;
|
||||
}
|
||||
$orderby = 'visible DESC, sortorder ASC';
|
||||
$options = array();
|
||||
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname', $orderby)) {
|
||||
foreach ($courses as $course) {
|
||||
$options[$course->id] = format_string($course->fullname, true,
|
||||
array('context' => \context_course::instance($course->id)));
|
||||
}
|
||||
}
|
||||
// If there are no options to display, then don't display anything.
|
||||
if (count($options) === 0) {
|
||||
return false;
|
||||
$selected = $this->courseid;
|
||||
$nothing = array();
|
||||
if ($choose) {
|
||||
$selected = null;
|
||||
$nothing = array('choosedots');
|
||||
}
|
||||
$url = new \moodle_url('/admin/tool/monitor/index.php');
|
||||
$select = new \single_select($url, 'courseid', $options, $this->courseid);
|
||||
$select = new \single_select($url, 'courseid', $options, $selected, $nothing);
|
||||
$select->set_label(get_string('selectacourse', 'tool_monitor'));
|
||||
return $select;
|
||||
}
|
||||
|
||||
@@ -24,38 +24,58 @@
|
||||
|
||||
require_once(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
require_once($CFG->dirroot . '/admin/tool/monitor/lib.php');
|
||||
|
||||
$courseid = optional_param('courseid', SITEID, PARAM_INT);
|
||||
$courseid = optional_param('courseid', 0, PARAM_INT);
|
||||
$action = optional_param('action', '', PARAM_ALPHA);
|
||||
$cmid = optional_param('cmid', 0, PARAM_INT);
|
||||
$ruleid = optional_param('ruleid', 0, PARAM_INT);
|
||||
$subscriptionid = optional_param('subscriptionid', 0, PARAM_INT);
|
||||
$confirm = optional_param('confirm', false, PARAM_BOOL);
|
||||
|
||||
require_login();
|
||||
|
||||
// We need to explicitly check that the course id is something legitimate.
|
||||
$choose = false;
|
||||
// Validate course id.
|
||||
if (empty($courseid)) {
|
||||
$courseid = SITEID;
|
||||
require_login();
|
||||
$context = context_system::instance();
|
||||
// check system level capability.
|
||||
if (!has_capability('tool/monitor:subscribe', $context)) {
|
||||
// If not system level then check to see if they have access to any course level rules.
|
||||
if (tool_monitor_get_user_courses()){
|
||||
// Make them choose a course.
|
||||
$choose = true;
|
||||
} else {
|
||||
// return error.
|
||||
print_error('rulenopermission', 'tool_monitor');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// They might want to see rules for this course.
|
||||
$course = get_course($courseid);
|
||||
require_login($course);
|
||||
$context = context_course::instance($course->id);
|
||||
// Check for caps.
|
||||
require_capability('tool/monitor:subscribe', $context);
|
||||
}
|
||||
|
||||
$coursecontext = context_course::instance($courseid);
|
||||
|
||||
if (!get_config('tool_monitor', 'enablemonitor')) {
|
||||
// This should never happen as the this page does not appear in navigation when the tool is disabled.
|
||||
throw new coding_exception('Event monitoring is disabled');
|
||||
}
|
||||
|
||||
$sitename = format_string($SITE->fullname, true, array('context' => $coursecontext));
|
||||
// Use the user context here so that the header shows user information.
|
||||
$PAGE->set_context(context_user::instance($USER->id));
|
||||
|
||||
// Set up the page.
|
||||
$indexurl = new moodle_url('/admin/tool/monitor/index.php', array('courseid' => $courseid));
|
||||
$PAGE->set_url($indexurl);
|
||||
$PAGE->set_pagelayout('report');
|
||||
$PAGE->set_title($sitename);
|
||||
$PAGE->set_title(get_string('managesubscriptions', 'tool_monitor'));
|
||||
$PAGE->set_heading(fullname($USER));
|
||||
$settingsnode = $PAGE->settingsnav->find('monitor', null)->make_active();
|
||||
$settingsnode = $PAGE->settingsnav->find('monitor', null);
|
||||
if ($settingsnode) {
|
||||
$settingsnode->make_active();
|
||||
}
|
||||
|
||||
// Create/delete subscription if needed.
|
||||
if (!empty($action)) {
|
||||
@@ -86,7 +106,7 @@ if (!empty($action)) {
|
||||
} else {
|
||||
$subscription = \tool_monitor\subscription_manager::get_subscription($subscriptionid);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->confirm(get_string('subareyousure', 'tool_monitor', $subscription->get_name($coursecontext)),
|
||||
echo $OUTPUT->confirm(get_string('subareyousure', 'tool_monitor', $subscription->get_name($context)),
|
||||
$confirmurl, $cancelurl);
|
||||
echo $OUTPUT->footer();
|
||||
exit();
|
||||
@@ -104,17 +124,13 @@ $renderer = $PAGE->get_renderer('tool_monitor', 'managesubs');
|
||||
$totalrules = \tool_monitor\rule_manager::count_rules_by_courseid($courseid);
|
||||
$rules = new \tool_monitor\output\managesubs\rules('toolmonitorrules', $indexurl, $courseid);
|
||||
|
||||
$usercourses = $rules->get_user_courses_select();
|
||||
if (!empty($usercourses)) {
|
||||
echo $renderer->render($usercourses);
|
||||
} else {
|
||||
// Nothing to show at all. Show a notification.
|
||||
echo $OUTPUT->notification(get_string('rulenopermission', 'tool_monitor'), 'notifyproblem');
|
||||
}
|
||||
$usercourses = $rules->get_user_courses_select($choose);
|
||||
// There must be user courses otherwise we wouldn't make it this far.
|
||||
echo $renderer->render($usercourses);
|
||||
|
||||
// Render the current subscriptions list.
|
||||
$totalsubs = \tool_monitor\subscription_manager::count_user_subscriptions();
|
||||
if (!empty($totalsubs)) {
|
||||
if (!empty($totalsubs) && !$choose) {
|
||||
// Show the subscriptions section only if there are subscriptions.
|
||||
$subs = new \tool_monitor\output\managesubs\subs('toolmonitorsubs', $indexurl, $courseid);
|
||||
echo $OUTPUT->heading(get_string('currentsubscriptions', 'tool_monitor'), 3);
|
||||
@@ -122,14 +138,13 @@ if (!empty($totalsubs)) {
|
||||
}
|
||||
|
||||
// Render the potential rules list.
|
||||
// Check the capability here before displaying any rules to subscribe to.
|
||||
if (has_capability('tool/monitor:subscribe', $coursecontext)) {
|
||||
if (!$choose) {
|
||||
echo $OUTPUT->heading(get_string('rulescansubscribe', 'tool_monitor'), 3);
|
||||
echo $renderer->render($rules);
|
||||
}
|
||||
|
||||
// Check if the user can manage the course rules we are viewing.
|
||||
$canmanagerules = has_capability('tool/monitor:managerules', $coursecontext);
|
||||
$canmanagerules = has_capability('tool/monitor:managerules', $context);
|
||||
|
||||
if (empty($totalrules)) {
|
||||
// No rules present. Show a link to manage rules page if permissions permit.
|
||||
|
||||
+33
-12
@@ -79,19 +79,40 @@ function tool_monitor_extend_navigation_user_settings($navigation, $user, $userc
|
||||
|
||||
// Don't show the setting if the event monitor isn't turned on. No access to other peoples subscriptions.
|
||||
if (get_config('tool_monitor', 'enablemonitor') && $USER->id == $user->id) {
|
||||
// The $course->id will always be the course that corresponds to the current context.
|
||||
$courseid = $course->id;
|
||||
// A $course->id of $SITE->id might either be the frontpage or the site. So if we get the site ID back, check the...
|
||||
// ...courseid parameter passed to the page so we can know if we are looking at the frontpage rules or site level rules.
|
||||
if ($course->id == $SITE->id && optional_param('courseid', $course->id, PARAM_INT) == 0) {
|
||||
$courseid = 0;
|
||||
}
|
||||
$url = new moodle_url('/admin/tool/monitor/index.php', array('courseid' => $courseid));
|
||||
$subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url,
|
||||
navigation_node::TYPE_SETTING, null, 'monitor', new pix_icon('i/settings', ''));
|
||||
// Now let's check to see if the user has any courses / site rules that they can subscribe to.
|
||||
if ($courses = tool_monitor_get_user_courses()) {
|
||||
$url = new moodle_url('/admin/tool/monitor/index.php');
|
||||
$subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url,
|
||||
navigation_node::TYPE_SETTING, null, 'monitor', new pix_icon('i/settings', ''));
|
||||
|
||||
if (isset($subsnode) && !empty($navigation)) {
|
||||
$navigation->add_node($subsnode);
|
||||
if (isset($subsnode) && !empty($navigation)) {
|
||||
$navigation->add_node($subsnode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of courses and also include 'Site' for site wide rules.
|
||||
*
|
||||
* @return array|bool Returns an array of courses or false if the user has no permission to subscribe to rules.
|
||||
*/
|
||||
function tool_monitor_get_user_courses() {
|
||||
$orderby = 'visible DESC, sortorder ASC';
|
||||
$options = array();
|
||||
if (has_capability('tool/monitor:subscribe', context_system::instance())) {
|
||||
$options[0] = get_string('site');
|
||||
}
|
||||
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname', $orderby)) {
|
||||
foreach ($courses as $course) {
|
||||
$options[$course->id] = format_string($course->fullname, true,
|
||||
array('context' => context_course::instance($course->id)));
|
||||
}
|
||||
}
|
||||
// If there are no courses and there is no site permission then return false.
|
||||
if (count($options) < 1) {
|
||||
return false;
|
||||
} else {
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ Feature: tool_monitor_rule
|
||||
| Course 1 | C1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -11,8 +11,8 @@ Feature: tool_monitor_subscriptions
|
||||
| Course 2 | C2 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher2 | Teacher | 2 | teacher2@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| teacher2 | Teacher | 2 | teacher2@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@@ -55,7 +55,7 @@ Feature: tool_monitor_subscriptions
|
||||
|
||||
Scenario: Subscribe to a rule on course level
|
||||
Given I log in as "teacher1"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Course 1"
|
||||
When I follow "Subscribe to rule \"New rule course level\""
|
||||
@@ -64,7 +64,7 @@ Feature: tool_monitor_subscriptions
|
||||
|
||||
Scenario: Delete a subscription on course level
|
||||
Given I log in as "teacher1"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Course 1"
|
||||
And I follow "Subscribe to rule \"New rule course level\""
|
||||
@@ -77,7 +77,7 @@ Feature: tool_monitor_subscriptions
|
||||
|
||||
Scenario: Subscribe to a rule on site level
|
||||
Given I log in as "admin"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Acceptance test site"
|
||||
When I follow "Subscribe to rule \"New rule site level\""
|
||||
@@ -86,7 +86,7 @@ Feature: tool_monitor_subscriptions
|
||||
|
||||
Scenario: Delete a subscription on site level
|
||||
Given I log in as "admin"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Acceptance test site"
|
||||
And I follow "Subscribe to rule \"New rule site level\""
|
||||
@@ -100,11 +100,11 @@ Feature: tool_monitor_subscriptions
|
||||
|
||||
Scenario: Receiving notification on site level
|
||||
Given I log in as "admin"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Messaging"
|
||||
And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
|
||||
And I press "Save changes"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Acceptance test site"
|
||||
And I follow "Subscribe to rule \"New rule site level\""
|
||||
@@ -119,11 +119,11 @@ Feature: tool_monitor_subscriptions
|
||||
|
||||
Scenario: Receiving notification on course level
|
||||
Given I log in as "teacher1"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Messaging"
|
||||
And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
|
||||
And I press "Save changes"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Course 1"
|
||||
And I follow "Subscribe to rule \"New rule course level\""
|
||||
@@ -139,7 +139,7 @@ Feature: tool_monitor_subscriptions
|
||||
|
||||
Scenario: Navigating via quick link to rules
|
||||
Given I log in as "admin"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
When I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Course 1"
|
||||
Then I should see "You can manage rules from the Event monitoring rules page."
|
||||
@@ -147,7 +147,7 @@ Feature: tool_monitor_subscriptions
|
||||
And I should see "You can subscribe to rules from the Event monitoring page."
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Course 1"
|
||||
And I should see "You can manage rules from the Event monitoring rules page."
|
||||
@@ -155,11 +155,12 @@ Feature: tool_monitor_subscriptions
|
||||
And I should see "You can subscribe to rules from the Event monitoring page."
|
||||
And I click on "//a[text()='Event monitoring']" "xpath_element"
|
||||
And the field "courseid" matches value "Course 1"
|
||||
And I set the field "courseid" to "Choose..."
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I should not see "You can manage rules from the Event monitoring rules page."
|
||||
And I log out
|
||||
And I log in as "teacher2"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Course 1"
|
||||
And I should not see "You can manage rules the from the Event monitoring rules page."
|
||||
@@ -170,7 +171,7 @@ Feature: tool_monitor_subscriptions
|
||||
| tool/monitor:managerules | Prohibit |
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
When I set the field "Select a course" to "Course 1"
|
||||
Then I should see "You can manage rules from the Event monitoring rules page."
|
||||
@@ -178,7 +179,7 @@ Feature: tool_monitor_subscriptions
|
||||
And I should not see "You can manage rules from the Event monitoring rules page."
|
||||
And I log out
|
||||
And I log in as "teacher2"
|
||||
And I follow "My preferences" in the user menu
|
||||
And I follow "Preferences" in the user menu
|
||||
And I follow "Event monitoring"
|
||||
And I set the field "Select a course" to "Course 1"
|
||||
And I should not see "You can manage rules from the Event monitoring rules page."
|
||||
|
||||
@@ -26,6 +26,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2014111001; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_monitor'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ require_once(__DIR__.'/../../../../lib/phpunit/bootstraplib.php');
|
||||
require_once(__DIR__.'/../../../../lib/testing/lib.php');
|
||||
|
||||
echo "Initialising Moodle PHPUnit test environment...\n";
|
||||
testing_update_composer_dependencies();
|
||||
|
||||
$output = null;
|
||||
exec('php --version', $output, $code);
|
||||
@@ -72,4 +73,6 @@ if ($code == 0) {
|
||||
|
||||
passthru("php util.php --buildconfig", $code);
|
||||
|
||||
echo "\n";
|
||||
echo "PHPUnit test environment setup complete.\n";
|
||||
exit(0);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_phpunit'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_replace'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'tool_spamcleaner'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_task'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
define(["jquery","core/ajax","core/log","core/notification","core/templates","core/config","core/str"],function(a,b,c,d,e,f,g){var h=function(b,f){g.get_string("templateselected","tool_templatelibrary",b).done(function(b){a('[data-region="displaytemplateheader"]').text(b)}).fail(d.exception);var h="@template "+b,i=f.match(/{{!([\s\S]*?)}}/g),j=0;if(null!==i)for(j=0;j<i.length;j++){var k=i[j],l=k.indexOf(h);if(-1!==l){var m=l+h.length+1;k=k.substr(m,k.length-2-m),f=k;break}}a('[data-region="displaytemplatesource"]').text(f);var n=f.match(/Example context \(json\):([\s\S]*)/),o=!1;if(n){var p=n[1].trim();try{o=a.parseJSON(p)}catch(q){c.debug("Could not parse json example context for template."),c.debug(q)}}o?e.render(b,o).done(function(b,c){a('[data-region="displaytemplateexample"]').empty(),a('[data-region="displaytemplateexample"]').append(b),e.runTemplateJS(c)}).fail(d.exception):g.get_string("templatehasnoexample","tool_templatelibrary").done(function(b){a('[data-region="displaytemplateexample"]').text(b)}).fail(d.exception)},i=function(a){var c=a.split("/"),e=c.shift(),g=c.shift();b.call([{methodname:"core_output_load_template",args:{component:e,template:g,themename:f.theme},done:function(b){h(a,b)},fail:d.exception}])};return a('[data-region="list-templates"]').on("click","[data-templatename]",function(){var b=a(this).data("templatename");i(b)}),{}});
|
||||
define(["jquery","core/ajax","core/log","core/notification","core/templates","core/config","core/str"],function(a,b,c,d,e,f,g){var h=function(a,b){var c="@template "+b,d=0,e=[];if(e=a.match(/{{!([\s\S]*?)}}/g),null!==e)for(d=0;d<e.length;d++){var f=e[d],g=f.indexOf(c);if(-1!==g){var h=g+c.length+1;return f=f.substr(h,f.length-2-h)}}return!1},i=function(b,f,i){g.get_string("templateselected","tool_templatelibrary",b).done(function(b){a('[data-region="displaytemplateheader"]').text(b)}).fail(d.exception);var j=h(f,b);j===!1&&(j=h(i,b)),j&&(f=j),a('[data-region="displaytemplatesource"]').text(f);var k=f.match(/Example context \(json\):([\s\S]*)/),l=!1;if(k){var m=k[1].trim();try{l=a.parseJSON(m)}catch(n){c.debug("Could not parse json example context for template."),c.debug(n)}}l?e.render(b,l).done(function(b,c){a('[data-region="displaytemplateexample"]').empty(),a('[data-region="displaytemplateexample"]').append(b),e.runTemplateJS(c)}).fail(d.exception):g.get_string("templatehasnoexample","tool_templatelibrary").done(function(b){a('[data-region="displaytemplateexample"]').text(b)}).fail(d.exception)},j=function(c){var e=c.split("/"),g=e.shift(),h=e.shift(),j=b.call([{methodname:"core_output_load_template",args:{component:g,template:h,themename:f.theme}},{methodname:"tool_templatelibrary_load_canonical_template",args:{component:g,template:h}}]);a.when.apply(a,j).done(function(a,b){i(c,a,b)}).fail(d.exception)};return a('[data-region="list-templates"]').on("click","[data-templatename]",function(){var b=a(this).data("templatename");j(b)}),{}});
|
||||
@@ -25,21 +25,20 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
function($, ajax, log, notification, templates, config, str) {
|
||||
|
||||
/**
|
||||
* Handle a template loaded response.
|
||||
* Search through a template for a template docs comment.
|
||||
*
|
||||
* @param {String} templateName The template name
|
||||
* @param {String} source The template source
|
||||
* @param {String} templateSource The raw template
|
||||
* @param {String} templateName The name of the template used to search for docs tag
|
||||
* @return {String|boolean} the correct comment or false
|
||||
*/
|
||||
var templateLoaded = function(templateName, source) {
|
||||
str.get_string('templateselected', 'tool_templatelibrary', templateName).done(function(s) {
|
||||
$('[data-region="displaytemplateheader"]').text(s);
|
||||
}).fail(notification.exception);
|
||||
var findDocsSection = function(templateSource, templateName) {
|
||||
|
||||
// Find the comment section marked with @template component/template.
|
||||
var marker = "@template " + templateName;
|
||||
var marker = "@template " + templateName,
|
||||
i = 0,
|
||||
sections = [];
|
||||
|
||||
var sections = source.match(/{{!([\s\S]*?)}}/g);
|
||||
var i = 0;
|
||||
sections = templateSource.match(/{{!([\s\S]*?)}}/g);
|
||||
|
||||
// If no sections match - show the entire file.
|
||||
if (sections !== null) {
|
||||
@@ -50,11 +49,38 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
// Remove {{! and }} from start and end.
|
||||
var offset = start + marker.length + 1;
|
||||
section = section.substr(offset, section.length - 2 - offset);
|
||||
source = section;
|
||||
break;
|
||||
return section;
|
||||
}
|
||||
}
|
||||
}
|
||||
// No matching comment.
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Handle a template loaded response.
|
||||
*
|
||||
* @param {String} templateName The template name
|
||||
* @param {String} source The template source
|
||||
* @param {String} originalSource The original template source (not theme overridden)
|
||||
*/
|
||||
var templateLoaded = function(templateName, source, originalSource) {
|
||||
str.get_string('templateselected', 'tool_templatelibrary', templateName).done(function(s) {
|
||||
$('[data-region="displaytemplateheader"]').text(s);
|
||||
}).fail(notification.exception);
|
||||
|
||||
// Find the comment section marked with @template component/template.
|
||||
var docs = findDocsSection(source, templateName);
|
||||
|
||||
if (docs === false) {
|
||||
// Docs was not in theme template, try original.
|
||||
docs = findDocsSection(originalSource, templateName);
|
||||
}
|
||||
|
||||
// If we found a docs section, limit the template library to showing this section.
|
||||
if (docs) {
|
||||
source = docs;
|
||||
}
|
||||
|
||||
$('[data-region="displaytemplatesource"]').text(source);
|
||||
|
||||
@@ -86,6 +112,7 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
|
||||
/**
|
||||
* Load the a template source from Moodle.
|
||||
*
|
||||
* @param {String} templateName
|
||||
*/
|
||||
var loadTemplate = function(templateName) {
|
||||
@@ -93,16 +120,26 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
|
||||
var component = parts.shift();
|
||||
var name = parts.shift();
|
||||
|
||||
ajax.call([{
|
||||
var promises = ajax.call([{
|
||||
methodname: 'core_output_load_template',
|
||||
args:{
|
||||
component: component,
|
||||
template: name,
|
||||
themename: config.theme
|
||||
},
|
||||
done: function(source) { templateLoaded(templateName, source); },
|
||||
fail: notification.exception
|
||||
}
|
||||
}, {
|
||||
methodname: 'tool_templatelibrary_load_canonical_template',
|
||||
args:{
|
||||
component: component,
|
||||
template: name
|
||||
}
|
||||
}]);
|
||||
|
||||
// When returns a new promise that is resolved when all the passed in promises are resolved.
|
||||
// The arguments to the done become the values of each resolved promise.
|
||||
$.when.apply($, promises)
|
||||
.done( function(source, originalSource) { templateLoaded(templateName, source, originalSource); })
|
||||
.fail(notification.exception);
|
||||
};
|
||||
|
||||
// Add the event listeners.
|
||||
|
||||
@@ -23,10 +23,12 @@
|
||||
*/
|
||||
namespace tool_templatelibrary;
|
||||
|
||||
use stdClass;
|
||||
use core_component;
|
||||
use core\output\mustache_template_finder;
|
||||
use coding_exception;
|
||||
use moodle_exception;
|
||||
use required_capability_exception;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* API exposed by tool_templatelibrary
|
||||
@@ -41,52 +43,98 @@ class api {
|
||||
*
|
||||
* @param string $component Filter the list to a single component.
|
||||
* @param string $search Search string to optionally filter the list of templates.
|
||||
* @param string $themename The name of the current theme.
|
||||
* @return array[string] Where each template is in the form "component/templatename".
|
||||
*/
|
||||
public static function list_templates($component = '', $search = '') {
|
||||
public static function list_templates($component = '', $search = '', $themename = '') {
|
||||
global $CFG;
|
||||
|
||||
$templatedirs = array();
|
||||
$results = array();
|
||||
|
||||
if ($component != '') {
|
||||
if ($component !== '') {
|
||||
// Just look at one component for templates.
|
||||
$dir = core_component::get_component_directory($component);
|
||||
if (!$dir) {
|
||||
return $templatedirs;
|
||||
}
|
||||
$dirs = mustache_template_finder::get_template_directories_for_component($component, $themename);
|
||||
|
||||
$templatedirs[$component] = $dir . '/templates';
|
||||
$templatedirs[$component] = $dirs;
|
||||
} else {
|
||||
|
||||
// Look at all the templates dirs for all installed plugins.
|
||||
$dir = $CFG->libdir . '/templates';
|
||||
if (!empty($dir) && is_dir($dir)) {
|
||||
$templatedirs['core'] = $dir;
|
||||
// Look at all the templates dirs for core.
|
||||
$templatedirs['core'] = mustache_template_finder::get_template_directories_for_component('core', $themename);
|
||||
|
||||
// Look at all the templates dirs for subsystems.
|
||||
$subsystems = core_component::get_core_subsystems();
|
||||
foreach ($subsystems as $subsystem => $dir) {
|
||||
$dir .= '/templates';
|
||||
if (is_dir($dir)) {
|
||||
$dirs = mustache_template_finder::get_template_directories_for_component('core_' . $subsystem, $themename);
|
||||
$templatedirs['core_' . $subsystem] = $dirs;
|
||||
}
|
||||
}
|
||||
|
||||
// Look at all the templates dirs for plugins.
|
||||
$plugintypes = core_component::get_plugin_types();
|
||||
foreach ($plugintypes as $type => $dir) {
|
||||
$plugins = core_component::get_plugin_list_with_file($type, 'templates', false);
|
||||
foreach ($plugins as $plugin => $dir) {
|
||||
if (!empty($dir) && is_dir($dir)) {
|
||||
$templatedirs[$type . '_' . $plugin] = $dir;
|
||||
$pluginname = $type . '_' . $plugin;
|
||||
$dirs = mustache_template_finder::get_template_directories_for_component($pluginname, $themename);
|
||||
$templatedirs[$pluginname] = $dirs;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($templatedirs as $templatecomponent => $dir) {
|
||||
// List it.
|
||||
$files = glob($dir . '/*.mustache');
|
||||
foreach ($templatedirs as $templatecomponent => $dirs) {
|
||||
foreach ($dirs as $dir) {
|
||||
// List it.
|
||||
$files = glob($dir . '/*.mustache');
|
||||
|
||||
foreach ($files as $file) {
|
||||
$templatename = basename($file, '.mustache');
|
||||
if ($search == '' || strpos($templatename, $search) !== false) {
|
||||
$results[] = $templatecomponent . '/' . $templatename;
|
||||
foreach ($files as $file) {
|
||||
$templatename = basename($file, '.mustache');
|
||||
if ($search == '' || strpos($templatename, $search) !== false) {
|
||||
$results[$templatecomponent . '/' . $templatename] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$results = array_keys($results);
|
||||
sort($results);
|
||||
return $results;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a mustache template.
|
||||
* Note - this function differs from the function core_output_load_template
|
||||
* because it will never return a theme overridden version of a template.
|
||||
*
|
||||
* @param string $component The component that holds the template.
|
||||
* @param string $template The name of the template.
|
||||
* @return string the template
|
||||
*/
|
||||
public static function load_canonical_template($component, $template) {
|
||||
// Get the list of possible template directories.
|
||||
$dirs = mustache_template_finder::get_template_directories_for_component($component);
|
||||
$filename = false;
|
||||
|
||||
foreach ($dirs as $dir) {
|
||||
// Skip theme dirs - we only want the original plugin/core template.
|
||||
if (strpos($dir, "/theme/") === false) {
|
||||
$candidate = $dir . $template . '.mustache';
|
||||
if (file_exists($candidate)) {
|
||||
$filename = $candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($filename === false) {
|
||||
throw new moodle_exception('filenotfound', 'error');
|
||||
}
|
||||
|
||||
$templatestr = file_get_contents($filename);
|
||||
return $templatestr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -95,4 +95,55 @@ class external extends external_api {
|
||||
public static function list_templates_returns() {
|
||||
return new external_multiple_structure(new external_value(PARAM_RAW, 'The template name (format is component/templatename)'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of load_canonical_template() parameters.
|
||||
*
|
||||
* @return external_function_parameters
|
||||
*/
|
||||
public static function load_canonical_template_parameters() {
|
||||
return new external_function_parameters(
|
||||
array('component' => new external_value(PARAM_COMPONENT, 'component containing the template'),
|
||||
'template' => new external_value(PARAM_ALPHANUMEXT, 'name of the template'))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Can this function be called directly from ajax?
|
||||
*
|
||||
* @return boolean
|
||||
* @since Moodle 2.9
|
||||
*/
|
||||
public static function load_canonical_template_is_allowed_from_ajax() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a mustache template.
|
||||
* Note - this function differs from the function core_output_load_template
|
||||
* because it will never return a theme overridden version of a template.
|
||||
*
|
||||
* @param string $component The component that holds the template.
|
||||
* @param string $template The name of the template.
|
||||
* @return string the template
|
||||
*/
|
||||
public static function load_canonical_template($component, $template) {
|
||||
$params = self::validate_parameters(self::load_canonical_template_parameters(),
|
||||
array('component' => $component,
|
||||
'template' => $template));
|
||||
|
||||
$component = $params['component'];
|
||||
$template = $params['template'];
|
||||
|
||||
return api::load_canonical_template($component, $template);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns description of load_canonical_template() result value.
|
||||
*
|
||||
* @return external_description
|
||||
*/
|
||||
public static function load_canonical_template_returns() {
|
||||
return new external_value(PARAM_RAW, 'template');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,8 +59,8 @@ class list_templates_page implements renderable, templatable {
|
||||
foreach ($components as $component) {
|
||||
$info = new stdClass();
|
||||
$info->component = $component;
|
||||
if ($component == 'core') {
|
||||
$info->name = get_string('core_component', 'tool_templatelibrary');
|
||||
if (strpos($component, 'core') === 0) {
|
||||
$info->name = get_string('coresubsystem', 'tool_templatelibrary', $component);
|
||||
} else {
|
||||
$info->name = $pluginmanager->plugin_name($component);
|
||||
}
|
||||
|
||||
@@ -33,5 +33,12 @@ $functions = array(
|
||||
'type' => 'read',
|
||||
'capabilities'=> '',
|
||||
),
|
||||
'tool_templatelibrary_load_canonical_template' => array(
|
||||
'classname' => 'tool_templatelibrary\external',
|
||||
'methodname' => 'load_canonical_template',
|
||||
'description' => 'Load a canonical template by name (not the theme overidden one).',
|
||||
'type' => 'read'
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
$string['all'] = 'All components';
|
||||
$string['component'] = 'Component';
|
||||
$string['core_component'] = 'Moodle core';
|
||||
$string['coresubsystem'] = 'Subsystem ({$a})';
|
||||
$string['documentation'] = 'Documentation';
|
||||
$string['example'] = 'Example';
|
||||
$string['noresults'] = 'No results';
|
||||
|
||||
@@ -65,5 +65,19 @@ class tool_templatelibrary_external_testcase extends externallib_advanced_testca
|
||||
$this->assertEquals($result[0], "tool_templatelibrary/list_templates_page");
|
||||
}
|
||||
|
||||
public function test_load_canonical_template() {
|
||||
global $CFG;
|
||||
|
||||
$originaltheme = $CFG->theme;
|
||||
// Change the theme to 'base' because it overrides these templates.
|
||||
$CFG->theme = 'base';
|
||||
|
||||
$template = external::load_canonical_template('core', 'notification_problem');
|
||||
|
||||
// Only the base template should contain the docs.
|
||||
$this->assertContains('@template core/notification_problem', $template);
|
||||
|
||||
// Restore the original theme.
|
||||
$CFG->theme = $originaltheme;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
$plugin->version = 2015021623; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_templatelibrary'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version.
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX).
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version.
|
||||
$plugin->component = 'tool_uploadcourse'; // Full name of the plugin (used for diagnostics).
|
||||
|
||||
@@ -421,8 +421,14 @@ function uu_pre_process_custom_profile_data($data) {
|
||||
function uu_check_custom_profile_data(&$data) {
|
||||
global $CFG, $DB;
|
||||
$noerror = true;
|
||||
$testuserid = null;
|
||||
|
||||
// find custom profile fields and check if data needs to converted.
|
||||
if (!empty($data['username'])) {
|
||||
if (preg_match('/id=(.*)"/i', $data['username'], $result)) {
|
||||
$testuserid = $result[1];
|
||||
}
|
||||
}
|
||||
// Find custom profile fields and check if data needs to converted.
|
||||
foreach ($data as $key => $value) {
|
||||
if (preg_match('/^profile_field_/', $key)) {
|
||||
$shortname = str_replace('profile_field_', '', $key);
|
||||
@@ -436,9 +442,20 @@ function uu_check_custom_profile_data(&$data) {
|
||||
$data['status'][] = get_string('invaliduserfield', 'error', $shortname);
|
||||
$noerror = false;
|
||||
}
|
||||
// Check for duplicate value.
|
||||
if (method_exists($formfield, 'edit_validate_field') ) {
|
||||
$testuser = new stdClass();
|
||||
$testuser->{$key} = $value;
|
||||
$testuser->id = $testuserid;
|
||||
$err = $formfield->edit_validate_field($testuser);
|
||||
if (!empty($err[$key])) {
|
||||
$data['status'][] = $err[$key].' ('.$key.')';
|
||||
$noerror = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $noerror;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'tool_xmldb'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111001; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_cas'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
$plugin->dependencies = array('auth_ldap' => 2014110400);
|
||||
$plugin->dependencies = array('auth_ldap' => 2015050500);
|
||||
|
||||
+2
-2
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_db'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
+4
-4
@@ -142,12 +142,12 @@ class auth_plugin_email extends auth_plugin_base {
|
||||
$user = get_complete_user_data('username', $username);
|
||||
|
||||
if (!empty($user)) {
|
||||
if ($user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->auth != $this->authtype) {
|
||||
if ($user->auth != $this->authtype) {
|
||||
return AUTH_CONFIRM_ERROR;
|
||||
|
||||
} else if ($user->secret == $confirmsecret && $user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in
|
||||
$DB->set_field("user", "confirmed", 1, array("id"=>$user->id));
|
||||
return AUTH_CONFIRM_OK;
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
$string['auth_emaildescription'] = '<p>Email-based self-registration enables a user to create their own account via a \'Create new account\' button on the login page. The user then receives an email containing a secure link to a page where they can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.</p><p>Note: In addition to enabling the plugin, email-based self-registration must also be selected from the self registration drop-down menu on the \'Manage authentication\' page.</p>';
|
||||
$string['auth_emailnoemail'] = 'Tried to send you an email but failed!';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the signup page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha/learnmore for more details. <br /><em>PHP cURL extension is required.</em>';
|
||||
$string['auth_emailrecaptcha'] = 'Adds a visual/audio confirmation form element to the sign-up page for email self-registering users. This protects your site against spammers and contributes to a worthwhile cause. See http://www.google.com/recaptcha for more details.';
|
||||
$string['auth_emailrecaptcha_key'] = 'Enable reCAPTCHA element';
|
||||
$string['auth_emailsettings'] = 'Settings';
|
||||
$string['pluginname'] = 'Email-based self-registration';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_email'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
+2
-2
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_fc'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_imap'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
+6
-5
@@ -607,12 +607,12 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$user = get_complete_user_data('username', $username);
|
||||
|
||||
if (!empty($user)) {
|
||||
if ($user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->auth != $this->authtype) {
|
||||
if ($user->auth != $this->authtype) {
|
||||
return AUTH_CONFIRM_ERROR;
|
||||
|
||||
} else if ($user->secret == $confirmsecret && $user->confirmed) {
|
||||
return AUTH_CONFIRM_ALREADY;
|
||||
|
||||
} else if ($user->secret == $confirmsecret) { // They have provided the secret key to get in
|
||||
if (!$this->user_activate($username)) {
|
||||
return AUTH_CONFIRM_FAIL;
|
||||
@@ -1653,7 +1653,8 @@ class auth_plugin_ldap extends auth_plugin_base {
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->wwwroot &&
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->wwwroot.'/' &&
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot.'/login/' &&
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot.'/login/index.php')
|
||||
$_SERVER['HTTP_REFERER'] != $CFG->httpswwwroot.'/login/index.php' &&
|
||||
clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL) != '')
|
||||
? $_SERVER['HTTP_REFERER'] : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ class auth_ldap_plugin_testcase extends advanced_testcase {
|
||||
'lastnamephonetic' => '最後のお名前のテスト一号',
|
||||
'firstnamephonetic' => 'お名前のテスト一号',
|
||||
'alternatename' => 'Alternate Name User Test 1',
|
||||
'email' => 'usersignuptest1@email.com',
|
||||
'email' => 'usersignuptest1@example.com',
|
||||
'description' => 'This is a description for user 1',
|
||||
'city' => 'Perth',
|
||||
'country' => 'au',
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111001; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_ldap'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_manual'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_mnet'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_nntp'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_nologin'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_none'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_pam'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_pop3'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_radius'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -25,6 +25,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_shibboleth'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -16,7 +16,7 @@ Feature: Authentication
|
||||
Scenario: Log in as an existing admin user filling the form
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
|
||||
| testuser | testuser | Test | User | moodle@example.com |
|
||||
And I am on site homepage
|
||||
When I follow "Log in"
|
||||
And I set the field "Username" to "testuser"
|
||||
@@ -27,7 +27,7 @@ Feature: Authentication
|
||||
Scenario: Log in as an unexisting user filling the form
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname | email |
|
||||
| testuser | testuser | Test | User | moodle@moodlemoodle.com |
|
||||
| testuser | testuser | Test | User | moodle@example.com |
|
||||
And I am on site homepage
|
||||
When I follow "Log in"
|
||||
And I set the field "Username" to "testuser"
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2014110400; // Requires this Moodle version
|
||||
$plugin->version = 2015051100; // The current plugin version (Date: YYYYMMDDXX)
|
||||
$plugin->requires = 2015050500; // Requires this Moodle version
|
||||
$plugin->component = 'auth_webservice'; // Full name of the plugin (used for diagnostics)
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'availability_completion';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'availability_date';
|
||||
|
||||
@@ -10,8 +10,8 @@ Feature: availability_grade
|
||||
| Course 1 | C1 | topics | 1 |
|
||||
And the following "users" exist:
|
||||
| username | email |
|
||||
| teacher1 | t@example.org |
|
||||
| student1 | s@example.org |
|
||||
| teacher1 | t@example.com |
|
||||
| student1 | s@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@@ -59,8 +59,22 @@ Feature: availability_grade
|
||||
And I set the field "Grade" to "A1"
|
||||
And I click on "min" "checkbox" in the ".availability-item" "css_element"
|
||||
And I set the field "Minimum grade percentage (inclusive)" to "50"
|
||||
And I click on "max" "checkbox" in the ".availability-item" "css_element"
|
||||
And I set the field "Maximum grade percentage (exclusive)" to "80"
|
||||
And I press "Save and return to course"
|
||||
|
||||
# Check if disabling a part of the restriction is get saved.
|
||||
And I open "P3" actions menu
|
||||
And I click on "Edit settings" "link" in the "P3" activity
|
||||
And I expand all fieldsets
|
||||
And I click on "max" "checkbox" in the ".availability-item" "css_element"
|
||||
And I press "Save and return to course"
|
||||
And I open "P3" actions menu
|
||||
And I click on "Edit settings" "link" in the "P3" activity
|
||||
And I expand all fieldsets
|
||||
And the field "Maximum grade percentage (exclusive)" matches value ""
|
||||
And I follow "Course 1"
|
||||
|
||||
# Add a Page with a grade condition for 10%.
|
||||
And I add a "Page" to section "4"
|
||||
And I set the following fields to these values:
|
||||
@@ -104,8 +118,8 @@ Feature: availability_grade
|
||||
# Give the assignment 40%.
|
||||
And I follow "A1"
|
||||
And I follow "View/grade all submissions"
|
||||
# Pick the grade link in the row that has s@example.org in it.
|
||||
And I click on "//a[contains(@href, 'action=grade') and ancestor::tr/td[normalize-space(.) = 's@example.org']]/img" "xpath_element"
|
||||
# Pick the grade link in the row that has s@example.com in it.
|
||||
And I click on "//a[contains(@href, 'action=grade') and ancestor::tr/td[normalize-space(.) = 's@example.com']]/img" "xpath_element"
|
||||
And I set the field "Grade out of 100" to "40"
|
||||
And I click on "Save changes" "button"
|
||||
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'availability_grade';
|
||||
|
||||
+1
@@ -94,6 +94,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
|
||||
+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("#fitem_id_availabilityconditionsjson");u.delegate("change",function(){M.core_availability.form.update()},".availability_grade select[name=id]"),u.delegate("click",function(){o(this,!0)},".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>"+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("#fitem_id_availabilityconditionsjson");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"]});
|
||||
|
||||
+1
@@ -94,6 +94,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
|
||||
@@ -92,6 +92,7 @@ M.availability_grade.form.getNode = function(json) {
|
||||
|
||||
root.delegate('click', function() {
|
||||
updateCheckbox(this, true);
|
||||
M.core_availability.form.update();
|
||||
}, '.availability_grade input[type=checkbox]');
|
||||
|
||||
root.delegate('valuechange', function() {
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'availability_group';
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'availability_grouping';
|
||||
|
||||
@@ -10,8 +10,8 @@ Feature: availability_profile
|
||||
| Course 1 | C1 | topics | 1 |
|
||||
And the following "users" exist:
|
||||
| username | email |
|
||||
| teacher1 | t@example.org |
|
||||
| student1 | s@example.org |
|
||||
| teacher1 | t@example.com |
|
||||
| student1 | s@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
@@ -37,7 +37,7 @@ Feature: availability_profile
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button"
|
||||
And I set the field "User profile field" to "Email address"
|
||||
And I set the field "Value to compare against" to "s@example.org"
|
||||
And I set the field "Value to compare against" to "s@example.com"
|
||||
And I click on ".availability-item .availability-eye img" "css_element"
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
@@ -51,7 +51,7 @@ Feature: availability_profile
|
||||
And I click on "Add restriction..." "button"
|
||||
And I click on "User profile" "button"
|
||||
And I set the field "User profile field" to "Email address"
|
||||
And I set the field "Value to compare against" to "q@example.org"
|
||||
And I set the field "Value to compare against" to "q@example.com"
|
||||
And I click on ".availability-item .availability-eye img" "css_element"
|
||||
And I click on "Save and return to course" "button"
|
||||
|
||||
@@ -78,7 +78,7 @@ Feature: availability_profile
|
||||
|
||||
# Set field value for user.
|
||||
And I navigate to "Browse list of users" node in "Site administration > Users > Accounts"
|
||||
And I click on "a[title=Edit]" "css_element" in the "s@example.org" "table_row"
|
||||
And I click on "a[title=Edit]" "css_element" in the "s@example.com" "table_row"
|
||||
And I expand all fieldsets
|
||||
And I set the field "Super field" to "Bananaman"
|
||||
And I click on "Update profile" "button"
|
||||
|
||||
@@ -24,6 +24,6 @@
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
$plugin->version = 2014111000;
|
||||
$plugin->requires = 2014110400;
|
||||
$plugin->version = 2015051100;
|
||||
$plugin->requires = 2015050500;
|
||||
$plugin->component = 'availability_profile';
|
||||
|
||||
@@ -75,7 +75,7 @@ Feature: display_availability
|
||||
And I press "Add restriction..."
|
||||
And I click on "User profile" "button" in the "Add restriction..." "dialogue"
|
||||
And I set the field "User profile field" to "Email address"
|
||||
And I set the field "Value to compare against" to "email@example.org"
|
||||
And I set the field "Value to compare against" to "email@example.com"
|
||||
And I set the field "Method of comparison" to "is equal to"
|
||||
And I press "Save and return to course"
|
||||
|
||||
|
||||
+10
-2
@@ -125,8 +125,16 @@ abstract class backup implements checksumable {
|
||||
const OPERATION_BACKUP ='backup'; // We are performing one backup
|
||||
const OPERATION_RESTORE ='restore';// We are performing one restore
|
||||
|
||||
// Version (to keep CFG->backup_version (and release) updated automatically)
|
||||
const VERSION = 2014111000;
|
||||
// Version and release (to keep CFG->backup_version (and release) updated automatically).
|
||||
/**
|
||||
* Usually same than major release version, this is used to mark important
|
||||
* point is backup when some behavior/approach channged, in order to allow
|
||||
* conditional coding based on it.
|
||||
*/
|
||||
const VERSION = 2015051100;
|
||||
/**
|
||||
* Usually same than major release zero version, mainly for informative/historic purposes.
|
||||
*/
|
||||
const RELEASE = '2.9';
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -299,7 +299,7 @@
|
||||
<IDNUMBER>891220979</IDNUMBER>
|
||||
<FIRSTNAME>Admin</FIRSTNAME>
|
||||
<LASTNAME>User</LASTNAME>
|
||||
<EMAIL>adamzap@gmail.com</EMAIL>
|
||||
<EMAIL>adamzap@example.com</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
@@ -368,7 +368,7 @@
|
||||
<IDNUMBER>891111111</IDNUMBER>
|
||||
<FIRSTNAME>Adam</FIRSTNAME>
|
||||
<LASTNAME>Zapletal</LASTNAME>
|
||||
<EMAIL>azaple1@lsu.edu</EMAIL>
|
||||
<EMAIL>azaple1@example.com</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
@@ -481,7 +481,7 @@
|
||||
<IDNUMBER></IDNUMBER>
|
||||
<FIRSTNAME>Philip</FIRSTNAME>
|
||||
<LASTNAME>Cali</LASTNAME>
|
||||
<EMAIL>pcali1@lsu.edu</EMAIL>
|
||||
<EMAIL>pcali1@example.com</EMAIL>
|
||||
<EMAILSTOP>0</EMAILSTOP>
|
||||
<ICQ></ICQ>
|
||||
<SKYPE></SKYPE>
|
||||
|
||||
@@ -3051,11 +3051,6 @@ class restore_activity_grades_structure_step extends restore_structure_step {
|
||||
$oldparentid = $data->categoryid;
|
||||
$courseid = $this->get_courseid();
|
||||
|
||||
// make sure top course category exists, all grade items will be associated
|
||||
// to it. Later, if restoring the whole gradebook, categories will be introduced
|
||||
$coursecat = grade_category::fetch_course_category($courseid);
|
||||
$coursecatid = $coursecat->id; // Get the categoryid to be used
|
||||
|
||||
$idnumber = null;
|
||||
if (!empty($data->idnumber)) {
|
||||
// Don't get any idnumber from course module. Keep them as they are in grade_item->idnumber
|
||||
@@ -3080,8 +3075,18 @@ class restore_activity_grades_structure_step extends restore_structure_step {
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data->categoryid)) {
|
||||
// If the grade category id of the grade item being restored belongs to this course
|
||||
// then it is a fair assumption that this is the correct grade category for the activity
|
||||
// and we should leave it in place, if not then unset it.
|
||||
// TODO MDL-34790 Gradebook does not import if target course has gradebook categories.
|
||||
$conditions = array('id' => $data->categoryid, 'courseid' => $courseid);
|
||||
if (!$this->task->is_samesite() || !$DB->record_exists('grade_categories', $conditions)) {
|
||||
unset($data->categoryid);
|
||||
}
|
||||
}
|
||||
|
||||
unset($data->id);
|
||||
$data->categoryid = $coursecatid;
|
||||
$data->courseid = $this->get_courseid();
|
||||
$data->iteminstance = $this->task->get_activityid();
|
||||
$data->idnumber = $idnumber;
|
||||
|
||||
@@ -11,7 +11,7 @@ Feature: Duplicate activities
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -12,7 +12,7 @@ Feature: Import course's contents into another course
|
||||
| Course 2 | C2 | 0 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
@@ -11,7 +11,7 @@ Feature: Option to include groups and groupings when importing a course to anoth
|
||||
| Course 2 | C2 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@asd.com |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
|
||||
+2
-2
@@ -42,8 +42,8 @@ function core_badges_myprofile_navigation(\core_user\output\myprofile\tree $tree
|
||||
return true;
|
||||
}
|
||||
|
||||
// Add category.
|
||||
$category = new core_user\output\myprofile\category('badges', get_string('badges', 'badges'), null);
|
||||
// Add category. This node should appear after 'contact' so that administration block appears towards the end. Refer MDL-49928.
|
||||
$category = new core_user\output\myprofile\category('badges', get_string('badges', 'badges'), 'contact');
|
||||
$tree->add_category($category);
|
||||
|
||||
// Determine context.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user