Compare commits

..

847 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) cbfee05d7f Moodle release 3.0.9 2017-03-11 22:15:54 +01:00
Marina Glancy 0833e7cfc7 MDL-58010 user: allow to update only whitelisted preferences 2017-03-10 18:10:44 +00:00
Eloy Lafuente (stronk7) 10d80cd64c weekly release 3.0.8+ 2017-01-27 00:27:49 +01:00
Dan Poltawski 024f0b702a Merge branch 'MDL-57639-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2017-01-24 10:11:26 +00:00
Dan Poltawski 68529165cd Merge branch 'MDL-57677-30-usermodified' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2017-01-23 09:49:49 +00:00
Andrew Nicols 87f6a483c3 MDL-57639 mod_forum: Update to use correct variable name
This addresses a regression where unnecessary attributes were removed
from the old variable. This one was missed.
2017-01-19 14:01:37 +08:00
David Mudrák c4fabc91e1 MDL-57677 mod_forum: Fix wrong user displayed as the last post's author
In the recent issue MDL-56225, we started to record the current user as
the usermodified in the forum_discussions table when updating a forum
post. It made sense but it was a mistake.

Even if the current user really modifies the discussion by updating the
post, the field usermodified has actually been always interpreted and
displayed as the last post' author. Not as the last user who touched the
discussion.

This patch reverts that particular change to the previous behaviour and
adds explicit unit test for it.
2017-01-17 20:07:54 +01:00
Eloy Lafuente (stronk7) 25c75f9b99 Moodle release 3.0.8 2017-01-08 11:04:22 +01:00
Eloy Lafuente (stronk7) 517cc1f9a7 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2017-01-08 11:04:18 +01:00
David Mudrák 00e928271b MDL-57580 mod_assign: Fix the incorrect type of some input parameters
The PARAM_TEXT has been misused in certain cases here. The 'action'
parameter seems to always be alphabetic, with values like
savesubmission, editsubmission and others as handled in assign::view().

Fixing the action handling fixes the reported XSS issue. While working
on it, I spotted two more places where PARAM_TEXT does not seem
appropriate. I include changes for them too, even if they are no
strictly related to the reported bug and there are no known ways to
abuse it.

* The 'plugin' looks like PARAM_PLUGIN and is even declared as such in
  some other parts of the assignment code (such as feedback forms).

* The 'workflowstate' is one of the ASSIGN_MARKING_WORKFLOW_STATE
  constants and is supposed to be alpha in external function input
  parameters handling, too.
2017-01-05 17:40:26 +01:00
Rajesh Taneja 824965d5dc MDL-57531 behat: Set noreplyaddress to valid address
noreplyaddress should be a valid address, else
it will not be saved. For behat we don't send
email, so set it to noreply@example.com, to
avoid failing validation on localhost
2017-01-05 06:53:23 +00:00
David Mudrák ae375cfcdc MDL-57531 mail: Validate the sender's email address
The patch adds validation for the noreplyaddress setting variable, for
the explicit $replyto parameter and for the sender's email. In case of
misconfigured noreplyaddress setting, it falls back to the default
noreply address value. In case of invalid email in the user's record,
the email is not sent.

The patch also adds unit test for the value returned by the function
generate_email_processing_address() so that it can be considered as a
valid email, too.

This is supposed to significantly minimise the risk of exploiting the
vulnerability in PHPMailer's Sender field.
2017-01-04 13:35:07 +00:00
David Mudrák 1c25f894ef MDL-57531 mail: Do not let admins set invalid email addresses
The noreply and support emails should always be valid.
2017-01-04 13:34:09 +00:00
David Mudrák ef7442df5b MDL-56225 mod_forum: Fix inability to edit attachments
The 'attachments' is not a real DB field here. It comes from the form's
filepicker and holds the id of the attachments filearea. The function
forum_add_attachment() expects it as a property of the first argument.

There were two possible approaches here. Either to pass the raw $newpost
to forum_add_attachment(), or add the attachments into the list
modifiable fields. The second approach is safer.
2017-01-04 10:36:40 +00:00
Andrew Nicols a1fadacb86 MDL-56225 mod_forum: Remove unnecessary attributes from update 2017-01-03 16:58:33 +00:00
AMOS bot 8f6cefd57d Automatically generated installer lang files 2016-12-08 00:05:43 +08:00
Dan Poltawski f7b04c388e weekly release 3.0.7+ 2016-12-02 15:18:06 +00:00
Dan Poltawski a6ec5b6ff6 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-12-02 15:18:05 +00:00
Eloy Lafuente (stronk7) 589c0fbd88 Merge branch 'MDL-57193-30-notest' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-12-02 11:41:25 +01:00
Frederic Massart fe5264217d MDL-57193 auth_db: Flip the array outside the loop for better perf
Also as the recent changes where affecting the whitespaces quite
a lot, I took the liberty of aligning a few lines which weren't.
2016-12-02 16:30:17 +08:00
John Okely fdaea8ad64 MDL-57193 auth_db: Use a recordset and array_key_exists 2016-12-02 16:30:17 +08:00
Josh Willcock 4f22f01fe4 MDL-57193 auth_db: Fixed bug suspends all users if external DB has > 10k 2016-12-02 16:30:17 +08:00
AMOS bot 842db4fd37 Automatically generated installer lang files 2016-12-01 00:06:02 +08:00
AMOS bot f2066cb88f Merge branch 'MOODLE_30_STABLE' into install_30_STABLE 2016-12-01 00:06:02 +08:00
AMOS bot 0ae9cfc1c2 Automatically generated installer lang files 2016-11-30 00:05:00 +08:00
Dan Poltawski 8dfbc3a822 weekly release 3.0.7+ 2016-11-29 13:32:27 +00:00
Dan Poltawski 6c0d5df3a2 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-11-29 13:32:25 +00:00
David Monllao fb92dba76f Merge branch 'MDL-57163-30' of https://github.com/vvzh/moodle into MOODLE_30_STABLE 2016-11-29 11:43:31 +08:00
Tim Lock b80b3d0237 MDL-57170 repository_dropbox: Ensure Dropbox Legacy continues to work 2016-11-28 10:31:31 +08:00
Vladimir Zhirov a0f554f012 MDL-57163 installation: fixed "Call to undefined function curl_version" 2016-11-27 12:13:53 +04:00
AMOS bot 44c7ab2121 Automatically generated installer lang files 2016-11-27 00:06:05 +08:00
AMOS bot 8690bb8068 Merge branch 'MOODLE_30_STABLE' into install_30_STABLE 2016-11-26 00:04:47 +08:00
David Monllao 60b566037a weekly release 3.0.7+ 2016-11-25 15:56:29 +08:00
Tony Butler 7d6c55bfc1 MDL-56948 mod_assign: Don't call get_grade_item() unless we have one 2016-11-24 15:58:44 +00:00
Damyon Wiese 1cf01e8add MDL-57100 JS: Exceptions give exceptions
Exceptions returned from ajax are not in the format expected by the JS, so
an error occurs and the exception popups are not appearing.

Conflicts:
	lib/amd/build/notification.min.js
	lib/amd/src/notification.js
2016-11-23 18:08:17 +00:00
AMOS bot dd9f8fae09 Automatically generated installer lang files 2016-11-23 00:05:30 +08:00
AMOS bot 2a3c0ef415 Automatically generated installer lang files 2016-11-18 00:07:02 +08:00
AMOS bot c6135d8d46 Automatically generated installer lang files 2016-11-17 00:04:55 +08:00
Eloy Lafuente (stronk7) ca86a178c8 Moodle release 3.0.7 2016-11-12 20:21:29 +01:00
AMOS bot 9b94006603 Automatically generated installer lang files 2016-11-12 00:29:19 +08:00
Dan Poltawski 65eb6bd459 weekly release 3.0.6+ 2016-11-11 12:05:49 +00:00
Andrew Nicols 8ae126d9b3 Merge branch 'MDL-55121-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-11-11 15:13:52 +08:00
Andrew Nicols 9b6313b0b7 Merge branch 'MDL-55994_30' of https://github.com/bostelm/moodle into MOODLE_30_STABLE 2016-11-11 14:00:24 +08:00
Andrew Nicols 9381d3e9ca Merge branch 'MDL-56417_30' of https://github.com/dmonllao/moodle into MOODLE_30_STABLE 2016-11-11 12:00:23 +08:00
Andrew Nicols 747225192f Merge branch 'MDL-52216_30_STABLE' of https://github.com/eugeneventer/moodle-fixes into MOODLE_30_STABLE 2016-11-11 11:22:51 +08:00
Simey Lameze 9c802cf1d4 MDL-55121 environment: check for unsuported php version 7.1 2016-11-11 10:02:21 +08:00
Eugene Venter c29df134e7 MDL-52216 mod_lesson: prevent invalid view modes 2016-11-11 09:26:29 +13:00
Henning Bostelmann 0c8a667aa9 MDL-55994 blog: Resolve warning messages in RSS feed generation 2016-11-10 16:33:58 +00:00
Dan Poltawski 0d593bd003 Merge branch 'MDL-56623_30-messages-to-adressed-to-until' of git://github.com/lucaboesch/moodle into MOODLE_30_STABLE 2016-11-10 15:04:35 +00:00
Dan Poltawski 0dd5c403cb Merge branch 'MDL-55249_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-11-10 15:01:44 +00:00
Dan Poltawski a788beadce MDL-55777 version: bump 2016-11-10 13:48:16 +00:00
Dan Poltawski db7bb6eae5 Merge branch 'MDL-55777-30' of git://github.com/ankitagarwal/moodle into MOODLE_30_STABLE 2016-11-10 13:46:47 +00:00
Eloy Lafuente (stronk7) cda80862da Merge branch 'MDL-53481-30-uniqsqlparam' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-11-10 13:16:06 +01:00
Luca Bösch 6006cd746a MDL-56623 messages: To (addressed) and to (until) different
In some languages "to" having the meaning of "until" and "to" having the meaning of "addressed to" are different.
This should be taken care of by having two different translation terms.

AMOS BEGIN
  CPY [to,core],[addressedto,core]
AMOS END
2016-11-10 11:13:05 +01:00
David Mudrák 93ccd9a8ed MDL-53481 availability: Fix unit test to not execute the huge query
Some DBs have troubles to execute such a huge query as generated in this
test. We do not actually need to execute it. All we need is to make sure
that the parameter placeholders are enumerated correctly. So it is what
this new test does.
2016-11-10 09:55:59 +01:00
Nicholas Hoobin 5e1b84ae0e MDL-56417 session: Respect the return value of ignore_timeout_hook. 2016-11-10 14:25:55 +08:00
Ankit Agarwal 20a03b8085 MDL-55777 installation: Check libcurl version on install 2016-11-10 10:21:58 +05:30
Juan Leyva 388b48ebcd MDL-56268 webservice: Format backtrace to avoid display private datawq 2016-11-10 11:41:24 +08:00
Simey Lameze 317bcee9e4 MDL-51347 core_notes: check view notes capability by course context 2016-11-10 11:41:24 +08:00
Tim Hunt 75ed173bac MDL-53744 question file access: fix access checks 2016-11-10 11:41:24 +08:00
Juan Leyva 396f819ce7 MDL-56065 user: Fix update_users Web Service
Users won’t be updated if:
- They are admins and the user updating is not
- They are the guest user
- They are mnet users
- They are deleted users
2016-11-10 11:41:24 +08:00
David Monllao fc701cb3a2 Merge branch 'MDL-56753-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-11-10 11:39:15 +08:00
Simey Lameze 50a9aa3202 MDL-56753 mod_assign: behat tests for groups and grouping counting 2016-11-10 11:18:18 +08:00
Simey Lameze 7733c75210 MDL-56753 mod_assign: fix groups and submitted counting on grading summary
This also fixes a coding error that was displayed when a group was not part of
assignment grouping.
2016-11-10 11:18:18 +08:00
Andrew Nicols 1d0df063a9 Merge branch 'MDL-55883_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-11-10 11:14:28 +08:00
Andrew Nicols 8faca311f1 Merge branch 'MDL-56755-m30' of https://github.com/micaherne/moodle into MOODLE_30_STABLE 2016-11-09 15:45:26 +08:00
Andrew Nicols fd8435ce92 Merge branch 'MDL-56726-30-cfgadmin' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-11-09 14:52:59 +08:00
David Monllao 4165507baf Merge branch 'MDL-56133-m30' of https://github.com/NeillM/moodle into MOODLE_30_STABLE 2016-11-09 14:24:21 +08:00
David Monllao e2d1844913 Merge branch 'MDL-53481-30-uniqsqlparam' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-11-09 12:50:20 +08:00
David Mudrák 688a698dc2 MDL-53481 availability: Fix uniqueness of SQL named param placeholders
Static variables do not behave the way you might expect when accessing
them through the classes inheritance. When accessing a method via self::
or static:: operators, even though the method is inherited, its variable
scope is not. So the method unique_sql_parameter() was using the scope
of the child class and each child class had its own sequence of usp1,
usp2, usp3, ... placeholders. This led to "Incorrect number of query
parameters" error when multiuple condition classes were contributing to
a single SQL query.

All credit should go to Adam Olley who debugged and described the
essence of the problem in the tracker.
2016-11-08 14:24:45 +01:00
Neill Magill 4152d926af MDL-56133 tool_langimport: Changes should be visible after import
Before this change if a language pack was updated by the
\tool_langimport\task\update_langpacks_task scheduled task, changes
would not be available to users until an admin manually cleared the
strings cache.

This change causes the cache to purged when a language pack it update,
this will cause it to rebuild so users will start seeing updates
automatically.
2016-11-08 10:55:48 +00:00
Dan Poltawski 218d1f0276 weekly release 3.0.6+ 2016-11-08 10:16:36 +00:00
Dan Poltawski 1b2ae4d7d3 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-11-08 10:16:35 +00:00
Michael Aherne 6ff83aa7e4 MDL-56755 assign: Improve documentation of assign::get_grade_item() 2016-11-08 09:04:25 +00:00
Andrew Nicols ab44e17338 Merge branch 'wip-MDL-56120-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-11-08 10:50:31 +08:00
David Monllao 8791b78091 Merge branch 'MDL-53718_30' of git://github.com/aolley/moodle into MOODLE_30_STABLE 2016-11-08 10:00:01 +08:00
Adrian Greeve a7f71822ff MDL-56120 calendar: Unit tests for getting events.
Added a unit test for checking that calendar_get_events
will only return events for activated activities.
2016-11-08 08:35:34 +08:00
Adrian Greeve 78303a974d MDL-56120 calendar: Fix disabled modules showing events.
calendar_get_events now checks for disabled activities
and only shows evetns for active modules.
2016-11-08 08:34:36 +08:00
Eloy Lafuente (stronk7) b9f81ce7cb Merge branch 'MDL-56765-30' of git://github.com/jleyva/moodle into MOODLE_30_STABLE 2016-11-08 01:27:58 +01:00
Russell Smith 12abdd7cbc MDL-54916 filestorage: Only write empty zip on change.
In some cases we may inspect an empty zip file. If we do open
an empty zip file, check that it changed before we attempt to write
it to disk.  It may be the case that we were reading the file from
a location that we don't have write access to.
2016-11-07 16:20:48 +01:00
Adam Olley a85576bf1a MDL-53718 badges: Dont display course badges when disabled 2016-11-07 15:58:23 +10:30
David Monllao eee689975a Merge branch 'MDL-56129-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-11-07 11:16:34 +08:00
David Monllao c641721530 Merge branch 'MDL-56731_30_STABLE' of https://github.com/tonynlin/moodle into MOODLE_30_STABLE 2016-11-07 10:45:22 +08:00
Jonathon Fowler 2688f5a4a9 MDL-56129 core: Change HTTP error code for iOS 10 video playback
This patch changes the effective response code from a 407 to a 403 when
erroring on iOS 10 and when a HTTP_X_PLAYBACK_SESSION_ID HTTP header is
found.

This causes the iOS Media framework to send the cookie with the request
which subsequently succeeds.
2016-11-07 10:01:45 +08:00
AMOS bot 4ccd9811d4 Automatically generated installer lang files 2016-11-07 00:05:02 +08:00
Juan Leyva f17db49ec6 MDL-56765 webservice: After a new session is started unset old preferences 2016-11-04 19:16:28 +00:00
Dan Poltawski 1642ba1ea3 Merge branch 'wip-MDL-54986-30' of https://github.com/Beedell/moodle into MOODLE_30_STABLE 2016-11-04 14:31:19 +00:00
Dan Poltawski fbbe6c88d6 Merge branch 'MDL-53945_30' of git://github.com/aolley/moodle into MOODLE_30_STABLE 2016-11-04 14:07:27 +00:00
Tony Lin 8d68bbd484 MDL-56731 groups: Fixes breadcrumb when returning to groups/index.php 2016-11-04 13:28:31 +00:00
Dan Poltawski 07f06046e3 weekly release 3.0.6+ 2016-11-04 11:17:55 +00:00
Dan Poltawski 32f556dda0 MDL-56673 tool_templatelibrary: fix externallib backwards compat
The function now matches the VALUE_DEFAULT option of the service.
2016-11-04 11:45:29 +01:00
Jun Pataleta efec93b8e8 MDL-46903 mod_scorm: Apply alias to compare text column 2016-11-04 14:24:07 +08:00
Andrew Nicols d556156427 Merge branch 'MDL-56673-30-fix1' of http://github.com/damyon/moodle into MOODLE_30_STABLE 2016-11-04 14:10:13 +08:00
Damyon Wiese 5644de2d37 MDL-56673 tool_templatelibrary: Don't show templates from other themes 2016-11-04 14:07:18 +08:00
David Monllao 3d9ed4ae61 Merge branch 'MDL-56748-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-11-04 13:45:49 +08:00
Andrew Nicols c5dd7b71da MDL-56748 cache: Removes cache definition instances in purge_store
Previously a purge_store was only purging caches but it was leaving a
reference to the store instance for the cache definition.

As a result, the cache was never cleared away correctly and, in cases
where the cache store makes a TCP connection to a backend system, the
number of open sockets was increasing for each store instance.

After a complete purge, as found in the unit test reset, the cache
definitions should be both purged and removed.

This change should also lead to a drop in memory consumption for unit
tests as there will no longer be references to unused definition stores.
2016-11-04 13:45:10 +08:00
David Monllao d8ff21935d Merge branch 'mdl30_MDL-46903' of https://github.com/danmarsden/moodle into MOODLE_30_STABLE 2016-11-04 08:25:04 +08:00
Adam Olley 1454c203a9 MDL-53945 mnet: Use moodle_url to provide string with url
Using moodle_url where possible is preferable to hardcoding uri's as
moodle_url is able to take care of alot of the formatting for us.

In this instance, it handles the $CFG->admin url path for us.
2016-11-04 09:13:24 +10:30
Adam Olley 3cc3a80a27 MDL-53945 mnet: replace hardcoded admin dir with cfg
Several places in admin/mnet pull in required files using a hardcoded
admin dir string, as this is configurable it needs to use $CFG->admin
instead.

Places where the url is passed through moodle_url don't need to be
updated as that already automatically translates the urls for us.
2016-11-04 09:13:23 +10:30
David Mudrák 820d389575 MDL-56726 admin: Fix hard-coded path to the admin directory 2016-11-03 10:18:45 +01:00
John Beedell 7c882f4389 MDL-54986 Quiz: Disable add button for quiz with attempts 2016-11-03 09:11:15 +00:00
Dan Marsden 7540ee5e5e MDL-46903 scorm: Fix db error in objectives report for oracle.
also improve 2004 report handling to help with testing.
2016-11-03 21:20:57 +13:00
Andrew Nicols dbda3be673 Merge branch 'MDL-56634-30' of git://github.com/ankitagarwal/moodle into MOODLE_30_STABLE 2016-11-02 14:05:28 +08:00
David Monllao 0b69e31402 Merge branch 'MDL-56323-30' of git://github.com/l-campbell/moodle into MOODLE_30_STABLE 2016-11-02 13:12:29 +08:00
Ankit Agarwal cd9927ac9f MDL-56634 webservices: clean api desc 2016-11-02 10:04:16 +05:30
David Monllao 9e4c960c39 Merge branch 'MDL-43796_30_blindmarking' of https://github.com/SWiT/moodle into MOODLE_30_STABLE 2016-11-02 12:29:14 +08:00
Andrew Nicols 8b2fb6720c Merge branch 'MDL-56673-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-11-02 12:16:28 +08:00
Stephen Bourget b25dab817e MDL-55883 mod_lesson: Missing include in lesson_update_events 2016-11-01 21:21:36 -04:00
Stephen Bourget 82907dc43b MDL-55249 mod_feedback: Associate status with current activity
The status screen in mod_feedback simply checks to see if there are any
attempts in progress to return the user status.  This check should be
limited to only include instances of the current feedback activity not
any feedback activity on the site.
2016-11-01 21:17:04 -04:00
Dan Poltawski 7c889e2f08 Merge branch 'MDL-54112-30' of https://github.com/hcpss-banderson/moodle into MOODLE_30_STABLE 2016-11-01 21:31:06 +00:00
Dan Poltawski 8976674370 Merge branch 'mdl30_MDL-47500' of git://github.com/danmarsden/moodle into MOODLE_30_STABLE 2016-11-01 21:29:34 +00:00
Dan Poltawski 99b8d0a69d Merge branch 'mdl55456-moodle30' of https://github.com/tlock/moodle into MOODLE_30_STABLE 2016-11-01 21:27:51 +00:00
Brian Barnes 468d2770c5 MDL-47500 scorm: improved height calculation 2016-11-02 08:45:43 +13:00
Eloy Lafuente (stronk7) 2ce1d2c71b weekly release 3.0.6+ 2016-11-01 19:48:05 +01:00
Dan Poltawski 3fe2093f3b MDL-56673 templatelibrary: return false when core template doesn't exist 2016-11-01 10:19:28 +00:00
Marina Glancy 9273b920e5 MDL-56615 portfolio_googledocs: add basic unittests 2016-10-31 20:35:20 +01:00
Marina Glancy 03e398154c MDL-56615 portfolio: fix php 7.0.9 warning 2016-10-31 20:34:45 +01:00
Dan Poltawski fdac7064c2 Merge branch 'MDL-56542-30-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-10-31 15:13:56 +00:00
Brendan Anderson b6ed8fdf5f MDL-54112 mod_assign: Add scale null grade filter 2016-10-27 10:09:03 -04:00
Dan Poltawski 84f1341162 weekly release 3.0.6+ 2016-10-27 12:19:32 +01:00
Dan Poltawski 6be87e8003 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-10-27 12:19:31 +01:00
Dan Poltawski 25f472d2a0 Revert "Merge branch 'MDL-56129-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE"
This reverts commit bff2510df9, reversing
changes made to e40c822a58.
2016-10-27 10:05:36 +01:00
Eloy Lafuente (stronk7) 232178eca2 Merge branch 'MDL-56354-30' of https://github.com/mr-russ/moodle into MOODLE_30_STABLE 2016-10-26 01:05:51 +02:00
Russell Smith ca99df58e2 MDL-56354 unittests: Put debug messages in the failure notice. 2016-10-26 09:27:01 +11:00
Dan Poltawski 26d01a4e56 Merge branch 'MDL-56136_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-10-25 20:44:36 +01:00
Eloy Lafuente (stronk7) 617528c5ae Merge branch 'MDL-56250-30-formvalidation' of https://github.com/roperto/moodle into MOODLE_30_STABLE 2016-10-25 20:30:47 +02:00
Helen Foster cba517e826 MDL-56542 lang: Merge English strings from the en_fix language pack 2016-10-25 20:28:40 +02:00
Eloy Lafuente (stronk7) 0fed28f9c9 Merge branch 'MOODLE_30_STABLE' of https://github.com/yuriy-os/moodle into MOODLE_30_STABLE 2016-10-25 20:00:28 +02:00
Dan Poltawski caf74fff01 Merge branch 'MDL-55143-30' of https://github.com/mr-russ/moodle into MOODLE_30_STABLE 2016-10-25 18:39:20 +01:00
AMOS bot 3e2295f008 Automatically generated installer lang files 2016-10-26 00:04:49 +08:00
David Monllao 9bfd78bafc Merge branch 'wip-mdl-56347-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-10-25 15:20:29 +08:00
Russell Smith 0dc04c49bd MDL-56347 caching: Better class variables for notices. 2016-10-25 09:53:49 +08:00
Rajesh Taneja dd705dd7ff MDL-56347 phpunit: Set class for alternative cache store
If alternative cache store is sued, then set the class
and warn user about this.
2016-10-25 09:53:28 +08:00
lazydaisy 91c9d79227 MDL-48350 theme_bootstrapbase: restyle action icons in docked blocks 2016-10-24 21:39:16 +02:00
Dan Poltawski e9f7b1bcc5 Merge branch 'wip-MDL-56439-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-10-24 14:34:11 +01:00
Lee Campbell 811856d064 MDL-56323 core_user: User profile field default value not on signup page
The default value of a configured text input user profile field is not rendering on signup page
2016-10-24 09:34:22 +01:00
David Monllao bff2510df9 Merge branch 'MDL-56129-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-10-24 12:01:19 +08:00
Andrew Nicols 638b683ac5 MDL-56129 core: Set a timeout on the session cookie
This is primarily because iOS has changed something under the hood which
means that only session cookies which have an expiry are passed around the
OS.

In order to make media playable outside of the browser (e.g. a video), we
must set a session cookie timeout.

Since the session timeout is configurable, this patch sets the cookie
timeout to the session timeout plus a period of one week.

This ensures that videos continue to work, and that the expired session
message is shown on the login page, but without requiring excessively long
session times.
2016-10-24 11:48:06 +08:00
Frédéric Massart e40c822a58 MDL-56341 mustache: JS engines handles strings wrapped in quote
Prior to the patch the strings wrapped as the following one
where not found and replaced when rendering the template via Javascript

{{#quote}}{{#str}}string,component{{/str}}{{/quote}}
2016-10-24 10:09:52 +08:00
Yuriy Osychenko b45bc1d389 MDL-53098 lib: Mark form as submitted in confirmation dialog.
If the quiz attempt use popup window with Javascript security it will
show to the user misleading message that he is going to lose entered
data.
To avoid this we should mark form as submitted to turn off browser`s
pop-up window when user confirms finishing attempt.
Also we need to check if core_formchangechecker is present on a page.
2016-10-24 00:43:27 +03:00
Daniel Thee Roperto 511b478297 MDL-56250 forms library: Changed form to validate once per object.
If two instances of moodleforms are validated in the same run, most
likely a phpunit test run, it would store the first validation result.
Now it stores the validation result per instance, not for all instances.
2016-10-21 10:38:47 +11:00
Eloy Lafuente (stronk7) 3d13576463 weekly release 3.0.6+ 2016-10-20 17:52:41 +02:00
Eloy Lafuente (stronk7) bf7e998500 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-10-20 17:52:37 +02:00
Andrew Nicols 6fdcba2544 Merge branch 'MDL-56328_30-fix-rtl' of git://github.com/dmonllao/moodle into MOODLE_30_STABLE 2016-10-19 13:30:37 +08:00
David Monllao 7f5f314977 MDL-56328 theme: Remove RTL styles
They should only be applied while editing mode is on
2016-10-19 12:43:29 +08:00
Eloy Lafuente (stronk7) 8d6eaed3b7 Merge branch 'MDL-29774-30-by-sam-wilson' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-10-18 17:34:56 +02:00
Andrew Nicols e904f8c075 MDL-55858 mod_forum: Remove subscription links when not relevant
When a forum is force-subscribed or subscription is disabled, do not
include the subscription link in forum posts.
2016-10-18 17:01:13 +02:00
Dan Poltawski 9f4f53f699 Merge branch 'MDL-56131-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-10-18 13:44:41 +01:00
Dan Poltawski 02cba0b682 Merge branch 'MDL-56062-30' of https://github.com/lucisgit/moodle into MOODLE_30_STABLE 2016-10-18 12:06:59 +01:00
Eloy Lafuente (stronk7) f9d95d9ed9 Merge branch 'MDL-56275-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-10-18 12:13:25 +02:00
Dan Poltawski 26bf333277 MDL-56275 blog: do not display the 'choose a link' button
When registereing an external blog the choose a link button is
misleading, we don't have any repos which restrict to RSS feeds, so the
majority of results you get from the repo picker will be wrong.
2016-10-18 11:09:14 +01:00
David Monllao 48bc44477d Merge branch 'MDL-56328-M30' of git://github.com/lazydaisy/moodle into MOODLE_30_STABLE 2016-10-18 16:08:00 +08:00
Eloy Lafuente (stronk7) 959cb13aad Merge branch 'MDL-56345-30' of https://github.com/lucisgit/moodle into MOODLE_30_STABLE 2016-10-18 09:38:57 +02:00
Tim Lock 533e6018c6 MDL-55456 course: set context for category ajax requests 2016-10-18 12:51:54 +10:30
Sam Wilson 89b8a5c82f MDL-29774 core_user: Update group-membership summaries on AJAX calls 2016-10-18 09:36:09 +08:00
Eloy Lafuente (stronk7) b7108061a4 Merge branch 'wip-mdl-56348-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-10-18 01:10:41 +02:00
Russell Smith 49235cdd85 MDL-55143 unittests: Check the db rather than cache for version hash. 2016-10-18 09:53:38 +11:00
Eloy Lafuente (stronk7) a1e14a55db Merge branch 'MDL-56368-M30' of git://github.com/lazydaisy/moodle into MOODLE_30_STABLE 2016-10-18 00:38:59 +02:00
Michael Aherne 0822adfe49 MDL-56131 choice: Set maximum lifetime for lock 2016-10-17 13:51:22 +08:00
AMOS bot 4079f3ad90 Automatically generated installer lang files 2016-10-17 00:06:59 +08:00
Matthew Switlik b90aa9570a MDL-43796 assign: Reset revealidentities on restore
Set revealidentities to 0 when restoring, importing, or duplicating an
assignment activity with blindmarking on and no user data.
2016-10-14 14:22:33 -04:00
AMOS bot ea69caa2d6 Automatically generated installer lang files 2016-10-15 00:04:57 +08:00
lazydaisy c5b6b52432 MDL-56368 theme_bootstrapbase: Settings for Restrict Access not inline. 2016-10-14 15:55:12 +01:00
lazydaisy 3de493704b MDL-56328 theme_bootstrapbase: reduce activity indent when not editing 2016-10-14 15:27:05 +01:00
Marina Glancy e6885a4e71 MDL-56439 course: added missing require 2016-10-14 08:21:29 +08:00
Eloy Lafuente (stronk7) 3292e36a21 weekly release 3.0.6+ 2016-10-13 20:02:28 +02:00
Eloy Lafuente (stronk7) f330c27f67 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-10-13 20:02:25 +02:00
Eloy Lafuente (stronk7) 3ac6d35915 Merge branch 'MDL-56319-m30' of https://github.com/micaherne/moodle into MOODLE_30_STABLE 2016-10-13 19:47:02 +02:00
Tony Butler f83d4ceb24 MDL-56345 assignfeedback_editpdf: Use correct strings for tool alt text 2016-10-13 10:09:17 +01:00
Tony Butler 003699dba4 MDL-56062 mod_assign: Use $gradeitem->get_decimals() for grade display 2016-10-12 20:57:41 +01:00
AMOS bot 5ac7b30bd3 Automatically generated installer lang files 2016-10-12 00:05:16 +08:00
Paul Holden 6ce2b2b141 MDL-55345 user: correct userid when linking to iplookup from profile 2016-10-11 17:06:54 +02:00
Janek Lasocki-Biczysko 81c5d47c2a MDL-51401 enrol: ensures correct order of roles in UI components
Role sort order was not available in the UI (in JavaScript) due to
the use of PHP assoc arrays and JSON encoding/decoding. This patch
addresses this by sending the roles in a json array, rather than
json object.
2016-10-11 18:01:56 +08:00
David Monllao 6d9c397d37 Merge branch 'MDL-52051-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-10-11 17:11:58 +08:00
Dan Poltawski 61a12d418e Merge branch 'MDL-36611-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-10-11 08:53:49 +01:00
Rajesh Taneja 67a20af671 MDL-56348 cache: Removed second parameter
There is no second parameter in the api
and identifier should be set by set_identifiers
2016-10-11 12:51:58 +08:00
Andrew Nicols a107243c61 MDL-52051 repository_dropbox: Add the V2 API 2016-10-11 11:45:44 +08:00
Kirill Astashov aa8d361b83 MDL-36611 outcome: Set page context when editing outcome 2016-10-11 10:02:01 +08:00
Eloy Lafuente (stronk7) 46da0ff5a5 Merge branch 'MDL-56220-m30' of https://github.com/micaherne/moodle into MOODLE_30_STABLE 2016-10-11 01:18:50 +02:00
Eloy Lafuente (stronk7) 36eebecef6 Merge branch 'MDL-56316-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-10-10 18:18:41 +02:00
Eloy Lafuente (stronk7) bc6a3998b9 Merge branch 'MDL-51633_M30' of git://github.com/lazydaisy/moodle into MOODLE_30_STABLE 2016-10-10 17:49:10 +02:00
Simey Lameze 0fd4fe4fb3 MDL-56050 core: set missing context to maintenance mode 2016-10-10 23:15:28 +08:00
Andrew Nicols 015729e746 MDL-52051 repository_dropbox: Move v1 API aside 2016-10-10 20:34:13 +08:00
Andrew Nicols 72de799d7b MDL-52051 oauth: expires_in is optional 2016-10-10 20:34:13 +08:00
Dan Poltawski 30078d7b9d Merge branch 'MDL-51584-30' of https://github.com/mr-russ/moodle into MOODLE_30_STABLE 2016-10-10 13:27:05 +01:00
Dan Poltawski 5de9f1c0d3 Merge branch 'MDL-55597-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-10-10 11:33:15 +01:00
Michael Aherne ce4ef5bd79 MDL-56319 blocks: Observe empty default blocks setting 2016-10-10 09:55:21 +01:00
Russell Smith dbff7477aa MDL-51584 gradebook: use direct $CFG access for freeze.
get_config() is called a lot of times on freeze and is expensive,
using $CFG is much lower overhead.
2016-10-10 15:43:22 +11:00
AMOS bot c02fd57da7 Automatically generated installer lang files 2016-10-09 00:06:33 +08:00
lazydaisy 8a5e17b2e1 MDL-51633 theme_bootstrapbase: Restyled ADD BLOCK to remove max-width. 2016-10-07 18:58:18 +01:00
AMOS bot f608a42e09 Automatically generated installer lang files 2016-10-08 00:05:07 +08:00
Frédéric Massart 6da1369913 MDL-55597 tool_templatelibrary: Re-inforce logic to skip theme templates 2016-10-07 10:44:40 +02:00
Andrew Nicols ef8da7069e MDL-56316 tests: Ensure consistent assertion count 2016-10-07 14:46:30 +08:00
Eloy Lafuente (stronk7) 7223cd2518 weekly release 3.0.6+ 2016-10-06 22:31:34 +02:00
Dan Poltawski 4be702669b MDL-56303 quiz: lack of quiz filtering
Also, correctly feed completiongradeitemnumber with grade item numbers
and not with grade item ids.
2016-10-06 22:20:09 +02:00
Eloy Lafuente (stronk7) 98648c4242 weekly release 3.0.6+ 2016-10-06 11:51:37 +02:00
Eloy Lafuente (stronk7) cc59a3e2af Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-10-06 11:51:33 +02:00
Dan Poltawski 075f978ba2 Merge branch 'MDL-54802-30-fix-2' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-10-05 14:33:53 +01:00
Cameron Ball 331613ddb1 MDL-54802 mod_quiz: Improve validation when editing a quiz uusing require passing grade
When editing a quiz that is using the require passing grade completion method,
the grade to pass cannot be zero. Since the completion method is locked we
cannot recommend that the completion method is changed (as we do when the quiz
is being created). Instead we have to inform the user that the grade to pass
must not be zero.
2016-10-05 19:32:13 +08:00
Dan Poltawski 41d5e39323 Merge branch 'MDL-54802-30-fix' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-10-05 10:33:52 +01:00
Cameron Ball 7455f7d100 MDL-54802 mod_quiz: Move grade to pass error to require passing grade element
When using a passing grade of zero, with the required passing grade
option, an error was displayed on the "grade to pass" element.
This was confusing as the error message is referring to the
"Require passing grade" element. This patch moves the message to
the "Require passing grade" element.

Additionaly this patch fixes a small typo in a comment.
2016-10-05 17:17:56 +08:00
Rajesh Taneja 7d36214618 MDL-56210 behat: Pending and complete js is added by js_init_code 2016-10-05 15:46:51 +08:00
Eloy Lafuente (stronk7) a231d66dec Merge branch 'MDL-56231-30-flexible_table-construct-phpdoc' of https://github.com/roperto/moodle into MOODLE_30_STABLE 2016-10-05 01:49:18 +02:00
AMOS bot 21a20a0a65 Automatically generated installer lang files 2016-10-05 00:06:43 +08:00
Dan Poltawski 5885ba383a Merge branch 'MDL-55861_30_STABLE' of https://github.com/dj4452/moodle into MOODLE_30_STABLE 2016-10-04 15:44:06 +01:00
Eloy Lafuente (stronk7) 9416c59e47 Merge branch 'MDL-56069_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-10-04 16:37:50 +02:00
Michael Aherne 9fe421f29e MDL-56220 cache: Call static method correctly 2016-10-04 15:03:23 +01:00
Andrew Nicols 4e2770b175 Merge branch 'MDL-55886-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-10-04 11:22:40 +08:00
Dan Poltawski 620ca55842 Merge branch 'MDL-56181-30-czechia' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-10-03 16:43:57 +01:00
Dan Poltawski 754c41eb9f Merge branch 'MDL-52317-m30' of https://github.com/NeillM/moodle into MOODLE_30_STABLE 2016-10-03 16:09:46 +01:00
Dan Poltawski 8edc190aae MDL-54802 quiz: fix bad whitespace 2016-10-03 14:47:21 +01:00
Dan Poltawski df42740f33 Merge branch 'MDL-54802-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-10-03 14:47:17 +01:00
Andrew Nicols 1b5cc6c463 Merge branch 'MDL-55421-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-10-03 19:49:43 +08:00
Dan Poltawski 3aebea76e0 Merge branch 'wip-MDL-55911-30' of https://github.com/Beedell/moodle into MOODLE_30_STABLE 2016-10-03 10:24:57 +01:00
David Monllao 223378c332 Merge branch 'wip-mdl-56210-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-10-03 13:53:55 +08:00
Daniel Thee Roperto 3320df92f5 MDL-56231 library: Fixed PhpDoc for flexible_table constructor.
The flexible_table::__construct($uniqueid) accepts a string, not an int
as previously noted in the PhpDoc.
2016-10-03 16:05:09 +11:00
Neill Magill 8e2d2046c1 MDL-52317 Atto: Large resized images may display scroll bars
When an image was added via Atto and it was set to resize automatically
if the alignment was set to Top, Middle or Bottom when it was made
smaller then a vertical scroll bar would be displayed.

This was caused by the interaction of the margin settings on the image
and the 100% width set via the img-responsive css class. The width of
an element only includes the content area and not any borders, padding
or margins.

This change stops atto hardcoding the styles for image alignment into
the images style tag, it instead adds a class that defines the alignment
the image should have.

This change has the benefit that themers will now be able to adjust
how atto image alignments work if they wish.

Images added before this patch will continue to have the issue
until they are edited by the plugin, at which time their legacy style
will be removed and the new alignment method will be added.

Thanks to Andrew Nicols who provided a refactor for the Alignment
and style detection code.
2016-09-30 08:51:31 +01:00
Rajesh Taneja 4e9f6420ff MDL-56210 behat: Ensure behat waits for dependancy manager 2016-09-30 10:33:30 +08:00
Dan Poltawski 71d9056aef MDL-55886 block_rss_client: fix oracle compatibility 2016-09-29 16:59:53 +01:00
Deepa Jayaprakash 411fdd46c5 MDL-55861 course: Click drag&drop icon, incorrect activities shown 2016-09-29 16:47:52 +01:00
Dan Poltawski 2a6ac3f844 MDL-55421 travis: check npm/grunt on multiple npm versions
This is a backport of the patch from MDL-55048

Check npm install and grunt execution on the higest and lowest node
versions. Included some minor tweaks along the way:

* Move the grunt execution into scripts part of the configuration (that way
  the grunt output is not collapsed and is easily visible in build output).

* Restructure the install section to be task based (thanks to Eloy for
  the suggestion) and as such, don't run composer install on the grunt
  task (speed up the build slightly).

* Switch around the grunt job to a matrix include so that every
  variation of grunt job doesn't need to be excluded.
  ( https://docs.travis-ci.com/user/customizing-the-build/#Explicity-Including-Jobs )
2016-09-29 16:43:27 +01:00
Dan Poltawski a30b21e86f MDL-55421 js: add some global ignores to js files
This is to prevent linting to be extremely noisy about rollup related
problems.

Should not affect built files.
2016-09-29 16:43:27 +01:00
Dan Poltawski 08f8ff9ffc MDL-55421 eslint: add config/package defintion
Partial backport of MDL-52127 to allow people to use eslint linting
in earlier branches than master.

This is an earlier version of eslint than in master beacuse of
node requirements being higer.
2016-09-29 16:43:27 +01:00
Eloy Lafuente (stronk7) 59fac4cf16 MDL-56127 forms: multiple select dependencies fixed
This is a fix for a regressions introduced by MDL-54778. It
seems that escaped all our tests because there isn't any case
of such a dependency in core, but Daniele Cordella was facing
it within his surveypro module.
2016-09-29 16:52:51 +02:00
Dan Poltawski 43f53ff0f5 weekly release 3.0.6+ 2016-09-29 12:42:58 +01:00
Dan Poltawski f9de835157 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-09-29 12:42:56 +01:00
David Mudrák daa9b4d3c2 MDL-56181 lang: Fix CI and CZ country short names to match ISO 3166 2016-09-29 11:53:11 +02:00
Eloy Lafuente (stronk7) 895b108ff1 Merge branch 'MDL-55804_30' of git://github.com/dmonllao/moodle into MOODLE_30_STABLE 2016-09-29 01:14:49 +02:00
Eloy Lafuente (stronk7) 0de90550dc Merge branch 'MDL-56019-30' of git://github.com/dpalou/moodle into MOODLE_30_STABLE 2016-09-28 20:08:48 +02:00
Dan Poltawski d1b6cf4333 Merge branch 'MDL-56038-m30' of https://github.com/sammarshallou/moodle into MOODLE_30_STABLE 2016-09-28 14:42:49 +01:00
Eloy Lafuente (stronk7) 1c6999087f MDL-46946 user: Document user_not_fully_set_up() changes 2016-09-28 02:23:21 +02:00
Eloy Lafuente (stronk7) 527dc0ce02 Merge branch 'MDL-46946-30-reqcusfield' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-09-28 02:22:03 +02:00
Rajesh Taneja 20a8c2e9c2 MDL-55957 behat: Set some text before selecting in Atto 2016-09-28 01:42:25 +02:00
Eloy Lafuente (stronk7) e1043b0311 Merge branch 'MDL-55951-30' of git://github.com/crazyserver/moodle into MOODLE_30_STABLE 2016-09-28 00:11:43 +02:00
Tim Hunt ff085ba20b MDL-56136 restore: better error handling copying file at start 2016-09-27 18:10:13 +01:00
Tim Hunt 14f75eda28 MDL-56069 quiz: nav buttons don't scroll to the right question
When there is more than one question on a page, say questions 2, 3 & 4.
Then when you click the navigation button for Q4, then it should load
the next page scrolled down so that Q4 is visible. That was not working.
2016-09-27 17:57:51 +01:00
AMOS bot 5b99ccb9e3 Automatically generated installer lang files 2016-09-28 00:04:54 +08:00
Jean-Philippe Gaudreau cd9cf364a1 MDL-56040 behat: Fixing missing "|" in tables 2016-09-27 14:58:03 +01:00
Dan Poltawski 875ee59a5a Merge branch 'MDL-55987-30-grademem' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-09-27 11:23:48 +01:00
Dan Poltawski 96de3cf711 Merge branch 'MDL-55957-30-workshopfiles' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-09-27 10:37:29 +01:00
David Monllao 750a1815b1 MDL-55804 tool_uploadcourse: strftime only to user input
Default value already comes as a timestamp.
2016-09-27 08:12:16 +08:00
David Monllao aca1dc1b63 MDL-55804 forms: Return exported data through _prepareValue 2016-09-27 08:12:16 +08:00
AMOS bot 40b98690ed Automatically generated installer lang files 2016-09-24 00:04:52 +08:00
John Beedell 4296f2b9da MDL-55911 Quiz: Accessibility, Label blanks in DD questions 2016-09-23 13:46:39 +01:00
Eloy Lafuente (stronk7) 1de74443af weekly release 3.0.6+ 2016-09-23 10:01:39 +02:00
Eloy Lafuente (stronk7) 2073c4871b Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-09-23 10:01:35 +02:00
AMOS bot b0a3467e82 Automatically generated installer lang files 2016-09-23 00:04:56 +08:00
Simey Lameze 9283ca1850 MDL-54802 mod_quiz: Add validation to require passing grade greater than 0
This commit adds a form validation to prevent the creation of quizzes
using zero or null grade to pass when using require passing grade.
2016-09-22 08:57:48 +08:00
David Mudrák d0f7cefec6 MDL-46946 user: Make missing required custom fields trigger profile edit
If there is a required custom field that the user can fill by editing
their profile, and that field is missing, the user should be considered
as not fully set up. Instead, we want to redirect them to edit their
profile first.

There are some exceptions when we want to fall back to the previous
behaviour and check just the name and email fields. These exceptional
cases include checking remote user data in incoming MNet request (no
user id, no custom fields supported) and calls to require_login() with
redirecting disabled (typically ajax filepicker requests on profile
editing page itself).

Additional plugins that call the function user_not_fully_set_up()
themselves, should perform the strict check in most/typical cases. So
the strict mode is enabled by default even if it changes the behaviour
slightly. In improbable case of additional plugins relying on the
previous behaviour of the function, they can use the $strict parameter
and keep performing the lax check. However, I am sure the correct fix in
that case will likely be to stop abusing this function.

Note that custom fields are not currently transferred during the MNet
roaming. So having custom fields configured as required on MNet service
provider site (where users can't edit their profiles) is expected to
display an error (as the site is considered as misconfigured).
2016-09-21 18:05:06 +02:00
sam marshall 08e3be8806 MDL-56038 Web services: json_last_error_msg not in PHP 5.4 2016-09-20 14:53:46 +01:00
Andrew Nicols 93c60b87e4 Merge branch 'MDL-55876-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-09-20 09:12:01 +08:00
Simey Lameze cdd3def5b6 MDL-55876 core_course: prevent changes on front page course 2016-09-20 08:52:14 +08:00
Ruslan Kabalin bfe06f7600 MDL-55776 enrol: Optimise enrolled users listing.
Here we optimise SQL queries for enrolled users list. Expensive subquery is
replaced with faster LEFT JOIN and the whole groups filtering component is
aded on demand.
2016-09-19 23:48:41 +02:00
Ruslan Kabalin 3df86df503 MDL-55776 enrol: Add unit tests for enrolment manager. 2016-09-19 23:48:35 +02:00
AMOS bot b733fa7055 Automatically generated installer lang files 2016-09-20 00:04:51 +08:00
Dan Poltawski d989883024 Merge branch 'MDL-55988_30_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_30_STABLE 2016-09-19 12:08:55 +01:00
Dan Poltawski 8c90381a31 Merge branch 'wip-mdl-55117-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-09-19 11:39:44 +01:00
Dan Poltawski fdd56d83e3 Merge branch 'm30_MDL-55820' of git://github.com/danmarsden/moodle into MOODLE_30_STABLE 2016-09-19 11:32:21 +01:00
Dan Poltawski e5c03946e7 Merge branch 'MDL-55944_30' of https://github.com/mr-russ/moodle into MOODLE_30_STABLE 2016-09-19 11:28:27 +01:00
Eloy Lafuente (stronk7) 350b6ce426 MDL-29332 versions: Force bump becuase patch ones were matching upstream 2016-09-19 12:03:49 +02:00
Eloy Lafuente (stronk7) b11daeca71 Merge branch 'wip-MDL-29332-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-09-19 12:02:46 +02:00
Dani Palou d6fd5d362f MDL-56019 ws: Use itemid null when getting modules intro 2016-09-19 11:48:20 +02:00
David Monllao 8a1a0bbbaf Merge branch 'MDL-42041-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-09-19 15:09:38 +08:00
AMOS bot ecc07981ad Automatically generated installer lang files 2016-09-17 00:04:59 +08:00
Russell Smith 115f9cc02a MDL-55602 session: Add redis handler with locking.
Backport of MDL-54606
2016-09-16 08:15:30 -07:00
Mark Johnson a4a2d1edd0 MDL-55988 Forms: Stop autocomplete triggering warning on unload
Prevents autocomplete fields marking a form "dirty" when initialised,
and allows them to honour the "ignoredirty" class.
2016-09-16 13:09:05 +01:00
David Mudrák 6ff87b25d4 MDL-55987 gradebook: Claim extra memory when updating final grades
As we experienced in a bigger moodle.org course (7500 users, 70 grade
items), the standard memory limit 256M may not be enough here. We were
not able to find any obvious memory leak in the processing. Requiring
extra memory helped in this particular case and it seems reasonable to
have it in the core.
2016-09-16 12:49:51 +02:00
AMOS bot 20c207639a Automatically generated installer lang files 2016-09-16 00:05:26 +08:00
Dan Poltawski cb3b8c222e weekly release 3.0.6+ 2016-09-15 11:15:01 +01:00
David Monllao be08c8a7de Merge branch 'MDL-55945-30' of https://github.com/snake/moodle into MOODLE_30_STABLE 2016-09-15 12:39:01 +08:00
Jake Dallimore fe096488fe MDL-55945 login: fix https support for forgot_password.php 2016-09-15 09:22:41 +08:00
David Mudrák 01ffc90d90 MDL-55957 workshop: Add behat tests for embedded images
This tests basic functionality of the images embedded into the
instructions and conclusion fields.
2016-09-14 14:38:04 +02:00
David Mudrák 3c215fa3d2 MDL-55957 workshop: Fix the embedded files serving
There was a bug with serving the files from the areas instructauthors,
instructreviewers and conclusion. These three areas should not use the
itemid in the plugininfo URLs. But they did use 0 as the itemid which
broke the file previews when browsing via server files repository.

The first part of the patch fixes all relevant calls to
file_rewrite_pluginfile_urls() so that null is now properly used instead
of zero.

The second part of the fix is that we no longer delete the first $args
element in the workshop_pluginfile() function - the itemid is not
supposed to appear there now.

The last part of the patch is that instead of repeating the same code
block copy&pasted for each file area in workshop_pluginfile(), we now
have a single block covering them all.
2016-09-14 12:43:24 +02:00
Rajesh Taneja d7c33a1392 MDL-55117 behat: Re-initialise to ensure modified config is not used
As behat cli process is 1 run for features
Any modification in  will be reflected
in later runs on cli. In this case
- disabling enablebadges in block_badges.feature
- reflected while running cron in award_badges.feature
2016-09-14 10:47:15 +08:00
Russell Smith 85efc6975a MDL-55944 testing: Reduce sleep usage.
Remove sleep() and replace with waiting for a second to roll over,
this results in a simpler call the guarantee time() has moved forward
2016-09-14 10:26:14 +10:00
Marina Glancy 789b0b62c3 MDL-55864 general: fix PHP7.1 strict warnings 2016-09-13 15:24:17 +01:00
Pau Ferrer Ocaña 078d007b87 MDL-55951 output: Add errorcode to fatal_error when available 2016-09-13 15:30:25 +02:00
Adrian Greeve 43e6d24c87 MDL-55505 mod_assign: Fix to feedback behat test. 2016-09-13 11:16:07 +08:00
Marina Glancy bc48debf36 MDL-29332 question: calculated variables may differ in case only 2016-09-13 10:15:26 +08:00
Eloy Lafuente (stronk7) 76b676b929 Merge branch 'wip-MDL-55505-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-09-12 19:26:36 +02:00
Eloy Lafuente (stronk7) 03eab92866 Merge branch 'wip-MDL-55654-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-09-12 19:16:08 +02:00
Eloy Lafuente (stronk7) 71bea77b6a Merge branch 'MDL-55632-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-09-12 19:03:37 +02:00
Eloy Lafuente (stronk7) d4b14d6298 Merge branch 'MDL-55874-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-09-12 18:32:45 +02:00
Dan Poltawski d357ee7039 Merge branch 'wip-mdl-55353-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-09-12 11:49:38 +01:00
Dan Poltawski be27606bf1 Merge branch 'wip-MDL-55862-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-09-12 11:11:28 +01:00
Dan Poltawski 5a9d8d48ca Merge branch 'wip-mdl-55610-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-09-12 10:18:20 +01:00
David Monllao 16c89550d8 Merge branch 'MDL-55626-M30' of git://github.com/lazydaisy/moodle into MOODLE_30_STABLE 2016-09-12 12:39:15 +08:00
David Monllao 1e95a37cf3 Merge branch 'MDL-53893-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-09-12 10:29:43 +08:00
Eloy Lafuente (stronk7) b022c2cd1c Moodle release 3.0.6 2016-09-10 22:50:18 +02:00
lazydaisy be50133b45 MDL-55626 theme_clean: Fixed clean theme missing desktop-first-column 2016-09-10 01:24:12 +01:00
Marina Glancy 7416cc5d48 MDL-55654 user: apply format_string to field names 2016-09-09 14:31:51 +08:00
Rajesh Taneja 65c0e2b9b4 MDL-55353 behat: Ensure teacher edit activity at different time
Recent activity is showing activities which were
updated since user last logged in and first modification
done on the activity. So ensure update happens at different
time than activity created.
2016-09-09 10:17:18 +08:00
Simey Lameze 95c919d651 MDL-53893 core_badges: Behat for all selected roles award badges 2016-09-09 08:44:22 +08:00
Simey Lameze 8dcf12afdc MDL-53893 core_badges: Add strictness to manual badge criteria 2016-09-09 08:44:22 +08:00
Adrian Greeve 598e62100c MDL-55505 mod_assign: Editing previous attempt works correctly.
Editing a previous attempt keeps the current feedback and grades
as it should and does not override them.
2016-09-08 20:33:22 +08:00
Adrian Greeve e9bf5a3998 MDL-55862 mod_data: Use proper name function for display.
The old method for displaying the name of a field was being
used. This meant that it was not possible to show a plugin's
name in view.php

Thanks to David Herney Bernal for providing a solution.
2016-09-08 20:30:00 +08:00
Dan Poltawski be4e216e6b MDL-55874 report_particiption: fix invalid html
When messaging disabled.
2016-09-08 08:05:06 +01:00
David Monllao 04b0feca62 weekly release 3.0.5+ 2016-09-08 13:56:37 +08:00
Adrian Greeve 8b61a6a338 MDL-41174 course: Update calendar events.
Updates calendar events when the activity name is changed.
2016-09-07 14:17:05 +08:00
Jake Dallimore f9c8cef1a4 MDL-50803 login: Remove token from URL in forgot password process
Store the token value in the session and redirect to self, thus
removing the token from the URL and eliminating the problem where
the token is exposed via the http referer header.
2016-09-06 22:22:25 +08:00
Juan Leyva d80dbeb289 MDL-49026 webservice: Remove tokens on password change 2016-09-06 22:22:25 +08:00
Eloy Lafuente (stronk7) 5b33ea8f59 Merge branch 'MDL-55618-m30' of https://github.com/NeillM/moodle into MOODLE_30_STABLE 2016-09-06 16:20:51 +02:00
Eloy Lafuente (stronk7) f38037357a Merge branch 'wip-MDL-55844-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-09-06 16:08:31 +02:00
Dan Poltawski 03200f984e Merge branch 'MDL-42125_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-09-06 11:48:52 +01:00
Dan Poltawski e4a959503b Merge branch 'wip-mdl-55749-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-09-06 08:46:09 +01:00
Andrew Nicols aaf50eed5d MDL-42041 mod_book: Add Turn Editing On to page body 2016-09-06 15:39:44 +08:00
Rajesh Taneja b6c2b6e0f6 MDL-55749 badges: define global before using it 2016-09-06 10:29:03 +08:00
David Monllao 2e77fffa31 Merge branch 'MDL-55617-m30' of https://github.com/NeillM/moodle into MOODLE_30_STABLE 2016-09-06 10:18:25 +08:00
David Monllao ef8d67664b Merge branch 'MDL-55587-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-09-06 10:07:21 +08:00
Rajesh Taneja 9074566c1d MDL-55610 behat: Clear static file cache
php file cache might be out-of-sync
to ensure full directory is deleted
clear php file cache
2016-09-06 09:44:20 +08:00
Eloy Lafuente (stronk7) 9c238c8e25 Merge branch 'MDL-55663-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-09-05 18:07:27 +02:00
Eloy Lafuente (stronk7) d5e3b4879e Merge branch 'MDL-55724-m30' of https://github.com/sammarshallou/moodle into MOODLE_30_STABLE 2016-09-05 17:33:54 +02:00
Dan Poltawski 7b6f134c96 Merge branch 'MDL-55627_30' of https://github.com/bostelm/moodle into MOODLE_30_STABLE 2016-09-05 14:09:15 +01:00
Dan Poltawski b350178a7c Merge branch 'MDL-55742-30' of https://github.com/xow/moodle into MOODLE_30_STABLE 2016-09-05 10:50:47 +01:00
Henning Bostelmann dbf9bf0dab MDL-55627 filter_mathjaxloader: use correct string concatenation op 2016-09-05 11:43:16 +02:00
Dan Poltawski cab725229c Merge branch 'MDL-55771_m30' of git://github.com/markn86/moodle into MOODLE_30_STABLE 2016-09-05 10:18:52 +01:00
Dan Poltawski 2087df46f6 Merge branch 'MDL-55815_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-09-05 08:57:38 +01:00
Dan Poltawski bc82c260b8 Merge branch 'MDL-54113-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-09-05 07:53:07 +01:00
David Monllao 8902327ac9 Merge branch 'wip-MDL-41174-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-09-05 13:46:12 +08:00
Adrian Greeve 39aa2988b3 MDL-41174 course: Module name change updates calendar. 2016-09-05 08:59:02 +08:00
Marina Glancy f09f5a3c88 MDL-55844 profile: display formatted course name 2016-09-02 18:05:12 +08:00
John Okely ac8e288f11 MDL-55457 mod_lti: Support object icon_info in tool proxy 2016-09-02 09:46:40 +08:00
Tim Hunt 3ab94015bb MDL-42125 quiz stats: clearer message when manual grading required 2016-09-01 12:36:00 +01:00
Neill Magill 21fcfae6b7 MDL-55617 backup: Possible fatal errors in backup and restore
The unserialize() function will not always return an object
especially when as can happen the controller field of a
record in the backup_controllers table is empty.

This change ensures that in this case the script will
not cause a fatal error, but instead throw an error.
2016-09-01 08:50:16 +01:00
Neill Magill cb9594a285 MDL-55618 backup: Header should not be output twice
Before this patch if the pre-check failed during
the final stage of an import a request for the
page header to be output was made for a second
time, this caused a coding_error to occur.

This change removes the second request to
output the page header, which will allow the user
to see the reasons the pre-check failed.
2016-09-01 08:48:55 +01:00
John Okely 99f6caea55 MDL-55742 mod_lti: Remove support for get_magic_quotes_gpc
Thanks to Bishop Bettini for the original patch.
2016-09-01 15:00:05 +08:00
David Monllao 4846a96518 weekly release 3.0.5+ 2016-09-01 11:14:08 +08:00
David Monllao 258d8124ed Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-09-01 11:14:06 +08:00
Dan Marsden e46c306d8e MDL-55820 scorm: use correct displayattempt default options 2016-09-01 13:30:33 +12:00
Tim Hunt 9ad7051878 MDL-55815 quiz review: after close should beat immediately after
This only arises in specific situations: student submitted less than 2
mintues before time close, or when a teacher previews after the close
date. However, in those cases, the old behaviour was confusing. Now,
'After the quiz is closed' takes priority.
2016-08-31 13:00:25 +01:00
Tim Hunt 75ca17683b MDL-55815 quiz: convert attempt state tests to a data provider 2016-08-31 13:00:24 +01:00
Eloy Lafuente (stronk7) 4a59ad1168 Merge branch 'MDL-55237_30' of git://github.com/dmonllao/moodle into MOODLE_30_STABLE 2016-08-30 12:55:03 +02:00
sam marshall 599e1a877b MDL-55724 Glossary: Prevent infinite loop in trusttext_strip 2016-08-30 10:32:00 +01:00
Mark Nelson e13382cd6b MDL-55771 core: added title attribute when using JS to render {{pix}} 2016-08-30 14:58:57 +08:00
Marina Glancy c6adb42063 MDL-55581 htmlpurifier: test for attributes in video tag 2016-08-30 13:49:57 +08:00
Frederic Massart df248aab58 MDL-55663 filter: Filters could be incorrectly reported as inactive 2016-08-30 11:23:18 +08:00
David Mudrák 302d9fea73 MDL-55660 tablelib: Fetch only a single row when auto defining columns
In a very rare cases where the columns are not declared explicitly, we
want to fetch single row only without a warning raised. This seems like
a valid use case for IGNORE_MULTIPLE flag.
2016-08-29 19:14:19 +02:00
AMOS bot 6721af2ec4 Automatically generated installer lang files 2016-08-30 00:05:12 +08:00
Eloy Lafuente (stronk7) 5096a6d39d Merge branch 'MDL-55667-30-participantslink' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-08-29 16:54:04 +02:00
Eloy Lafuente (stronk7) 5997c8775d Merge branch 'MDL-55741_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-08-29 14:08:54 +02:00
Cameron Ball a7085963b5 MDL-55587 core_media: Properly escape ampersand 2016-08-29 19:16:37 +08:00
David Mudrák 9dc0baedfa MDL-55667 navigation: Do not display site participants link to students
The problem here was that user/index.php checks the system level
capability moodle/site:viewparticipants when the user is on the front
page, and the moodle/course:viewparticipants on non-front pages.

But the navigation displayed the link by mistake even in situations,
when the user has the capability moodle/course:viewparticipants on the
front page (typically when the default role for the front page is set to
student).

Added behat tests for reproducing the bug and also for checking the
basic functionality of the feature.
2016-08-29 12:11:53 +02:00
David Monllao 12ed0259b6 Merge branch 'wip-MDL-55581-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-08-29 16:54:29 +08:00
David Monllao 092fecd7be Merge branch 'MDL-55661-30-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-08-29 14:40:50 +08:00
David Monllao 22a42d5093 Merge branch 'MDL-55312_load_timeout_for_amd_modules_30' of https://github.com/gthomas2/moodle into MOODLE_30_STABLE 2016-08-29 14:31:59 +08:00
Marina Glancy 4496863cfd MDL-55581 htmlpurifier: allow track tag in videos and audios 2016-08-29 13:26:24 +08:00
David Monllao f2a7331dca Merge branch 'wip-MDL-55708-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-08-29 11:19:15 +08:00
David Monllao 443dcc00c3 Merge branch 'MDL-55477_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-08-29 11:14:36 +08:00
David Monllao abac5252aa MDL-55237 mod_forum: Adding missing require as in 31 and master 2016-08-29 10:11:06 +08:00
Tim Hunt affe326f23 MDL-55741 phpunit: does not reset get_log_manager cache 2016-08-26 17:15:40 +01:00
AMOS bot f451db08d4 Automatically generated installer lang files 2016-08-27 00:05:01 +08:00
Helen Foster ab71d16bd8 MDL-55661 lang: Merge English strings from the en_fix language pack 2016-08-25 14:41:55 +02:00
Dan Poltawski b5f3ed32a6 weekly release 3.0.5+ 2016-08-25 12:09:41 +01:00
Dan Poltawski b9435d3688 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-08-25 12:09:40 +01:00
Marina Glancy 3ea2065563 MDL-55708 mod_assign: display formatted acitvity names 2016-08-25 09:53:59 +08:00
AMOS bot bca6ca7a2a Automatically generated installer lang files 2016-08-25 00:05:43 +08:00
Andrew Nicols ba175bc7ac MDL-54113 assign: Open files in new window
Open files in a new window when viewing to ensure that the form change
checker does not warn about the page reloading.
2016-08-24 11:34:27 +08:00
David Monllao 4e4040df85 Merge branch 'MDL-55604-30' of https://github.com/mr-russ/moodle into MOODLE_30_STABLE 2016-08-24 09:36:46 +08:00
Russell Smith d391b3472a MDL-55604 cache: Fix identifier and cacheable_object
When a cachable object is store in the static cache from
the backing store, it was incorrect serialised rather than
using the wake function.  This has been resolved and tests added.

During the investigation into cacheable_object, it was discovered
that set_identifiers never removes identifiers when you call it,
so set_identifiers(array('a')) and set_identifiers(array('b')) really
resulted in array('a','b') as the identifiers rather than 'b'.

The fix for this issue depends on the set_identifiers fix and
they have been coupled together as a result.
2016-08-24 08:28:50 +10:00
gthomas2 57a5be5490 MDL-55312 requirejs: Fix timeouts with infinite waitSeconds 2016-08-23 17:42:01 +01:00
Dan Poltawski f3c7517c85 Merge branch 'MDL-55628-m30' of https://github.com/sammarshallou/moodle into MOODLE_30_STABLE 2016-08-23 15:48:13 +01:00
Dan Poltawski 09c37aa4eb Merge branch 'wip-mdl-46514-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-08-23 08:59:40 +01:00
David Monllao 16ede7192d Merge branch 'MDL-46654-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-08-23 15:31:23 +08:00
Andrew Nicols 49b3391b98 MDL-46654 mod_forum: Hide digestoptions when no subscription
Daily digest options should not be generated if the user cannot subscribe
to anything in the first place.
2016-08-23 15:10:25 +08:00
David Monllao 893b75e690 Merge branch 'MDL-54838-30' of https://github.com/nashtechdev01/moodle into MOODLE_30_STABLE 2016-08-23 12:44:49 +08:00
sam marshall d34fa71df4 MDL-55628 Completion: Use simpledata for completion cache
The completion cache is currently not marked as simpledata. On the
course page it is frequently retrieved hundreds of times which results
in many calls to the slow unserialize function. By making a slight
change to the data format (using arrays instead of objects) we can
mark it as simpledata, which will avoid using unserialize.
2016-08-22 17:16:50 +01:00
Dan Poltawski bacf77c9d7 Merge branch 'MDL-55273-cookie-secure-default-MOODLE_30_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_30_STABLE 2016-08-22 15:25:40 +01:00
Jake Dallimore 88e7c13d9a MDL-55565 core_backup: Fix warning when restoring question categories
Fixed a call to get_records_sql, which was being used incorrectly in
restore_find_best_target_context to determine a unique contextid.
2016-08-22 14:23:21 +01:00
Dan Poltawski a2b3f5864b Merge branch 'MDL-55605-lesson-restore-bug-MOODLE_30_STABLE' of https://github.com/kenneth-hendricks/moodle into MOODLE_30_STABLE 2016-08-22 14:13:28 +01:00
Dan Poltawski 2dc70084d3 Merge branch 'MDL-55551_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-08-22 12:53:34 +01:00
Dan Poltawski 68ec7cb526 Merge branch 'MDL-55557_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-08-22 12:45:55 +01:00
Dan Poltawski a7a02f8cc0 Merge branch 'wip-MDL-22183-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-08-22 09:12:54 +01:00
Brendan Heywood 1a93f1de4a MDL-55273 admin: Change $CFG->cookiesecure default to on 2016-08-22 09:24:12 +10:00
Tim Hunt 85f7df7e06 MDL-55477 quiz reports: all user fields should have repeats suppressed 2016-08-19 18:05:15 +01:00
Rajesh Taneja d235685214 MDL-46514 behat: section should be set before switch-case 2016-08-19 14:13:03 +08:00
Andrew Nicols b509663e15 MDL-55632 mod_forum: Tidy up forum post messages 2016-08-19 09:58:50 +08:00
Kenneth Hendricks 251752740b MDL-55605 mod_lesson: Fix activitylinks restore bug 2016-08-18 16:39:38 +10:00
Adrian Greeve 66fc37ed7f MDL-22183 lib: More unit tests for next day start. 2016-08-18 10:25:18 +08:00
Adrian Greeve 5f46e36461 MDL-22183 lib: Cleanup of get_next functions. 2016-08-18 10:25:18 +08:00
Adrian Greeve 496be783b3 MDL-22183 lib: Time settings removed for stats cron.
Old settings that should be ignored have been removed from the
statistics cron code.
2016-08-18 10:25:18 +08:00
Dan Poltawski 490e8f97e6 weekly release 3.0.5+ 2016-08-17 14:47:14 +01:00
Dan Poltawski bc0fc18cec Merge branch 'MDL-36713_m30v2' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-08-16 12:05:23 +01:00
Andrew Nicols dec2a585a3 Merge branch 'MDL-55272-30' of https://github.com/mr-russ/moodle into MOODLE_30_STABLE 2016-08-16 15:11:39 +08:00
Russell Smith ffd94de398 MDL-55272 lib: Allow random_bytes() to return large values.
PHP has a recursion limit and random_bytes on PHP5.6 without openssl
will error if sent a large value.  Using a loop has lower overhead than
recursion as well.
2016-08-16 12:16:45 +10:00
Stephen Bourget 20fb475465 MDL-36713 Blog: Display accurate error when a guest views a user blog 2016-08-15 21:50:31 -04:00
Andrew Nicols cf9a76e739 Merge branch 'wip-MDL-50586-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-08-16 08:52:56 +08:00
Dan Poltawski 92ed7da4d1 Merge branch 'wip-MDL-55494-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-08-15 13:14:42 +01:00
Dan Poltawski 014237d27d MDL-52105 enrol_self: fix upgrade savepoint 2016-08-15 12:11:50 +01:00
Dan Poltawski 09dec86ebd Merge branch 'wip-MDL-55366-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-08-15 11:43:41 +01:00
Dan Poltawski 8f300a967c Merge branch 'wip-MDL-55397-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-08-15 11:35:39 +01:00
Dan Poltawski 37cee5e44a Merge branch 'MDL-52105-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-08-15 11:14:06 +01:00
Simey Lameze 67bdccc036 MDL-52105 enrol_self: Behat test for key holder feature 2016-08-15 13:00:28 +08:00
Simey Lameze ed21b54c5a MDL-52105 enrol_self: Fix wrong holdkey cap restriction for manager
This commit add an upgrade step to remove wrong CAP_PROHIBIT on enrol/self:holdkey for manager role.
Also remove the restriction from the self enrolment access file.
2016-08-15 13:00:28 +08:00
Adrian Greeve 038cfaffcc MDL-55366 mod_lesson: Fix warning with TF page.
Having an image in the answer text would create a warning.
2016-08-15 10:22:21 +08:00
Stephen Bourget 31348f709e MDL-55557 mod_wiki: Add missing MOODLE_INTERNAL checks 2016-08-13 21:43:23 -04:00
Stephen Bourget 989dd5a826 MDL-55551 Blog: Add missing MOODLE_INTERNAL check. 2016-08-12 20:22:57 -04:00
Marina Glancy f7503bd6c2 MDL-55494 report_eventlist: ignore only logstore_legacy 2016-08-12 13:56:14 +08:00
Marina Glancy 23fb083903 MDL-55494 tool_monitor: ignore only tool_monitor and logstore_legacy
previously any plugin type ending with _monitor or _legacy would be ignored
2016-08-12 13:56:14 +08:00
Marina Glancy de9cd39715 MDL-50586 gradingform_rubric: warn about missing 0-points levels 2016-08-12 13:26:32 +08:00
Marina Glancy a52c83d83e MDL-55397 block_site_main_menu: eliminate CSS conflict
CSS for '.path-admin .buttons' defines padding, border and background that affected how main menu looks on admin pages
2016-08-11 15:43:41 +08:00
Andrew Nicols d418f42040 weekly release 3.0.5+ 2016-08-11 13:17:12 +08:00
Andrew Nicols 02d570966a Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-08-11 13:17:08 +08:00
AMOS bot 3ea6de7502 Automatically generated installer lang files 2016-08-10 00:05:07 +08:00
Dan Poltawski c6cb45fce7 Merge branch 'wip-MDL-55425-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-08-09 10:58:42 +01:00
Dan Poltawski 7502cdf6c6 MDL-51078 report_log: use simpler/faster str_split over preg_split 2016-08-09 09:09:15 +01:00
Stephen Bourget d1a50dce98 MDL-51078 report_log: Allow filtering by all changes 2016-08-09 09:09:09 +01:00
Andrew Nicols 95cc9d3b53 Merge branch 'wip-mdl-55329-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-08-09 14:28:19 +08:00
Andrew Nicols c8c910b1bd MDL-55274 mod_chat: Add unit tests for special commands 2016-08-09 10:49:53 +08:00
Andrew Nicols 6c0deebbd9 Merge branch 'MDL-55274-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-08-09 10:49:47 +08:00
Dan Poltawski 771f142254 Merge branch 'MDL-55398_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-08-08 10:40:50 +01:00
Mark Nielsen 339ca4ca04 MDL-55453 core_lib: Fix usage of js_send_uncached 2016-08-08 09:54:22 +01:00
Russell Smith 42a4a52a4c MDL-55292 performance: Allow Tideways profiler extension.
PHP7 doesn't have any default XHProf support and all other
investigated forks don't have stable PHP7.  Tideways is under
active development and is easy to install.  The data format
is compatible with XHProf so it is a drop-in replacement in that way.
2016-08-08 15:26:42 +08:00
Nick Phillips 06c9734dc8 MDL-55274 mod_chat: regain beep and / command in mod_chat.
format_text cannot be called on the whole input text, but must be
called on user-supplied text that will be output into chats. This
means it cannot simply be called in one place, but must instead be
called on the relevant parts of text once commands have been matched.
2016-08-08 12:29:32 +08:00
Andrew Nicols 2cfeebee65 Merge branch 'MDL-55454_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-08-08 10:04:18 +08:00
AMOS bot 32a9efd6dc Automatically generated installer lang files 2016-08-06 00:05:20 +08:00
Marina Glancy 6ed74faf27 MDL-55425 user: allow to update another user editor pref 2016-08-05 09:39:36 +08:00
Andrew Nicols e7c8da0fb8 weekly release 3.0.5+ 2016-08-04 09:58:53 +08:00
Andrew Nicols 4c9af61327 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-08-04 09:58:50 +08:00
Rajesh Taneja 0944b1641a MDL-54656 behat: Skip test if db family is not mysql or postgres 2016-08-04 08:47:42 +08:00
Tim Hunt f19f239c98 MDL-55454 quiz: loses shufflequestion setting restoring old backups 2016-08-03 18:43:28 +01:00
Eloy Lafuente (stronk7) b7f6ea3578 Merge branch 'MDL-54656_m30v3' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-08-03 00:51:52 +02:00
Eloy Lafuente (stronk7) 95086f294b Merge branch 'MDL-55166-30-blocksettings' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-08-03 00:34:11 +02:00
Dan Poltawski a896f02f1f MDL-54847 tests: fix unused var 2016-08-02 20:16:45 +01:00
Cameron Ball 4f9a64b6ff MDL-54847 weblib: Test media attributes individually 2016-08-02 20:16:41 +01:00
Dan Poltawski 10ba40f1c3 Merge branch 'wip-MDL-33741-m30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-08-02 12:20:33 +01:00
Dan Poltawski 6e882379f4 Merge branch 'MDL-54847-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-08-02 10:59:55 +01:00
Cameron Ball d2d65178fa MDL-54847 weblib: Support basic HTML media tags 2016-08-02 15:55:39 +08:00
Andrew Nicols 500e6d4519 Merge branch 'MDL-55376-30-fix' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-08-02 12:06:29 +08:00
Cameron Ball 4847d73829 MDL-55376 mod_assign: Update behat test 2016-08-02 10:43:37 +08:00
Stephen Bourget 8ecd647160 MDL-55398 mod_feedback: prevent direct script access to lib files. 2016-08-01 20:56:14 -04:00
Dan Poltawski 79598473d2 Merge branch 'MDL-55360-30-workshopgradepass' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-08-01 18:57:22 +01:00
AMOS bot 8312bbfd7c Automatically generated installer lang files 2016-08-02 00:04:37 +08:00
Dan Poltawski 32949a75a7 MDL-55376 assign: trailing whitespace 2016-08-01 16:08:02 +01:00
Dan Poltawski 2e9332b85d Merge branch 'MDL-55376-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-08-01 16:06:58 +01:00
Dan Poltawski b907a57262 Merge branch 'MDL-53691-M30' of git://github.com/lazydaisy/moodle into MOODLE_30_STABLE 2016-08-01 11:47:44 +01:00
Andrew Nicols cc3126b724 Merge branch 'MDL-53152-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-08-01 15:08:14 +08:00
Jun Pataleta b5eaf7a60a MDL-53152 theme: Add parentheses to variable calculations 2016-08-01 13:43:30 +08:00
Marina Glancy 4fdeed4bec MDL-33741 file_info: show courses in hidden categories
This also has a couple of bugfixes:
- file_info_context_system::get_children() was looking for courses with parent=0, it is impossible, block removed;
- file_info_context_coursecat::get_area_coursecat_description() was checking the wrong capability to view files in description
2016-08-01 09:15:22 +08:00
Marina Glancy d9bea44f18 MDL-33741 file_info: check capability when serving file in coursecat description 2016-08-01 09:15:15 +08:00
Cameron Ball b61059dbd2 MDL-55376 mod_assign: Fix bug stopping admin from editing submissions 2016-07-29 19:09:07 +08:00
AMOS bot 306c38dfcd Automatically generated installer lang files 2016-07-29 00:06:01 +08:00
David Mudrák 4d5707a128 MDL-55360 workshop: Add tests for setting grades to pass via mod form
These scenarios should cover common cases of defining the grades to pass
pass via the workshop settings form. Note that behaviour of the fields
in terms of locale-specific decimals input (MDL-51806) is not covered
with these tests as I want to avoid installation of additional language
pack. Instead, I assume that functionality of unformat_float() is tested
separately in the core.
2016-07-28 09:54:46 +02:00
David Mudrák 2510fae394 MDL-55360 workshop: Emptying grades to pass should set them to zero
When editing existing workshop with a grade to pass defined, when the
field is emptied, it should be interpreted as setting it to zero. This
was not happening because unformat_float replaces the field with null,
therefore effectively unsetting it.

By casting to float, we interpret all empty values (including null) as
zeros. This behaviour is consistent with how gradebook setup UI works.
2016-07-28 09:54:46 +02:00
David Mudrák cd830f4e2c MDL-55360 workshop: Allow creating workshops with empty grades to pass
As a regression of MDL-55360, it was not possible to create new
workshops if the field "Submission grade to pass" or "Assessment grade
to pass" was left empty. The validation failed with "You must enter a
number here".

The fields submissiongradepass and gradinggradepass are always present
as we explicitly define them in the mod form. So the isset() condition
in the validation was useless and it did not allow to submit the form
with these fields empty.

Additionally, the unformat_float() returns null only if it receives
empty value on the input. Which can't happen in our case so I am
removing this condition to improve the readability of the code.
2016-07-28 09:54:46 +02:00
David Monllao bcf700b088 weekly release 3.0.5+ 2016-07-28 12:07:23 +08:00
David Mudrák 5914ef444c MDL-55166 admin: Fix display of misleading debug warning on manage block
Blocks can declare has_config() as true without actually using the
default node in the admin tree. Typical use case is when the block
injects its settings to other parts of the admin tree and it assigns
null to its $setting node in its settings.php file.

As Janek L.B. correctly spotted, this led to false debugging message
on admin/blocks.php as the code interpreted it as missing settings.php
file.

The patch adds explicit file existence test for this rare case.
2016-07-27 23:16:34 +02:00
Rajesh Taneja 7c74b0aeb8 MDL-55329 behat: PyStrings should end with : (colon) 2016-07-27 07:02:34 +08:00
Rajesh Taneja d574272a0c MDL-55337 behat: After posting click to redirect page 2016-07-27 06:39:40 +08:00
lazydaisy d9d3ec4e55 MDL-53691 theme_bootstrapbase: Backport of MDL-53147 2016-07-26 21:43:44 +01:00
Eloy Lafuente (stronk7) 8d5deef79e Merge branch 'wip-MDL-51735-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-07-26 20:17:50 +02:00
Eloy Lafuente (stronk7) fbba7dfee6 Merge branch 'MDL-54657_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-07-26 19:57:16 +02:00
Eloy Lafuente (stronk7) 89a02c4370 Merge branch 'wip-mdl-55337-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-07-26 13:27:20 +02:00
Rajesh Taneja 22f3ebaad9 MDL-55337 behat: Added 1 sec delay between post
Ensure post is created at different timestamp, else
returned posts will be different and test fails.
This will happen on a fast machine.
2016-07-26 19:01:59 +08:00
David Monllao 568fea46d2 Merge branch 'wip-MDL-55183-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-07-26 09:57:07 +08:00
David Monllao 44d7062228 Merge branch 'MDL-55283-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-07-26 05:05:07 +08:00
David Monllao 329e98a621 Merge branch 'MDL-51242-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-07-26 02:41:27 +08:00
Stephen Bourget e1fe3532a0 MDL-55252 mod_chat: prevent direct script access to lib files. 2016-07-25 09:42:39 +01:00
Stephen Bourget 149ae1248e MDL-55253 mod_choice: prevent direct script access to lib files. 2016-07-25 09:40:48 +01:00
Stephen Bourget 485f8744a4 MDL-55255 mod_data: prevent direct script access to lib files. 2016-07-25 09:40:20 +01:00
An Pham Van 74a0d2afb6 MDL-54838 workshop: Differentiate labels for each comment field.
In a Workshop activity, comment fields on Assessment forms do not properly link to the corresponding Aspect.
So screen reader users may find it difficult to complete the Assessment forms.
There should be a hidden label text for each comment field.
2016-07-25 14:38:36 +07:00
Adrian Greeve c43e0956d5 MDL-51735 mod_lesson: A lesson with no content shows a message.
Before it would show an error.
2016-07-25 10:55:50 +08:00
Adrian Greeve c310304149 MDL-55183 editor_atto: Fix requires error.
When using a different theme and removing an editor
plugin such as the equation plugin, atto will display
an error about a missing dependency.

A thank you to Anthony Forth for providing this patch.
2016-07-25 09:17:53 +08:00
Eloy Lafuente (stronk7) a244bd7eaa weekly release 3.0.5+ 2016-07-21 11:45:03 +02:00
Eloy Lafuente (stronk7) ec75234e9c Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-07-21 11:44:59 +02:00
Andrew Nicols 4fdf0b226c MDL-55283 javascript: Check dir is readable before traversing them 2016-07-20 12:17:08 +08:00
AMOS bot f6409a7719 Automatically generated installer lang files 2016-07-20 00:05:39 +08:00
Eloy Lafuente (stronk7) 44ce1facbc Merge branch 'MDL-55220-30' of git://github.com/jleyva/moodle into MOODLE_30_STABLE 2016-07-19 13:22:43 +02:00
Dan Poltawski f11742850f Merge branch 'MDL-55206-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-07-19 10:52:47 +01:00
Dan Poltawski baaf2e67e1 Merge branch 'MDL-54915-30' of http://github.com/damyon/moodle into MOODLE_30_STABLE 2016-07-19 09:39:09 +01:00
Dan Poltawski 19421799cb Revert "Merge branch 'MDL-54915-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE"
This reverts commit 4b6e0cbd57, reversing
changes made to 8d6dde0805.
2016-07-19 09:37:36 +01:00
David Monllao 1e56841201 Merge branch 'MDL-55157_m30v6' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-07-19 08:42:24 +02:00
Damyon Wiese 28436ac123 MDL-54915 templates: Fix async rendering of js blocks
Mustache JS helper can overwrite JS blocks when using nested templates.

Each call to render should have it's own scope.

Conflicts:
	lib/amd/build/templates.min.js
	lib/amd/src/templates.js
2016-07-19 13:19:48 +08:00
Frederic Massart d2b890c689 MDL-4915 templates: Improve JS string handling in templates
Backported from MDL-53667 to make cherry-picking easier across branches.

The native String.replace method in extremely slow when we are
dealing with a large string and large quantity of strings to replace.
This new solution walks through the string looking for placeholders
to replace.
2016-07-19 13:15:38 +08:00
Stephen Bourget ad097b6fbd MDL-55157 mod_feedback: Course reset should update dates 2016-07-18 22:11:39 -04:00
Eloy Lafuente (stronk7) 3724d55c21 MDL-52544 oracle: small tweaks
This commit just:

- Moves the null => '' to better place, restricting it to PHP >= 7.0
  (bug https://bugs.php.net/bug.php?id=72524)
- Adds a couple of notes here and there.
- Changes some small details to keep the file using the same coding.
2016-07-19 04:04:57 +02:00
Eloy Lafuente (stronk7) 353c12c32f Merge branch 'MDL-52544-30' of git://github.com/damyon/moodle into MOODLE_30_STABLE 2016-07-19 04:04:51 +02:00
Eloy Lafuente (stronk7) da0d992d20 Merge branch 'MDL-51410_m30v2' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-07-19 02:31:40 +02:00
David Monllao 32d225deab Merge branch 'MDL-55161-m30' of https://github.com/micaherne/moodle into MOODLE_30_STABLE 2016-07-18 20:02:32 +02:00
David Monllao a4de0bbd59 Merge branch 'MDL-55163-30' of git://github.com/jleyva/moodle into MOODLE_30_STABLE 2016-07-18 19:45:23 +02:00
Dan Poltawski 87c1a2e7e8 Merge branch 'wip-mdl-55174-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-07-18 14:49:54 +01:00
Dan Poltawski 5a00afe7ab Merge branch 'MDL-55012-30' of git://github.com/damyon/moodle into MOODLE_30_STABLE 2016-07-18 13:55:23 +01:00
Dan Poltawski 5ef2a25523 Merge branch 'MDL-55240-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-07-18 10:51:10 +01:00
Dan Poltawski 4b6e0cbd57 Merge branch 'MDL-54915-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-07-18 09:17:55 +01:00
AMOS bot 6eb850896a Automatically generated installer lang files 2016-07-16 00:05:50 +08:00
Jun Pataleta 2148abcd34 MDL-55206 admin: Some code cleanup
* Removed unnecessary TODOs.
* Changed message prompt case to sentence case.
2016-07-15 14:54:44 +08:00
Jun Pataleta 70883b76fd MDL-55206 admin: Remove div tags in password policy error message 2016-07-15 14:54:44 +08:00
Rajesh Taneja b5b18eb572 MDL-55174 core_testing: Use proper directory separator
While searching for existing files if directory
separator is not correct then original files
and directories will be deleted. So use DIRECTORY_SEPARATOR.
2016-07-15 13:54:22 +08:00
Damyon Wiese c345d23084 MDL-55012 Atto: no style attrs on paste
Specifically on paste - we don't need all the random style attributes
from content on the clipboard. When you copy from a webpage - the browser
inlines all the styles from the page so that the pasted content will look
like the place it was copied from. But this is never what you want - you
want the content on paste, but with no special styling.
2016-07-15 13:41:45 +08:00
Jun Pataleta 8e6d1ac1d6 MDL-55240 editpdf: Revert changes in MDL-54772
* Revert rendering of annotations and comments back to the
  drawing region.
* Bind events to stamp annotation when editing only.
2016-07-15 10:39:38 +08:00
David Monllao 8d6dde0805 weekly release 3.0.5+ 2016-07-14 11:28:46 +02:00
David Monllao 0dc21f5a0e Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-07-14 11:28:44 +02:00
Juan Leyva c7ae332304 MDL-55220 forum: Add string filtering in WS
The following external functions now filter the discussion and post
name and subject.
- get_forum_discussions_paginated
- get_forum_discussion_posts
2016-07-14 09:14:59 +01:00
Stephen Bourget 365e6b1c49 MDL-54657 Behat: Add tests for section_links block 2016-07-13 21:40:15 -04:00
Michael Aherne 4063900e2b MDL-55161 assign: Check for existence of gradebook feedback plugin 2016-07-13 09:03:44 +01:00
Andrew Nicols 0949754d1f Merge branch 'MDL-47371-30-fix' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-07-13 12:11:51 +08:00
Cameron Ball bcfca5e67d MDL-47371 mod_book: Fix out of scope $unescapedtitle 2016-07-13 10:28:54 +08:00
Damyon Wiese 373d1eb7d0 MDL-52544 oracle: Apply upstream pull request to AdoDB oracle driver
Upstream: https://github.com/ADOdb/ADOdb/pull/259

Prevent segfault with ocipo driver on php7.

The OCIFetchinto function is causing segfaults on php7 - probably because the fields array
is not initialised or it is optimised out. This fixes just changes to use the safer function
oci_fetch_array instead.
2016-07-13 08:46:40 +08:00
Stephen Bourget 27f6cc4519 MDL-51410 mod_survey: fix notifications when saving analysis 2016-07-12 20:09:26 -04:00
tunele 28027d45ea MDL-55083 admin: provide friendly error in case phpxml is missing 2016-07-13 00:09:52 +02:00
Eloy Lafuente (stronk7) 9251dcc986 MDL-53803 mod_choice: fix trailing whitespace 2016-07-12 18:06:29 +02:00
Eloy Lafuente (stronk7) 970a714e13 Merge branch 'MDL-53803_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-07-12 18:02:52 +02:00
Eloy Lafuente (stronk7) acc2203622 Merge branch 'MDL-54892-MOODLE_30_STABLE' of https://github.com/tobiasreischmann/moodle into MOODLE_30_STABLE 2016-07-12 17:51:56 +02:00
Eloy Lafuente (stronk7) ad857b10c3 Merge branch 'MDL-55136_dataobject_30' of git://github.com/davosmith/moodle into MOODLE_30_STABLE 2016-07-12 15:48:30 +02:00
Eloy Lafuente (stronk7) 726051dcf9 MDL-37250 mod_lesson: Move conditions to queries for better performance
While this ony seems to affect MySQL, better put the filter/conditions
on every query so the temporary view/table does not need to handle
thousands of potentially unrelated records.
2016-07-12 13:33:18 +02:00
Eloy Lafuente (stronk7) cd172ea20e Merge branch 'wip-MDL-37250-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-07-12 13:21:15 +02:00
David Monllao eee0dce093 Merge branch 'MDL-55133-30' of git://github.com/damyon/moodle into MOODLE_30_STABLE 2016-07-12 13:16:48 +02:00
Dan Poltawski 68adc36911 Merge branch 'MDL-47371-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-07-12 10:14:30 +01:00
David Monllao 3be99e4e7c Merge branch 'MDL-55170_M30' of https://github.com/nadavkav/moodle into MOODLE_30_STABLE 2016-07-12 10:30:59 +02:00
Dan Poltawski 8994550de2 Merge branch 'MDL-55007-m30' of https://github.com/dthies/moodle into MOODLE_30_STABLE 2016-07-12 09:21:08 +01:00
Cameron Ball bc63d5bc06 MDL-47371 mod_book: Don't double escape book titles 2016-07-12 10:34:43 +08:00
Cameron Ball 469a0854e3 MDL-47371 block_navigation: Don't double escape course titles 2016-07-12 10:34:43 +08:00
Cameron Ball ce4ff71aa3 MDL-47371 weblib: Add option to disable escaping 2016-07-12 10:34:42 +08:00
Andrew Nicols f811e12a60 MDL-54915 core: JS Blocks must not used shared variables
The JS blocks in a template must _not_ use a shared variable as they can be
executed asynchronously and complete in any order.

Instead it is stored in the only local variable available - the current
context.

Since the context can be passed in from elsewhere, we namespace it to
reduce the chance of collission.
2016-07-12 10:01:52 +08:00
Daniel Thies 5654da6ca2 MDL-5507 filter_mathjaxloader: Add commeents for regexes 2016-07-11 13:23:07 -05:00
Nadav Kavalerchik 9a07482c0b MDL-55170 theme_bootstrapbase: Fix user enrollment dialog, RTL 2016-07-11 18:19:04 +03:00
David Monllao 16d219ac90 Merge branch 'wip-MDL-54962-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-07-11 16:16:07 +02:00
Dan Poltawski 069cc7b961 Merge branch 'MDL-55112-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-07-11 14:42:15 +01:00
Dan Poltawski cdf2cf7f39 Merge branch 'MDL-55137-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-07-11 14:37:59 +01:00
Dan Poltawski e72b815237 Merge branch 'MDL-55128-30' of git://github.com/jleyva/moodle into MOODLE_30_STABLE 2016-07-11 13:33:24 +01:00
Dan Poltawski 01a64e03ad Merge branch 'wip-MDL-55154-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-07-11 13:31:26 +01:00
Juan Leyva 39e110d145 MDL-55163 mod_assign: Fix mod_assign_copy_previous_attempts
- Not exposed via WS
- Have a bug when calling the api function
2016-07-11 10:30:51 +01:00
David Monllao eb0ac9cbe8 Merge branch 'MDL-54832-30' of https://github.com/nashtechdev01/moodle into MOODLE_30_STABLE 2016-07-11 06:47:47 +02:00
Adrian Greeve c77ade8587 MDL-37250 mod_lesson: All actual attempts on the lesson are displayed.
The lesson overview report now shows all attempts made including hitting
the page and immediately navigating away.
2016-07-11 08:21:23 +08:00
Adrian Greeve e0bf071213 MDL-54962 mod_data: Approval status is now translated.
It was using hardcoded English. Now it uses get_string.
2016-07-11 08:20:43 +08:00
AMOS bot d23f1b75f5 Automatically generated installer lang files 2016-07-11 00:06:14 +08:00
Eloy Lafuente (stronk7) 0324fefaf6 Moodle release 3.0.5 2016-07-10 00:29:18 +02:00
Davo Smith 32a5148e50 MDL-55136 data_object: fix param handling in fetch_all_helper 2016-07-09 09:19:48 +01:00
AMOS bot b7797e9c6c Automatically generated installer lang files 2016-07-09 00:04:53 +08:00
Adrian Greeve 40e105976c MDL-55154 mod_lesson: Lesson numerical response shows images. 2016-07-08 09:54:22 +08:00
Daniel Thies da0e1acfed MDL-55007 filter_mathjaxloader: Change unit test 2016-07-07 20:26:18 -05:00
Daniel Thies 28cdac1c6f MDL-55007 filter_mathjaxloader: Wrap nolink around each expresssion 2016-07-07 20:26:07 -05:00
Eloy Lafuente (stronk7) aa28da8286 weekly release 3.0.4+ 2016-07-07 10:20:00 +02:00
Eloy Lafuente (stronk7) 89a3f06ec5 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-07-07 10:19:55 +02:00
Damyon Wiese 4aec01cc4c MDL-52544 oracle: php7 fixes for oci driver
These are our bugs actually - the oci docs are very clear that bound
params should be in-scope when oci_execute is called - and due to pass by value etc,
this was not true for our driver.

There is another bug that needed fixing - OCI barfs if null values are bound - this
can be avoided by setting them to '' which oci treats as null.

And finally - all our lob/clob/blob hacks were also binding to local "out-of-scope" vars.
2016-07-07 13:10:03 +08:00
Andrew Nicols 119412b0ca Merge branch 'MDL-54734-30' of git://github.com/lameze/moodle into MOODLE_30_STABLE 2016-07-07 09:58:32 +08:00
Simey Lameze 1e8bbc6040 MDL-54734 core_user: do not cache dummy user records 2016-07-07 09:32:47 +08:00
Andrew Nicols 2245bc111b MDL-54734 user: Add tests to demonstrate multi-user issues 2016-07-07 09:31:58 +08:00
Stephen Bourget 9cf520a2e0 MDL-53803 mod_choice: remove orphaned answers when removing options 2016-07-06 17:16:18 -04:00
Eloy Lafuente (stronk7) 27273dab58 Merge branch 'wip-MDL-46682-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-07-06 18:14:08 +02:00
Cameron Ball 574afbc75f MDL-55137: Update PHPDoc for external_format_text 2016-07-06 17:48:41 +08:00
Eloy Lafuente (stronk7) 646d613ed4 MDL-54934 workshop: ensure "Current phase" is always separated
Apparently some readers can join 2 adjacent spans completely, simply
adding a whitespace between them prevents that, ensuring separation.,
2016-07-06 11:36:23 +02:00
Adrian Greeve fb5ea89a95 MDL-46682 auth/db: Increase of chunk size and update change.
The update query was not checking the mnet auth id and could
have been updating the wrong entry.
2016-07-06 16:44:54 +08:00
Damyon Wiese 443feb7ee8 MDL-55133 javascript: Correctly use component names in requirejs
Core subsystems must use the 'core_' prefix always.
2016-07-06 10:29:35 +08:00
Jerome Mouneyrac e8e02a7188 MDL-46682 auth/db: IN clause crashes when too many users to sync 2016-07-06 10:08:26 +08:00
Eloy Lafuente (stronk7) 191d5bc618 Merge branch 'MDL-54934-30' of https://github.com/nashtechdev01/moodle into MOODLE_30_STABLE 2016-07-05 20:44:31 +02:00
Eloy Lafuente (stronk7) 3815754c3b Merge branch 'MDL-49244-30' of git://github.com/jleyva/moodle into MOODLE_30_STABLE 2016-07-05 20:19:54 +02:00
Eloy Lafuente (stronk7) ea9061b213 Merge branch 'MDL-29738-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-07-05 17:07:31 +02:00
Loc Nguyen 744adf1bb6 MDL-54832 workshop: adding landmark for userplantable
Accessibility enhance: add an aria-label on the userplan table so
that it's accessible to me through my screen reader
2016-07-05 20:34:54 +07:00
Andrew Nicols 96b36b930a MDL-29738 file: Remove unused stylesheet functionality
This functionality was commented out in
78946b9bdb for MDL-20204 back in 2009.
Since then it has been wasting cycles performing utterly pointless
preg_match and preg_replace calls.
2016-07-05 19:29:57 +08:00
Andrew Nicols 7ff1344a59 MDL-55114 chat: Remove commented-out variables 2016-07-05 12:46:55 +02:00
Eloy Lafuente (stronk7) 968a10d3e5 Merge branch 'MDL-55113-30' of git://github.com/dpalou/moodle into MOODLE_30_STABLE 2016-07-05 12:22:00 +02:00
Dan Poltawski e2d37a1957 Merge branch 'MDL-54928-30' of git://github.com/dpalou/moodle into MOODLE_30_STABLE 2016-07-05 11:20:10 +01:00
Dan Poltawski 3e0e8e6fbd Merge branch 'MDL-54841-30' of https://github.com/nashtechdev01/moodle into MOODLE_30_STABLE 2016-07-05 11:13:52 +01:00
Juan Leyva 66efea063b MDL-55128 course: Fix param type for shortname 2016-07-05 09:51:35 +01:00
Dani Palou 044de08f20 MDL-54928 notifications: Add username to emailto users 2016-07-05 10:36:20 +02:00
Dani Palou 1db3d3a676 MDL-54928 notifications: Retrieve username from DB if empty 2016-07-05 10:36:20 +02:00
Andrew Nicols 909c3269bd MDL-51242 messageinbound: Guess the port from hostspec
Existing language strings for the host component suggest that the host can
be provided in the format hostname:port, but we previously did not support
this.

This patch explodes the string based on the colon character and assumes
that if there are two parts, that they are in the format hostname:port.

Note: This does not attempt to deal with full host specifications (e.g.
protocol://hostname:port), as this is beyond the scope of this change.
2016-07-05 14:54:21 +08:00
An Pham Van 1899e49017 MDL-54841 workshop: Combine links for attachment icon and text.
In a workshop activity, on the view submission page where having attachment(s), there's an accessibility issue.
There're 2 separate links for the icon and text which causes an issue for keyboard and screen reader users.
So the text and icon should be combined in one link.
2016-07-05 13:31:22 +07:00
Jake Dallimore 69af79848a MDL-53431 tool_monitor: Access control for tool monitor subscriptions 2016-07-05 10:46:04 +08:00
Dan Poltawski 635c6c8484 Merge branch 'MDL-55019-30' of git://github.com/jleyva/moodle into MOODLE_30_STABLE 2016-07-04 15:29:46 +01:00
Dan Poltawski 2628e64fa5 Merge branch 'MDL-54976-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-07-04 14:52:04 +01:00
Dan Poltawski ed577ebd43 Merge branch 'MDL-54994_30' of git://github.com/stronk7/moodle into MOODLE_30_STABLE 2016-07-04 14:18:21 +01:00
Dan Poltawski d4a279464e Merge branch 'MDL-55041_30_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_30_STABLE 2016-07-04 12:45:58 +01:00
Dan Poltawski e24a2c5ce2 Merge branch 'MDL-41945-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-07-04 12:39:39 +01:00
Marina Glancy 84cd5dca45 MDL-55069 core: escape special characters in email headers 2016-07-04 12:28:06 +01:00
Dani Palou 693e184927 MDL-55113 assign: Use PARAM_RAW in onlinetext text 2016-07-04 09:59:58 +02:00
Andrew Nicols 6d68238b13 Merge branch 'MDL-54953-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-07-04 15:29:29 +08:00
Jun Pataleta 784c5b9889 MDL-55112 mod_forum: Query all forum fields to avoid debug messages 2016-07-04 15:23:40 +08:00
Davo Smith 93b0fd8f26 MDL-55057 mod_scorm: fix handling of SCO identifiers with apostrophes 2016-07-04 13:14:40 +08:00
Cameron Ball 868fdbbdc0 MDL-41945 mod_assign: Check if submission has been modified
This patch adds a check that stops a user submitting an assignment
if someone else has modified it in the meantime.
2016-07-04 12:25:02 +08:00
Andrew Nicols e11ad0fc71 Merge branch 'MDL-55020-30-pluginzip' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-07-04 11:26:53 +08:00
Andrew Nicols 3c5501fc01 Merge branch 'MDL-54968-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-07-04 10:33:30 +08:00
Andrew Nicols 12cce3ef84 Merge branch 'MDL-53019_30' of git://github.com/stronk7/moodle into MOODLE_30_STABLE 2016-07-04 09:11:04 +08:00
AMOS bot 705b81f2c1 Automatically generated installer lang files 2016-07-02 00:05:24 +08:00
Mark Johnson 74526688a0 MDL-55041 roles: Fix JSON parsing in permission manager 2016-07-01 15:00:36 +01:00
Eloy Lafuente (stronk7) f4adac3f9a MDL-53019 environment: 3.2 requirements added
Changes:
 - PHP 5.6.5 required
2016-07-01 13:50:02 +02:00
Eloy Lafuente (stronk7) 256c202cab MDL-54994 badges: Count correctly the number of external badges shown 2016-07-01 13:41:13 +02:00
Loc Nguyen 5797c5ea2b MDL-54934 workshop: indicate current phase
Indicate phase in page titles, current phase in userplan table
so that it's accessible to me through my screen reader
2016-07-01 18:40:59 +07:00
Jun Pataleta b5d947c09e MDL-54976 mod_scorm: Add validation for availability dates 2016-07-01 14:50:56 +08:00
Andrew Nicols 566f5a7d07 weekly release 3.0.4+ 2016-07-01 10:20:26 +08:00
Andrew Nicols 18af3d7858 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-07-01 10:20:23 +08:00
David Mudrák 811f5b406d MDL-55020 admin: Fix renaming of the plugin package root folder
There was a problem with core\update\code_manager::unzip_plugin_file()
if it was used to extract a plugin package into a non-empty target
directory and the plugin package root folder was being renamed at the
same time.

The problem was caused by the underlying helper method
rename_extracted_rootdir() that worked only for ZIPs extracted to an
empty temporary location. When the plugin was extracted to the actual
dirroot with other existing plugin folders present, the method failed
badly.

The solution in the patch is to always extract the ZIP into a temporary
empty location, perform the eventual root renaming there, and only then
move the extracted contents to the final destination. Additionally we
are changing the behaviour of the rename_extracted_rootdir() method so
that now it throws exception if the plugin package contains multiple
root folders (it should not happen in normal situations as such a plugin
would not pass the pre-install validation).

Unit tests did not catch this bug before because in the tests, the
target directory had been empty. Now we are adding a new directory
"aaa_another" to the target location to test in more realistic
environment. Tests for the new behaviour of the renaming method are
added, too.

p.s. I noticed that moodle_exception class was not imported into the
namespace and this is fixed now too (and covered with unit tests).
2016-07-01 01:05:41 +02:00
Juan Leyva aac89d23ac MDL-49244 course: Clean parameters in core_course_get_categories 2016-06-30 13:27:59 +01:00
Dan Poltawski 5b059a03c5 MDL-32135 mod_choice: fix behat tests 2016-06-30 09:25:31 +01:00
Stephen Bourget 5ca8087ea8 MDL-32135 mod_choice: update behat tests 2016-06-30 09:25:30 +01:00
Dan Poltawski 74630a36fb Merge branch 'MDL-32135_m30v2' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-06-30 09:25:30 +01:00
Dan Poltawski 88b45d17a8 Merge branch 'MDL-55002-30-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-06-28 09:05:59 +01:00
Andrew Nicols ab13910a8e Merge branch 'MDL-54910_m30v2' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-06-28 13:02:11 +08:00
Andrew Nicols b1b833ca00 Merge branch 'MDL-54911_m30v3' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-06-28 12:41:24 +08:00
Andrew Nicols 38d38ee049 MDL-54755 core: Correct behat language 2016-06-28 10:02:13 +08:00
Andrew Nicols 0eb3ffbcec Merge branch 'MDL-54755_moodle30' of https://github.com/StudiUM/moodle into MOODLE_30_STABLE 2016-06-28 10:01:55 +08:00
Andrew Nicols c2c0dc1b4c Merge branch 'MDL-54935-30' of git://github.com/ryanwyllie/moodle into MOODLE_30_STABLE 2016-06-28 09:40:55 +08:00
Andrew Nicols 9543b1c57a Merge branch 'wip-mdl-54974-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-06-28 08:33:48 +08:00
Helen Foster a84e3767b7 MDL-55002 lang: Merge English strings from the en_fix language pack 2016-06-27 23:12:43 +02:00
Eloy Lafuente (stronk7) c59c57a2da Merge branch 'MDL-54900-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-06-27 19:03:42 +02:00
AMOS bot 3a39f54589 Automatically generated installer lang files 2016-06-28 00:06:18 +08:00
Eloy Lafuente (stronk7) 4070006db6 Merge branch 'MDL-52887-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-06-27 16:13:45 +02:00
Gilles-Philippe Leblanc a19df21939 MDL-54755 core: Incorrect redirection after password change 2016-06-27 08:22:11 -04:00
Eloy Lafuente (stronk7) 80c47141a1 Merge branch 'MDL-54663-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-06-27 13:26:51 +02:00
Marina Glancy 9b1f8676c5 MDL-54968 user: change query for resetting dashboard
In case of inconsistent data the fatal error could have happen.
Also improve performance by joining several queries into one.
2016-06-27 15:09:03 +08:00
Rajesh Taneja 723702bf08 MDL-54974 behat: Handle interupts on PHP7
As https://bugs.php.net/bug.php?id=71448 is
not going to get fixed, we need to declare tick
2016-06-27 14:32:54 +08:00
Andrew Nicols 9880e5fbd7 Merge branch 'MDL-53111_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-06-27 14:23:40 +08:00
Marina Glancy 371aae1e1c MDL-54900 mod_choice: correctly count number of answered users 2016-06-27 12:48:20 +08:00
Andrew Nicols 9d087a1a28 Merge branch 'MDL-54785-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-06-27 09:33:40 +08:00
Juan Leyva 4f8e5d15f3 MDL-55019 webservice: Course summary text should not be cleaned 2016-06-24 13:34:35 +01:00
Stephen Bourget ebe33c4377 MDL-54911 mod_feedback: start date should be before the end date 2016-06-23 17:41:15 -04:00
Stephen Bourget 14c7153625 MDL-54910 mod_data: Open dates should be before close dates 2016-06-23 17:34:14 -04:00
Stephen Bourget abef0f8b05 MDL-32135 mod_choice: Open time should be before close time 2016-06-23 17:22:41 -04:00
Andrew Nicols 39087f28ae weekly release 3.0.4+ 2016-06-23 14:49:40 +08:00
Andrew Nicols 7ab2ac2575 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-06-23 14:49:37 +08:00
Frederic Massart fab4c8b424 MDL-54785 files: Deprecate the support for $usepost and related 2016-06-23 12:46:38 +08:00
Frederic Massart 294c33960e Revert "MDL-44626 files: Show the PHP max upload size instead of 'unlimited'"
This reverts commit 6f0768618a.
2016-06-23 12:44:40 +08:00
Frederic Massart 4d957a5373 Revert "Merge branch 'MDL-54110_master' of https://github.com/marxjohnson/moodle"
This reverts commit 016e0abfbc, reversing
changes made to 58a2f0ac40.
2016-06-23 12:44:40 +08:00
Frederic Massart dd12c1df33 Revert "MDL-54110 repositories: Whitespace, Typo + unit test fixes"
This reverts commit 7e4d43e1a2.
2016-06-23 12:44:40 +08:00
Stephen Bourget d4f446f9a8 MDL-54935 Survey: Remove duplicate event trigger 2016-06-23 03:01:30 +00:00
Cameron Ball 7a010b1896 MDL-35104 auth: Always allow editing username for new users 2016-06-22 15:03:47 +08:00
Marina Glancy f5fe07de0c MDL-52887 mod_choice: backup allowmultiple option 2016-06-22 13:52:19 +08:00
Andrew Nicols 79c37128c3 MDL-54663 forum: Correct digest link to forum preferences 2016-06-22 13:12:35 +08:00
Marina Glancy 5ec74b7131 MDL-54953 mod_chat: remove Safari hack
This hack was introduced in MDL-16878 and is not needed in modern Safari versions
but it was reported that it can breaks chat in IE
2016-06-22 12:22:14 +08:00
Eloy Lafuente (stronk7) 7573bf0b66 MDL-54778 form: Make it all js style (eslint) compliant
The changes in this commit should not be problematic, just:

- different whitespace.
- some docs.
- 1 variable to camelCase.

And then, less trivial, but safe enough IMO:

- a change to camelCase some identifiers and their calculation.
2016-06-22 01:30:18 +02:00
Eloy Lafuente (stronk7) d8230f25d0 Merge branch 'MDL-54778-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-06-22 01:30:14 +02:00
AMOS bot dc77a3c5d0 Automatically generated installer lang files 2016-06-22 00:06:30 +08:00
Tobias Reischmann 2dc2a2b663 MDL-54892 core: Pass proper parameter for plugin uninstall queries 2016-06-21 09:16:20 +02:00
Andrew Nicols a55c462eb8 Merge branch 'MDL-54920-m30' of https://github.com/sammarshallou/moodle into MOODLE_30_STABLE 2016-06-21 14:19:33 +08:00
Andrew Nicols 7f93f96a02 Merge branch 'MDL-54894-30' of git://github.com/crazyserver/moodle into MOODLE_30_STABLE 2016-06-21 12:11:12 +08:00
Andrew Nicols 1242b84eb6 Merge branch 'MDL-54881_30' of https://github.com/mr-russ/moodle into MOODLE_30_STABLE 2016-06-21 11:32:35 +08:00
Andrew Nicols 88b799a470 Merge branch 'MDL-35104-30-2' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-06-21 11:23:11 +08:00
Cameron Ball cbce72a73a MDL-35104 auth: Don't allow modification of username
Presently it is either unreliable, or not possible to change
the username of a user created with an authentication plugin.
In some cases it is even hard coded to fail. Ideally we would
sync the username, and the issue MDL-21928 exists to address
that. However, in the mean time we should not allow the
username of an external user to be modified.
2016-06-21 11:14:29 +08:00
Andrew Nicols 3a435c4deb Merge branch 'MDL-51505-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-06-21 10:31:04 +08:00
Andrew Nicols a9972ecea0 MDL-54778 form: Fix lots of issues with form dependencies
The original issue here was that each loop of the named values did not
check for prototypal properties. As a result, if there were input fields
with names such as 'sort', 'valueOf', 'constructor', etc. these would
return their prototypal functions instead of a falsy value, and be treated
as though they are array - hence the 'Cannot push to Function' type error.

Following on from this I discovered that the data stores were being created
as arrays, but used as objects. This can also cause issues with some form
input names -- e.g. if they are numeric.

These two issues were resolved together by correctly storing them in
objects, and checking that those objects had real properties
(hasOwnProperty). This itself has to use the prototypal function to cater
for the potential of a field name called 'hasOwnProperty'.

I also found that the instance value stores were being initialised in the
prototype (and therefore shared), which meant that there were numerous
issues if two forms were present on the same page, or one form replaced an
existing one (e.g. forms initialised in JS).

In addition, it also became apparant that several values were being used
outside of scope, or in the wrong scope. This caused further issues when
creating multiple forms on a page.
2016-06-21 08:07:56 +08:00
Russell Smith 2b04eb1f14 MDL-54881 quiz: Ensure user attempts are deterministic for testing. 2016-06-21 08:33:00 +10:00
AMOS bot 51176946f9 Automatically generated installer lang files 2016-06-21 00:05:46 +08:00
AMOS bot bde2af526d Automatically generated installer lang files 2016-06-21 00:05:45 +08:00
Pau Ferrer Ocaña 1014381131 MDL-54894 comments: Get course from context if not informed 2016-06-20 09:02:17 +02:00
AMOS bot 2f86038ad9 Automatically generated installer lang files 2016-06-20 00:05:13 +08:00
AMOS bot 96d1ff2aaa Automatically generated installer lang files 2016-06-19 00:06:32 +08:00
Eloy Lafuente (stronk7) 364329af40 weekly release 3.0.4+ 2016-06-16 17:01:38 +02:00
sam marshall 5a5815d779 MDL-54920 Behat: Allow viewport size to be set consistently
Provides a new Behat step

And I set viewport size to "800x600"
2016-06-15 15:29:38 +01:00
Andrew Nicols 1367b11624 Merge branch 'MDL-53788_modlti_m30' of git://github.com/nhoobin/moodle into MOODLE_30_STABLE 2016-06-15 09:12:53 +08:00
Nicholas Hoobin 69b9974f91 MDL-53788 multilangupgrade: fix aggressive course cache rebuilding 2016-06-15 10:50:15 +10:00
Nicholas Hoobin 2ad35901a5 MDL-53788 user: fix aggressive course cache rebuilding 2016-06-15 10:44:54 +10:00
Nicholas Hoobin a14ec86bfd MDL-53788 mod_lti: fix aggressive course cache rebuilding 2016-06-15 10:44:54 +10:00
Andrew Nicols 7a58d43b1c Merge branch 'MDL-54559-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-06-14 14:30:53 +08:00
Andrew Nicols 76fd59d287 Merge branch 'MDL-54797_30' of git://github.com/aolley/moodle into MOODLE_30_STABLE 2016-06-14 13:27:35 +08:00
jogarcia 23e40cc6f7 MDL-54576 theme: Redirect to show confirmation
After selecting a new theme, save the new configs
then redirect to show the confirmation and the new
theme's read me.  This prevents any odd behavior
from the old theme bleeding into the display of
the confirmation.
2016-06-14 11:44:42 +08:00
Eloy Lafuente (stronk7) 2c478380d8 Merge branch 'MDL-54890-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-06-13 20:09:29 +02:00
Joby Harding 09bfb22703 MDL-51505 tool_templatelibrary: Prevent jumping when selecting template 2016-06-13 17:07:49 +08:00
Dan Poltawski 112b98def7 Merge branch 'MDL-54772-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-06-13 09:35:36 +01:00
Dan Poltawski 1ccd1c284d Merge branch 'MDL-54842-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-06-13 08:36:40 +01:00
Jun Pataleta 6a798ad9bf MDL-54772 mod_assign: Fixes for PDF editor
* Render the annotations and comments within the drawing canvas, not in
the drawing region.
* Remove edit-related event bindings for stamp annotations.
2016-06-13 10:00:20 +08:00
Stephen Bourget 8730fd39b8 MDL-54656 Behat: Additional tests for advanced search 2016-06-12 21:06:04 -04:00
Stephen Bourget 781b74cf38 MDL-54656 Behat: Add tests for search_forums block 2016-06-12 21:05:45 -04:00
Dan Poltawski 014c45b7ac MDL-54890 course: remove erranous duplicated switch label
Detected by eslint rule 'no-duplicate-case'
2016-06-10 10:10:12 +01:00
Dan Poltawski c6cd02470e MDL-54890 assignfeedback_editpdf: Fix missing semicolon
Detected by eslint rule 'semi'
2016-06-10 10:07:02 +01:00
Jun Pataleta a424f6cb60 MDL-54842 core_renderer: Hide additional body HTML in embedded layout 2016-06-10 14:48:04 +08:00
Stephen Bourget 203e47a3b8 MDL-53111 Lesson: Allow "end reached" criteria to be disabled 2016-06-09 12:22:20 -04:00
Dan Poltawski 83a32727a5 weekly release 3.0.4+ 2016-06-09 11:25:21 +01:00
Dan Poltawski 8416d4cfc2 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-06-09 11:25:19 +01:00
Andrew Nicols 19bc0f5d75 MDL-54853 weblib: Specify version and fixed encoding 2016-06-09 09:57:03 +08:00
Andrew Nicols 53e32ff5b8 Merge branch 'MDL-54853-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-06-09 09:56:58 +08:00
Cameron Ball 4ac487dba6 MDL-54853 weblib: Properly specify encoding for blanktarget 2016-06-08 18:29:52 +08:00
Andrew Nicols e214b30e3f Merge branch 'MDL-53947-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-06-08 08:47:18 +08:00
Dan Poltawski 0e6cbf13cc MDL-46721 assign: clarify ternerary statement 2016-06-07 12:15:53 +01:00
Dan Poltawski 33b234805a Merge branch 'MDL-46721-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-06-07 12:12:39 +01:00
Frederic Massart f710093255 MDL-48756 editor_atto: Bulk atto autosave queries 2016-06-07 11:51:21 +01:00
Dan Poltawski 97edee1f24 Merge branch 'MDL-54765-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-06-07 09:41:32 +01:00
David Monllao 365cc7aaed Merge branch 'MDL-54180_30_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_30_STABLE 2016-06-07 16:17:32 +08:00
Eric Merrill ffb6dc984d MDL-54559 theme: Fix padding that pushes navbar down 2016-06-07 15:01:14 +08:00
Skylar Kelty 8f62c066ad MDL-53947 memcached: Fix memcached session warning on PHP7 2016-06-07 10:27:10 +08:00
Eloy Lafuente (stronk7) e79e879783 Merge branch 'MDL-54769-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-06-06 23:57:00 +02:00
Eloy Lafuente (stronk7) 6ac1f4e96e Merge branch 'MDL-54805-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-06-06 18:08:57 +02:00
Dan Poltawski 9f812d2602 Merge branch 'wip-MDL-50824-MOODLE_30_STABLE' of https://github.com/cdsmith-umn/moodle into MOODLE_30_STABLE 2016-06-06 15:07:03 +01:00
Dan Poltawski e69409fdc0 Merge branch 'MDL-53392_30' of https://github.com/snake/moodle into MOODLE_30_STABLE 2016-06-06 13:21:11 +01:00
Dan Poltawski f2577ea928 Merge branch 'MDL-54557-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-06-06 13:17:10 +01:00
Dan Poltawski 9da0108feb Merge branch 'wip-MDL-49852-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-06-06 11:55:59 +01:00
Eloy Lafuente (stronk7) 678b8f5219 Merge branch 'MDL-41922-30-c' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-06-06 11:52:11 +02:00
Mike Churchward 3ce17afe99 MDL-54805 portfolio_download: Adding a 'require' of necessary library file 2016-06-04 21:54:34 +08:00
AMOS bot 378b29c760 Automatically generated installer lang files 2016-06-04 00:04:39 +08:00
Frederic Massart 0c325214e4 MDL-41922 mod_quiz: Don't report quiz due when an attempt was finished 2016-06-03 14:52:58 +08:00
Jun Pataleta f5194755f1 MDL-54765 mod_assign: Use selectedIndex for setting page selection
Set the 'selectedIndex' attribute of the page selection element instead of
the 'value' attribute since YUI is having trouble with this in IE.
2016-06-03 14:52:50 +08:00
Andrew Nicols 378bd31dbc weekly release 3.0.4+ 2016-06-03 12:01:47 +08:00
Andrew Nicols 451831e313 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-06-03 12:01:45 +08:00
Clement Smith 6b8ce1602c MDL-50824 message/externallib.php: Fix get_string call
This fixes the get_string call by adding the intended recipient's
fullname as the third argument when a user tries to message the
recipient, the recipient is blocking non-contacts from messaging
them, and the user is not in the recipient's contact list.
2016-06-02 07:22:38 -05:00
Adam Olley 9747d42070 MDL-54797 course: Add indexed field to condition of delete query
Deleting records from the course_completion_criteria table goes much
faster when we include the indexed course field in the delete query.
2016-06-02 15:52:59 +09:30
Marina Glancy 847e73efe4 MDL-54557 course: treat section summary as contents 2016-06-02 12:57:00 +08:00
AMOS bot 76f6647587 Automatically generated installer lang files 2016-06-02 00:04:29 +08:00
Frederic Massart 809309af4f MDL-48248 enrol_manual: Handle durations more precise than int days 2016-06-01 16:00:10 +08:00
Marina Glancy de2a386a98 MDL-54769 backup: add missing error language string 2016-06-01 09:45:34 +08:00
Andrew Nicols c2d39f88e3 Merge branch 'MDL-53598-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-06-01 08:26:08 +08:00
Mark Johnson 1ec4e9320a MDL-54180 Behat: Handle exceptions from driver when saving screenshot 2016-05-31 12:39:47 +01:00
Marina Glancy 4bca636f94 MDL-53598 block_glossary_random: do not fail if glossary was deleted
This commit refactors how associated glossary is searched for and removes
unnecessary DB queries. Also prevents from situations when the global glossary or course have
been deleted
2016-05-31 15:31:32 +08:00
David Monllao 65c42a0638 Merge branch 'MDL-54065-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-05-31 15:28:20 +08:00
Andrew Nicols d26072d275 Merge branch 'MDL-54655_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-31 13:53:33 +08:00
David Monllao 6fcc6d835f Merge branch 'MDL-54667-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-05-31 13:09:55 +08:00
David Monllao 876db7c5e5 Merge branch 'MDL-53851-30' of https://github.com/blckct/moodle into MOODLE_30_STABLE 2016-05-31 11:47:10 +08:00
David Monllao 2fb8dbad77 Merge branch 'MDL-53938_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-05-31 11:43:27 +08:00
David Monllao 88dcc03e9b Merge branch 'MDL-54605_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-05-31 11:33:02 +08:00
Andrew Nicols af313210ed Merge branch 'MDL-54579_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-31 11:19:26 +08:00
Jakub Kania ebc4062450 MDL-54667 core_lib: Fix the param name in edit profile link 2016-05-30 16:35:35 +08:00
Cameron Ball 9196d5ae69 MDL-37138 weblib: Document blanktarget in upgrade.txt 2016-05-30 16:13:10 +08:00
David Monllao c0298a5967 Merge branch 'MDL_54002_m30v3' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-30 16:09:26 +08:00
David Monllao d9196660b5 Merge branch 'MDL-54010-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-05-30 16:04:47 +08:00
David Monllao de44442189 Merge branch 'MDL-54577-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-05-30 15:46:10 +08:00
David Monllao 086b3f25a0 Merge branch 'MDL-29905-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-30 15:41:29 +08:00
David Monllao 932e53d839 Merge branch 'MDL-54116-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-05-30 15:36:48 +08:00
David Monllao dc54c9af93 Merge branch 'MDL-49943-30' of git://github.com/marinaglancy/moodle into MOODLE_30_STABLE 2016-05-30 15:29:43 +08:00
David Monllao dc04236962 Merge branch 'MDL-37138-30-2' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-05-30 15:02:39 +08:00
Andrew Nicols 4c3f595bc5 Merge branch 'MDL-54567-30-build' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-30 14:44:35 +08:00
Marina Glancy 30ee8e40e0 MDL-49943 mod_choice: display multiple answers in complete report 2016-05-30 14:17:58 +08:00
Jun Pataleta 247c29e4df MDL-53425 blocklib: Raise execution time for dashboard reset process 2016-05-30 14:12:44 +08:00
Andrew Nicols 1b1ad2f2ee Merge branch 'MDL-35987-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-30 13:41:23 +08:00
David Monllao 94320c47c5 Merge branch 'MDL-53425-30-delete-by-chunks' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-05-30 13:35:52 +08:00
Andrew Nicols 3a091f4522 MDL-54567 backup: Fixtures for legacy grade value rewrite 2016-05-30 13:22:21 +08:00
Frederic Massart 946343cd24 MDL-54567 backup: Process the calculations_freeze item upon restore 2016-05-30 13:22:21 +08:00
Cameron Ball cda2a0269f MDL-37138 chat: Use blanktarget option for chat text 2016-05-30 13:18:26 +08:00
Cameron Ball 0bdfc38a6e MDL-37138 message: Use blanktarget option for message text 2016-05-30 13:18:26 +08:00
Cameron Ball 0c1ba9c959 MDL-37138 weblib: Add blanktarget option to format_text 2016-05-30 13:18:26 +08:00
David Monllao abbd492512 Merge branch 'MDL-48248-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-30 13:06:47 +08:00
Frederic Massart 5bc25db29c MDL-29905 question: Auto remove stale questions upon category deletion 2016-05-30 12:26:31 +08:00
Eric Merrill 04e9b8e614 MDL-29905 question: Try to delete unused hidden/random questions
Before going to display the warning about moving in use questions,
try to delete unused Random qtype questions, as well as 'hidden'
questions (these are questions that were deleted from the category),
but were in use at the time.
2016-05-30 12:26:30 +08:00
Jun Pataleta d1654d9803 MDL-53425 blocklib: Perform deletion of block instances by chunk 2016-05-30 11:24:27 +08:00
David Monllao ecf200c5f0 Merge branch 'MDL-43887-30' of git://github.com/cameron1729/moodle into MOODLE_30_STABLE 2016-05-30 11:09:14 +08:00
David Monllao 8efb7d9aed Merge branch 'MDL-51806_30' of https://github.com/snake/moodle into MOODLE_30_STABLE 2016-05-30 10:52:21 +08:00
Jake Dallimore 6c361cf374 MDL-51806 mod_workshop: Add locale support for grade values. 2016-05-30 10:48:14 +08:00
David Monllao 0c798d3353 Merge branch 'wip-MDL-45427-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-05-30 10:19:52 +08:00
Marina Glancy bd6c7d5b93 MDL-54065 gradebook: correctly display module icon 2016-05-30 10:08:26 +08:00
Stephen Bourget 53ac88ab8a MDL-54655 Behat: Tests for the online_users block 2016-05-27 18:26:28 -04:00
Adrian Greeve 079c7e4022 MDL-49852 mod_assign: Unit tests for activity completion. 2016-05-27 15:38:29 +08:00
Tim Hunt 9a16044c21 MDL-54605 quiz regrading: incorrect DB query
There were two issues. With groups, the $params array was wrong
due to PHP + vs array_merge sillyness.

Also, the first column in the SQL was not necessarily unique,
so we need to use a recordset rather than get_records.
2016-05-27 08:12:20 +01:00
Steve Bader 2f61c533d4 MDL-49852 mod_assign: Fix group assignment completion tracking
Fixes completion tracking for group assignments where either only
one student is required to click Submit when submitting the
assignment for grading, all students are required to submit,
or no students are required to click submit (meaning that simply
uploading submits for grading).
2016-05-27 13:05:02 +08:00
Cameron Ball 9d661b7030 MDL-43887 formslib: Allow not set date field
Previously if the date field was not enabled it would
be treated as having value 0. A bug would allow this 0
to pass through and save the date as 1 January 1970
2016-05-27 01:53:32 +08:00
AMOS bot 7e99566a9e Automatically generated installer lang files 2016-05-27 00:04:57 +08:00
Jake Dallimore 9402642f95 MDL-53392 mod_assign: Fix selector for alert on increasing max grade 2016-05-26 14:53:52 +08:00
Cameron Ball b1c2c0f474 MDL-54010 roles: Specify encoding for escaped export data 2016-05-26 10:32:09 +08:00
Nigel Cunningham 86100ea6c0 MDL-54010 roles: Fix missing HTMLspecialchars in role export code.
Role name and description fields are currently not escaped when
exporting a role. This results in an unusable file when characters
such as ampersands are used in a name or description. Fix this by
using htmlspecialchars on both fields.

Signed-off-by: Nigel Cunningham <nigelc@catalyst-au.net>
2016-05-26 10:32:09 +08:00
Stephen Bourget 1423682a40 MDL-54577 Behat: Add tests for messages block 2016-05-26 10:22:13 +08:00
Marina Glancy 9994e13064 MDL-54116 block_comments: warnings when commenting outside of a course 2016-05-26 10:20:26 +08:00
Stephen Bourget f1af51c59d MDL-54116 block_comments: behat test 2016-05-26 10:20:26 +08:00
Eloy Lafuente (stronk7) eba73c81f1 weekly release 3.0.4+ 2016-05-26 02:14:13 +02:00
Eloy Lafuente (stronk7) a49305d9c4 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-05-26 02:14:10 +02:00
David Monllao 5beb3657a4 Merge branch 'MDL-54059-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-05-25 16:19:20 +08:00
Adrian Greeve 4f8ae68644 MDL-45427 mod_data: Inserting tags into templates.
Allows tags to be inserted into the editor without
having to touch Atto at all.
2016-05-25 15:29:47 +08:00
David Monllao 07836f7da0 Merge branch 'MDL-46934-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-25 13:25:25 +08:00
Frederic Massart f80ab4d427 MDL-35987 qtype_multianswer: Prevent restore failure due to bad sequence 2016-05-25 12:24:14 +08:00
Andrew Nicols 4f538c08a7 MDL-54059 testing: Add grunt test 2016-05-25 10:51:27 +08:00
Andrew Nicols 1db139031d MDL-54059 testing: Simplify travis output 2016-05-25 10:50:42 +08:00
Frederic Massart ff81f1c783 MDL-48248 enrol_manual: Ensure that the default value is always selected 2016-05-25 10:17:23 +08:00
Stephen Bourget 72808207d2 MDL-54002 Behat: tests for recent blogs block 2016-05-24 12:50:38 -04:00
AMOS bot 2302ac07fb Automatically generated installer lang files 2016-05-25 00:04:54 +08:00
Cameron Ball 806a93abdc MDL-46721 assign: Make blind marking participant numbers match
Previously emails were setting the "From" header to the incorrect
participant number.
2016-05-24 18:25:35 +08:00
David Monllao 67dec8d44d Merge branch 'MDL-54582_30' of git://github.com/timhunt/moodle into MOODLE_30_STABLE 2016-05-24 11:17:27 +08:00
Andrew Nicols 7d5616fa15 MDL-53687 core_media: Comment fix 2016-05-24 09:07:21 +08:00
Andrew Nicols 1ca9ac5b79 Merge branch 'MDL-53687-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-24 09:07:16 +08:00
AMOS bot 2ae82421dd Automatically generated installer lang files 2016-05-24 00:04:34 +08:00
Jakub Kania 56afc60c55 MDL-53851 news block: Display news from all the accessible groups 2016-05-23 17:19:01 +02:00
Frederic Massart 3798e7ef55 MDL-53687 core_media: Edge does not yet support WebM and OGG 2016-05-23 16:25:38 +08:00
Dan Poltawski 2772b598b8 weekly release 3.0.4+ 2016-05-20 10:09:17 +01:00
Frederic Massart 0c05085b41 MDL-46934 webservice_rest: Fixed undefined index on XML output 2016-05-20 17:03:50 +08:00
David Monllao a22978b8ad Merge branch 'MDL-54640_30' of git://github.com/dmonllao/moodle into MOODLE_30_STABLE 2016-05-20 09:05:19 +08:00
Rajesh Taneja 63b9cc7b80 MDL-54640 behat: add 1 sec delay before running tasks
Also just execute task, as running whole cron is not
required
2016-05-20 09:03:06 +08:00
Stephen Bourget d0c5c6804f MDL-54579 Behat: tests for the private_files block 2016-05-19 20:03:15 -04:00
David Monllao 9211f438d6 Merge branch 'MDL-54578_m30v2' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-19 11:41:41 +08:00
David Monllao a2ddf7d84d Merge branch 'MDL-54613-m30' of https://github.com/micaherne/moodle into MOODLE_30_STABLE 2016-05-19 11:21:11 +08:00
Eloy Lafuente (stronk7) 54d3a2c4e4 Merge branch 'MDL-54553-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-05-18 18:23:59 +02:00
Stephen Bourget d84c524d2c MDL-54578 Behat: Add tests for the myprofile block 2016-05-18 09:09:26 -04:00
Dan Poltawski 114c6918b6 MDL-54553 behat: check statuscode of http request 2016-05-18 11:16:19 +01:00
Dan Poltawski 995994ee75 Merge branch 'MDL-54027-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-18 11:05:01 +01:00
Michael Aherne e7a48b1afd MDL-54613 unit tests: Add iteminstance to test grade_item 2016-05-18 10:59:44 +01:00
Dan Poltawski 443487dab7 Merge branch 'wip-mdl-53956-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-05-18 10:45:21 +01:00
Dan Poltawski 58fd7d6345 Merge branch 'MDL-54549-30-en_fix' of git://github.com/mudrd8mz/moodle into MOODLE_30_STABLE 2016-05-18 10:29:17 +01:00
Rajesh Taneja c9072543fc MDL-53956 behat: Avoid before and after step and switch
After pressing the button, if system is slow then
after step and before step might fail as the window
is closed by then. Execute steps one after other
2016-05-18 14:19:09 +08:00
David Monllao c827490373 MDL-45390 grades: Bump build to today's date
To test backup/restore.
2016-05-18 14:13:40 +08:00
David Monllao b4311689f6 Merge branch 'wip-MDL-45390-30' of git://github.com/abgreeve/moodle into MOODLE_30_STABLE 2016-05-18 14:12:51 +08:00
Andrew Nicols b627d8c15b Merge branch 'wip-mdl-54564-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-05-18 12:27:44 +08:00
Andrew Nicols 967adff2ff MDL-54620 rating: Add tests for get_aggregate_string 2016-05-18 12:13:26 +08:00
Andrew Nicols 759c1e65bb Merge branch 'MDL-54620_30' of git://github.com/dmonllao/moodle into MOODLE_30_STABLE 2016-05-18 12:10:21 +08:00
Rajesh Taneja fe04ddaef3 MDL-54564 behat: Wait after hover, to ensure page is ready 2016-05-18 11:18:59 +08:00
Adrian Greeve b215dec368 MDL-45390 gradebook: sql tidy up and version alignment. 2016-05-18 10:44:16 +08:00
Andrew Nicols 544017f884 Merge branch 'MDL-54049-30' of git://github.com/jleyva/moodle into MOODLE_30_STABLE 2016-05-18 10:38:20 +08:00
David Monllao 69033e2214 MDL-45390 grades: Courses letters using system bad boundaries
Added unit tests to highlight the existing failures and adding
unset_config between each set of tests.
2016-05-18 10:02:46 +08:00
Adrian Greeve f000ff41ae MDL-45390 gradebook: Grade boundary fix.
Code to upgrade, fix, and freeze the gradebook for
courses with letter boundary problems.
2016-05-18 10:02:46 +08:00
Adrian Greeve 5f91a59fed MDL-45390 gradebook: Behat tests for grade boundary issues. 2016-05-18 09:58:15 +08:00
Adrian Greeve 0cbd302b83 MDL-45390 gradebook: Unit tests for grade boundary issue. 2016-05-18 09:58:07 +08:00
Kevin Wiliarty 45294e503e MDL-54620 ratings: display '0' when aggregate = 0 2016-05-18 07:37:41 +08:00
Helen Foster 4a17764ebd MDL-54549 lang: Merge English strings from the en_fix language pack 2016-05-17 13:18:36 +02:00
Dan Poltawski e25d3383b9 weekly release 3.0.4+ 2016-05-17 10:48:45 +01:00
Dan Poltawski b88965b626 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-05-17 10:48:43 +01:00
David Monllao acd9521a65 NOBUG: Bumping versions after a rewrite 2016-05-17 17:11:56 +08:00
Mark Nelson fcebfea419 MDL-52599 block_rss_client: fixed various PHP errors 2016-05-17 17:10:54 +08:00
Rajesh Taneja cab3620f33 MDL-54573 testing: don't uppercase dbtype 2016-05-17 17:10:53 +08:00
Andrew Nicols 61b6d3d204 Merge branch 'MDL-52599-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-05-17 17:10:53 +08:00
Andrew Nicols b69b0543c7 Merge branch 'MDL-54600-m30' of https://github.com/micaherne/moodle into MOODLE_30_STABLE 2016-05-17 17:10:52 +08:00
Dan Poltawski 3bafd53957 MDL-54573 testing: don't uppercase dbtype 2016-05-17 17:10:52 +08:00
David Monllao e6b308401c Merge branch 'MDL-54573-30' of git://github.com/danpoltawski/moodle into MOODLE_30_STABLE 2016-05-17 17:10:52 +08:00
Stephen Bourget 3d21fc3bdf MDL-54131 Behat: Fix hide all courses test 2016-05-17 17:10:51 +08:00
David Monllao 844b20e158 Merge branch 'MDL-54584-30' of git://github.com/andrewnicols/moodle into MOODLE_30_STABLE 2016-05-17 17:10:51 +08:00
Michael Aherne c9d6c62e47 MDL-54600 phpunit: Prevent locked files failing tests 2016-05-16 14:41:44 +01:00
Dan Poltawski 4174c59a57 MDL-52599 rss block: clarifty sql and make style more moodley 2016-05-16 11:09:54 +01:00
Clement Smith 36f909cc4c MDL-52599 blocks/rss_client: Fix RSS block config page
This fixes an error where the RSS block config page would display
'Array' where the multiselect list of feeds should be when
accessed by a user who has not saved any RSS feed urls and yet the
block has been previously configured by another user.
2016-05-16 11:09:53 +01:00
David Monllao aabfa11f71 Merge branch 'MDL-54133_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-16 12:03:18 +08:00
David Monllao c6fe3d243d Merge branch 'MDL-54131_m30v3' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-16 12:01:49 +08:00
David Monllao cb921865b7 Merge branch 'MDL-54130_m30v2' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-16 11:32:12 +08:00
Andrew Nicols cbef0010f0 MDL-54584 repository: Set a default filename in prepare_file 2016-05-16 11:08:46 +08:00
vpisabeywardana def7e7843a MDL-52815 theme: group select overlapping issue
Gave minimum width for select tags which are under 'groups' and 'members' classes
2016-05-16 02:44:31 +00:00
AMOS bot 9dbb91f678 Automatically generated installer lang files 2016-05-15 00:04:53 +08:00
Stephen Bourget d058341145 MDL-54131 Behat: tests for the course list block 2016-05-13 22:06:40 -04:00
Stephen Bourget 52a630f7c8 MDL-54133 Behat: tests for the course overview block 2016-05-13 21:42:38 -04:00
Tim Hunt 77c4401c02 MDL-54582 accesslib: improve performance of load_course_context
The new query is logically equivalen, but much, much faster, at
least on Postgred. (15ms, instead of 700ms, in one example I tried
on the database for the OU's main Moodle site.)
2016-05-13 20:38:03 +01:00
Dan Poltawski 06c174bab8 MDL-54573 testing: use dbtype rather dbvendor for diagnostics
So that we can differentiate between drivers
2016-05-13 14:53:47 +01:00
David Monllao 4b6e571ccb weekly release 3.0.4+ 2016-05-13 18:32:28 +08:00
Frederic Massart 81b676c3a9 MDL-54027 mod_forum: Display sub-header on user posts/discussions page 2016-05-13 17:40:24 +08:00
Dan Poltawski 0d1e222b3d NOBUG: ensure version number doesn't go backwards
(Due to reverts happening in MDL-45390)
2016-05-13 09:36:37 +01:00
Dan Poltawski 9528275bee Merge branch 'MDL-54101_m30' of git://github.com/markn86/moodle into MOODLE_30_STABLE 2016-05-13 09:34:31 +01:00
Dan Poltawski 782ad586a8 Merge branch 'wip-mdl-54543-m30' of https://github.com/rajeshtaneja/moodle into MOODLE_30_STABLE 2016-05-13 09:34:31 +01:00
Stephen Bourget b19552e332 MDL-54130 Behat: Add tests for Completion Status block 2016-05-12 21:27:18 -04:00
Mark Nelson 86f523fdf9 MDL-54101 core: fixed core/str get_string caching issue 2016-05-12 18:59:19 +08:00
Rajesh Taneja 0f24b0ae06 MDL-54543 behat: Increase file download range
with different db's, the id and defaultgrade
might be different, so increasing the range
to avoid such failures
2016-05-12 16:02:03 +08:00
Tim Hunt a4079c3c74 MDL-53938 qformat_gift: handle multi-choice MR with one 100% choice 2016-05-11 18:07:46 +01:00
Andrew Nicols c3bac7250a Merge branch 'MDL-54055-30' of git://github.com/junpataleta/moodle into MOODLE_30_STABLE 2016-05-11 15:02:09 +08:00
Jun Pataleta 6cb33703ba MDL-54055 gradingform_guide: Skip insertion of empty comments
We should not be adding empty entries for the frequently-used comments.
2016-05-11 14:54:50 +08:00
Andrew Nicols cb19237594 Merge branch 'MDL-54125_m30' of git://github.com/markn86/moodle into MOODLE_30_STABLE 2016-05-11 14:12:41 +08:00
Mark Nelson ac6d4ce728 MDL-54125 mod_data: fixed PHP notice
Also removed unused variables.
2016-05-11 13:02:01 +08:00
Andrew Nicols c768daa20b Merge branch 'MDL-52800-30' of git://github.com/ryanwyllie/moodle into MOODLE_30_STABLE 2016-05-11 11:16:00 +08:00
Andrew Nicols 3945629232 MDL-54110 repositories: Whitespace, Typo + unit test fixes 2016-05-11 10:42:53 +08:00
Andrew Nicols 539c1cf9ec Merge branch 'MDL-54110_30_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_30_STABLE 2016-05-11 10:42:42 +08:00
Mark Johnson a674b3659c MDL-54110 repositories: Allow repositories to ignore post_max_size
Repositories can now override usespost() if they don't upload using POST
requests. This restores the ability of users with
moodle/course:ignorefilesizelimits to upload files of unlimited size
lost in MDL-44626.
2016-05-10 16:11:28 +01:00
Dan Poltawski 8e25eba291 Merge branch 'MDL-50704-30-bp' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-10 15:59:43 +01:00
David Monllao a5b26a385a Merge branch 'MDL-52133-30' of git://github.com/ryanwyllie/moodle into MOODLE_30_STABLE 2016-05-10 21:41:41 +08:00
David Monllao 94d6b16158 weekly release 3.0.4+ 2016-05-10 18:55:11 +08:00
David Monllao 82c2cde553 Merge branch 'install_30_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_30_STABLE 2016-05-10 18:55:09 +08:00
Ryan Wyllie 42defe4dc1 MDL-52800 theme: Fix styling for inplace editing tooltip 2016-05-10 05:16:04 +00:00
Andrew Nicols d7491c3314 Merge branch 'MDL-54115_m30v1' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-10 12:09:53 +08:00
Andrew Nicols 2941f5ce70 MDL-54004 behat: Whitespace fixes 2016-05-10 12:02:52 +08:00
Andrew Nicols 1a1182740b Merge branch 'MDL-54004_m30v2' of https://github.com/sbourget/moodle into MOODLE_30_STABLE 2016-05-10 11:38:34 +08:00
Andrew Nicols a5573b4862 Merge branch 'MDL-52506-30' of git://github.com/ryanwyllie/moodle into MOODLE_30_STABLE 2016-05-10 10:16:44 +08:00
Ryan Wyllie 3f6149cce3 MDL-52506 mod_assign: Fix return links for atto auto save 2016-05-10 01:23:50 +00:00
Stephen Bourget f7c3ff4b3b MDL-54115 Behat: tests for the comments block 2016-05-09 19:02:24 -04:00
Stephen Bourget 9955806518 MDL-54004 Behat: tests for calendar block 2016-05-09 16:08:30 -04:00
Stephen Bourget 7ff356aa3d MDL-54004 Behat: tests for upcoming events block 2016-05-09 16:08:09 -04:00
AMOS bot 91c42f09a7 Automatically generated installer lang files 2016-05-10 00:04:52 +08:00
Frederic Massart 396e1a76d3 MDL-50704 date: Fix invalid timezone mapping for +14
The value Etc/GMT-14 was added to the list of known timezones,
and Etc/GMT+13 & Etc/GMT+14 were removed as they are not valid.

Tests were added to ensure that legacy user timezones are mapped
to known timezones. Other tests were changed to reflect the changes
with regards to Etc/GMT+13 and +-14.
2016-05-09 17:36:36 +08:00
Andrew Nicols 1ffadaf625 Merge branch 'MDL-52708-30_STABLE' of https://github.com/ramdesh/moodle into MOODLE_30_STABLE 2016-05-09 15:52:30 +08:00
David Monllao 1c28c9fc20 Merge branch 'MDL-54034-30' of git://github.com/FMCorz/moodle into MOODLE_30_STABLE 2016-05-09 07:50:47 +08:00
Frederic Massart d2d41fa003 MDL-54034 ajax: Apply filters in ajax requests
This also clarified that developers can decide to force filters
to be ignored when using external_format_text, though they cannot
force filters to be turned on as the clients should be able to
opt-out from filtering should they want to.
2016-05-06 18:02:46 +08:00
Ryan Wyllie a95f10f2d6 MDL-52133 mod_assign: Support userid on single grade page 2016-05-06 07:20:09 +00:00
Juan Leyva 477cfba57c MDL-54049 core_message: Add missing external format text 2016-05-04 12:54:27 +02:00
Ramindu Deshapriya b906a29e50 MDL-52708 core_admin: Added Behat test to automate MDLQA-8190 2016-04-15 00:07:36 +05:30
690 changed files with 18669 additions and 3662 deletions
+17
View File
@@ -0,0 +1,17 @@
*/**/yui/src/*/meta/
*/**/build/
node_modules/
vendor/
lib/editor/atto/yui/src/rangy/js/
lib/editor/tinymce/plugins/pdw/tinymce/
lib/editor/tinymce/tiny_mce/
lib/requirejs/
lib/yuilib/
lib/jquery/
lib/htmlpurifier/
lib/flowplayer/
lib/xhprof/
lib/amd/src/loglevel.js
lib/amd/src/mustache.js
theme/bootstrapbase/javascript/html5shiv.js
theme/bootstrapbase/amd/src/bootstrap.js
+172
View File
@@ -0,0 +1,172 @@
{
'env': {
'browser': true,
'amd': true
},
'globals': {
'M': true,
'Y': true
},
'rules': {
// See http://eslint.org/docs/rules/ for all rules and explanations of all
// rules.
// === Possible Errors ===
'comma-dangle': 'off',
'no-cond-assign': 'error',
'no-console': 'error',
'no-constant-condition': 'error',
'no-control-regex': 'error',
'no-debugger': 'error',
'no-dupe-args': 'error',
'no-dupe-keys': 'error',
'no-duplicate-case': 'error',
'no-empty': 'warn',
'no-empty-character-class': 'error',
'no-ex-assign': 'error',
'no-extra-boolean-cast': 'error',
'no-extra-parens': 'off',
'no-extra-semi': 'error',
'no-func-assign': 'error',
'no-inner-declarations': 'error',
'no-invalid-regexp': 'error',
'no-irregular-whitespace': 'error',
'no-negated-in-lhs': 'error',
'no-obj-calls': 'error',
'no-prototype-builtins': 'off',
'no-regex-spaces': 'error',
'no-sparse-arrays': 'error',
'no-unexpected-multiline': 'error',
'no-unreachable': 'warn',
'no-unsafe-finally': 'error',
'use-isnan': 'error',
'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
'valid-typeof': 'error',
// === Best Practices ===
// (these mostly match our jshint config)
'array-callback-return': 'warn',
'block-scoped-var': 'warn',
'complexity': 'warn',
'consistent-return': 'warn',
'curly': 'error',
'dot-notation': 'warn',
'no-alert': 'warn',
'no-caller': 'error',
'no-case-declarations': 'error',
'no-div-regex': 'error',
'no-empty-pattern': 'error',
'no-empty-function': 'warn',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'warn',
'no-fallthrough': 'error',
'no-floating-decimal': 'warn',
// Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-labels': 'error',
'no-loop-func': 'error',
'no-multi-spaces': 'warn',
'no-multi-str': 'error',
'no-native-reassign': 'warn',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': 'warn',
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-assign': 'error',
'no-self-compare': 'error',
'no-sequences': 'warn',
'no-throw-literal': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-unused-labels': 'error',
'no-useless-call': 'warn',
'no-useless-escape': 'warn',
'no-with': 'error',
'wrap-iife': ['error', 'any'],
// === Variables ===
'no-delete-var': 'error',
'no-undef': 'error',
'no-undef-init': 'error',
'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
// === Stylistic Issues ===
'array-bracket-spacing': 'warn',
'block-spacing': 'warn',
'brace-style': ['warn', '1tbs'],
'camelcase': 'warn',
'comma-spacing': ['warn', { 'before': false, 'after': true }],
'comma-style': ['warn', 'last'],
'computed-property-spacing': 'error',
'consistent-this': 'off',
'eol-last': 'off',
'func-names': 'off',
'func-style': 'off',
// indent currently not doing well with our wrapping style, so disabled.
'indent': ['off', 4, { 'SwitchCase': 1 }],
'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
'keyword-spacing': 'warn',
'linebreak-style': ['error', 'unix'],
'lines-around-comment': 'off',
'max-len': ['error', 132],
'max-lines': 'off',
'max-depth': 'warn',
'max-nested-callbacks': ['warn', 5],
'max-params': 'off',
'max-statements': 'off',
'max-statements-per-line': ['warn', { max: 2 }],
'new-cap': ['warn', { 'properties': false }],
'new-parens': 'warn',
'newline-after-var': 'off',
'newline-before-return': 'off',
'newline-per-chained-call': 'off',
'no-array-constructor': 'off',
'no-bitwise': 'error',
'no-continue': 'off',
'no-inline-comments': 'off',
'no-lonely-if': 'off',
'no-mixed-operators': 'off',
'no-mixed-spaces-and-tabs': 'error',
'no-multiple-empty-lines': 'warn',
'no-negated-condition': 'off',
'no-nested-ternary': 'warn',
'no-new-object': 'off',
'no-plusplus': 'off',
'no-spaced-func': 'warn',
'no-ternary': 'off',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'off',
'no-unneeded-ternary': 'off',
'no-whitespace-before-property': 'warn',
'object-curly-newline': 'off',
'object-curly-spacing': 'warn',
'object-property-newline': 'off',
'one-var': 'off',
'one-var-declaration-per-line': ['warn', 'initializations'],
'operator-assignment': 'off',
'operator-linebreak': 'off',
'padded-blocks': 'off',
'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
'quotes': 'off',
'require-jsdoc': 'warn',
'semi': 'error',
'semi-spacing': ['warn', {'before': false, 'after': true}],
'sort-vars': 'off',
'space-before-blocks': 'warn',
'space-before-function-paren': ['warn', 'never'],
'space-in-parens': 'warn',
'space-infix-ops': 'warn',
'space-unary-ops': 'warn',
'spaced-comment': 'warn',
'unicode-bom': 'error',
'wrap-regex': 'off',
}
}
+82 -36
View File
@@ -27,13 +27,13 @@ env:
# Postgres is significantly is pretty reasonable in its run-time.
# Run unit tests on MySQL
- DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
- DB=mysqli TASK=PHPUNIT
# Run CI Tests without running PHPUnit.
- DB=none PHPUNIT=false INSTALL=false CITEST=true
- DB=none TASK=CITEST
# Run unit tests on Postgres
- DB=pgsql PHPUNIT=true INSTALL=false CITEST=false
- DB=pgsql TASK=PHPUNIT
matrix:
# Enable fast finish.
@@ -41,37 +41,62 @@ matrix:
# It will not stop the jobs from running.
fast_finish: true
include:
# Run grunt/npm install on lowest supported npm version
- php: 7
env: DB=none TASK=GRUNT NVM_VERSION='0.10'
# Run grunt/npm install on highest version ('node' is an alias for the latest node.js version.)
- php: 7
env: DB=none TASK=GRUNT NVM_VERSION='node'
exclude:
# MySQL - it's just too slow.
# Exclude it on all versions except for 7.0
# - env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
# - env: DB=mysqli TASK=PHPUNIT
# php: 5.6
#
# - env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
# - env: DB=mysqli TASK=PHPUNIT
# php: 5.5
- env: DB=mysqli PHPUNIT=true INSTALL=false CITEST=false
- env: DB=mysqli TASK=PHPUNIT
php: 5.4
- env: DB=none TASK=GRUNT
php: 5.4
cache:
directories:
- $HOME/.composer/cache
- $HOME/.npm
install:
# Disable xdebug. We aren't generating code coverage, and it has a huge impact upon test performance.
- rm /home/travis/.phpenv/versions/$(phpenv version-name)/etc/conf.d/xdebug.ini
# Set the encrypted GITHUB_TOKEN if it's available to raise the API limit.
- if [ -n "$GITHUB_APITOKEN" ]; then composer config github-oauth.github.com $GITHUB_APITOKEN; fi
- >
if [ "$TASK" = 'PHPUNIT' ];
then
if [ -n "$GITHUB_APITOKEN" ]; then
composer config github-oauth.github.com $GITHUB_APITOKEN;
echo 'auth.json' >> .git/info/exclude
fi
# Install composer dependencies.
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
# Typically it should be able to use the Composer cache if any other job has already completed before we started here.
- travis_retry composer install --prefer-dist --no-interaction
# Install composer dependencies.
# We need --no-interaction in case we hit API limits for composer. This causes it to fall back to a standard clone.
# Typically it should be able to use the Composer cache if any other job has already completed before we started here.
travis_retry composer install --prefer-dist --no-interaction;
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
nvm install $NVM_VERSION ;
nvm use $NVM_VERSION ;
fi
before_script:
- >
if [ "$INSTALL" = 'true' -o "$PHPUNIT" = 'true' ];
if [ "$TASK" = 'PHPUNIT' ];
then
# Copy generic configuration in place.
cp config-dist.php config.php ;
@@ -113,38 +138,36 @@ before_script:
mysql -u root -e 'SET GLOBAL innodb_file_per_table=ON;' ;
mysql -e 'CREATE DATABASE travis_ci_test DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_bin;' ;
fi
if [ "$PHPUNIT" = 'true' ];
then
# Create a directory for the phpunit dataroot.
mkdir -p "$HOME"/roots/phpunit
# The phpunit dataroot and prefix..
sed -i \
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
config.php ;
# Initialise PHPUnit for Moodle.
php admin/tool/phpunit/cli/init.php
fi
fi
script:
########################################################################
# PHPUnit
########################################################################
- >
if [ "$PHPUNIT" = 'true' ];
if [ "$TASK" = 'PHPUNIT' ];
then
vendor/bin/phpunit;
# Create a directory for the phpunit dataroot.
mkdir -p "$HOME"/roots/phpunit
# The phpunit dataroot and prefix..
sed -i \
-e "/require_once/i \\\$CFG->phpunit_dataroot = '\/home\/travis\/roots\/phpunit';" \
-e "/require_once/i \\\$CFG->phpunit_prefix = 'p_';" \
config.php ;
# Initialise PHPUnit for Moodle.
php admin/tool/phpunit/cli/init.php
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
npm install --no-spin;
npm install --no-spin -g grunt ;
fi
########################################################################
# CI Tests
########################################################################
- >
if [ "$CITEST" = 'true' ];
if [ "$TASK" = 'CITEST' ];
then
# Note - this is deliberately placed in the script section as we
# should not add any code until after phpunit has run.
@@ -169,7 +192,30 @@ script:
# Actually run the CI Tests - do this outside of the main test to make output clearer.
- >
if [ "$CITEST" = 'true' ];
if [ "$TASK" = 'CITEST' ];
then
bash local/ci/php_lint/php_lint.sh;
fi
script:
- >
if [ "$TASK" = 'PHPUNIT' ];
then
vendor/bin/phpunit;
fi
- >
if [ "$TASK" = 'CITEST' ];
then
bash local/ci/php_lint/php_lint.sh;
fi
- >
if [ "$TASK" = 'GRUNT' ];
then
grunt ;
# Add all files to the git index and then run diff --cached to see all changes.
# This ensures that we get the status of all files, including new files.
git add . ;
git diff --cached --exit-code ;
fi
+4 -1
View File
@@ -154,7 +154,10 @@
$settings = '<a href="' . $blocksettings->url . '">' . get_string('settings') . '</a>';
} else if ($blocksettings instanceof admin_settingpage) {
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
} else {
} else if (!file_exists($CFG->dirroot.'/blocks/'.$block->name.'/settings.php')) {
// If the block's settings node was not found, we check that the block really provides the settings.php file.
// Note that blocks can inject their settings to other nodes in the admin tree without using the default locations.
// This can be done by assigning null to $setting in settings.php and it is a valid case.
debugging('Warning: block_'.$block->name.' returns true in has_config() but does not provide a settings.php file',
DEBUG_DEVELOPER);
}
+6 -6
View File
@@ -51,25 +51,25 @@ Options:
Example:
\$sudo -u www-data /usr/bin/php admin/cli/reset_password.php
"; //TODO: localize - to be translated later when everything is finished
";
echo $help;
die;
}
cli_heading('Password reset'); // TODO: localize
$prompt = "enter username (manual authentication only)"; // TODO: localize
cli_heading('Password reset');
$prompt = "Enter username (manual authentication only)";
$username = cli_input($prompt);
if (!$user = $DB->get_record('user', array('auth'=>'manual', 'username'=>$username, 'mnethostid'=>$CFG->mnet_localhost_id))) {
cli_error("Can not find user '$username'");
}
$prompt = "Enter new password"; // TODO: localize
$prompt = "Enter new password";
$password = cli_input($prompt);
$errmsg = '';//prevent eclipse warning
if (!check_password_policy($password, $errmsg)) {
cli_error($errmsg);
cli_error(html_to_text($errmsg, 0));
}
$hashedpassword = hash_internal_user_password($password);
@@ -78,4 +78,4 @@ $DB->set_field('user', 'password', $hashedpassword, array('id'=>$user->id));
echo "Password changed\n";
exit(0); // 0 means success
exit(0); // 0 means success.
+172
View File
@@ -1145,6 +1145,11 @@
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="2.8" requires="2.2">
@@ -1418,6 +1423,11 @@
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.0" requires="2.2">
@@ -1434,6 +1444,7 @@
<VENDOR name="oracle" version="10.2" />
</DATABASE>
<PHP version="5.4.4" level="required">
<RESTRICT function="restrict_php_version_71" message="unsupportedphpversion71" />
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
@@ -1556,6 +1567,11 @@
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.1" requires="2.7">
@@ -1572,6 +1588,7 @@
<VENDOR name="oracle" version="10.2" />
</DATABASE>
<PHP version="5.4.4" level="required">
<RESTRICT function="restrict_php_version_71" message="unsupportedphpversion71" />
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
@@ -1696,6 +1713,161 @@
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.2" requires="2.7">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="5.5.31" />
<VENDOR name="mysql" version="5.5.31" />
<VENDOR name="postgres" version="9.1" />
<VENDOR name="mssql" version="10.0" />
<VENDOR name="oracle" version="10.2" />
</DATABASE>
<PHP version="5.6.5" level="required">
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
<FEEDBACK>
<ON_CHECK message="opensslrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="optional">
<FEEDBACK>
<ON_CHECK message="intlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+6
View File
@@ -52,6 +52,12 @@ if (!function_exists('json_encode') || !function_exists('json_decode')) {
die();
}
// Make sure xml extension is available.
if (!extension_loaded('xml')) {
echo 'Moodle requires the xml PHP extension. Please install or enable the xml extension.';
die();
}
define('NO_OUTPUT_BUFFERING', true);
if (isset($_POST['upgradekey'])) {
+2 -1
View File
@@ -60,7 +60,8 @@ class mnet_simple_host_form extends moodleform {
}
if ($host = $DB->get_record('mnet_host', array('wwwroot' => $wwwroot))) {
global $CFG;
return array('wwwroot' => get_string('hostexists', 'mnet', $CFG->wwwroot . '/admin/mnet/peers.php?hostid=' . $host->id));
return array('wwwroot' => get_string('hostexists', 'mnet',
new moodle_url('/admin/mnet/peers.php', array('hostid' => $host->id))));
}
return array();
}
+2 -2
View File
@@ -109,7 +109,7 @@ if (!empty($hostid)) {
$mnet_peer->set_id($hostid);
echo $OUTPUT->header();
$currenttab = 'mnetdetails';
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
if ($hostid != $CFG->mnet_all_hosts_id) {
$mnet_peer->currentkey = mnet_get_public_key($mnet_peer->wwwroot, $mnet_peer->application);
@@ -144,7 +144,7 @@ if (empty($noreviewform) && $id = optional_param('id', 0, PARAM_INT)) {
// we're editing an existing one, so set up the tabs
$currenttab = 'mnetdetails';
$mnet_peer->set_id($id);
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
} else if (empty($noreviewform) && ($wwwroot = optional_param('wwwroot', '', PARAM_URL)) && ($applicationid = optional_param('applicationid', 0, PARAM_INT))) {
$application = $DB->get_field('mnet_application', 'name', array('id'=>$applicationid));
$mnet_peer->bootstrap($wwwroot, null, $application);
+1 -1
View File
@@ -26,7 +26,7 @@
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/admin/mnet/profilefields_form.php');
require_once($CFG->dirroot . '/' . $CFG->admin .'/mnet/profilefields_form.php');
$mnet = get_mnet_environment();
require_login();
+2 -2
View File
@@ -27,7 +27,7 @@
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/admin/mnet/services_form.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/services_form.php');
$mnet = get_mnet_environment();
require_login();
@@ -82,7 +82,7 @@ if ($formdata = $mform->get_data()) {
echo $OUTPUT->header();
$currenttab = 'mnetservices';
require_once($CFG->dirroot . '/admin/mnet/tabs.php');
require_once($CFG->dirroot . '/' . $CFG->admin . '/mnet/tabs.php');
echo $OUTPUT->box_start();
$s = mnet_get_service_info($mnet_peer, false); // basic data only
$mform->set_data($s);
+4
View File
@@ -32,10 +32,14 @@ $getroles = optional_param('getroles', 0, PARAM_BOOL);
list($context, $course, $cm) = get_context_info_array($contextid);
$PAGE->set_context($context);
require_login($course, false, $cm);
require_capability('moodle/role:review', $context);
require_sesskey();
$OUTPUT->header();
list($overridableroles, $overridecounts, $nameswithcounts) = get_overridable_roles($context,
ROLENAME_BOTH, true);
+3 -2
View File
@@ -71,8 +71,9 @@ class core_role_preset {
$dom->appendChild($top);
$top->appendChild($dom->createElement('shortname', $role->shortname));
$top->appendChild($dom->createElement('name', $role->name));
$top->appendChild($dom->createElement('description', $role->description));
$top->appendChild($dom->createElement('name', htmlspecialchars($role->name, ENT_COMPAT | ENT_HTML401, 'UTF-8')));
$top->appendChild($dom->createElement('description', htmlspecialchars($role->description, ENT_COMPAT | ENT_HTML401,
'UTF-8')));
$top->appendChild($dom->createElement('archetype', $role->archetype));
$contextlevels = $dom->createElement('contextlevels');
+1 -1
View File
@@ -32,7 +32,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$ADMIN->add('development', $temp);
// "Profiling" settingpage (conditionally if the 'xhprof' extension is available only).
$xhprofenabled = extension_loaded('xhprof') && function_exists('xhprof_enable');
$xhprofenabled = extension_loaded('xhprof') || extension_loaded('tideways');
$temp = new admin_settingpage('profiling', new lang_string('profiling', 'admin'), 'moodle/site:config', !$xhprofenabled);
// Main profiling switch.
$temp->add(new admin_setting_configcheckbox('profilingenabled', new lang_string('profilingenabled', 'admin'), new lang_string('profilingenabled_help', 'admin'), false));
+1 -1
View File
@@ -109,7 +109,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
// "httpsecurity" settingpage
$temp = new admin_settingpage('httpsecurity', new lang_string('httpsecurity', 'admin'));
$temp->add(new admin_setting_configcheckbox('loginhttps', new lang_string('loginhttps', 'admin'), new lang_string('configloginhttps', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('cookiesecure', new lang_string('cookiesecure', 'admin'), new lang_string('configcookiesecure', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('cookiehttponly', new lang_string('cookiehttponly', 'admin'), new lang_string('configcookiehttponly', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowframembedding', new lang_string('allowframembedding', 'admin'), new lang_string('allowframembedding_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', new lang_string('loginpasswordautocomplete', 'admin'), new lang_string('loginpasswordautocomplete_help', 'admin'), 0));
+6 -4
View File
@@ -27,9 +27,12 @@ if ($primaryadmin) {
$primaryadminemail = NULL;
$primaryadminname = NULL;
}
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'), new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'), new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'), new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
$temp->add(new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'),
new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_EMAIL));
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'),
new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
$ADMIN->add('server', $temp);
@@ -78,7 +81,6 @@ $temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('st
60*60*7 => '7 '.new lang_string('hours'),
60*60*8 => '8 '.new lang_string('hours') )));
$temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'), new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
$temp->add(new admin_setting_configtime('statsruntimestarthour', 'statsruntimestartminute', new lang_string('statsruntimestart', 'admin'), new lang_string('configstatsruntimestart', 'admin'), array('h' => 0, 'm' => 0)));
$temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'), new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
$ADMIN->add('server', $temp);
@@ -0,0 +1,57 @@
@core @core_admin
Feature: Enable multiple accounts to have the same email address
In order to have multiple accounts registerd on the system with the same email address
As an admin
I need to enable multiple accounts to be registered with the same email address and verify it is applied
Background:
Given I log in as "admin"
Scenario: Enable registration of multiple accounts with the same email address
Given the following config values are set as admin:
| allowaccountssameemail | 1 |
When I navigate to "Add a new user" node in "Site administration>Users>Accounts"
And I set the following fields to these values:
| Username | testmultiemailuser1 |
| Choose an authentication method | Manual accounts |
| New password | test@User1 |
| First name | Test |
| Surname | Multi1 |
| Email address | testmultiemailuser@example.com |
And I press "Create user"
And I should see "Test Multi1"
And I press "Add a new user"
And I set the following fields to these values:
| Username | testmultiemailuser2 |
| Choose an authentication method | Manual accounts |
| New password | test@User2 |
| First name | Test |
| Surname | Multi2 |
| Email address | testmultiemailuser@example.com |
And I press "Create user"
Then I should see "Test Multi2"
And I should not see "This email address is already registered"
Scenario: Disable registration of multiple accounts with the same email address
Given the following config values are set as admin:
| allowaccountssameemail | 0 |
When I navigate to "Add a new user" node in "Site administration>Users>Accounts"
And I set the following fields to these values:
| Username | testmultiemailuser1 |
| Choose an authentication method | Manual accounts |
| New password | test@User1 |
| First name | Test |
| Surname | Multi1 |
| Email address | testmultiemailuser@example.com |
And I press "Create user"
And I should see "Test Multi1"
And I press "Add a new user"
And I set the following fields to these values:
| Username | testmultiemailuser2 |
| Choose an authentication method | Manual accounts |
| New password | test@User2 |
| First name | Test |
| Surname | Multi2 |
| Email address | testmultiemailuser@example.com |
And I press "Create user"
Then I should see "This email address is already registered"
+3
View File
@@ -101,6 +101,9 @@ if (empty($options['torun'])) {
if (extension_loaded('pcntl')) {
$disabled = explode(',', ini_get('disable_functions'));
if (!in_array('pcntl_signal', $disabled)) {
// Handle interrupts on PHP7.
declare(ticks = 1);
pcntl_signal(SIGTERM, "signal_handler");
pcntl_signal(SIGINT, "signal_handler");
}
@@ -184,6 +184,8 @@ class controller {
if ($updated) {
$this->info[] = get_string('langupdatecomplete', 'tool_langimport');
// The strings have been changed so we need to purge their cache to ensure users see the changes.
get_string_manager()->reset_caches();
} else {
$this->info[] = get_string('nolangupdateneeded', 'tool_langimport');
}
@@ -97,6 +97,15 @@ class manager {
'secure' => $CFG->messageinbound_hostssl,
);
if (strpos($configuration['hostspec'], ':')) {
$hostdata = explode(':', $configuration['hostspec']);
if (count($hostdata) === 2) {
// A hostname in the format hostname:port has been provided.
$configuration['hostspec'] = $hostdata[0];
$configuration['port'] = $hostdata[1];
}
}
$this->client = new \Horde_Imap_Client_Socket($configuration);
try {
+5 -4
View File
@@ -103,15 +103,16 @@ class eventlist {
foreach ($pluginlist as $plugin => $directory) {
$plugindirectory = $directory . '/classes/event';
foreach (self::get_file_list($plugindirectory) as $eventname => $notused) {
$plugineventname = '\\' . $plugintype . '_' . $plugin . '\\event\\' . $eventname;
$fullpluginname = $plugintype . '_' . $plugin;
$plugineventname = '\\' . $fullpluginname . '\\event\\' . $eventname;
// Check that this is actually an event.
if (method_exists($plugineventname, 'get_static_info') && $plugin != 'monitor') { // No selfie here.
if (method_exists($plugineventname, 'get_static_info') && $fullpluginname !== 'tool_monitor') { // No selfie here.
$ref = new \ReflectionClass($plugineventname);
if (!$ref->isAbstract() && $plugin != 'legacy') {
if (!$ref->isAbstract() && $fullpluginname !== 'logstore_legacy') {
if ($withoutcomponent) {
$noncorepluginlist[$plugineventname] = $plugineventname::get_name();
} else {
$noncorepluginlist[$plugintype . '_' . $plugin][$plugineventname] = $plugineventname::get_name();
$noncorepluginlist[$fullpluginname][$plugineventname] = $plugineventname::get_name();
}
}
}
@@ -140,6 +140,10 @@ class eventobservers {
$subscriptions = subscription_manager::get_subscriptions_by_event($eventobj);
$idstosend = array();
foreach ($subscriptions as $subscription) {
// Only proceed to fire events and notifications if the subscription is active.
if (!subscription_manager::subscription_is_active($subscription)) {
continue;
}
$starttime = $now - $subscription->timewindow;
$starttime = ($starttime > $subscription->lastnotificationsent) ? $starttime : $subscription->lastnotificationsent;
if ($subscription->courseid == 0) {
+11 -2
View File
@@ -55,17 +55,26 @@ class subscription {
* Magic get method.
*
* @param string $prop property to get.
*
* @return mixed
* @throws \coding_exception
*/
public function __get($prop) {
if (property_exists($this->subscription, $prop)) {
if (isset($this->subscription->$prop)) {
return $this->subscription->$prop;
}
throw new \coding_exception('Property "' . $prop . '" doesn\'t exist');
}
/**
* Magic isset method.
*
* @param string $prop the property to get.
* @return bool true if the property is set, false otherwise.
*/
public function __isset($prop) {
return property_exists($this->subscription, $prop);
}
/**
* Get a human readable name for instances associated with this subscription.
*
@@ -35,6 +35,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subscription_manager {
/** @const Period of time, in days, after which an inactive subscription will be removed completely.*/
const INACTIVE_SUBSCRIPTION_LIFESPAN_IN_DAYS = 30;
/**
* Subscribe a user to a given rule.
*
@@ -456,4 +460,78 @@ class subscription_manager {
return false;
}
/**
* Activates a group of subscriptions based on an input array of ids.
*
* @since 3.0.5
* @param array $ids of subscription ids.
* @return bool true if the operation was successful, false otherwise.
*/
public static function activate_subscriptions(array $ids) {
global $DB;
if (!empty($ids)) {
list($sql, $params) = $DB->get_in_or_equal($ids);
$success = $DB->set_field_select('tool_monitor_subscriptions', 'inactivedate', '0', 'id ' . $sql, $params);
return $success;
}
return false;
}
/**
* Deactivates a group of subscriptions based on an input array of ids.
*
* @since 3.0.5
* @param array $ids of subscription ids.
* @return bool true if the operation was successful, false otherwise.
*/
public static function deactivate_subscriptions(array $ids) {
global $DB;
if (!empty($ids)) {
$inactivedate = time();
list($sql, $params) = $DB->get_in_or_equal($ids);
$success = $DB->set_field_select('tool_monitor_subscriptions', 'inactivedate', $inactivedate, 'id ' . $sql,
$params);
return $success;
}
return false;
}
/**
* Deletes subscriptions which have been inactive for a period of time.
*
* @since 3.0.5
* @param int $userid if provided, only this user's stale subscriptions will be deleted.
* @return bool true if the operation was successful, false otherwise.
*/
public static function delete_stale_subscriptions($userid = 0) {
global $DB;
// Get the expiry duration, in days.
$cutofftime = strtotime("-" . self::INACTIVE_SUBSCRIPTION_LIFESPAN_IN_DAYS . " days", time());
if (!empty($userid)) {
// Remove any stale subscriptions for the desired user only.
$success = $DB->delete_records_select('tool_monitor_subscriptions',
'userid = ? AND inactivedate < ? AND inactivedate <> 0',
array($userid, $cutofftime));
} else {
// Remove all stale subscriptions.
$success = $DB->delete_records_select('tool_monitor_subscriptions',
'inactivedate < ? AND inactivedate <> 0',
array($cutofftime));
}
return $success;
}
/**
* Check whether a subscription is active.
*
* @since 3.0.5
* @param \tool_monitor\subscription $subscription instance.
* @return bool true if the subscription is active, false otherwise.
*/
public static function subscription_is_active(subscription $subscription) {
return empty($subscription->inactivedate);
}
}
@@ -0,0 +1,274 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
namespace tool_monitor\task;
use tool_monitor\subscription;
use tool_monitor\subscription_manager;
/**
* Simple task class responsible for activating, deactivating and removing subscriptions.
*
* Activation/deactivation is managed by looking at the same access rules used to determine whether a user can
* subscribe to the rule in the first place.
*
* Removal occurs when a subscription has been inactive for a period of time exceeding the lifespan, as set by
* subscription_manager::get_inactive_subscription_lifespan().
*
* I.e.
* - Activation: If a user can subscribe currently, then an existing subscription should be made active.
* - Deactivation: If a user cannot subscribe currently, then an existing subscription should be made inactive.
* - Removal: If a user has a subscription that has been inactive for longer than the prescribed period, then
* delete the subscription entirely.
*
* @since 3.0.5
* @package tool_monitor
* @copyright 2016 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class check_subscriptions extends \core\task\scheduled_task {
/** @var array 1d static cache, indexed by userid, storing whether or not the user has been fully set up.*/
protected $userssetupcache = array();
/** @var array 2d static cache, indexed by courseid and userid, storing whether a user can access the course with
* the 'tool/monitor:subscribe' capability.
*/
protected $courseaccesscache = array();
/**
* Get a descriptive name for this task.
*
* @since 3.0.5
* @return string name of the task.
*/
public function get_name() {
return get_string('taskchecksubscriptions', 'tool_monitor');
}
/**
* Checks all course-level rule subscriptions and activates/deactivates based on current course access.
*
* The ordering of checks within the task is important for optimisation purposes. The aim is to be able to make a decision
* about whether to activate/deactivate each subscription without making unnecessary checks. The ordering roughly follows the
* context model, starting with system and user checks and moving down to course and course-module only when necessary.
*
* For example, if the user is suspended, then any active subscription is made inactive right away. I.e. there is no need to
* check site-level, course-level or course-module-level permissions. Likewise, if a subscriptions is site-level, there is no
* need to check course-level and course-module-level permissions.
*
* The task performs the following checks, in this order:
* 1. Check for a suspended user, breaking if suspended.
* 2. Check for an incomplete (not set up) user, breaking if not fully set up.
* 3. Check for the required capability in the relevant context, breaking if the capability is not found.
* 4. Check whether the subscription is site-context, breaking if true.
* 5. Check whether the user has course access, breaking only if the subscription is not also course-module-level.
* 6. Check whether the user has course-module access.
*
* @since 3.0.5
*/
public function execute() {
global $DB;
if (!get_config('tool_monitor', 'enablemonitor')) {
return; // The tool is disabled. Nothing to do.
}
$toactivate = array(); // Store the ids of subscriptions to be activated upon completion.
$todeactivate = array(); // Store the ids of subscriptions to be deactivated upon completion.
// Resultset rows are ordered by userid and courseid to work nicely with get_fast_modinfo() caching.
$sql = "SELECT u.id AS userid, u.firstname AS userfirstname, u.lastname AS userlastname, u.suspended AS usersuspended,
u.email AS useremail, c.visible as coursevisible, c.cacherev as coursecacherev, s.courseid AS subcourseid,
s.userid AS subuserid, s.cmid AS subcmid, s.inactivedate AS subinactivedate, s.id AS subid
FROM {user} u
JOIN {tool_monitor_subscriptions} s ON (s.userid = u.id)
LEFT JOIN {course} c ON (c.id = s.courseid)
WHERE u.id = s.userid
ORDER BY s.userid, s.courseid";
$rs = $DB->get_recordset_sql($sql);
foreach ($rs as $row) {
// Create skeleton records from the result. This should be enough to use in subsequent access calls and avoids DB hits.
$sub = $this->get_subscription_from_rowdata($row);
$sub = new subscription($sub);
if (!isset($user) || $user->id != $sub->userid) {
$user= $this->get_user_from_rowdata($row);
}
if ((!isset($course) || $course->id != $sub->courseid) && !empty($sub->courseid)) {
$course = $this->get_course_from_rowdata($row);
}
// The user is suspended at site level, so deactivate any active subscriptions.
if ($user->suspended) {
if (subscription_manager::subscription_is_active($sub)) {
$todeactivate[] = $sub->id;
}
continue;
}
// Is the user fully set up? As per require_login on the subscriptions page.
if (!$this->is_user_setup($user)) {
if (subscription_manager::subscription_is_active($sub)) {
$todeactivate[] = $sub->id;
}
continue;
}
// Determine the context, based on the subscription course id.
$sitelevelsubscription = false;
if (empty($sub->courseid)) {
$context = \context_system::instance();
$sitelevelsubscription = true;
} else {
$context = \context_course::instance($sub->courseid);
}
// Check capability in the context.
if (!has_capability('tool/monitor:subscribe', $context, $user)) {
if (subscription_manager::subscription_is_active($sub)) {
$todeactivate[] = $sub->id;
}
continue;
}
// If the subscription is site-level, then we've run all the checks required to make an access decision.
if ($sitelevelsubscription) {
if (!subscription_manager::subscription_is_active($sub)) {
$toactivate[] = $sub->id;
}
continue;
}
// Check course access.
if (!$this->user_can_access_course($user, $course, 'tool/monitor:subscribe')) {
if (subscription_manager::subscription_is_active($sub)) {
$todeactivate[] = $sub->id;
}
continue;
}
// If the subscription has no course module relationship.
if (empty($sub->cmid)) {
if (!subscription_manager::subscription_is_active($sub)) {
$toactivate[] = $sub->id;
}
continue;
}
// Otherwise, check the course module info. We use the same checks as on the subscription page.
$modinfo = get_fast_modinfo($course, $sub->userid);
$cm = $modinfo->get_cm($sub->cmid);
if (!$cm || !$cm->uservisible || !$cm->available) {
if (subscription_manager::subscription_is_active($sub)) {
$todeactivate[] = $sub->id;
}
continue;
}
// The course module is available and visible, so make a decision.
if (!subscription_manager::subscription_is_active($sub)) {
$toactivate[] = $sub->id;
}
}
$rs->close();
// Activate/deactivate/delete relevant subscriptions.
subscription_manager::activate_subscriptions($toactivate);
subscription_manager::deactivate_subscriptions($todeactivate);
subscription_manager::delete_stale_subscriptions();
}
/**
* Determines whether a user is fully set up, using cached results where possible.
*
* @since 3.0.5
* @param \stdClass $user the user record.
* @return bool true if the user is fully set up, false otherwise.
*/
protected function is_user_setup($user) {
if (!isset($this->userssetupcache[$user->id])) {
$this->userssetupcache[$user->id] = !user_not_fully_set_up($user, true);
}
return $this->userssetupcache[$user->id];
}
/**
* Determines a user's access to a course with a given capability, using cached results where possible.
*
* @since 3.0.5
* @param \stdClass $user the user record.
* @param \stdClass $course the course record.
* @param string $capability the capability to check.
* @return bool true if the user can access the course with the specified capability, false otherwise.
*/
protected function user_can_access_course($user, $course, $capability) {
if (!isset($this->courseaccesscache[$course->id][$user->id][$capability])) {
$this->courseaccesscache[$course->id][$user->id][$capability] = can_access_course($course, $user, $capability, true);
}
return $this->courseaccesscache[$course->id][$user->id][$capability];
}
/**
* Returns a partial subscription record, created from properties of the supplied recordset row object.
* Intended to return a minimal record for specific use within this class and in subsequent access control calls only.
*
* @since 3.0.5
* @param \stdClass $rowdata the row object.
* @return \stdClass a partial subscription record.
*/
protected function get_subscription_from_rowdata($rowdata) {
$sub = new \stdClass();
$sub->id = $rowdata->subid;
$sub->userid = $rowdata->subuserid;
$sub->courseid = $rowdata->subcourseid;
$sub->cmid = $rowdata->subcmid;
$sub->inactivedate = $rowdata->subinactivedate;
return $sub;
}
/**
* Returns a partial course record, created from properties of the supplied recordset row object.
* Intended to return a minimal record for specific use within this class and in subsequent access control calls only.
*
* @since 3.0.5
* @param \stdClass $rowdata the row object.
* @return \stdClass a partial course record.
*/
protected function get_course_from_rowdata($rowdata) {
$course = new \stdClass();
$course->id = $rowdata->subcourseid;
$course->visible = $rowdata->coursevisible;
$course->cacherev = $rowdata->coursecacherev;
return $course;
}
/**
* Returns a partial user record, created from properties of the supplied recordset row object.
* Intended to return a minimal record for specific use within this class and in subsequent access control calls only.
*
* @since 3.0.5
* @param \stdClass $rowdata the row object.
* @return \stdClass a partial user record.
*/
protected function get_user_from_rowdata($rowdata) {
$user = new \stdClass();
$user->id = $rowdata->userid;
$user->firstname = $rowdata->userfirstname;
$user->lastname = $rowdata->userlastname;
$user->email = $rowdata->useremail;
$user->suspended = $rowdata->usersuspended;
return $user;
}
}
+1
View File
@@ -38,6 +38,7 @@
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User id of the subscriber"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Timestamp of when this subscription was created"/>
<FIELD NAME="lastnotificationsent" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Timestamp of the time when a notification was last sent for this subscription."/>
<FIELD NAME="inactivedate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
+9
View File
@@ -32,5 +32,14 @@ $tasks = array(
'day' => '*',
'dayofweek' => '*',
'month' => '*'
),
array(
'classname' => 'tool_monitor\task\check_subscriptions',
'blocking' => 0,
'minute' => 'R',
'hour' => 'R',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
)
);
+15
View File
@@ -59,5 +59,20 @@ function xmldb_tool_monitor_upgrade($oldversion) {
// Moodle v3.0.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2015111601) {
// Define field inactivedate to be added to tool_monitor_subscriptions.
$table = new xmldb_table('tool_monitor_subscriptions');
$field = new xmldb_field('inactivedate', XMLDB_TYPE_INTEGER, '10', null, true, null, 0, 'lastnotificationsent');
// Conditionally launch add field inactivedate.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Monitor savepoint reached.
upgrade_plugin_savepoint(true, 2015111601, 'tool', 'monitor');
}
return true;
}
+1 -1
View File
@@ -24,7 +24,7 @@
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->dirroot . '/admin/tool/monitor/lib.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/monitor/lib.php');
$courseid = optional_param('courseid', 0, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA);
@@ -99,4 +99,5 @@ $string['subhelp'] = 'Subscription details';
$string['subhelp_help'] = 'This subscription listens for when the event \'{$a->eventname}\' has been triggered in \'{$a->moduleinstance}\' {$a->frequency} time(s) in {$a->minutes} minute(s).';
$string['subscribeto'] = 'Subscribe to rule "{$a}"';
$string['taskcleanevents'] = 'Removes any unnecessary event monitor events';
$string['taskchecksubscriptions'] = 'Activate/deactivate invalid rule subscriptions';
$string['unsubscribe'] = 'Unsubscribe';
@@ -384,7 +384,7 @@ class tool_monitor_eventobservers_testcase extends advanced_testcase {
// Now let us trigger 7 instances of the event.
$event = \mod_book\event\course_module_instance_list_viewed::create_from_course($course);
$event->trigger();
sleep(1); // Add a second delay, to prevent time collisions.
$this->waitForSecond(); // Add a second delay, to prevent time collisions.
}
$this->run_adhock_tasks();
$messages = $messagesink->get_messages();
@@ -0,0 +1,65 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || exit();
/**
* Unit tests for the subscription class.
* @since 3.0.5
*
* @package tool_monitor
* @category test
* @copyright 2016 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_monitor_subscription_testcase extends advanced_testcase {
/**
* @var \tool_monitor\subscription $subscription object.
*/
private $subscription;
/**
* Test set up.
*/
public function setUp() {
$this->resetAfterTest(true);
// Create the mock subscription.
$sub = new stdClass();
$sub->id = 100;
$sub->name = 'My test rule';
$sub->courseid = 20;
$this->subscription = $this->getMock('\tool_monitor\subscription',null, array($sub));
}
/**
* Test for the magic __isset method.
*/
public function test_magic_isset() {
$this->assertEquals(true, isset($this->subscription->name));
$this->assertEquals(true, isset($this->subscription->courseid));
$this->assertEquals(false, isset($this->subscription->ruleid));
}
/**
* Test for the magic __get method.
*/
public function test_magic_get() {
$this->assertEquals(20, $this->subscription->courseid);
$this->setExpectedException('coding_exception');
$this->subscription->ruleid;
}
}
@@ -0,0 +1,364 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
defined('MOODLE_INTERNAL') || exit();
/**
* Unit tests for the tool_monitor clean events task.
* @since 3.0.5
*
* @package tool_monitor
* @category test
* @copyright 2016 Jake Dallimore <jrhdallimore@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_monitor_task_check_subscriptions_testcase extends advanced_testcase {
private $course;
private $user;
private $rule;
private $subscription;
private $teacherrole;
private $studentrole;
/**
* Test set up.
*/
public function setUp() {
global $DB;
set_config('enablemonitor', 1, 'tool_monitor');
$this->resetAfterTest(true);
// All tests defined herein need a user, course, rule and subscription, so set these up.
$this->user = $this->getDataGenerator()->create_user();
$this->course = $this->getDataGenerator()->create_course();
$rule = new stdClass();
$rule->userid = 2; // Rule created by admin.
$rule->courseid = $this->course->id;
$rule->plugin = 'mod_book';
$rule->eventname = '\mod_book\event\course_module_viewed';
$rule->timewindow = 500;
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
$this->rule = $monitorgenerator->create_rule($rule);
$sub = new stdClass();
$sub->courseid = $this->course->id;
$sub->userid = $this->user->id;
$sub->ruleid = $this->rule->id;
$this->subscription = $monitorgenerator->create_subscription($sub);
// Also set up a student and a teacher role for use in some tests.
$this->teacherrole = $DB->get_record('role', array('shortname' => 'teacher'));
$this->studentrole = $DB->get_record('role', array('shortname' => 'student'));
}
/**
* Reloads the subscription object from the DB.
*
* @return void.
*/
private function reload_subscription() {
global $DB;
$sub = $DB->get_record('tool_monitor_subscriptions', array('id' => $this->subscription->id));
$this->subscription = new \tool_monitor\subscription($sub);
}
/**
* Test to confirm the task is named correctly.
*/
public function test_task_name() {
$task = new \tool_monitor\task\check_subscriptions();
$this->assertEquals(get_string('taskchecksubscriptions', 'tool_monitor'), $task->get_name());
}
/**
* Test to confirm that site level subscriptions are activated and deactivated according to system capabilities.
*/
public function test_site_level_subscription() {
// Create a site level subscription.
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
$sub = new stdClass();
$sub->userid = $this->user->id;
$sub->ruleid = $this->rule->id;
$this->subscription = $monitorgenerator->create_subscription($sub);
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should be inactive as the user doesn't have the capability. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Now, assign the user as a teacher role at system context.
$this->getDataGenerator()->role_assign($this->teacherrole->id, $this->user->id, context_system::instance());
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should be active now. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm that if the module is disabled, no changes are made to active subscriptions.
*/
public function test_module_disabled() {
set_config('enablemonitor', 0, 'tool_monitor');
// Subscription should be active to start with.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Run the task. Note, we never enrolled the user.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should still be active. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm an active, valid subscription stays active once the scheduled task is run.
*/
public function test_active_unaffected() {
// Enrol the user as a teacher. This role should have the required capability.
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, $this->teacherrole->id);
// Subscription should be active to start with.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should still be active. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm that a subscription for a user without an enrolment to the course is made inactive.
*/
public function test_course_enrolment() {
// Subscription should be active until deactivated by the scheduled task. Remember, by default the test setup
// doesn't enrol the user, so the first run of the task should deactivate it.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should NOT be active. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Enrol the user.
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, $this->teacherrole->id);
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// Subscription should now be active again.
$this->reload_subscription();
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm that subscriptions for enrolled users without the required capability are made inactive.
*/
public function test_enrolled_user_with_no_capability() {
// Enrol the user. By default, students won't have the required capability.
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, $this->studentrole->id);
// The subscription should be active to start with. Pass in the id only to refetch the data.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should NOT be active. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm that subscriptions for users who fail can_access_course(), are deactivated.
*/
public function test_can_access_course() {
// Enrol the user as a teacher. This role should have the required capability.
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, $this->teacherrole->id);
// Strip the ability to see hidden courses, so we'll fail the check_subscriptions->user_can_access_course call.
$context = \context_course::instance($this->course->id);
assign_capability('moodle/course:viewhiddencourses', CAP_PROHIBIT, $this->teacherrole->id, $context);
// Subscription should be active to start with.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Hide the course.
course_change_visibility($this->course->id, false);
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should be inactive. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm that subscriptions for enrolled users who don't have CM access, are deactivated.
*/
public function test_cm_access() {
// Enrol the user as a student but grant to ability to subscribe. Students cannot view hidden activities.
$context = \context_course::instance($this->course->id);
assign_capability('tool/monitor:subscribe', CAP_ALLOW, $this->studentrole->id, $context);
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, $this->studentrole->id);
// Generate a course module.
$book = $this->getDataGenerator()->create_module('book', array('course' => $this->course->id));
// And add a subscription to it.
$sub = new stdClass();
$sub->courseid = $this->course->id;
$sub->userid = $this->user->id;
$sub->ruleid = $this->rule->id;
$sub->cmid = $book->cmid;
$monitorgenerator = $this->getDataGenerator()->get_plugin_generator('tool_monitor');
$this->subscription = $monitorgenerator->create_subscription($sub);
// The subscription should be active to start with. Pass in the id only to refetch the data.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should still be active. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Make the course module invisible, which should in turn make the subscription inactive.
set_coursemodule_visible($book->cmid, false);
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should NOT be active. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Make the course module visible again.
set_coursemodule_visible($book->cmid, true);
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should be active. Pass in the id only to refetch the data.
$this->reload_subscription();
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm that long term inactive subscriptions are removed entirely.
*/
public function test_stale_subscription_removal() {
global $DB;
// Manually set the inactivedate to 1 day older than the limit allowed.
$daysold = 1 + \tool_monitor\subscription_manager::INACTIVE_SUBSCRIPTION_LIFESPAN_IN_DAYS;
$inactivedate = strtotime("-$daysold days", time());
$DB->set_field('tool_monitor_subscriptions', 'inactivedate', $inactivedate, array('id' => $this->subscription->id));
// Subscription should be inactive to start with.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// Subscription should now not exist at all.
$this->assertEquals(false, $DB->record_exists('tool_monitor_subscriptions', array('id' => $this->subscription->id)));
}
/**
* Test to confirm that subscriptions for a partially set up user are deactivated.
*/
public function test_user_not_fully_set_up() {
global $DB;
// Enrol the user as a teacher.
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, $this->teacherrole->id);
// The subscription should be active to start.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Unset the user's email address, so we fail the check_subscriptions->is_user_setup() call.
$DB->set_field('user', 'email', '', array('id' => $this->user->id));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should now be inactive.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
/**
* Test to confirm that a suspended user's subscriptions are deactivated properly.
*/
public function test_suspended_user() {
global $DB;
// Enrol the user as a teacher. This role should have the required capability.
$this->getDataGenerator()->enrol_user($this->user->id, $this->course->id, $this->teacherrole->id);
// Subscription should be active to start with.
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Suspend the user.
$DB->set_field('user', 'suspended', '1', array('id' => $this->user->id));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should now be inactive.
$this->reload_subscription();
$this->assertEquals(false, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
// Unsuspend the user.
$DB->set_field('user', 'suspended', '0', array('id' => $this->user->id));
// Run the task.
$task = new \tool_monitor\task\check_subscriptions();
$task->execute();
// The subscription should now be active again.
$this->reload_subscription();
$this->assertEquals(true, \tool_monitor\subscription_manager::subscription_is_active($this->subscription));
}
}
+1 -1
View File
@@ -26,6 +26,6 @@
defined('MOODLE_INTERNAL') || die;
$plugin->version = 2015111600; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2015111601; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2015111000; // Requires this Moodle version.
$plugin->component = 'tool_monitor'; // Full name of the plugin (used for diagnostics).
+1 -1
View File
@@ -121,7 +121,7 @@ echo $OUTPUT->box_end();
/// Rebuild course cache which might be incorrect now
echo $OUTPUT->notification('Rebuilding course cache...', 'notifysuccess');
rebuild_course_cache();
rebuild_course_cache(0, true);
echo $OUTPUT->notification('...finished', 'notifysuccess');
echo $OUTPUT->continue_button(new moodle_url('/admin/'));
+3 -2
View File
@@ -26,6 +26,7 @@
defined('MOODLE_INTERNAL') || die;
// profiling tool, added to development
if (extension_loaded('xhprof') && function_exists('xhprof_enable') && (!empty($CFG->profilingenabled) || !empty($CFG->earlyprofilingenabled))) {
$ADMIN->add('development', new admin_externalpage('toolprofiling', get_string('pluginname', 'tool_profiling'), "$CFG->wwwroot/$CFG->admin/tool/profiling/index.php", 'moodle/site:config'));
if ((extension_loaded('xhprof') || extension_loaded('tideways')) && (!empty($CFG->profilingenabled) || !empty($CFG->earlyprofilingenabled))) {
$ADMIN->add('development', new admin_externalpage('toolprofiling', get_string('pluginname', 'tool_profiling'),
"$CFG->wwwroot/$CFG->admin/tool/profiling/index.php", 'moodle/site:config'));
}
+1 -1
View File
@@ -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(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){e.replaceNodeContents(a('[data-region="displaytemplateexample"]'),b,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}}],!0,!1);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)}),{}});
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){if(!a)return!1;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){e.replaceNodeContents(a('[data-region="displaytemplateexample"]'),b,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}}],!0,!1);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(b){var c=a(this).data("templatename");b.preventDefault(),j(c)}),{}});
+1 -1
View File
@@ -1 +1 @@
define(["jquery","core/ajax","core/log","core/notification","core/templates"],function(a,b,c,d,e){var f=function(b){e.render("tool_templatelibrary/search_results",{templates:b}).done(function(b,c){e.replaceNode(a('[data-region="searchresults"]'),b,c)}).fail(d.exception)},g=function(){var c=a('[data-field="component"]').val(),e=a('[data-field="search"]').val();b.call([{methodname:"tool_templatelibrary_list_templates",args:{component:c,search:e},done:f,fail:d.exception}],!0,!1)},h=null,i=function(a,b){null!==h&&window.clearTimeout(h),h=window.setTimeout(function(){a(),h=null},b)},j=function(){i(g,400)};return a('[data-region="list-templates"]').on("change",'[data-field="component"]',j),a('[data-region="list-templates"]').on("input",'[data-field="search"]',j),g(),{}});
define(["jquery","core/ajax","core/log","core/notification","core/templates","core/config"],function(a,b,c,d,e,f){var g=function(b){e.render("tool_templatelibrary/search_results",{templates:b}).done(function(b,c){e.replaceNode(a('[data-region="searchresults"]'),b,c)}).fail(d.exception)},h=function(c){var e=a('[data-field="component"]').val(),f=a('[data-field="search"]').val();b.call([{methodname:"tool_templatelibrary_list_templates",args:{component:e,search:f,themename:c},done:g,fail:d.exception}],!0,!1)},i=null,j=function(a,b){null!==i&&window.clearTimeout(i),i=window.setTimeout(function(){a(),i=null},b)},k=function(){j(h.bind(this,f.theme),400)};return a('[data-region="list-templates"]').on("change",'[data-field="component"]',k),a('[data-region="list-templates"]').on("input",'[data-field="search"]',k),h(f.theme),{}});
@@ -33,6 +33,9 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
*/
var findDocsSection = function(templateSource, templateName) {
if (!templateSource) {
return false;
}
// Find the comment section marked with @template component/template.
var marker = "@template " + templateName,
i = 0,
@@ -141,8 +144,9 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
};
// Add the event listeners.
$('[data-region="list-templates"]').on('click', '[data-templatename]', function() {
$('[data-region="list-templates"]').on('click', '[data-templatename]', function(e) {
var templatename = $(this).data('templatename');
e.preventDefault();
loadTemplate(templatename);
});
+6 -7
View File
@@ -21,8 +21,8 @@
* @copyright 2015 Damyon Wiese <damyon@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'],
function($, ajax, log, notification, templates) {
define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates', 'core/config'],
function($, ajax, log, notification, templates, config) {
/**
* The ajax call has returned with a new list of templates.
@@ -42,15 +42,14 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
*
* @method refreshSearch
*/
var refreshSearch = function() {
var refreshSearch = function(themename) {
var componentStr = $('[data-field="component"]').val();
var searchStr = $('[data-field="search"]').val();
// Trigger the search.
ajax.call([
{ methodname: 'tool_templatelibrary_list_templates',
args: { component: componentStr, search: searchStr },
args: { component: componentStr, search: searchStr, themename: themename },
done: reloadListTemplate,
fail: notification.exception }
], true, false);
@@ -78,12 +77,12 @@ define(['jquery', 'core/ajax', 'core/log', 'core/notification', 'core/templates'
};
var changeHandler = function() {
queueRefresh(refreshSearch, 400);
queueRefresh(refreshSearch.bind(this, config.theme), 400);
};
// Add change handlers to refresh the list.
$('[data-region="list-templates"]').on('change', '[data-field="component"]', changeHandler);
$('[data-region="list-templates"]').on('input', '[data-field="search"]', changeHandler);
refreshSearch();
refreshSearch(config.theme);
return {};
});
+22 -9
View File
@@ -47,7 +47,12 @@ class api {
* @return array[string] Where each template is in the form "component/templatename".
*/
public static function list_templates($component = '', $search = '', $themename = '') {
global $CFG;
global $CFG, $PAGE;
if (empty($themename)) {
$themename = $PAGE->theme->name;
}
$themeconfig = \theme_config::load($themename);
$templatedirs = array();
$results = array();
@@ -77,6 +82,9 @@ class api {
foreach ($plugintypes as $type => $dir) {
$plugins = core_component::get_plugin_list_with_file($type, 'templates', false);
foreach ($plugins as $plugin => $dir) {
if ($type == 'theme' && $plugin != $themename && !in_array($plugin, $themeconfig->parents)) {
continue;
}
if (!empty($dir) && is_dir($dir)) {
$pluginname = $type . '_' . $plugin;
$dirs = mustache_template_finder::get_template_directories_for_component($pluginname, $themename);
@@ -111,25 +119,30 @@ class api {
*
* @param string $component The component that holds the template.
* @param string $template The name of the template.
* @return string the template
* @return string the template or false if template doesn't exist.
*/
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;
$themedir = core_component::get_plugin_types()['theme'];
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 (strpos($dir, $themedir) === 0) {
continue;
}
$candidate = $dir . $template . '.mustache';
if (file_exists($candidate)) {
$filename = $candidate;
break;
}
}
if ($filename === false) {
throw new moodle_exception('filenotfound', 'error');
// There are occasions where we don't have a core template.
return false;
}
$templatestr = file_get_contents($filename);
@@ -59,7 +59,13 @@ class external extends external_api {
VALUE_DEFAULT,
''
);
$params = array('component' => $component, 'search' => $search);
$themename = new external_value(
PARAM_COMPONENT,
'The current theme',
VALUE_DEFAULT,
''
);
$params = array('component' => $component, 'search' => $search, 'themename' => $themename);
return new external_function_parameters($params);
}
@@ -67,16 +73,18 @@ class external extends external_api {
* Loads the list of templates.
* @param string $component Limit the search to a component.
* @param string $search The search string.
* @param string $themename The name of theme
* @return array[string]
*/
public static function list_templates($component, $search) {
public static function list_templates($component, $search, $themename = '') {
$params = self::validate_parameters(self::list_templates_parameters(),
array(
'component' => $component,
'search' => $search,
'themename' => $themename,
));
return api::list_templates($component, $search);
return api::list_templates($component, $search, $themename);
}
/**
@@ -107,7 +115,7 @@ class external extends external_api {
*
* @param string $component The component that holds the template.
* @param string $template The name of the template.
* @return string the template
* @return string the template, false if template doesn't exist.
*/
public static function load_canonical_template($component, $template) {
$params = self::validate_parameters(self::load_canonical_template_parameters(),
+5 -5
View File
@@ -582,6 +582,11 @@ class tool_uploadcourse_course {
}
}
// Course start date.
if (!empty($coursedata['startdate'])) {
$coursedata['startdate'] = strtotime($coursedata['startdate']);
}
// Ultimate check mode vs. existence.
switch ($mode) {
case tool_uploadcourse_processor::MODE_CREATE_NEW:
@@ -631,11 +636,6 @@ class tool_uploadcourse_course {
$this->do = self::DO_CREATE;
}
// Course start date.
if (!empty($coursedata['startdate'])) {
$coursedata['startdate'] = strtotime($coursedata['startdate']);
}
// Add role renaming.
$errors = array();
$rolenames = tool_uploadcourse_helper::get_role_names($this->rawdata, $errors);
@@ -425,7 +425,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
'fullname' => 'Fullname',
'category' => '1',
'visible' => '0',
'startdate' => '8 June 1990',
'startdate' => 644803200,
'idnumber' => '123abc',
'summary' => 'Summary',
'format' => 'weeks',
@@ -452,7 +452,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
$this->assertEquals($defaultdata['fullname'], $course->fullname);
$this->assertEquals($defaultdata['category'], $course->category);
$this->assertEquals($defaultdata['visible'], $course->visible);
$this->assertEquals(mktime(0, 0, 0, 6, 8, 1990), $course->startdate);
$this->assertEquals($defaultdata['startdate'], $course->startdate);
$this->assertEquals($defaultdata['idnumber'], $course->idnumber);
$this->assertEquals($defaultdata['summary'], $course->summary);
$this->assertEquals($defaultdata['format'], $course->format);
@@ -478,7 +478,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
'fullname' => 'Fullname 2',
'category' => $cat->id,
'visible' => '1',
'startdate' => '11 June 1984',
'startdate' => 455760000,
'idnumber' => 'changedid',
'summary' => 'Summary 2',
'format' => 'topics',
@@ -505,7 +505,7 @@ class tool_uploadcourse_course_testcase extends advanced_testcase {
$this->assertEquals($defaultdata['fullname'], $course->fullname);
$this->assertEquals($defaultdata['category'], $course->category);
$this->assertEquals($defaultdata['visible'], $course->visible);
$this->assertEquals(mktime(0, 0, 0, 6, 11, 1984), $course->startdate);
$this->assertEquals($defaultdata['startdate'], $course->startdate);
$this->assertEquals($defaultdata['idnumber'], $course->idnumber);
$this->assertEquals($defaultdata['summary'], $course->summary);
$this->assertEquals($defaultdata['format'], $course->format);
+36 -17
View File
@@ -302,25 +302,38 @@ class auth_plugin_db extends auth_plugin_base {
// Find obsolete users.
if (count($userlist)) {
list($notin_sql, $params) = $DB->get_in_or_equal($userlist, SQL_PARAMS_NAMED, 'u', false);
$removeusers = array();
$params['authtype'] = $this->authtype;
$sql = "SELECT u.*
$sql = "SELECT u.id, u.username
FROM {user} u
WHERE u.auth=:authtype AND u.deleted=0 AND u.mnethostid=:mnethostid $suspendselect AND u.username $notin_sql";
WHERE u.auth=:authtype
AND u.deleted=0
AND u.mnethostid=:mnethostid
$suspendselect";
$params['mnethostid'] = $CFG->mnet_localhost_id;
$internalusersrs = $DB->get_recordset_sql($sql, $params);
$usernamelist = array_flip($userlist);
foreach ($internalusersrs as $internaluser) {
if (!array_key_exists($internaluser->username, $usernamelist)) {
$removeusers[] = $internaluser;
}
}
$internalusersrs->close();
} else {
$sql = "SELECT u.*
$sql = "SELECT u.id, u.username
FROM {user} u
WHERE u.auth=:authtype AND u.deleted=0 AND u.mnethostid=:mnethostid $suspendselect";
$params = array();
$params['authtype'] = $this->authtype;
$params['mnethostid'] = $CFG->mnet_localhost_id;
$removeusers = $DB->get_records_sql($sql, $params);
}
$params['mnethostid'] = $CFG->mnet_localhost_id;
$remove_users = $DB->get_records_sql($sql, $params);
if (!empty($remove_users)) {
$trace->output(get_string('auth_dbuserstoremove','auth_db', count($remove_users)));
if (!empty($removeusers)) {
$trace->output(get_string('auth_dbuserstoremove', 'auth_db', count($removeusers)));
foreach ($remove_users as $user) {
foreach ($removeusers as $user) {
if ($this->config->removeuser == AUTH_REMOVEUSER_FULLDELETE) {
delete_user($user);
$trace->output(get_string('auth_dbdeleteuser', 'auth_db', array('name'=>$user->username, 'id'=>$user->id)), 1);
@@ -334,7 +347,7 @@ class auth_plugin_db extends auth_plugin_base {
}
}
}
unset($remove_users);
unset($removeusers);
}
if (!count($userlist)) {
@@ -359,12 +372,20 @@ class auth_plugin_db extends auth_plugin_base {
// Only go ahead if we actually have fields to update locally.
if (!empty($updatekeys)) {
list($in_sql, $params) = $DB->get_in_or_equal($userlist, SQL_PARAMS_NAMED, 'u', true);
$params['authtype'] = $this->authtype;
$sql = "SELECT u.id, u.username
$update_users = array();
// All the drivers can cope with chunks of 10,000. See line 4491 of lib/dml/tests/dml_est.php
$userlistchunks = array_chunk($userlist , 10000);
foreach($userlistchunks as $userlistchunk) {
list($in_sql, $params) = $DB->get_in_or_equal($userlistchunk, SQL_PARAMS_NAMED, 'u', true);
$params['authtype'] = $this->authtype;
$params['mnethostid'] = $CFG->mnet_localhost_id;
$sql = "SELECT u.id, u.username
FROM {user} u
WHERE u.auth=:authtype AND u.deleted=0 AND u.username {$in_sql}";
if ($update_users = $DB->get_records_sql($sql, $params)) {
WHERE u.auth = :authtype AND u.deleted = 0 AND u.mnethostid = :mnethostid AND u.username {$in_sql}";
$update_users = $update_users + $DB->get_records_sql($sql, $params);
}
if ($update_users) {
$trace->output("User entries to update: ".count($update_users));
foreach ($update_users as $user) {
@@ -935,5 +956,3 @@ class auth_plugin_db extends auth_plugin_base {
return $user;
}
}
+1 -1
View File
@@ -1780,7 +1780,7 @@ class auth_plugin_ldap extends auth_plugin_base {
unset_cache_flag($this->pluginconfig.'/ntlmsess', $key);
// Redirection
if (user_not_fully_set_up($USER)) {
if (user_not_fully_set_up($USER, true)) {
$urltogo = $CFG->wwwroot.'/user/edit.php';
// We don't delete $SESSION->wantsurl yet, so we get there later
} else if (isset($SESSION->wantsurl) and (strpos($SESSION->wantsurl, $CFG->wwwroot) === 0)) {
+1 -1
View File
@@ -260,7 +260,7 @@ class auth_plugin_mnet extends auth_plugin_base {
exit;
}
if (user_not_fully_set_up($remoteuser)) {
if (user_not_fully_set_up($remoteuser, false)) {
print_error('notenoughidpinfo', 'mnet');
exit;
}
+1 -1
View File
@@ -54,7 +54,7 @@
&& $user = authenticate_user_login($frm->username, $frm->password)) {
complete_user_login($user);
if (user_not_fully_set_up($USER)) {
if (user_not_fully_set_up($USER, true)) {
$urltogo = $CFG->wwwroot.'/user/edit.php?id='.$USER->id.'&amp;course='.SITEID;
// We don't delete $SESSION->wantsurl yet, so we get there later
+7 -2
View File
@@ -34,6 +34,10 @@ defined('MOODLE_INTERNAL') || die();
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class tree_node {
/** @var int Counter to be used in {@link tree_node::unique_sql_parameter()}. */
protected static $uniquesqlparametercounter = 1;
/**
* Determines whether this particular item is currently available
* according to the availability criteria.
@@ -242,10 +246,11 @@ abstract class tree_node {
* @return SQL code for the parameter, e.g. ':pr1234'
*/
protected static function unique_sql_parameter(array &$params, $value) {
static $count = 1;
// Note we intentionally do not use self:: here.
$count = tree_node::$uniquesqlparametercounter++;
$unique = 'usp' . $count;
$params[$unique] = $value;
$count++;
return ':' . $unique;
}
}
+57
View File
@@ -675,6 +675,63 @@ class tree_testcase extends \advanced_testcase {
json_encode(tree::get_root_json(array($child, $child), tree::OP_AND, array(true, false))));
}
/**
* Tests the behaviour of the counter in unique_sql_parameter().
*
* There was a problem with static counters used to implement a sequence of
* parameter placeholders (MDL-53481). As always with static variables, it
* is a bit tricky to unit test the behaviour reliably as it depends on the
* actual tests executed and also their order.
*
* To minimise risk of false expected behaviour, this test method should be
* first one where {@link core_availability\tree::get_user_list_sql()} is
* used. We also use higher number of condition instances to increase the
* risk of the counter collision, should there remain a problem.
*/
public function test_unique_sql_parameter_behaviour() {
global $DB;
$this->resetAfterTest();
$generator = $this->getDataGenerator();
// Create a test course with multiple groupings and groups and a student in each of them.
$course = $generator->create_course();
$user = $generator->create_user();
$studentroleid = $DB->get_field('role', 'id', array('shortname' => 'student'));
$generator->enrol_user($user->id, $course->id, $studentroleid);
// The total number of groupings and groups must not be greater than 61.
// There is a limit in MySQL on the max number of joined tables.
$groups = [];
for ($i = 0; $i < 25; $i++) {
$group = $generator->create_group(array('courseid' => $course->id));
groups_add_member($group, $user);
$groups[] = $group;
}
$groupings = [];
for ($i = 0; $i < 25; $i++) {
$groupings[] = $generator->create_grouping(array('courseid' => $course->id));
}
foreach ($groupings as $grouping) {
foreach ($groups as $group) {
groups_assign_grouping($grouping->id, $group->id);
}
}
$info = new \core_availability\mock_info($course);
// Make a huge tree with 'AND' of all groups and groupings conditions.
$conditions = [];
foreach ($groups as $group) {
$conditions[] = \availability_group\condition::get_json($group->id);
}
foreach ($groupings as $groupingid) {
$conditions[] = \availability_grouping\condition::get_json($grouping->id);
}
shuffle($conditions);
$tree = new tree(tree::get_root_json($conditions));
list($sql, $params) = $tree->get_user_list_sql(false, $info, false);
// This must not throw exception.
$DB->fix_sql_params($sql, $params);
}
/**
* Tests get_user_list_sql.
*/
+1 -1
View File
@@ -381,7 +381,7 @@ class cc2moodle {
if (!empty($format['defaultblocks'])) {
$blocknames = $format['defaultblocks'];
} else {
if (!empty($CFG->defaultblocks)) {
if (isset($CFG->defaultblocks)) {
$blocknames = $CFG->defaultblocks;
} else {
$blocknames = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
-1
View File
@@ -145,7 +145,6 @@ if ($backup->get_stage() == backup_ui::STAGE_FINAL) {
if (!empty($precheckresults['errors'])) { // If errors are found, terminate the import.
fulldelete($tempdestination);
echo $OUTPUT->header();
echo $renderer->precheck_notices($precheckresults);
echo $OUTPUT->continue_button(new moodle_url('/course/view.php', array('id'=>$course->id)));
echo $OUTPUT->footer();
+8 -4
View File
@@ -930,8 +930,11 @@ class backup_gradebook_structure_step extends backup_structure_step {
$grade_setting = new backup_nested_element('grade_setting', 'id', array(
'name', 'value'));
$gradebook_attributes = new backup_nested_element('attributes', null, array('calculations_freeze'));
// Build the tree
$gradebook->add_child($gradebook_attributes);
$gradebook->add_child($grade_categories);
$grade_categories->add_child($grade_category);
@@ -946,14 +949,15 @@ class backup_gradebook_structure_step extends backup_structure_step {
$gradebook->add_child($grade_settings);
$grade_settings->add_child($grade_setting);
// Define sources
// Add attribute with gradebook calculation freeze date if needed.
$attributes = new stdClass();
$gradebookcalculationfreeze = get_config('core', 'gradebook_calculations_freeze_' . $this->get_courseid());
if ($gradebookcalculationfreeze) {
$gradebook->add_attributes(array('calculations_freeze'));
$gradebook->get_attribute('calculations_freeze')->set_value($gradebookcalculationfreeze);
$attributes->calculations_freeze = $gradebookcalculationfreeze;
}
// Define sources
$gradebook_attributes->set_source_array([$attributes]);
//Include manual, category and the course grade item
$grade_items_sql ="SELECT * FROM {grade_items}
@@ -181,7 +181,7 @@ abstract class restore_qtype_plugin extends restore_plugin {
$info = new stdClass();
$info->filequestionid = $oldquestionid;
$info->dbquestionid = $newquestionid;
$info->answer = $data->answertext;
$info->answer = s($data->answertext);
throw new restore_step_exception('error_question_answers_missing_in_db', $info);
}
$newitemid = $this->questionanswercache[$data->answertext];
+106 -2
View File
@@ -121,6 +121,21 @@ class restore_gradebook_structure_step extends restore_structure_step {
return false;
}
// Identify the backup we're dealing with.
$backuprelease = floatval($this->get_task()->get_info()->backup_release); // The major version: 2.9, 3.0, ...
$backupbuild = 0;
preg_match('/(\d{8})/', $this->get_task()->get_info()->moodle_release, $matches);
if (!empty($matches[1])) {
$backupbuild = (int) $matches[1]; // The date of Moodle build at the time of the backup.
}
// On older versions the freeze value has to be converted.
// We do this from here as it is happening right before the file is read.
// This only targets the backup files that can contain the legacy freeze.
if ($backupbuild > 20150618 && ($backuprelease < 3.0 || $backupbuild < 20160527)) {
$this->rewrite_step_backup_file_for_legacy_freeze($fullpath);
}
// Arrived here, execute the step
return true;
}
@@ -129,7 +144,7 @@ class restore_gradebook_structure_step extends restore_structure_step {
$paths = array();
$userinfo = $this->task->get_setting_value('users');
$paths[] = new restore_path_element('gradebook', '/gradebook');
$paths[] = new restore_path_element('attributes', '/gradebook/attributes');
$paths[] = new restore_path_element('grade_category', '/gradebook/grade_categories/grade_category');
$paths[] = new restore_path_element('grade_item', '/gradebook/grade_items/grade_item');
if ($userinfo) {
@@ -141,7 +156,7 @@ class restore_gradebook_structure_step extends restore_structure_step {
return $paths;
}
protected function process_gradebook($data) {
protected function process_attributes($data) {
// For non-merge restore types:
// Unset 'gradebook_calculations_freeze_' in the course and replace with the one from the backup.
$target = $this->get_task()->get_target();
@@ -493,6 +508,8 @@ class restore_gradebook_structure_step extends restore_structure_step {
$gradebookcalculationsfreeze = get_config('core', 'gradebook_calculations_freeze_' . $this->get_courseid());
preg_match('/(\d{8})/', $this->get_task()->get_info()->moodle_release, $matches);
$backupbuild = (int)$matches[1];
// The function floatval will return a float even if there is text mixed with the release number.
$backuprelease = floatval($this->get_task()->get_info()->backup_release);
// Extra credits need adjustments only for backups made between 2.8 release (20141110) and the fix release (20150619).
if (!$gradebookcalculationsfreeze && $backupbuild >= 20141110 && $backupbuild < 20150619) {
@@ -504,6 +521,14 @@ class restore_gradebook_structure_step extends restore_structure_step {
require_once($CFG->libdir . '/db/upgradelib.php');
upgrade_calculated_grade_items($this->get_courseid());
}
// Courses from before 3.1 (20160518) may have a letter boundary problem and should be checked for this issue.
// Backups from before and including 2.9 could have a build number that is greater than 20160518 and should
// be checked for this problem.
if (!$gradebookcalculationsfreeze && ($backupbuild < 20160518 || $backuprelease <= 2.9)) {
require_once($CFG->libdir . '/db/upgradelib.php');
upgrade_course_letter_boundary($this->get_courseid());
}
}
/**
@@ -571,6 +596,85 @@ class restore_gradebook_structure_step extends restore_structure_step {
}
}
}
/**
* Rewrite step definition to handle the legacy freeze attribute.
*
* In previous backups the calculations_freeze property was stored as an attribute of the
* top level node <gradebook>. The backup API, however, do not process grandparent nodes.
* It only processes definitive children, and their parent attributes.
*
* We had:
*
* <gradebook calculations_freeze="20160511">
* <grade_categories>
* <grade_category id="10">
* <depth>1</depth>
* ...
* </grade_category>
* </grade_categories>
* ...
* </gradebook>
*
* And this method will convert it to:
*
* <gradebook >
* <attributes>
* <calculations_freeze>20160511</calculations_freeze>
* </attributes>
* <grade_categories>
* <grade_category id="10">
* <depth>1</depth>
* ...
* </grade_category>
* </grade_categories>
* ...
* </gradebook>
*
* Note that we cannot just load the XML file in memory as it could potentially be huge.
* We can also completely ignore if the node <attributes> is already in the backup
* file as it never existed before.
*
* @param string $filepath The absolute path to the XML file.
* @return void
*/
protected function rewrite_step_backup_file_for_legacy_freeze($filepath) {
$foundnode = false;
$newfile = make_request_directory(true) . DIRECTORY_SEPARATOR . 'file.xml';
$fr = fopen($filepath, 'r');
$fw = fopen($newfile, 'w');
if ($fr && $fw) {
while (($line = fgets($fr, 4096)) !== false) {
if (!$foundnode && strpos($line, '<gradebook ') === 0) {
$foundnode = true;
$matches = array();
$pattern = '@calculations_freeze=.([0-9]+).@';
if (preg_match($pattern, $line, $matches)) {
$freeze = $matches[1];
$line = preg_replace($pattern, '', $line);
$line .= " <attributes>\n <calculations_freeze>$freeze</calculations_freeze>\n </attributes>\n";
}
}
fputs($fw, $line);
}
if (!feof($fr)) {
throw new restore_step_exception('Error while attempting to rewrite the gradebook step file.');
}
fclose($fr);
fclose($fw);
if (!rename($newfile, $filepath)) {
throw new restore_step_exception('Error while attempting to rename the gradebook step file.');
}
} else {
if ($fr) {
fclose($fr);
}
if ($fw) {
fclose($fw);
}
}
}
}
/**
@@ -0,0 +1,10 @@
<gradebook >
<attributes>
<calculations_freeze>20160511</calculations_freeze>
</attributes>
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebook>
@@ -0,0 +1,7 @@
<gradebook calculations_freeze="20160511">
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebook>
@@ -0,0 +1,10 @@
<gradebook some_other_value="false" >
<attributes>
<calculations_freeze>20160511</calculations_freeze>
</attributes>
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebook>
@@ -0,0 +1,7 @@
<gradebook some_other_value="false" calculations_freeze="20160511">
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebook>
@@ -0,0 +1,10 @@
<gradebook some_other_value="false" and_another_value="42">
<attributes>
<calculations_freeze>20160511</calculations_freeze>
</attributes>
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebook>
@@ -0,0 +1,7 @@
<gradebook some_other_value="false" calculations_freeze="20160511" and_another_value="42">
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebook>
@@ -0,0 +1,7 @@
<gradebookplugin some_other_value="false" calculations_freeze="20160511" and_another_value="42">
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebookplugin>
@@ -0,0 +1,7 @@
<gradebookplugin some_other_value="false" calculations_freeze="20160511" and_another_value="42">
<grade_categories>
<grade_category id="10">
<depth>1</depth>
</grade_category>
</grade_categories>
</gradebookplugin>
@@ -0,0 +1,92 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Test for restore_stepslib.
*
* @package core_backup
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
require_once($CFG->libdir . '/completionlib.php');
/**
* Test for restore_stepslib.
*
* @package core_backup
* @copyright 2016 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class core_backup_restore_gradebook_structure_step_testcase extends advanced_testcase {
/**
* Provide tests for rewrite_step_backup_file_for_legacy_freeze based upon fixtures.
*
* @return array
*/
public function rewrite_step_backup_file_for_legacy_freeze_provider() {
$fixturesdir = realpath(__DIR__ . '/fixtures/rewrite_step_backup_file_for_legacy_freeze/');
$tests = [];
$iterator = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($fixturesdir),
\RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($iterator as $sourcefile) {
$pattern = '/\.test$/';
if (!preg_match($pattern, $sourcefile)) {
continue;
}
$expectfile = preg_replace($pattern, '.expectation', $sourcefile);
$test = array($sourcefile, $expectfile);
$tests[basename($sourcefile)] = $test;
}
return $tests;
}
/**
* @dataProvider rewrite_step_backup_file_for_legacy_freeze_provider
* @param string $source The source file to test
* @param string $expected The expected result of the transformation
*/
public function test_rewrite_step_backup_file_for_legacy_freeze($source, $expected) {
$restore = $this->getMockBuilder('\restore_gradebook_structure_step')
->setMethods(null)
->disableOriginalConstructor()
->getMock()
;
// Copy the file somewhere as the rewrite_step_backup_file_for_legacy_freeze will write the file.
$dir = make_request_directory(true);
$filepath = $dir . DIRECTORY_SEPARATOR . 'file.xml';
copy($source, $filepath);
$rc = new \ReflectionClass('\restore_gradebook_structure_step');
$rcm = $rc->getMethod('rewrite_step_backup_file_for_legacy_freeze');
$rcm->setAccessible(true);
$rcm->invoke($restore, $filepath);
// Check the result.
$this->assertFileEquals($expected, $filepath);
}
}
+6 -2
View File
@@ -93,7 +93,9 @@ if ($action == 'choosebackupfile') {
// If it's some weird other kind of file then use old code.
$filename = restore_controller::get_tempdir_name($courseid, $USER->id);
$pathname = $tmpdir . '/' . $filename;
$fileinfo->copy_to_pathname($pathname);
if (!$fileinfo->copy_to_pathname($pathname)) {
throw new restore_ui_exception('errorcopyingbackupfile', null, $pathname);
}
$restore_url = new moodle_url('/backup/restore.php', array(
'contextid' => $contextid, 'filename' => $filename));
}
@@ -115,7 +117,9 @@ $data = $form->get_data();
if ($data && has_capability('moodle/restore:uploadfile', $context)) {
$filename = restore_controller::get_tempdir_name($courseid, $USER->id);
$pathname = $tmpdir . '/' . $filename;
$form->save_file('backupfile', $pathname);
if (!$form->save_file('backupfile', $pathname)) {
throw new restore_ui_exception('errorcopyingbackupfile', null, $pathname);
}
$restore_url = new moodle_url('/backup/restore.php', array('contextid'=>$contextid, 'filename'=>$filename));
redirect($restore_url);
die;
@@ -105,6 +105,12 @@ abstract class backup_controller_dbops extends backup_dbops {
throw new backup_dbops_exception('backup_controller_dbops_nonexisting');
}
$controller = unserialize(base64_decode($controllerrec->controller));
if (!is_object($controller)) {
// The controller field of the table did not contain a serialized object.
// It is made empty after it has been used successfully, it is likely that
// the user has pressed the browser back button at some point.
throw new backup_dbops_exception('backup_controller_dbops_loading_invalid_controller');
}
// Check checksum is ok. Sounds silly but it isn't ;-)
if (!$controller->is_checksum_correct($controllerrec->checksum)) {
throw new backup_dbops_exception('backup_controller_dbops_loading_checksum_mismatch');
@@ -95,6 +95,12 @@ abstract class restore_controller_dbops extends restore_dbops {
throw new backup_dbops_exception('restore_controller_dbops_nonexisting');
}
$controller = unserialize(base64_decode($controllerrec->controller));
if (!is_object($controller)) {
// The controller field of the table did not contain a serialized object.
// It is made empty after it has been used successfully, it is likely that
// the user has pressed the browser back button at some point.
throw new backup_dbops_exception('restore_controller_dbops_loading_invalid_controller');
}
// Check checksum is ok. Sounds silly but it isn't ;-)
if (!$controller->is_checksum_correct($controllerrec->checksum)) {
throw new backup_dbops_exception('restore_controller_dbops_loading_checksum_mismatch');
+1 -1
View File
@@ -793,7 +793,7 @@ abstract class restore_dbops {
// Prepare the query
list($stamp_sql, $stamp_params) = $DB->get_in_or_equal($stamps);
list($context_sql, $context_params) = $DB->get_in_or_equal($contexts);
$sql = "SELECT contextid
$sql = "SELECT DISTINCT contextid
FROM {question_categories}
WHERE stamp $stamp_sql
AND contextid $context_sql";
+2 -1
View File
@@ -95,7 +95,8 @@ class backup_logger_testcase extends basic_testcase {
$lo3 = new mock_base_logger3(backup::LOG_ERROR);
$lo1->set_next($lo2);
$lo2->set_next($lo3);
$this->assertFalse($lo1->process('test', backup::LOG_ERROR));
$msg = 13;
$this->assertFalse($lo1->process($msg, backup::LOG_ERROR));
// Test checksum correct
$lo1 = new mock_base_logger1(backup::LOG_ERROR);
+1 -1
View File
@@ -48,7 +48,7 @@ class award_criteria_activity extends award_criteria {
$this->course = $DB->get_record_sql('SELECT c.id, c.enablecompletion, c.cacherev, c.startdate
FROM {badge} b INNER JOIN {course} c ON b.courseid = c.id
WHERE b.id = :badgeid ', array('badgeid' => $this->badgeid));
WHERE b.id = :badgeid ', array('badgeid' => $this->badgeid), MUST_EXIST);
$this->courseid = $this->course->id;
}
+2 -2
View File
@@ -50,7 +50,7 @@ class award_criteria_course extends award_criteria {
$this->course = $DB->get_record_sql('SELECT c.id, c.enablecompletion, c.cacherev, c.startdate
FROM {badge} b INNER JOIN {course} c ON b.courseid = c.id
WHERE b.id = :badgeid ', array('badgeid' => $this->badgeid));
WHERE b.id = :badgeid ', array('badgeid' => $this->badgeid), MUST_EXIST);
$this->courseid = $this->course->id;
}
@@ -95,7 +95,7 @@ class award_criteria_course extends award_criteria {
* @return string
*/
public function get_details($short = '') {
global $DB;
global $DB, $OUTPUT;
$param = reset($this->params);
$course = $DB->get_record('course', array('id' => $param['course']));
+7 -4
View File
@@ -207,12 +207,15 @@ class award_criteria_manual extends award_criteria {
return array($join, $where, $params);
} else {
foreach ($this->params as $param) {
$join .= " LEFT JOIN {badge_manual_award} bma{$param['role']} ON
bma{$param['role']}.recipientid = u.id AND
bma{$param['role']}.issuerrole = :issuerrole{$param['role']} ";
$where .= " AND bma{$param['role']}.issuerrole IS NOT NULL ";
$roledata[] = " bma.issuerrole = :issuerrole{$param['role']} ";
$params["issuerrole{$param['role']}"] = $param['role'];
}
if (!empty($roledata)) {
$extraon = implode(' AND ', $roledata);
$join = " JOIN {badge_manual_award} bma ON bma.recipientid = u.id
AND bma.badgeid = :badgeid{$this->badgeid} AND ({$extraon})";
$params["badgeid{$this->badgeid}"] = $this->badgeid;
}
return array($join, $where, $params);
}
}
+1 -1
View File
@@ -160,7 +160,7 @@ if ($type == BADGE_TYPE_SITE) {
}
echo $OUTPUT->box('', 'notifyproblem hide', 'check_connection');
$totalcount = count(badges_get_badges($type, $courseid, '', '' , '', ''));
$totalcount = count(badges_get_badges($type, $courseid, '', '' , 0, 0));
$records = badges_get_badges($type, $courseid, $sortby, $sorthow, $page, BADGE_PERPAGE);
if ($totalcount) {
+41
View File
@@ -288,6 +288,47 @@ class core_badges_badgeslib_testcase extends advanced_testcase {
// The term Totara doesn't appear anywhere in the badges.
$result = badges_get_user_badges($user2->id, 0, 0, 0, 'Totara');
$this->assertCount(0, $result);
// Issue a user with a course badge and verify its returned based on if
// coursebadges are enabled or disabled.
$sitebadgeid = key($badges);
$badges[$sitebadgeid]->issue($this->user->id, true);
$badge = new stdClass();
$badge->id = null;
$badge->name = "Test course badge";
$badge->description = "Testing course badge";
$badge->timecreated = $now;
$badge->timemodified = $now;
$badge->usercreated = $user1->id;
$badge->usermodified = $user1->id;
$badge->issuername = "Test issuer";
$badge->issuerurl = "http://issuer-url.domain.co.nz";
$badge->issuercontact = "issuer@example.com";
$badge->expiredate = null;
$badge->expireperiod = null;
$badge->type = BADGE_TYPE_COURSE;
$badge->courseid = $this->course->id;
$badge->messagesubject = "Test message subject for course badge";
$badge->message = "Test message body for course badge";
$badge->attachment = 1;
$badge->notification = 0;
$badge->status = BADGE_STATUS_ACTIVE;
$badgeid = $DB->insert_record('badge', $badge, true);
$badges[$badgeid] = new badge($badgeid);
$badges[$badgeid]->issue($this->user->id, true);
// With coursebadges off, we should only get the site badge.
set_config('badges_allowcoursebadges', false);
$result = badges_get_user_badges($this->user->id);
$this->assertCount(1, $result);
// With it on, we should get both.
set_config('badges_allowcoursebadges', true);
$result = badges_get_user_badges($this->user->id);
$this->assertCount(2, $result);
}
public function data_for_message_from_template() {
+83
View File
@@ -231,3 +231,86 @@ Feature: Award badges
And I log in as "student1"
And I follow "Profile" in the user menu
Then I should see "Course Badge"
@javascript
Scenario: All of the selected roles can award badges
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
And the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
# Create course badge 1.
And I navigate to "Add a new badge" node in "Course administration > Badges"
And I follow "Add a new badge"
And I set the following fields to these values:
| Name | Course Badge 1 |
| Description | Course badge description |
| issuername | Tester of course badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Manual issue by role"
And I expand all fieldsets
# Set to ANY of the roles awards badge.
And I set the field "Teacher" to "1"
And I set the field "Any of the selected roles awards the badge" to "1"
And I press "Save"
And I press "Enable access"
And I press "Continue"
And I follow "Recipients (0)"
And I press "Award badge"
# Award course badge 1 to student 1.
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
When I press "Award badge"
And I follow "Course Badge 1"
And I follow "Recipients (1)"
Then I should see "Recipients (1)"
# Add course badge 2.
And I navigate to "Add a new badge" node in "Course administration > Badges"
And I follow "Add a new badge"
And I set the following fields to these values:
| Name | Course Badge 2 |
| Description | Course badge description |
| issuername | Tester of course badge |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
And I press "Create badge"
And I set the field "type" to "Manual issue by role"
And I expand all fieldsets
# Set to ALL of the selected roles award badge.
And I set the field "Teacher" to "1"
And I set the field "All of the selected roles award the badge" to "1"
And I press "Save"
And I press "Enable access"
And I press "Continue"
And I follow "Recipients (0)"
And I press "Award badge"
# Award course badge 2 to student 2.
And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
When I press "Award badge"
And I follow "Course Badge 2"
And I follow "Recipients (1)"
Then I should see "Recipients (1)"
And I log out
And I trigger cron
# Student 1 should have just course badge 1.
And I log in as "student1"
And I follow "Profile" in the user menu
When I follow "Course 1"
Then I should see "Course Badge 1"
And I should not see "Course Badge 2"
And I log out
# Student 2 should have just course badge 2.
And I log in as "student2"
And I follow "Profile" in the user menu
When I follow "Course 1"
Then I should see "Course Badge 2"
Then I should not see "Course Badge 1"
+1 -1
View File
@@ -83,7 +83,7 @@ $output = $PAGE->get_renderer('core', 'badges');
echo $output->header();
echo $OUTPUT->heading($title);
$totalcount = count(badges_get_badges($type, $courseid, '', '', '', '', $USER->id));
$totalcount = count(badges_get_badges($type, $courseid, '', '', 0, 0, $USER->id));
$records = badges_get_badges($type, $courseid, $sortby, $sorthow, $page, BADGE_PERPAGE, $USER->id);
if ($totalcount) {
@@ -0,0 +1,34 @@
@block @block_blog_recent
Feature: Feature: Users can use the recent blog entries block to view recent blog entries.
In order to enable the recent blog entries in a course
As a teacher
I can add recent blog entries block to a course
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
Scenario: Add the recent blogs block to a course when blogs are disabled
Given I log in as "admin"
And the following config values are set as admin:
| enableblogs | 0 |
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add the "Recent blog entries" block
Then I should see "Blogging is disabled!" in the "Recent blog entries" "block"
Scenario: Add the recent blogs block to a course when there are not any blog posts
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add the "Recent blog entries" block
Then I should see "No recent entries" in the "Recent blog entries" "block"
@@ -0,0 +1,117 @@
@block @block_blog_menu @mod_assign @block_blog_recent
Feature: Students can use the recent blog entries block to view recent entries on an activity page
In order to enable the recent blog entries block an activity page
As a teacher
I can add the recent blog entries block to an activity page
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
| student2 | Student | 2 | student2@example.com | S2 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Assignment" to section "1" and I fill the form with:
| Assignment name | Test assignment 1 |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
And I follow "Test assignment 1"
And I add the "Blog menu" block
And I add the "Recent blog entries" block
And I log out
Scenario: Students use the recent blog entries block to view blogs
Given I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment 1"
And I follow "Add an entry about this Assignment"
When I set the following fields to these values:
| Entry title | S1 First Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
Then I should see "S1 First Blog"
And I should see "This is my awesome blog!"
And I follow "Test assignment 1"
And I should see "S1 First Blog"
And I follow "S1 First Blog"
And I should see "This is my awesome blog!"
Scenario: Students only see a few entries in the recent blog entries block
Given I log in as "student1"
And I follow "Course 1"
And I follow "Test assignment 1"
And I follow "Add an entry about this Assignment"
# Blog 1 of 5
And I set the following fields to these values:
| Entry title | S1 First Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I follow "Test assignment 1"
And I follow "Add an entry about this Assignment"
# Blog 2 of 5
And I set the following fields to these values:
| Entry title | S1 Second Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Second Blog"
And I should see "This is my awesome blog!"
And I follow "Test assignment 1"
And I follow "Add an entry about this Assignment"
# Blog 3 of 5
And I set the following fields to these values:
| Entry title | S1 Third Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Third Blog"
And I should see "This is my awesome blog!"
And I follow "Test assignment 1"
And I follow "Add an entry about this Assignment"
# Blog 4 of 5
And I set the following fields to these values:
| Entry title | S1 Fourth Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Fourth Blog"
And I should see "This is my awesome blog!"
And I follow "Test assignment 1"
And I follow "Add an entry about this Assignment"
# Blog 5 of 5
And I set the following fields to these values:
| Entry title | S1 Fifth Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I should see "S1 Fifth Blog"
And I should see "This is my awesome blog!"
When I follow "Test assignment 1"
And I should not see "S1 First Blog"
And I should see "S1 Second Blog"
And I should see "S1 Third Blog"
And I should see "S1 Fourth Blog"
And I should see "S1 Fifth Blog"
And I follow "S1 Fifth Blog"
And I should see "This is my awesome blog!"
Then I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I follow "Test assignment 1"
And I configure the "Recent blog entries" block
And I set the following fields to these values:
| id_config_numberofrecentblogentries | 2 |
And I press "Save changes"
And I should see "S1 Fourth Blog"
And I should see "S1 Fifth Blog"
@@ -0,0 +1,107 @@
@block @block_blog_menu @block_blog_recent
Feature: Students can use the recent blog entries block to view recent entries on a course page
In order to enable the recent blog entries block a course page
As a teacher
I can add the recent blog entries block to a course page
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | 1 | student1@example.com | S1 |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Blog menu" block
And I add the "Recent blog entries" block
And I log out
Scenario: Students use the recent blog entries block to view blogs
Given I log in as "student1"
And I follow "Course 1"
And I follow "Add an entry about this course"
When I set the following fields to these values:
| Entry title | S1 First Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
Then I should see "S1 First Blog"
And I should see "This is my awesome blog!"
And I follow "C1"
And I should see "S1 First Blog"
And I follow "S1 First Blog"
And I should see "This is my awesome blog!"
Scenario: Students only see a few entries in the recent blog entries block
Given I log in as "student1"
And I follow "Course 1"
And I follow "Add an entry about this course"
# Blog 1 of 5
And I set the following fields to these values:
| Entry title | S1 First Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I follow "C1"
And I follow "Add an entry about this course"
# Blog 2 of 5
And I set the following fields to these values:
| Entry title | S1 Second Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Second Blog"
And I should see "This is my awesome blog!"
And I follow "C1"
And I follow "Add an entry about this course"
# Blog 3 of 5
And I set the following fields to these values:
| Entry title | S1 Third Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Third Blog"
And I should see "This is my awesome blog!"
And I follow "C1"
And I follow "Add an entry about this course"
# Blog 4 of 5
And I set the following fields to these values:
| Entry title | S1 Fourth Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Fourth Blog"
And I should see "This is my awesome blog!"
And I follow "C1"
And I follow "Add an entry about this course"
# Blog 5 of 5
And I set the following fields to these values:
| Entry title | S1 Fifth Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I should see "S1 Fifth Blog"
And I should see "This is my awesome blog!"
When I follow "C1"
And I should not see "S1 First Blog"
And I should see "S1 Second Blog"
And I should see "S1 Third Blog"
And I should see "S1 Fourth Blog"
And I should see "S1 Fifth Blog"
And I follow "S1 Fifth Blog"
And I should see "This is my awesome blog!"
Then I log out
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I configure the "Recent blog entries" block
And I set the following fields to these values:
| id_config_numberofrecentblogentries | 2 |
And I press "Save changes"
And I should see "S1 Fourth Blog"
And I should see "S1 Fifth Blog"
@@ -0,0 +1,96 @@
@block @block_blog_recent
Feature: Feature: Students can use the recent blog entries block to view recent entries on the frontpage
In order to enable the recent blog entries block on the frontpage
As an admin
I can add the recent blog entries block to the frontpage
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | 1 | student1@example.com | S1 |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Recent blog entries" block
And I log out
Scenario: Students use the recent blog entries block to view blogs
Given I log in as "student1"
And I am on site homepage
And I navigate to "Site blogs" node in "Site pages"
And I follow "Add a new entry"
When I set the following fields to these values:
| Entry title | S1 First Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
Then I should see "S1 First Blog"
And I should see "This is my awesome blog!"
And I am on site homepage
And I should see "S1 First Blog"
And I follow "S1 First Blog"
And I should see "This is my awesome blog!"
Scenario: Students only see a few entries in the recent blog entries block
Given I log in as "student1"
And I am on site homepage
And I navigate to "Site blogs" node in "Site pages"
And I follow "Add a new entry"
# Blog 1 of 5
And I set the following fields to these values:
| Entry title | S1 First Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I follow "Add a new entry"
# Blog 2 of 5
And I set the following fields to these values:
| Entry title | S1 Second Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Second Blog"
And I should see "This is my awesome blog!"
And I follow "Add a new entry"
# Blog 3 of 5
And I set the following fields to these values:
| Entry title | S1 Third Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Third Blog"
And I should see "This is my awesome blog!"
And I follow "Add a new entry"
# Blog 4 of 5
And I set the following fields to these values:
| Entry title | S1 Fourth Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I wait "1" seconds
And I should see "S1 Fourth Blog"
And I should see "This is my awesome blog!"
And I follow "Add a new entry"
# Blog 5 of 5
And I set the following fields to these values:
| Entry title | S1 Fifth Blog |
| Blog entry body | This is my awesome blog! |
And I press "Save changes"
And I should see "S1 Fifth Blog"
And I should see "This is my awesome blog!"
When I am on site homepage
And I should not see "S1 First Blog"
And I should see "S1 Second Blog"
And I should see "S1 Third Blog"
And I should see "S1 Fourth Blog"
And I should see "S1 Fifth Blog"
And I follow "S1 Fifth Blog"
And I should see "This is my awesome blog!"
Then I log out
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I configure the "Recent blog entries" block
And I set the following fields to these values:
| id_config_numberofrecentblogentries | 2 |
And I press "Save changes"
And I should see "S1 Fourth Blog"
And I should see "S1 Fifth Blog"
@@ -0,0 +1,197 @@
@block @block_calendar_month
Feature: Enable the calendar block in a course and test it's functionality
In order to enable the calendar block in a course
As a teacher
I can add the calendar block to a course
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
| student2 | Student | 2 | student2@example.com | S2 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
Scenario: Add the block to a the course
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add the "Calendar" block
Then I should see "Events key" in the "Calendar" "block"
@javascript
Scenario: View a global event in the calendar block
Given I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | Site Event |
And I log out
When I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Calendar" block
And I hover over today in the calendar
Then I should see "Site Event"
@javascript
Scenario: Filter site events in the calendar block
Given I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | Site Event |
And I log out
When I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | Course |
| id_name | Course Event |
And I follow "Course 1"
And I follow "Hide global events"
And I hover over today in the calendar
Then I should not see "Site Event"
And I should see "Course Event"
@javascript
Scenario: View a course event in the calendar block
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | Course |
| id_name | Course Event |
When I follow "Course 1"
And I hover over today in the calendar
Then I should see "Course Event"
@javascript
Scenario: Filter course events in the calendar block
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | Course |
| id_name | Course Event |
And I follow "Course 1"
And I create a calendar event with form data:
| id_eventtype | User |
| id_name | User Event |
When I click on "Dashboard" "link" in the "Navigation" "block"
And I follow "Course 1"
And I follow "Hide course events"
And I hover over today in the calendar
Then I should not see "Course Event"
And I should see "User Event"
@javascript
Scenario: View a user event in the calendar block
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | User |
| id_name | User Event |
When I click on "Dashboard" "link" in the "Navigation" "block"
And I follow "Course 1"
And I hover over today in the calendar
Then I should see "User Event"
@javascript
Scenario: Filter user events in the calendar block
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | Course |
| id_name | Course Event |
And I follow "Course 1"
And I create a calendar event with form data:
| id_eventtype | User |
| id_name | User Event |
When I click on "Dashboard" "link" in the "Navigation" "block"
And I follow "Course 1"
And I follow "Hide user events"
And I hover over today in the calendar
Then I should not see "User Event"
And I should see "Course Event"
@javascript
Scenario: View a group event in the calendar block
Given the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G2 |
When I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Edit settings" node in "Course administration"
And I set the following fields to these values:
| id_groupmode | Separate groups |
| id_groupmodeforce | Yes |
And I press "Save and display"
And I turn editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | Group |
| id_groupid | Group 1 |
| id_name | Group Event |
And I log out
Then I log in as "student1"
And I follow "Course 1"
And I hover over today in the calendar
And I should see "Group Event"
And I log out
And I log in as "student2"
And I follow "Course 1"
And I hover over today in the calendar
And I should not see "Group Event"
@javascript
Scenario: Filter group events in the calendar block
Given the following "groups" exist:
| name | course | idnumber |
| Group 1 | C1 | G1 |
| Group 2 | C1 | G2 |
And the following "group members" exist:
| user | group |
| student1 | G1 |
| student2 | G2 |
When I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Edit settings" node in "Course administration"
And I set the following fields to these values:
| id_groupmode | Separate groups |
| id_groupmodeforce | Yes |
And I press "Save and display"
And I turn editing mode on
And I add the "Calendar" block
And I create a calendar event with form data:
| id_eventtype | Course |
| id_name | Course Event 1 |
And I follow "Course 1"
And I create a calendar event with form data:
| id_eventtype | Group |
| id_groupid | Group 1 |
| id_name | Group Event 1 |
And I log out
Then I log in as "student1"
And I follow "Course 1"
And I follow "Hide group events"
And I hover over today in the calendar
And I should not see "Group Event 1"
And I should see "Course Event 1"
@@ -0,0 +1,28 @@
@block @block_calendar_month
Feature: Enable the calendar block in a course
In order to enable the calendar block in a course
As a teacher
I can add the calendar block to a course
@javascript
Scenario: View a global event in the calendar block in a course
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
When I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | Site Event |
And I log out
Then I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Calendar" block
And I hover over today in the calendar
And I should see "Site Event"
@@ -0,0 +1,19 @@
@block @block_calendar_month
Feature: View a site event on the dashboard
In order to view a site event
As a student
I can view the event in the calendar
@javascript
Scenario: View a global event in the calendar block on the dashboard
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | 1 | student1@example.com | S1 |
And I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | Site Event |
And I log out
When I log in as "student1"
And I hover over today in the calendar
Then I should see "Site Event"
@@ -0,0 +1,21 @@
@block @block_calendar_month
Feature: Enable the calendar block on the site front page
In order to enable the calendar block on the site front page
As an admin
I can add the calendar block on the site front page
@javascript
Scenario: View a global event in the calendar block on the front page
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | 1 | student1@example.com | S1 |
And I log in as "admin"
And I am on site homepage
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | Site Event |
And I log out
When I log in as "student1"
And I am on site homepage
And I hover over today in the calendar
Then I should see "Site Event"
@@ -0,0 +1,23 @@
@block @block_calendar_upcoming
Feature: Enable the upcoming events block in a course
In order to enable the calendar block in a course
As a teacher
I can view the event in the upcoming events block
Scenario: View a global event in the upcoming events block in a course
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
When I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | My Site Event |
And I log out
When I log in as "teacher1"
Then I should see "My Site Event" in the "Upcoming events" "block"
@@ -0,0 +1,17 @@
@block @block_calendar_upcoming
Feature: View a site event on the dashboard
In order to view a site event
As a student
I can view the event in the upcoming events block
Scenario: View a global event in the upcoming events block on the dashboard
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| student1 | Student | 1 | student1@example.com | S1 |
And I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | My Site Event |
And I log out
When I log in as "student1"
Then I should see "My Site Event"
@@ -0,0 +1,21 @@
@block @block_calendar_upcoming
Feature: View a site event on the frontpage
In order to view a site event
As a teacher
I can view the event in the upcoming events block
Scenario: View a global event in the upcoming events block on the frontpage
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And I log in as "admin"
And I create a calendar event with form data:
| id_eventtype | Site |
| id_name | My Site Event |
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Upcoming events" block
And I log out
When I log in as "teacher1"
And I am on site homepage
Then I should see "My Site Event" in the "Upcoming events" "block"
@@ -0,0 +1,34 @@
@block @block_comments
Feature: Enable Block comments on an activity page and view comments
In order to enable the comments block on an activity page
As a teacher
I can add the comments block to an activity page
Scenario: Add the comments block on an activity page and add comments
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@example.com |
| student1 | Student | First | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| page | C1 | page1 | Test page name | Test page description |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I follow "Test page name"
And I add the "Comments" block
And I follow "Show comments"
And I add "I'm a comment from the teacher" comment to comments block
And I log out
When I log in as "student1"
And I follow "Course 1"
And I follow "Test page name"
And I follow "Show comments"
Then I should see "I'm a comment from the teacher"
@@ -0,0 +1,29 @@
@block @block_comments
Feature: Enable Block comments on a course page and view comments
In order to enable the comments block on a course page
As a teacher
I can add the comments block to the course page
Scenario: Add the comments block on the course page and add comments
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@example.com |
| student1 | Student | First | student1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Comments" block
And I follow "Show comments"
And I add "I'm a comment from the teacher" comment to comments block
And I log out
When I log in as "student1"
And I follow "Course 1"
And I follow "Show comments"
Then I should see "I'm a comment from the teacher"
@@ -0,0 +1,29 @@
@block @block_comments
Feature: Enable Block comments on the dashboard and view comments
In order to enable the comments block on a the dashboard
As a teacher
I can add the comments block to my dashboard
Background:
Given the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | Frist | teacher1@example.com |
Scenario: Add the comments block on the dashboard and add comments with Javascript disabled
When I log in as "teacher1"
And I press "Customise this page"
And I add the "Comments" block
And I follow "Show comments"
And I add "I'm a comment from the teacher" comment to comments block
Then I should see "I'm a comment from the teacher"
@javascript
Scenario: Add the comments block on the dashboard and add comments with Javascript enabled
When I log in as "teacher1"
And I press "Customise this page"
And I add the "Comments" block
And I add "I'm a comment from the teacher" comment to comments block
Then I should see "I'm a comment from the teacher"
@@ -0,0 +1,21 @@
@block @block_comments
Feature: Enable Block comments on the frontpage and view comments
In order to enable the comments block on the frontpage
As a admin
I can add the comments block to the frontpage
Scenario: Add the comments block on the frontpage and add comments
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
And I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Comments" block
And I follow "Show comments"
And I add "I'm a comment from admin" comment to comments block
And I log out
When I log in as "teacher1"
And I am on site homepage
And I follow "Show comments"
Then I should see "I'm a comment from admin"
@@ -0,0 +1,59 @@
@block @block_completionstatus
Feature: Enable Block Completion in a course
In order to view the completion block in a course
As a teacher
I can add completion block to a course
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
And the following "courses" exist:
| fullname | shortname | category | enablecompletion |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following config values are set as admin:
| enablecompletion | 1 |
Scenario: Add the block to a the course where completion is disabled
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I navigate to "Edit settings" node in "Course administration"
And I set the following fields to these values:
| Enable completion tracking | No |
And I press "Save and display"
When I add the "Course completion status" block
Then I should see "Completion is not enabled for this course" in the "Course completion status" "block"
Scenario: Add the block to a the course where completion is not set
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add the "Course completion status" block
Then I should see "No completion criteria set for this course" in the "Course completion status" "block"
Scenario: Add the block to a course with criteria and view as an untracked role.
Given the following "activities" exist:
| activity | course | idnumber | name | intro |
| page | C1 | page1 | Test page name | Test page description |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I follow "Test page name"
And I navigate to "Edit settings" node in "Page module administration"
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
| Require view | 1 |
And I press "Save and return to course"
When I add the "Course completion status" block
And I navigate to "Course completion" node in "Course administration"
And I expand all fieldsets
And I set the following fields to these values:
| Test page name | 1 |
And I press "Save changes"
Then I should see "You are currently not being tracked by completion in this course" in the "Course completion status" "block"
@@ -0,0 +1,75 @@
@block @block_completionstatus
Feature: Enable Block Completion in a course using activity completion
In order to view the completion block in a course
As a teacher
I can add completion block to a course and set up activity completion
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
And the following "courses" exist:
| fullname | shortname | category | enablecompletion |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following config values are set as admin:
| enablecompletion | 1 |
And the following "activities" exist:
| activity | course | idnumber | name | intro |
| page | C1 | page1 | Test page name | Test page description |
Scenario: Add the block to a the course and add course completion items
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I follow "Test page name"
And I navigate to "Edit settings" node in "Page module administration"
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
| Require view | 1 |
And I press "Save and return to course"
And I add the "Course completion status" block
And I navigate to "Course completion" node in "Course administration"
And I expand all fieldsets
And I set the following fields to these values:
| Test page name | 1 |
And I press "Save changes"
And I log out
When I log in as "student1"
And I follow "Course 1"
Then I should see "Status: Not yet started" in the "Course completion status" "block"
And I should see "0 of 1" in the "Activity completion" "table_row"
Scenario: Add the block to a the course and add course completion items
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I follow "Test page name"
And I navigate to "Edit settings" node in "Page module administration"
And I set the following fields to these values:
| Completion tracking | Show activity as complete when conditions are met |
| Require view | 1 |
And I press "Save and return to course"
And I add the "Course completion status" block
And I navigate to "Course completion" node in "Course administration"
And I expand all fieldsets
And I set the following fields to these values:
| Test page name | 1 |
And I press "Save changes"
And I log out
When I log in as "student1"
And I follow "Course 1"
And I follow "Test page name"
And I follow "C1"
Then I should see "Status: Pending" in the "Course completion status" "block"
And I should see "0 of 1" in the "Activity completion" "table_row"
And I trigger cron
And I am on site homepage
And I follow "Course 1"
And I should see "1 of 1" in the "Activity completion" "table_row"
And I follow "More details"
And I should see "Yes" in the "Activity completion" "table_row"
@@ -0,0 +1,108 @@
@block @block_completionstatus
Feature: Enable Block Completion in a course using manual completion by others
In order to view the completion block in a course
As a teacher
I can add completion block to a course and set up manual completion by others
Background:
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| teacher2 | Teacher | 2 | teacher1@example.com | T2 |
| student1 | Student | 1 | student1@example.com | S1 |
And the following "courses" exist:
| fullname | shortname | category | enablecompletion |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher2 | C1 | teacher |
| student1 | C1 | student |
And the following config values are set as admin:
| enablecompletion | 1 |
Scenario: Add the block to a the course and mark a student complete.
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Course completion status" block
And I navigate to "Course completion" node in "Course administration"
And I expand all fieldsets
And I set the following fields to these values:
| Teacher | 1 |
And I press "Save changes"
And I log out
When I log in as "student1"
And I follow "Course 1"
And I should see "Status: Not yet started" in the "Course completion status" "block"
And I should see "No" in the "Teacher" "table_row"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Course completion" node in "Reports"
And I follow "Click to mark user complete"
# Running completion task just after clicking sometimes fail, as record
# should be created before the task runs.
And I wait "1" seconds
And I run the scheduled task "core\task\completion_regular_task"
And I am on site homepage
And I log out
And I log in as "student1"
And I follow "Course 1"
Then I should see "Status: Complete" in the "Course completion status" "block"
And I should see "Yes" in the "Teacher" "table_row"
And I follow "More details"
And I should see "Yes" in the "Marked complete by Teacher" "table_row"
Scenario: Add the block to a the course and require multiple roles to mark a student complete.
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Course completion status" block
And I navigate to "Course completion" node in "Course administration"
And I expand all fieldsets
And I set the following fields to these values:
| Teacher | 1 |
| Non-editing teacher | 1 |
| id_role_aggregation | ALL selected roles to mark when the condition is met |
And I press "Save changes"
And I log out
When I log in as "student1"
And I follow "Course 1"
And I should see "Status: Not yet started" in the "Course completion status" "block"
And I should see "No" in the "Teacher" "table_row"
And I should see "No" in the "Non-editing teacher" "table_row"
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Course completion" node in "Reports"
And I follow "Click to mark user complete"
And I log out
And I log in as "student1"
And I follow "Course 1"
And I should see "Status: In progress" in the "Course completion status" "block"
And I should see "Yes" in the "Teacher" "table_row"
And I should see "No" in the "Non-editing teacher" "table_row"
And I follow "More details"
And I should see "Yes" in the "Marked complete by Teacher" "table_row"
And I should see "No" in the "Marked complete by Non-editing teacher" "table_row"
And I log out
And I log in as "teacher2"
And I follow "Course 1"
And I navigate to "Course completion" node in "Reports"
And I follow "Click to mark user complete"
# Running completion task just after clicking sometimes fail, as record
# should be created before the task runs.
And I wait "1" seconds
And I run the scheduled task "core\task\completion_regular_task"
And I am on site homepage
And I log out
And I log in as "student1"
And I follow "Course 1"
Then I should see "Status: Complete" in the "Course completion status" "block"
And I should see "Yes" in the "Teacher" "table_row"
And I should see "Yes" in the "Non-editing teacher" "table_row"
And I follow "More details"
And I should see "Yes" in the "Marked complete by Teacher" "table_row"
And I should see "Yes" in the "Marked complete by Non-editing teacher" "table_row"
@@ -0,0 +1,49 @@
@block @block_completionstatus @block_selfcompletion
Feature: Enable Block Completion in a course using manual self completion
In order to view the completion block in a course
As a teacher
I can add completion block to a course and set up manual self completion
Scenario: Add the block to a the course and manually complete the course
Given the following "users" exist:
| username | firstname | lastname | email | idnumber |
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
| student1 | Student | 1 | student1@example.com | S1 |
And the following "courses" exist:
| fullname | shortname | category | enablecompletion |
| Course 1 | C1 | 0 | 1 |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
And the following config values are set as admin:
| enablecompletion | 1 |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add the "Course completion status" block
And I add the "Self completion" block
And I navigate to "Course completion" node in "Course administration"
And I expand all fieldsets
And I set the following fields to these values:
| id_criteria_self | 1 |
And I press "Save changes"
And I log out
When I log in as "student1"
And I follow "Course 1"
And I should see "Status: Not yet started" in the "Course completion status" "block"
And I should see "No" in the "Self completion" "table_row"
And I follow "Complete course"
And I should see "Confirm self completion"
And I press "Yes"
And I should see "Status: In progress" in the "Course completion status" "block"
# Running completion task just after clicking sometimes fail, as record
# should be created before the task runs.
And I wait "1" seconds
And I run the scheduled task "core\task\completion_regular_task"
And I am on site homepage
And I follow "Course 1"
Then I should see "Status: Complete" in the "Course completion status" "block"
And I should see "Yes" in the "Self completion" "table_row"
And I follow "More details"
And I should see "Yes" in the "Self completion" "table_row"
@@ -0,0 +1,78 @@
@block @block_course_list
Feature: Enable the course_list block on a category page and view it's contents
In order to enable the course list block on a category page
As an admin
I can add the course list block to a category page
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 3 | CAT2 | CAT3 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | CAT1 |
| Course 3 | C3 | CAT2 |
| Course 4 | C4 | CAT3 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
| teacher1 | C3 | editingteacher |
Scenario: Add the course list block on category page and navigate to the course listing
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I follow "Course 1"
And I follow "Miscellaneous"
And I add the "Courses" block
And I log out
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Miscellaneous"
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
Scenario: Add the course list block on category page and navigate to another course
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I follow "Course 1"
And I follow "Miscellaneous"
And I add the "Courses" block
And I log out
When I log in as "teacher1"
And I follow "Course 1"
And I follow "Miscellaneous"
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "Course 3"
And I should see "Course 3"
Scenario: Add the course list block on category page and view as an admin
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I follow "Course 1"
And I follow "Miscellaneous"
When I add the "Courses" block
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
@@ -0,0 +1,94 @@
@block @block_course_list
Feature: Enable the course_list block on a course page and view it's contents
In order to enable the course list block on an course page
As a teacher
I can add the course list block to a course page
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 3 | CAT2 | CAT3 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | CAT1 |
| Course 3 | C3 | CAT2 |
| Course 4 | C4 | CAT3 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
| teacher1 | C3 | editingteacher |
Scenario: Add the course list block on course page and navigate to the course listing
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add the "Courses" block
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
Scenario: Add the course list block on course page and navigate to another course
Given I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add the "Courses" block
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "Course 3"
And I should see "Course 3"
Scenario: Add the course list block on course page and view as an admin
Given I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
When I add the "Courses" block
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
Scenario: View the course list block on course page with hide all courses link enabled
Given the following config values are set as admin:
| block_course_list_hideallcourseslink | 1 |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
When I add the "Courses" block
Then I should not see "All courses" in the "My courses" "block"
Scenario: View the course list block on course page with admin sees own course enabled
Given the following config values are set as admin:
| block_course_list_adminview | own |
And the following "course enrolments" exist:
| user | course | role |
| admin | C1 | editingteacher |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
When I add the "Courses" block
Then I should not see "Miscellaneous" in the "My courses" "block"
And I should not see "Category 1" in the "My courses" "block"
And I should not see "Category 2" in the "My courses" "block"
And I should not see "Category 3" in the "My courses" "block"
And I should see "Course 1" in the "My courses" "block"
And I should not see "Course 2" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
@@ -0,0 +1,61 @@
@block @block_course_list
Feature: Enable the course_list block on the dashboard and view it's contents
In order to enable the course list block on the dashboard
As a user
I can add the course list block to the dashboard
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 3 | CAT2 | CAT3 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | CAT1 |
| Course 3 | C3 | CAT2 |
| Course 4 | C4 | CAT3 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
| teacher1 | C3 | editingteacher |
Scenario: Add the course list block on the dashboard and navigate to the course listing
Given I log in as "teacher1"
And I press "Customise this page"
When I add the "Courses" block
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
Scenario: Add the course list block on the dashboard and navigate to another course
Given I log in as "teacher1"
And I press "Customise this page"
When I add the "Courses" block
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "Course 3"
And I should see "Course 3"
Scenario: Add the course list block on the dashboard and view as an admin
Given I log in as "admin"
And I press "Customise this page"
When I add the "Courses" block
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
@@ -0,0 +1,86 @@
@block @block_course_list
Feature: Enable the course_list block on the frontpage and view it's contents
In order to enable the course list block on the frontpage
As an admin
I can add the course list block to the frontpage
Background:
Given the following "categories" exist:
| name | category | idnumber |
| Category 1 | 0 | CAT1 |
| Category 2 | 0 | CAT2 |
| Category 3 | CAT2 | CAT3 |
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
| Course 2 | C2 | CAT1 |
| Course 3 | C3 | CAT2 |
| Course 4 | C4 | CAT3 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | First | teacher1@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
| teacher1 | C3 | editingteacher |
Scenario: Add the course list block on the frontpage and navigate to the course listing
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Courses" block
And I log out
When I log in as "teacher1"
And I am on site homepage
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "All courses"
And I should see "Miscellaneous"
Scenario: Add the course list block on the frontpage page and navigate to another course
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Courses" block
And I log out
When I log in as "teacher1"
And I am on site homepage
Then I should see "Course 1" in the "My courses" "block"
And I should see "Course 2" in the "My courses" "block"
And I should see "Course 3" in the "My courses" "block"
And I should not see "Course 4" in the "My courses" "block"
And I follow "Course 3"
And I should see "Course 3"
Scenario: Add the course list block on the frontpage page and view as an admin
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
When I add the "Courses" block
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
Scenario: Add the course list block on the frontpage page and view as a guest
Given I log in as "admin"
And I am on site homepage
And I navigate to "Turn editing on" node in "Front page settings"
And I add the "Courses" block
And I log out
When I log in as "guest"
Then I should see "Miscellaneous" in the "Course categories" "block"
And I should see "Category 1" in the "Course categories" "block"
And I should see "Category 2" in the "Course categories" "block"
And I should not see "Category 3" in the "Course categories" "block"
And I should not see "Course 1" in the "Course categories" "block"
And I should not see "Course 2" in the "Course categories" "block"
And I follow "All courses"
And I should see "Miscellaneous"
+1 -1
View File
@@ -86,7 +86,7 @@ function block_course_overview_get_myorder() {
// If preference was not found, look in the old location and convert if found.
$order = array();
if ($value = get_user_preferences('course_overview_course_order')) {
$order = unserialize($value);
$order = unserialize_array($value);
block_course_overview_update_myorder($order);
unset_user_preference('course_overview_course_order');
}

Some files were not shown because too many files have changed in this diff Show More