Compare commits

..

862 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) 31059fd653 Moodle release 2.7.2 2014-09-06 13:01:52 +02:00
Eloy Lafuente (stronk7) cbdde9a495 weekly release 2.7.1+ 2014-09-04 19:55:11 +02:00
Eloy Lafuente (stronk7) ce65706ceb Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-09-04 19:55:06 +02:00
Marina Glancy 65f8dc31d8 MDL-46861 webservice: reverted unnecessary change in 2.7 2014-09-04 11:40:48 +08:00
Eloy Lafuente (stronk7) 779303d869 Merge branch 'MDL-47031-27-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_27_STABLE 2014-09-03 19:25:55 +02:00
Helen Foster 28c9a1993d MDL-47031 Merge English strings from the en_fix language pack 2014-09-03 10:59:31 +02:00
Marina Glancy 8f866fa1c3 Merge branch 'm27_MDL-46639' of git://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-09-03 16:59:16 +08:00
Dan Marsden a556c4d02c MDL-46639 SCORM: incorrect setting of launch param, it is done in scorm_parse_aicc 2014-09-03 20:21:31 +12:00
Charles Fulton 87c0820260 MDL-30414 block_private_files: convert button to inline link 2014-09-03 01:09:32 +02:00
Damyon Wiese 0444bcffc7 Merge branch 'wip-MDL-47052-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-09-02 15:30:46 +08:00
Marina Glancy 15990b65ac MDL-47052 report_participation: fixed bug when filtering by first letter 2014-09-02 15:01:32 +08:00
Michael de Raadt 1f3066f197 MDL-46619 Forum: link to the discussion only if users cannot see posts. 2014-09-02 10:10:05 +08:00
Michael de Raadt 532c25d5bd MDL-46619 Forum: only output last poster's name if user can view it. 2014-09-02 10:10:02 +08:00
Marina Glancy c256614eab Merge branch 'MDL-45952_27' of git://github.com/Syxton/moodle into MOODLE_27_STABLE 2014-09-02 09:58:58 +08:00
Eloy Lafuente (stronk7) 0f67177a54 Merge branch 'MDL-46633_m27' of https://github.com/shashirepo/moodle into MOODLE_27_STABLE 2014-09-02 02:12:22 +02:00
Eloy Lafuente (stronk7) 2e6e70ccd2 Merge branch 'wip_MDL-46679_m27_addonenv' of https://github.com/skodak/moodle into MOODLE_27_STABLE 2014-09-02 02:08:43 +02:00
Eloy Lafuente (stronk7) a13ae2ac2d Merge branch 'MDL-46979_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-09-02 01:48:56 +02:00
Eloy Lafuente (stronk7) e19f164fc7 Merge branch 'MDL-45909_install_M27' of https://github.com/nadavkav/moodle into MOODLE_27_STABLE 2014-09-02 01:46:34 +02:00
Eloy Lafuente (stronk7) 702c4b1206 Merge branch 'MDL-43639_updatePassEveryLogin_27' of https://github.com/moodlerooms/moodle into MOODLE_27_STABLE 2014-09-02 01:07:43 +02:00
Damyon Wiese 17a31c7a1f Merge branch 'MDL-46852-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-09-01 16:16:33 +08:00
Damyon Wiese 7b258d7186 Merge branch 'wip-MDL-46540-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-09-01 16:08:00 +08:00
Marina Glancy 609a129b84 MDL-46540 stats: missing include file
Thanks to Vadim Dvorovenko for finding a bug and providing a solution
2014-09-18 03:40:17 +08:00
Marina Glancy ecd01922e9 Merge branch 'MDL-46861_27_STABLE' of https://github.com/Lightwork-Marking/moodle into MOODLE_27_STABLE 2014-09-01 16:07:05 +08:00
Damyon Wiese c8782c56d7 Merge branch 'MDL-46902_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-09-01 15:54:18 +08:00
Damyon Wiese 4deed68f49 Merge branch 'MDL-46911-27' of https://github.com/bostelm/moodle into MOODLE_27_STABLE 2014-09-01 15:45:52 +08:00
Damyon Wiese 40b705e153 Merge branch 'm27_MDL-46985_7ZIP_RAR_MIME_types_missing' of https://github.com/scara/moodle into MOODLE_27_STABLE 2014-09-01 15:36:22 +08:00
Damyon Wiese 3b35ea4686 Merge branch 'm27_MDL-46961' of https://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-09-01 15:29:03 +08:00
Damyon Wiese 5a9dde69b1 Merge branch 'wip-mdl-46670-m27' of https://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-09-01 15:23:23 +08:00
Damyon Wiese a02ad260e0 Merge branch 'MDL-45818_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-09-01 15:17:57 +08:00
Marina Glancy 15f15ccddd Merge branch 'm27_MDL-46639' of git://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-09-01 14:34:52 +08:00
Marina Glancy 346e41d042 Merge branch 'MDL-46539-fix-27' of https://github.com/jmarthaler/moodle into MOODLE_27_STABLE 2014-09-01 14:34:40 +08:00
Frederic Massart 36bf61e152 MDL-46852 mod_lesson: More accurate comparison of shortanswer answers 2014-09-01 14:25:31 +08:00
Damyon Wiese bc180cd111 Merge branch 'wip-MDL-39233-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-09-01 13:40:38 +08:00
Damyon Wiese b10d7c59ae MDL-46619 Forum: whitespace fixes 2014-09-01 11:35:26 +08:00
Damyon Wiese 6aee251874 Merge branch 'MDL-46619-2.7-visisble-authors-qanda' of https://github.com/amandadoughty/moodle into MOODLE_27_STABLE 2014-09-01 11:00:35 +08:00
Damyon Wiese d1e9bdfbc8 Merge branch 'm27_MDL-46737' of https://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-09-01 10:55:22 +08:00
zbdd 0c18577317 MDL-37312 backup: Keep course idnumber on same site course restore
When the course idnumber is set during a same site course restore,
retain the course idnumber if there are no duplicates.
2014-09-01 10:44:50 +08:00
Rajesh Taneja 255221acdf MDL-46670 report_participation: Look for records in legacy and current
Priority log store will have current information, so
make sure to get information and aggregate that with
legacy data
2014-09-01 10:24:51 +08:00
Matteo Scaramuccia 93bd10c300 MDL-46985 Added 7-Zip and RAR MIME types. 2014-08-31 22:39:37 +02:00
Petr Skoda 03bdfbd37b MDL-39840 environment: add support for environment.xml in plugins
New features:

* environment.xml files in all types of plugins
* support for plugin strings via new optional plugin attribute in FEEDBACK
* support for class_name::method_name custom callbacks and classloader
2014-09-01 08:39:11 +12:00
AMOS bot d7de792dac Automatically generated installer lang files 2014-09-01 00:05:42 +08:00
Mark Nelson 763e5d6c83 MDL-45818 core_message: use system context if user no longer exists 2014-08-29 16:20:08 -07:00
Mark Nelson 436c7825b1 MDL-46902 core_course: display meaningful message when no courses found 2014-08-29 14:31:55 -07:00
AMOS bot 9074f5914f Automatically generated installer lang files 2014-08-30 00:05:30 +08:00
Paul Charsley 62ff078fcf MDL-46861 added missing required field areaname 2014-08-29 10:53:38 +12:00
Nadav Kavalerchik df174952fd MDL-45909 install/css: Left align input form fields on Install pages,in RTL mode 2014-08-28 22:58:02 +03:00
Tim Hunt 9d97806c7e MDL-46979 backup: remove duplicate string.
Thanks to Matt Sammarco for spotting this.
2014-08-28 20:45:00 +01:00
Eloy Lafuente (stronk7) e6f1c141bf weekly release 2.7.1+ 2014-08-28 19:12:21 +02:00
Eloy Lafuente (stronk7) 687f244a6f Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-08-28 19:12:14 +02:00
AMOS bot 461532ecfc Automatically generated installer lang files 2014-08-29 00:05:30 +08:00
shashirepo 16b6239a88 MDL-46633 chat: Chat send button gets stuck 2014-08-28 15:01:49 +05:30
Syxton 8121a2fad0 MDL-45952 feedback: non-respondents in groupings
Fixes feedback non-respondents list to show only members in groups in
the selected grouping if "Available for group members only" is selected.
2014-08-27 15:14:08 -04:00
Mark Nielsen d78e72a940 MDL-43639: Prevent user updated event on every login
If auth plugin prevents local passwords, then user
is updated and event is triggered on every login.
2014-08-27 11:24:51 -07:00
Jon Marthaler 16a175de06 MDL-46539 assign calendar: Fix lastcron value for assign cron 2014-08-27 11:15:38 -05:00
AMOS bot ec4f31f984 Automatically generated installer lang files 2014-08-28 00:05:33 +08:00
Damyon Wiese 323a7a151b Merge branch 'MDL-46812-27-fixup' of https://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-08-27 10:49:08 +08:00
Frederic Massart 14eb0c478d MDL-46812 gradereport_grader: Hide vertical scrollbar of scroller 2014-08-27 10:44:02 +08:00
Damyon Wiese e8b487e010 Merge branch 'wip-MDL-39888-27' of git://github.com/abgreeve/moodle into MOODLE_27_STABLE 2014-08-27 09:56:58 +08:00
Faisal Kaleem 641351118e MDL-46961 SCORM: JavaScript Hoisting issue. 2014-08-27 13:08:59 +12:00
Eloy Lafuente (stronk7) 12e42d2246 MDL-46875 tinymce: keep stable version YYYMMDD constant
Note this has been integrated together with previous commit
so nobody should get a "downgrade" ever (but Brian, I'm sorry :-)
2014-08-27 02:11:59 +02:00
Eloy Lafuente (stronk7) 0a668af390 Merge branch 'm27_MDL-46875' of https://github.com/totara/moodle into MOODLE_27_STABLE 2014-08-27 02:03:37 +02:00
Damyon Wiese 22290d726a Revert "Merge branch 'MDL-46917-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE"
This reverts commit 439f2e7e83, reversing
changes made to b523d5bc33.
2014-08-26 17:20:41 +08:00
Henning Bostelmann 03fc135cb6 MDL-46911 Database activity: jump to correct place in list after (un)approve 2014-08-26 10:17:07 +01:00
Marina Glancy 0459ed43e1 MDL-39233 mod_url: added unittest for get_course_content 2014-08-26 13:55:11 +08:00
Jason 928f531307 MDL-39233 mod_url: fix php notice 2014-08-26 13:55:10 +08:00
Damyon Wiese 767dfb307d MDL-46842 assign: Fix for unit tests - previous patch was completely ignoring manually reopening attempts. 2014-08-26 10:34:03 +08:00
Brian Barnes 3efe531af4 MDL-46875 tinymce: Fixed issue with full screen and spelling 2014-08-26 13:23:01 +12:00
Eloy Lafuente (stronk7) ef54b1272a Merge branch 'MDL-46477_m27' of https://github.com/shashirepo/moodle into MOODLE_27_STABLE 2014-08-26 02:24:31 +02:00
Eloy Lafuente (stronk7) 2e97e57edb Merge branch 'MDL-46753-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-08-26 02:08:17 +02:00
Eloy Lafuente (stronk7) 2f64ea2a2e Merge branch 'm27_MDL-46842' of https://github.com/greg-or/moodle-mod_assign into MOODLE_27_STABLE 2014-08-26 01:59:25 +02:00
Eloy Lafuente (stronk7) 3fda0a9736 Merge branch 'MDL-46868_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-26 01:40:48 +02:00
Eloy Lafuente (stronk7) 0047e4612c Merge branch 'm27_MDL-46816' of https://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-08-26 00:10:50 +02:00
Eloy Lafuente (stronk7) 44088a5aeb Merge branch 'wip-MDL-46874-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-08-25 22:11:17 +02:00
Eloy Lafuente (stronk7) 2507ecbd3e Merge branch 'm27_MDL-46900' of https://github.com/totara/moodle into MOODLE_27_STABLE 2014-08-25 20:55:29 +02:00
Damyon Wiese 439f2e7e83 Merge branch 'MDL-46917-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE 2014-08-25 16:55:08 +08:00
Marina Glancy b523d5bc33 Merge branch 'MDL-46894_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-25 16:53:40 +08:00
Marina Glancy 63e0fee364 Merge branch 'MDL-46916_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-25 16:50:05 +08:00
Damyon Wiese 063c6e23d4 Merge branch 'MDL-46923_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-08-25 16:48:11 +08:00
Damyon Wiese 5c1f1690bb Merge branch 'wip_MDL-43918_m27_cm' of https://github.com/skodak/moodle into MOODLE_27_STABLE 2014-08-25 16:44:50 +08:00
Marina Glancy b46ad4bdd5 Merge branch 'M27_MDL46887_assignment_file_max_size' of git://github.com/Dave-B/moodle into MOODLE_27_STABLE 2014-08-25 16:29:33 +08:00
Marina Glancy 8001ddd8b2 Merge branch 'MDL-46895_27' of git://github.com/colchambers/moodle into MOODLE_27_STABLE 2014-08-25 16:28:02 +08:00
Rex Lorenzo b9894e1e9f MDL-46776 gradereport_grader: Improve Grader report user interface
* Adding assignments to test course generator to more easily test the grader report with large number of students and graded activities.
2014-08-25 16:20:49 +08:00
Dan Marsden 0e26b1d309 MDL-46639 mod_scorm: Fix load of simple AICC content
Thanks to Ian Wild for the report and suggested patch.
2014-08-25 20:01:45 +12:00
Marina Glancy 5cc6700f27 Merge branch 'MDL-46904-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-08-25 14:45:38 +08:00
Damyon Wiese 090f8f300d Merge branch 'wip-MDL-46812_M27' of git://github.com/lazydaisy/moodle into MOODLE_27_STABLE 2014-08-25 14:03:18 +08:00
Damyon Wiese fc36873f61 Merge branch 'wip-MDL-46703-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-08-25 13:53:52 +08:00
Marina Glancy 315392626b Merge branch 'MDL-46918_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-25 12:01:27 +08:00
Petr Skoda c27add8d87 MDL-43918 add more validation to $modulename parameter when fetching cms 2014-08-25 12:19:11 +12:00
Adrian Greeve ae18cf2461 MDL-39888 mnet: Added a notification that logs may not be displayed in the log report.
In Moodle 2.7+ we are using the new logging system and if legacy logs are not enabled
(on the client system) then no logs will be displayed.
2014-08-23 11:55:57 +08:00
Colin Chambers deab7fda59 MDL-46895 qtype_calculated_find_formula_errors not defined causes Calculated question type test to fail 2014-08-22 14:03:36 +01:00
Andrew Nicols af3085d2d5 MDL-46917 atto: Focus on the editor when the form label is selected 2014-08-22 15:00:20 +08:00
Eloy Lafuente (stronk7) 55a8f72251 MDL-46918 ddl: cover behavior with unit test 2014-08-21 18:33:39 +01:00
Tim Hunt af02385d49 MDL-46918 ddl: fix error when renaming table already exists 2014-08-21 18:33:39 +01:00
AMOS bot c5b3017b49 Automatically generated installer lang files 2014-08-22 00:05:31 +08:00
Tim Hunt 5ec684b353 MDL-46916 behat: improve question state test. 2014-08-21 14:15:22 +01:00
Tim Hunt 0a03803081 MDL-46894 make Behat backup steps more robust. 2014-08-21 14:15:08 +01:00
Tim Hunt 6527b097e8 MDL-46868 glossary / filter: performance, check modinfo sooner.
Since we need to check modinfo anyway, do that as soon as possible so we
can get a performance win if there are no glossaries in the course.
2014-08-21 14:14:56 +01:00
Dan Poltawski 8f5c4f6b34 MDL-46880 mod_forum: move cron to scheduled task
Note that this is a very basic conversion without doing any refactoring
to split the tasks up better. That will come in MDL-44734, this is about
being a safe backportable change to give admins better control over the
running of the forum cron task.

Conflicts:
	mod/forum/version.php
2014-08-21 13:46:33 +01:00
Amanda Doughty b1325427ec MDL-46619 Forum: author showing in Q and A forum 2014-08-21 13:13:15 +01:00
shashirepo 5de6795ec0 MDL-46477 chat:hard coded string in mod/chat 2014-08-21 17:32:34 +05:30
Mary Evans 0dc138d47c MDL-46812 grade/report/grader: Need to tie up loose ends in Gradebook after MDL-43824
Squashed commit of the following:

commit 4ae57a823ba6fa1d627d2bad296cdf905b1930ee
Author: Mary Evans <lazydaisy@visible-expression.co.uk>
Date:   Thu Aug 21 02:05:35 2014 +0100

    MDL-46812 grade/report/grader: Reset previous commit for left scroller.

commit 7e3d27d3cc9d22ffe8e1dbb54eb705a65153a6b0
Author: Mary Evans <lazydaisy@visible-expression.co.uk>
Date:   Thu Aug 21 01:23:09 2014 +0100

    MDL-46812 grade/report/grader: Added jsenabled css body class to rtl style.

commit 0b5c3341b79c4b4bfefcd82eef1940964448ccba
Author: Mary Evans <lazydaisy@visible-expression.co.uk>
Date:   Thu Aug 21 01:13:34 2014 +0100

    MDL-46812 theme_base: Removed more redundant CSS.

commit 8c44e8a4c644a9139d1750af498bed6a14decf5c
Author: Mary Evans <lazydaisy@visible-expression.co.uk>
Date:   Wed Aug 20 15:44:42 2014 +0100

    MDL-46812 theme_base: Removed redundent grade/report/grader CSS in style/grade.css

commit 7c69b546fab03163d3863044ab9d1d9130c1cdd9
Author: Mary Evans <lazydaisy@visible-expression.co.uk>
Date:   Thu Aug 14 12:50:14 2014 +0100

    MDL-46812 grade/report/grader: Need to tie up loose ends in Gradebook after MDL-43824

        1. fixed gradebook layout when JS is disabled
        2. added height and background color to scroller when JS is enabled
        3. removed redundent top margin in user-grades table
2014-08-21 11:23:27 +01:00
Mark Nelson f367cfcbef MDL-46923 core_behat: fixed typos in function names 2014-08-20 22:11:31 -07:00
Brian Barnes c2b526c484 MDL-46900 theme: allowed more than 1 nav collapse element 2014-08-21 15:01:58 +12:00
Marina Glancy b01092111c weekly release 2.7.1+ 2014-08-21 10:18:55 +08:00
Marina Glancy 8ef945280c Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-08-21 10:18:53 +08:00
AMOS bot fbfeb98d39 Automatically generated installer lang files 2014-08-21 00:05:30 +08:00
Damyon Wiese 24276da9ce MDL-46904 core_task: Gracefully handle rubbish entries in the tasks table. 2014-08-20 17:02:02 +08:00
Gregory Faller 1f316df7d9 MDL-46842: Reopen assignment submissions when using offline grading worksheet 2014-08-20 17:28:38 +09:30
Damyon Wiese 467aefd1a6 Merge branch 'MDL-45029-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE
Conflicts:
	course/modlib.php
2014-08-20 13:58:58 +08:00
Simey Lameze f354a67357 MDL-45029 core_course: set aggregationcoef while creating a new course module 2014-08-20 12:07:34 +08:00
Mark Nelson 32193155f5 MDL-46188 core_course: use correct hide/show icon 2014-08-20 12:04:59 +08:00
Damyon Wiese b3f6c093aa Merge branch 'MDL-45029-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-08-20 10:21:46 +08:00
Eloy Lafuente (stronk7) 82a678c91e Merge branch 'MDL-46302-atto-float-right' of git://github.com/uhunkler/moodle into MOODLE_27_STABLE 2014-08-20 00:57:22 +02:00
Mark Nielsen f3f21f18c4 MDL-46536: OAuth signature fails with inconsistent new lines
When the LTI intro contains a single \n or
\r newline character then the OAuth signature
fails.  All newlines should be \r\n

Conflicts:
	mod/lti/tests/locallib_test.php
2014-08-19 21:51:13 +02:00
AMOS bot 05c7b75672 Automatically generated installer lang files 2014-08-20 00:05:29 +08:00
Mark Nielsen 39c01271f0 MDL-46051 mod_lti: Not enough data passed to lti_extend_lti_services 2014-08-19 17:08:59 +02:00
Mark Nielsen c09f63c5ac MDL-46051 mod_lti: Fixing errors in unknown_service_api_called class
Also adding unit tests.
2014-08-19 17:08:47 +02:00
Eloy Lafuente (stronk7) 9f9bcb251c Merge branch 'MDL-46301' of https://github.com/michaelwheeler/moodle into MOODLE_27_STABLE 2014-08-19 15:37:26 +02:00
David Balch 39864d9e88 MDL-46887 mod_assign: Enforce module's maxbytes setting at submission. 2014-08-19 14:01:15 +01:00
Marina Glancy 2a46808ed3 Merge branch 'wip-mdl-46327-m27' of git://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-08-19 17:39:40 +08:00
Rajesh Taneja 4221300426 MDL-46327 phpunit: drop_table should be used, rather then drop_temp_table 2014-08-19 17:17:50 +08:00
Simey Lameze d14fe6017f MDL-45029 core_course: set aggregationcoef while creating a new course module 2014-08-19 17:08:10 +08:00
Marina Glancy cdc0a8db3f MDL-46538 theme_base: recompiled moodle.css 2014-08-19 16:52:42 +08:00
Marina Glancy 9ddb811866 Merge branch 'MDL-46538_M27' of git://github.com/lazydaisy/moodle into MOODLE_27_STABLE 2014-08-19 16:52:08 +08:00
Petr Skoda 29dd7397e2 MDL-46711 session: add support for multiple servers to memcache session driver
Includes proper definition of object properties which fixes handling of timout default.
2014-08-19 16:41:26 +08:00
Marina Glancy bef5900bdb Merge branch 'MDL-46281-MOODLE_27_STABLE' of git://github.com/lucisgit/moodle into MOODLE_27_STABLE 2014-08-19 16:22:24 +08:00
Marina Glancy 623379d82b Merge branch 'MDL-46829_M27' of git://github.com/lazydaisy/moodle into MOODLE_27_STABLE 2014-08-19 14:21:18 +08:00
Marina Glancy 8480fd9364 Merge branch 'MDL-46833-MOODLE_27_STABLE' of git://github.com/lucisgit/moodle into MOODLE_27_STABLE 2014-08-19 14:21:09 +08:00
Damyon Wiese 5faaf18173 Merge branch 'MDL-41513-Scrollbar_not_working-27' of https://github.com/MorrisR2/moodle into MOODLE_27_STABLE 2014-08-19 14:07:10 +08:00
Marina Glancy d23d771071 Merge branch 'wip-mdl-46817-m27' of git://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-08-19 14:04:05 +08:00
Marina Glancy 5f690a9be6 Merge branch 'MDL-43197-27-2nd' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-08-19 13:26:01 +08:00
Damyon Wiese 95dae00235 Merge branch 'MDL-46188_m27' of https://github.com/shashirepo/moodle into MOODLE_27_STABLE 2014-08-19 13:14:45 +08:00
Marina Glancy 7c4e3db7c0 MDL-46874 gradereport: replace usage of class hidden with dimmed_text 2014-08-19 12:56:11 +08:00
Michael Wheeler 0ed1b7d277 MDL-46794 install: Fixed typo in config-dist.php 2014-08-19 11:26:49 +08:00
Marina Glancy 690988d958 Merge branch 'm27_MDL-46775' of git://github.com/totara/moodle into MOODLE_27_STABLE 2014-08-19 11:21:52 +08:00
Marina Glancy 26b3b4e80e Merge branch 'wip-mdl-46327-m27' of git://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-08-19 10:50:34 +08:00
Marina Glancy a5e67c5bcc Merge branch 'wip-MDL-46791-MOODLE_27_STABLE' of git://github.com/satrun77/moodle into MOODLE_27_STABLE 2014-08-19 10:50:22 +08:00
Frederic Massart 01327cfcf5 MDL-43197 gradereport_user: Parents/mentors can see all the relevant grades 2014-08-19 10:48:11 +08:00
Rajesh Taneja 1b775e96c1 MDL-46327 phpunit: Fixed oracle fail 2014-08-19 10:13:55 +08:00
Marina Glancy ef467ee957 MDL-46691 mod_choice: apply filters to user input 2014-08-19 03:04:57 +02:00
James Henestofel 247b756248 MDL-42231 auth: custom profile fields to support numbers at the end.
For data mapping LDAP or CAS.  Change order of fieldname display checks to verify
custom profile fields first to allow custom field shortname to contain number at the end.
2014-08-19 02:43:44 +02:00
Eloy Lafuente (stronk7) 1eedfdf2c0 Merge branch 'MDL-44894_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-19 02:34:48 +02:00
Eloy Lafuente (stronk7) d4bbbedbde Merge branch 'wip_MDL-46552_m27_memcached' of https://github.com/skodak/moodle into MOODLE_27_STABLE 2014-08-19 02:29:06 +02:00
Eloy Lafuente (stronk7) c8abe81b99 Merge branch 'MDL-45874-27' of https://github.com/danielneis/moodle into MOODLE_27_STABLE 2014-08-19 02:12:19 +02:00
Eloy Lafuente (stronk7) 7943aabfbe Merge branch 'wip-MDL-46826-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-08-18 20:06:54 +02:00
Eloy Lafuente (stronk7) 2de77919d8 Merge branch 'wip-MDL-46589-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-08-18 19:48:42 +02:00
Marina Glancy 5094443f65 MDL-41284 stats: fix sql query from MDL-41284 2014-08-18 19:42:41 +02:00
Eric Merrill 9ec65dc485 MDL-46766 auth_cas: Upgrading to phpCAS 1.3.3 2014-08-18 16:38:55 +08:00
Simey Lameze 068ef548de MDL-46753 auth_cas: Replace hardcoded logout_return_url to user defined URL.
Credit goes to Mitsuru Udagawa, thanks!
2014-08-18 12:57:34 +08:00
Damyon Wiese bad563d2f4 Merge branch 'm27_MDL-46760' of https://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-08-18 12:41:12 +08:00
Rajesh Taneja 50eb74065b MDL-46817 behat: Step to check if value exist/not in table column 2014-08-18 10:01:06 +08:00
AMOS bot febd8afc8e Automatically generated installer lang files 2014-08-18 00:07:49 +08:00
Marina Glancy cac959739b MDL-46703 mod_data: limit the width of select element when editing templates
Thanks to Hittesh for the provided solution
2014-08-16 13:27:27 +08:00
Marina Glancy cef5600303 MDL-46589 scheduled task does not send emails
Thanks to  Luděk Šulák  for the patch
2014-08-16 12:48:16 +08:00
Mary Evans 63a2e24bc2 MDL-46538 theme_base/theme_bootstrapbase: Removed incorrect RTL CSS. 2014-08-16 01:11:31 +01:00
Daniel Neis 35eefad6b3 MDL-45874 Fix access to users reports in navigation when using separate groups 2014-08-15 17:06:39 -03:00
Rajesh Taneja c8121c53d1 MDL-46817 behat: Table selector support css
Previously table selector supported id and caption only.
But in few cases we don't have proper id, so added support
for css
2014-08-15 13:17:06 +08:00
Marina Glancy 74f6a6ae5b MDL-46826 forum: make sql query indexed, regression from MDL-31089 2014-08-15 11:46:01 +08:00
Ray Morris d560fb3e26 MDL-41513 mod_quiz: Scrollbar not working in JS Security Popup 2014-08-14 15:44:51 -05:00
Ruslan Kabalin 213220c159 MDL-46833 mod_assign: Fix assignment view when available for group members only.
When assignment is "Available for group members only" and no users with
mod/assign:submit role permision is enrolled (students),
groups_filter_users_by_course_module_visible is causing error (as $users
array is empty). The patch resolves the issue.
2014-08-14 16:04:54 +01:00
shashirepo baa476ce92 MDL-46188 course:show/hide button disappears after action 2014-08-14 20:32:31 +05:30
Mary Evans 795dc143c2 MDL-46829 theme_base: Fixed regression in Base casued by MDL-45031. 2014-08-14 14:27:06 +01:00
Tony Butler a18e060c5b MDL-46281 core_backup: Add class_exists check for backup_<mod>_activity_task
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-08-14 12:57:15 +01:00
Mohamed Alsharaf 84ebf61b82 MDL-46791 question: fixed incorrect 5th param for tag_set() 2014-08-14 23:51:41 +12:00
Tim Hunt 300dff939f MDL-44894 question editing: fix validation with odd permissions
For users with edit permissions, but not add permissions, it was
impossible to save the editing form. The validation assuemd this value
was present, but it was not. Other code checks this field too, so I
added it rather than changing the validation and all the other uses.
2014-08-14 11:26:25 +01:00
Marina Glancy 2aa6dd4c60 weekly release 2.7.1+ 2014-08-14 14:52:31 +08:00
Marina Glancy e59d25c944 Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-08-14 14:52:27 +08:00
Dan Marsden a86531f20b MDL-46816 mod_asssign plagiarism: Remove unnecessary code. 2014-08-14 13:09:42 +12:00
Dan Marsden 239bfa31b0 MDL-46760 mod_scorm: Fix js error when preview mode disabled 2014-08-14 10:10:45 +12:00
Eloy Lafuente (stronk7) 9056ee506a MDL-45031 theme: fix tabs base line alignment by 1px.
Credit goes to Damyon Wiese, thanks!
2014-08-13 21:33:02 +02:00
Michael Wheeler 5a8fdd1c27 Normalize request header names. 2014-08-13 14:51:44 -04:00
AMOS bot be14be6175 Automatically generated installer lang files 2014-08-14 00:05:45 +08:00
Marina Glancy 0b09c8e48f Revert "Merge branch 'm27_MDL-46643' of git://github.com/totara/moodle into MOODLE_27_STABLE"
This reverts commit a62801941e, reversing
changes made to 0282c20862.
2014-08-13 16:30:07 +08:00
Andrew Nicols 90e4b26229 MDL-45759 mod_quiz: Correct behat test to reflect changes from a translation fix 2014-08-13 15:49:45 +08:00
Eloy Lafuente (stronk7) 8b9c45b666 Merge branch 'MDL-46697_27' of git://github.com/aolley/moodle into MOODLE_27_STABLE 2014-08-13 02:08:16 +02:00
Eloy Lafuente (stronk7) 2c3eea86fa Merge branch 'MDL-45031_M27' of git://github.com/lazydaisy/moodle into MOODLE_27_STABLE 2014-08-13 00:33:03 +02:00
Eloy Lafuente (stronk7) 39259ea58b Merge branch 'wip-MDL-46470-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE
Conflicts:
	theme/bootstrapbase/style/moodle.css
2014-08-13 00:26:16 +02:00
Tim Hunt 3ce36f6ac1 MDL-45642 questions: add required index to question_attempts.
It is important to be able to tell which behaviours are in use, and
without this index, it requires a complete scan of this table, which can
be very big, to verify that a behaviour is unused.
2014-08-12 11:38:26 +01:00
Dan Poltawski 6a9a7005b0 Merge branch 'MDL-43824-M27' of git://github.com/lazydaisy/moodle into MOODLE_27_STABLE
Conflicts:
	theme/bootstrapbase/style/moodle.css
2014-08-12 11:08:11 +01:00
Dan Poltawski 2d9145638c Merge branch 'm27_MDL-46718' of https://github.com/greg-or/moodle-mod_assign into MOODLE_27_STABLE 2014-08-12 11:02:18 +01:00
Marina Glancy 531b675632 Merge branch 'MDL-46308_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-12 16:02:54 +08:00
Marina Glancy c41d4355ac Merge branch 'MDL-21042_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-08-12 16:02:11 +08:00
Marina Glancy ac4bf23c02 Merge branch 'm27_MDL-46315' of git://github.com/totara/moodle into MOODLE_27_STABLE 2014-08-12 15:02:03 +08:00
Marina Glancy 51c59e8b9f Merge branch 'MDL-46600_import_failed_27' of git://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-08-12 15:01:55 +08:00
Marina Glancy 606db83726 Merge branch 'wip_MDL-46480_m27_footernan' of git://github.com/skodak/moodle into MOODLE_27_STABLE 2014-08-12 15:01:46 +08:00
Marina Glancy a62801941e Merge branch 'm27_MDL-46643' of git://github.com/totara/moodle into MOODLE_27_STABLE 2014-08-12 13:31:41 +08:00
Marina Glancy 0282c20862 Merge branch 'MDL-43740_manual_none_27' of git://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-08-12 13:29:30 +08:00
Simon Coggins 915e21170c MDL-46775: Fix call to unavailable function when loading an invalid JS file 2014-08-12 14:33:23 +12:00
Mary Evans 11b6abd02c MDL-45031 theme_base: Added style/tabs.css and updated config.php
also removed tabtree css from style/core.css to style/tabs.css.
2014-08-12 01:11:31 +01:00
Eloy Lafuente (stronk7) 6005337c33 Merge branch 'MDL-46676_2.7' of https://github.com/ikawhero/moodle into MOODLE_27_STABLE 2014-08-12 01:48:18 +02:00
Eloy Lafuente (stronk7) ea2833bc35 Merge branch 'MDL-46681_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-12 01:44:23 +02:00
Mary Evans 2271f1845c MDL-43824 core/grade/report/grader: Fix for misalignment of static rows with scale grades. 2014-08-11 23:53:36 +01:00
Dan Poltawski b4875aa348 Merge branch 'MDL-46496-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE 2014-08-11 14:38:35 +01:00
Dan Poltawski 3b4cc68ff4 Merge branch 'm27_MDL-44015' of https://github.com/greg-or/moodle-mod_assign into MOODLE_27_STABLE 2014-08-11 14:31:04 +01:00
Dan Poltawski 2f0d26c522 Merge branch 'MDL-46688_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-08-11 14:13:14 +01:00
Andrew Davis 3dd8bd5069 MDL-43740 core_grade: Thanks to Robert Russo for the patch. Removed the ability to set manual grade items to grade type "None" 2014-08-11 20:17:13 +08:00
Dan Poltawski eede6aae43 Merge branch 'MDL-45759-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE 2014-08-11 11:24:20 +01:00
Dan Poltawski a623fdf11b Merge branch 'wip-MDL-30668-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-08-11 10:41:42 +01:00
Marina Glancy 617144f163 Merge branch 'MDL-35984-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-08-11 17:24:48 +08:00
Dan Poltawski 61d3898de9 Merge branch 'MDL-46748-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-08-11 08:37:35 +01:00
Damyon Wiese ec297cc65b MDL-35984 Grades: Fix deprecation of grade_category::aggregate_values 2014-08-11 14:22:27 +08:00
Damyon Wiese 5e33ee65e5 MDL-35984 grade: Recalculate min/max for sum of grades when hidden grades are involved. 2014-08-11 14:22:27 +08:00
Damyon Wiese 3bf4cc3887 MDL-35984 grade: Add behat tests for grade aggregations 2014-08-11 14:22:27 +08:00
Andrew Nicols 4f88c9f38d MDL-45780 mod_quiz: Autosave should listen for textarea:change events too 2014-08-11 12:32:15 +08:00
Andrew Nicols 096ef13c79 MDL-45780 editor_atto: Update the textarea more often
This change updates the frequency of the textarea update to additionally
update it:
* on keypress; and
* on content paste.
2014-08-11 12:32:13 +08:00
Damyon Wiese c49e848571 MDL-46748 MathJax filter: Update setting default for https cdn url. 2014-08-11 12:03:54 +08:00
Damyon Wiese 25a0be8b27 MDL-46748 MathJax filter: Make misconfigured mathjax url less "fatal" for Atto. 2014-08-11 12:03:05 +08:00
Tim Hunt b760c63189 MDL-46308 qformat_xml: fix import of broken calculated questions.
Questions like this should not exist, of course. But they do, so we
should avoid generating errors in this case.
2014-08-08 17:59:15 +01:00
Tim Hunt b3569fb6fa MDL-46688 weblib: improve the highlight function.
Thanks to Joseph Baxter for suggesting some of the test cases.
2014-08-08 17:53:04 +01:00
Marina Glancy db14163584 MDL-30668 gradereport_grader: split user preferences into individual courses
This solves the DB exception when users were trying to insert very large string in DB
2014-08-08 15:16:32 +08:00
Andrew Nicols c58559191a MDL-46496 libraries: Add additional tests for jquery and jqueryUI
The additional tests add a clear example of the use of jquery UI images in
addition to working JavaScript.
2014-08-08 14:06:20 +08:00
Gregory Faller d86be9c53e MDL-46718: Return user to last accessed page when quick grading 2014-08-08 14:12:03 +09:30
Dan Marsden 7de6a916a2 MDL-46737 SCORM: correct dml syntax. 2014-08-08 15:10:11 +12:00
Andrew Nicols cf93e03ea0 MDL-45759 javascript: Handle setting of the confirm button fields post-init 2014-08-08 08:36:20 +08:00
Petr Skoda f2774239cb MDL-46480 fix get_htmlelement_size() to deal with hidden or non-block elements 2014-08-08 10:28:51 +12:00
Tim Hunt 5049dfceca MDL-46681 qtype_multichoice: disabled unused options
For questions set to 'One answer only', the 'Clear incorrect responses'
and 'Show the number of correct responses' hint options make not sense,
and are not used. Hence we disableIf them.
2014-08-07 14:23:07 +01:00
Marina Glancy 186af5a430 weekly release 2.7.1+ 2014-08-07 13:15:08 +08:00
Marina Glancy 7a4826bc3e Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-08-07 13:15:07 +08:00
Paul Holden 1b1432ab88 MDL-21042 report_security: don't display warning for riskbackup unnecessarily 2014-08-06 19:54:23 -07:00
Andrew Davis 5bfbec5521 MDL-46600 core_grades: made it explicit in the error message that a failed grade import means nothing was imported. 2014-08-07 09:17:04 +08:00
Shane Elliott eee25b4a13 MDL-46676 profilefield_datetime: Use moodle time API 2014-08-06 16:36:03 +08:00
Adam Olley a175c5d1ba MDL-46697 gradebook: Only count active users when needed (and only id)
The code only needs the id column to perform its count. On courses with a lot of users
fetching the whole user record for them all easily adds up to several hundred MB of
memory.
2014-08-06 15:58:11 +09:30
Gregory Faller d209e7161a MDL-44015: EditPDF scrolls instead of drawing on iOS 2014-08-06 14:42:53 +09:30
Marina Glancy ef494edcd6 MDL-46470 bootstrapbase: support linkedwhenselected attribute for tabs 2014-08-06 11:46:16 +08:00
Brian Barnes 20ada5de55 MDL-46643 calendar: improved tab order of calendar detail pages 2014-08-06 15:32:02 +12:00
Eloy Lafuente (stronk7) c21c4761d1 Merge branch 'm27_MDL-46625' of https://github.com/totara/moodle into MOODLE_27_STABLE 2014-08-05 13:04:37 +02:00
Brian Barnes 9ab9793c53 MDL-46315 themes: Fixed display inconsistancy with help modals 2014-08-05 13:08:17 +12:00
Eloy Lafuente (stronk7) 4a106a5759 Merge branch 'MDL-46641_27-delete-activity-step' of https://github.com/rlorenzo/moodle into MOODLE_27_STABLE 2014-08-05 02:27:35 +02:00
Petr Skoda b5256231a6 MDL-46552 session: add support for multiple servers in memcached session driver 2014-08-05 11:40:28 +12:00
Eloy Lafuente (stronk7) b29e02d57e Merge branch 'MDL-44149-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-08-04 17:10:58 +02:00
Damyon Wiese 95bb29b902 MDL-44149 Assign: Reopen attempts from quick grading (reopenuntilpass) 2014-08-04 15:55:10 +08:00
Marina Glancy 59fe1b009f Merge branch 'MDL-44794-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-08-04 14:24:51 +08:00
Simey Lameze ab8571d19a MDL-44794 group: unit test for groups_get_user_groups method. 2014-08-04 11:35:32 +08:00
Simey Lameze 90ff64881e MDL-44794 group: unit test for get_groups method. 2014-08-04 11:35:32 +08:00
Marina Glancy 1818308bca Merge branch 'MDL-46457_27' of git://github.com/aolley/moodle into MOODLE_27_STABLE 2014-08-04 11:24:30 +08:00
Marina Glancy b47604e938 Merge branch 'MDL-46414-m27' of git://github.com/sammarshallou/moodle into MOODLE_27_STABLE 2014-08-04 11:24:17 +08:00
Eloy Lafuente (stronk7) c1ee5cf31b Merge branch 'MDL-46620-27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-08-03 20:01:44 +02:00
Rex Lorenzo 18f802f85a MDL-46641 behat: Delete activity step does not work without actions menu open 2014-07-31 11:32:53 -07:00
AMOS bot ea8c5bdc74 Automatically generated installer lang files 2014-08-01 00:05:36 +08:00
Dan Poltawski 6b7a5f86a0 weekly release 2.7.1+ 2014-07-31 09:37:24 +01:00
Dan Poltawski f28ce6eb2e Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-07-31 09:37:20 +01:00
Brian Barnes 5bb55eeb21 MDL-46625 theme: Added a way to target the current page 2014-07-31 13:21:16 +12:00
Eric Merrill ddb652c706 MDL-46620 messages Make sure full message is used for read marking
message_mark_message_read needs to have the full message object,
otherwise data will be lost.
2014-07-30 15:58:04 -04:00
sam marshall 648cc055c2 MDL-46414 Conditional availability: Dropdowns not set correctly when editing in IE
In IE, you cannot set the value of a dropdown to an integer; it has to be a string.
This caused a bug in several parts of the conditional availability editing
interface.
2014-07-29 18:35:21 +01:00
Dan Poltawski 0fbda60bb3 Merge branch 'MDL-46236_27' of git://github.com/nobelium/moodle into MOODLE_27_STABLE 2014-07-29 12:04:32 +01:00
AMOS bot 486ad6e842 Automatically generated installer lang files 2014-07-29 16:02:21 +08:00
Dan Poltawski 74980995b4 Merge branch 'wip-MDL-46338-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-07-29 08:50:37 +01:00
Marina Glancy 33c3193f06 Merge branch 'm27_MDL-46325' of git://github.com/totara/moodle into MOODLE_27_STABLE 2014-07-29 11:58:55 +08:00
Sam Hemelryk 95924516fa Merge branch 'MDL-43908-MOODLE_27_STABLE' of https://github.com/lucisgit/moodle into MOODLE_27_STABLE 2014-07-29 15:51:09 +12:00
Sam Hemelryk 1663aa1fb9 Merge branch 'MDL-45041_27_STABLE' of git://github.com/jleyva/moodle into MOODLE_27_STABLE 2014-07-29 15:47:22 +12:00
Sam Hemelryk 970536b659 Merge branch 'MDL-46460_27' of git://github.com/jleyva/moodle into MOODLE_27_STABLE 2014-07-29 15:44:34 +12:00
Marina Glancy b6fadf63d4 MDL-46338 enrol_self: Icon should indicate enrolment availability 2014-07-29 09:51:21 +08:00
Adam Olley f1213f3a75 MDL-46457 mod_lti: Render lti description through standard format_module_intro 2014-07-29 10:41:40 +09:30
Sam Hemelryk adac041f8c Merge branch 'MDL-45044-m27-master' of https://github.com/dthies/moodle into MOODLE_27_STABLE 2014-07-29 08:47:00 +12:00
Dan Poltawski acadd22a65 Merge branch 'MDL-46206-27' of git://github.com/jethac/moodle into MOODLE_27_STABLE 2014-07-28 17:25:05 +01:00
Dan Poltawski acafcb18f5 Merge branch 'MDL-45594_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-07-28 12:54:17 +01:00
Dan Poltawski 71f4cb812c Merge branch 'wip-MDL-46503-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-07-28 12:49:15 +01:00
Dan Poltawski b1f78408a5 Merge branch 'm27_MDL-45715' of https://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-07-28 12:47:32 +01:00
Dan Poltawski 1669cf37f0 Merge branch 'MDL-46459_27' of git://github.com/jleyva/moodle into MOODLE_27_STABLE 2014-07-28 11:59:03 +01:00
Dan Poltawski 71e7387f43 Merge branch 'MDL-46433-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-07-28 11:49:38 +01:00
Dan Poltawski 4eb9f7dd72 Merge branch 'MDL-46504_27' of git://github.com/dmonllao/moodle into MOODLE_27_STABLE 2014-07-28 10:56:43 +01:00
Nobelium 568e9560af MDL-46236 mod_scorm : Setting lauch options for scorm in popup 2014-07-28 06:41:40 +00:00
Sam Hemelryk dc7fe6acca Merge branch 'wip_MDL-46449_m27_loginblock' of https://github.com/skodak/moodle into MOODLE_27_STABLE 2014-07-28 13:25:19 +12:00
Sam Hemelryk 786a6227d0 Merge branch 'MDL-43390_27' of git://github.com/dmonllao/moodle into MOODLE_27_STABLE 2014-07-28 12:22:51 +12:00
Sam Hemelryk fd9ee7dd8b Merge branch 'wip-MDL-46525-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-07-28 12:13:53 +12:00
Sam Hemelryk 8ba664e245 Merge branch 'MDL-46506-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-07-28 08:46:11 +12:00
Juan Leyva b88a31a654 MDL-45041 Web Service: add_user_device doesn't store entries for different users using the same push key 2014-07-25 10:40:08 +02:00
Juan Leyva 76dc0848c1 MDL-46460 Web Services: Invalid check of grades visibility for missing grades 2014-07-25 10:20:44 +02:00
Juan Leyva c838cb15d8 MDL-46459 Web Services: Incorrect return parameters get_grades external function 2014-07-25 09:31:43 +02:00
Damyon Wiese 3b1fec6fb2 MDL-46485 Assign: Fix when submitting to a group assignment from the default group 2014-07-25 15:20:36 +08:00
Damyon Wiese 4939d0d71a MDL-46485 Assign: New unit test to show error with group submission 2014-07-25 15:20:36 +08:00
Marina Glancy d61604b455 MDL-46525 enrol_cohort: fix JS error 2014-07-25 14:45:22 +08:00
Jason Fowler ec085021f2 MDL-46206 Accessibility: Add aria role to footer image 2014-07-25 14:36:06 +08:00
Brian Barnes 4c6481694e MDL-46325 behat: Fixed issue where 'teacher1' didn't exist 2014-07-25 15:44:26 +12:00
AMOS bot fdeb6af76e Automatically generated installer lang files 2014-07-24 22:41:56 +00:00
Petr Skoda ee7af1e19d MDL-46449 fix username prompt in login block when authloginviaemail enabled 2014-07-25 10:10:54 +12:00
Tony Butler 7561f3d64a MDL-43908 mod_assign: Order submissions by course id then cm id
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-07-24 17:30:18 +01:00
Tony Butler a65c0da40d MDL-43908 mod_assign: Remove redundant code and improve SQL query
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-07-24 17:30:09 +01:00
Tony Butler 1e07291026 MDL-43908 mod_assign: Prevent notifications for unavailable assignments
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-07-24 17:29:59 +01:00
Tony Butler 1215c112c0 MDL-43908 mod_assign: Defer notifications for unavailable assignments
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-07-24 17:29:40 +01:00
Daniel Thies 0e37d94b67 MDL-45044 filter_tex: properly escape excutable pathnames for Windows 2014-07-24 11:05:00 -05:00
uhunkler 3264dcece0 MDL-46302 correct atto img float right
Correct the atto image "float right" margin CSS
2014-07-24 17:24:37 +02:00
Dan Poltawski cc1dc858c0 weekly release 2.7.1+ 2014-07-24 09:51:04 +01:00
Dan Poltawski 6ca7efb157 Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-07-24 09:51:01 +01:00
Damyon Wiese 72d49e8419 MDL-46506 Assign: fix php warning on grant extension page
This code was missed when the extensionduedate was moved to the userflags table.
2014-07-24 11:26:23 +08:00
David Monllao cd2f4a87a4 MDL-46504 libraries: Fixing typo 2014-07-24 11:16:44 +08:00
Damyon Wiese b8ba7f3619 MDL-46017 Assign: Restore can't rely allocated marker fields existing in backup 2014-07-24 10:57:26 +08:00
Marina Glancy aa8ae42d24 MDL-46503 behat: cohort generator allows to create cohort in category 2014-07-24 10:04:12 +08:00
Mark Nelson 1c7509bc86 MDL-45594 core_message: added unit tests 2014-07-23 16:40:25 -07:00
Mark Nelson 7ed94cbe9c MDL-45594 core_message: ordered recent notifications by timecreated 2014-07-23 16:40:25 -07:00
Tim Hunt 7c7d086ae1 MDL-45594 simplify message_get_recent_conversations SQL
I am pretty sure that this new SQL is logically equivalent to
the original, and it passes Mark's unit tests. However, it is
hard to be 100% sure.
2014-07-23 16:40:25 -07:00
AMOS bot 725ce55546 Automatically generated installer lang files 2014-07-23 22:46:16 +00:00
Simey Lameze 1f55a12bf8 MDL-46433 blog: fix error message when creating an external blog 2014-07-23 16:12:05 +08:00
Dan Poltawski ee0f0b3986 Revert "Merge branch 'MDL-45594_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE"
This reverts commit 0cc8a0b4b2, reversing
changes made to 6d32f6300e.
2014-07-23 09:02:02 +01:00
Dan Poltawski 92d4bcd9f7 Merge branch 'MDL-46017-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-07-23 08:24:26 +01:00
Dan Marsden e7215ce5b7 MDL-45715 assign: disable marking allocation if markingworkflow is not set. 2014-07-23 19:21:30 +12:00
Sam Hemelryk 6dc0b5482b MDL-45724 cache: fixed warning structure bug 2014-07-23 15:24:35 +12:00
AMOS bot 45d7ec6123 Automatically generated installer lang files 2014-07-22 22:49:11 +00:00
Dan Poltawski a7e348e937 Merge branch 'MDL-37509-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-07-22 15:56:58 +01:00
Dan Poltawski eba7490c31 Merge branch 'MDL-34248_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-07-22 12:01:04 +01:00
Dan Poltawski a4798ada52 Merge branch '45724-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-07-22 09:07:25 +01:00
Sam Hemelryk 0cc8a0b4b2 Merge branch 'MDL-45594_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-07-22 11:12:17 +12:00
Sam Hemelryk 6d32f6300e Merge branch 'MDL-43063-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-07-22 09:49:10 +12:00
Dan Poltawski 08348b8f86 Merge branch 'MDL-46386-27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-07-21 14:11:46 +01:00
Eric Merrill 519eec044c MDL-46386 question Whitelist the Atto editor from return blocking
Prevent the question engine from blocking return/enter key presses
from being sent to the Atto editor.
2014-07-21 09:08:52 -04:00
Dan Poltawski ab156686ff Merge branch '46335-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-07-21 09:59:06 +01:00
Dan Poltawski 1fc8ebf085 Merge branch 'MDL-46370_27' of https://github.com/moodlerooms/moodle into MOODLE_27_STABLE 2014-07-21 09:54:57 +01:00
Damyon Wiese 0086364857 MDL-46017 Assign: Fix restore of marking workflow data 2014-07-21 16:38:21 +08:00
Damyon Wiese 05cc5bf052 MDL-37509 Assign: Do not put description in calendar before it should be shown to students 2014-07-21 15:58:08 +08:00
Simey Lameze 8bd3dfd6f5 MDL-43063 core: fix phpdoc comment codechecker issue. 2014-07-21 10:14:12 +08:00
Julien Boulen 1c9e079b7c MDL-46206 Accessibility: Remove alt attribute for footer image 2014-07-21 08:21:06 +08:00
Sam Hemelryk 8b90e93c94 MDL-42909 course: fixed whitespace 2014-07-21 11:43:04 +12:00
Sam Hemelryk 94f0349745 Merge branch 'MDL-42909-27' of git://github.com/phalacee/moodle into MOODLE_27_STABLE 2014-07-21 11:35:54 +12:00
David Balch 50cc7daa0f MDL-40479 mod_assign: Fix the colour of grading success messages. 2014-07-21 11:33:04 +12:00
Brian Barnes 0a841ac85c MDL-46406 core_auth: Placed remember username before submit login form 2014-07-21 11:22:22 +12:00
Sam Hemelryk 28d6752d07 Merge branch 'mdl-46427-m27' of git://github.com/deraadt/moodle into MOODLE_27_STABLE 2014-07-21 11:12:11 +12:00
Willy Lee 1d0f235097 MDL-46159 course: Add search box to course management pages 2014-07-21 10:56:22 +12:00
Sam Hemelryk 93d7596d3f Merge branch 'MDL-45339-27' of git://github.com/xow/moodle into MOODLE_27_STABLE 2014-07-21 10:49:33 +12:00
Sam Hemelryk aa9f17df92 Merge branch 'm27_MDL-46363' of https://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-07-21 10:45:43 +12:00
Sam Hemelryk d251180b31 MDL-45724 cache: added cache API warnings to the admin notifications page 2014-07-21 09:48:54 +12:00
Sam Hemelryk 67a77fa36f MDL-45724 cache: admin screen now shows store warnings
Implemented a means by which cache store instance can communicate
warnings due to things such as conflicting configurations etc.
2014-07-21 09:39:15 +12:00
AMOS bot c3cf035fad Automatically generated installer lang files 2014-07-20 00:44:24 +00:00
AMOS bot 8a52ccea0c Automatically generated installer lang files 2014-07-19 00:41:49 +00:00
Michael de Raadt d35f49ba45 MDL-46427 Course: Correcting dimmed course link class on profile pages. 2014-07-18 15:43:05 +08:00
Jason Fowler 38748c6ada MDL-42909 Course: Fix title for move-targets 2014-07-18 14:43:10 +08:00
Mark Nelson 68fb3969e1 MDL-34248 core_backup: used API instead of inserting into the log table directly 2014-07-17 18:12:01 -07:00
Mark Nelson 527afcfb8c MDL-34248 core_backup: added missing end quotation 2014-07-17 18:12:00 -07:00
Jim Thorpe c62f8bc71f enrol_imsenterprise: MDL-46363 including course lib when create_course is
used
2014-07-18 11:27:15 +12:00
Sam Hemelryk d3c034f8e8 MDL-46335 backup: fixed casting issue with setting labels
The issue was that clean_param took an int and returned a string
and the result was used in an exact comparison.
The type change mean the comparison failed.
The solution was to ensure the param was cast as a string.
2014-07-18 08:29:53 +12:00
John Okely 5f399d0c52 MDL-45339 Libraries: Add a note to docblock of get_config, set_config, and unset_config to note they are used in lib/db/upgrade.php 2014-07-17 17:48:14 +08:00
Dan Poltawski a9e0505fde weekly release 2.7.1+ 2014-07-17 09:22:55 +01:00
Dan Poltawski 96d73266ef Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-07-17 09:22:51 +01:00
AMOS bot 66a0fea650 Automatically generated installer lang files 2014-07-17 00:52:51 +00:00
AMOS bot a4bba406ad Automatically generated installer lang files 2014-07-17 00:52:51 +00:00
Mark Nelson 20914ba26a MDL-45594 core_message: added unit tests 2014-07-16 17:06:39 -07:00
Mark Nelson 8b5520877b MDL-45594 core_message: ordered recent notifications by timecreated 2014-07-16 17:06:39 -07:00
Tim Hunt 7cacba3db3 MDL-45594 simplify message_get_recent_conversations SQL
I am pretty sure that this new SQL is logically equivalent to
the original, and it passes Mark's unit tests. However, it is
hard to be 100% sure.
2014-07-16 17:06:39 -07:00
Sam Chaffee f4c37747dc MDL-46370 Ajax and Javascript - Fixes docked blocks not expanding when using dock on right 2014-07-16 12:04:50 -06:00
Dan Poltawski 3e65f72a40 Revert "MDL-46226 core: pix_icon no longer sets title to the alt text"
This reverts commit 956ec418c6.
2014-07-16 13:45:35 +01:00
Dan Poltawski d613a0db57 Revert "MDL-46226 fix unit tests"
This reverts commit d927f222a9.
2014-07-16 13:45:32 +01:00
Rajesh Taneja 26f004f29b MDL-30431 behat: Fixed wiki behat 2014-07-16 09:18:51 +02:00
Eloy Lafuente (stronk7) 0ed87e5063 MDL-30431 mod_wiki: whitespace fix 2014-07-16 01:19:36 +02:00
Eloy Lafuente (stronk7) 87cc899c44 Merge branch 'MDL-30431_wiki_comments_27' of https://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-07-16 01:16:19 +02:00
AMOS bot e1661a6346 Automatically generated installer lang files 2014-07-15 00:46:33 +00:00
Eloy Lafuente (stronk7) 3ba2b5c925 Merge branch 'MDL-46080_27' of https://github.com/jonof/moodle into MOODLE_27_STABLE 2014-07-14 23:30:25 +02:00
Sam Hemelryk 7c5d28c26c Merge branch 'MDL-42179-003-27' of https://github.com/dbezborodovrp/moodle into MOODLE_27_STABLE 2014-07-15 08:41:31 +12:00
Eloy Lafuente (stronk7) 67711964d1 Merge branch 'm27_MDL-31366' of git://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-07-14 18:17:44 +02:00
Dan Poltawski bf394372d8 Merge branch 'MDL-42752-27' of git://github.com/phalacee/moodle into MOODLE_27_STABLE 2014-07-14 16:09:29 +01:00
Dan Poltawski d927f222a9 MDL-46226 fix unit tests 2014-07-14 15:49:20 +01:00
Dan Poltawski bbcbbcd130 Merge branch 'MDL-46218_disabled2_27' of https://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-07-14 15:33:13 +01:00
Eloy Lafuente (stronk7) cc0b20ba9d Merge branch 'm27_MDL-46197' of https://github.com/totara/moodle into MOODLE_27_STABLE 2014-07-14 16:25:21 +02:00
Dan Poltawski 8f15eebc22 Merge branch 'm27_MDL-46226' of https://github.com/totara/moodle into MOODLE_27_STABLE 2014-07-14 15:13:45 +01:00
Damien Bezborodov d8b6437fa9 MDL-42179 mod_assign: Time remaining issue for group assignment 2014-07-14 13:52:41 +09:30
David Monllao e257ad8372 MDL-43390 files: Only lock when locking is not prevented 2014-07-14 12:13:41 +08:00
Sam Hemelryk ba03dc18ad Merge branch 'MDL-42214_popup_blocked_27' of https://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-07-14 15:27:46 +12:00
Sam Hemelryk 7c15d3b34c Merge branch 'MDL-46073_27' of https://github.com/totara/openbadges into MOODLE_27_STABLE 2014-07-14 15:15:57 +12:00
Andrew Davis 1c76803ec1 MDL-42214 core_message:prevented popup notifications of messages from blocked users 2014-07-14 10:11:14 +08:00
Andrew Davis 5660ceba8d MDL-30431 mod_wiki: clarified the logic around editing and deleting wiki comments and added behat tests 2014-07-14 08:16:39 +08:00
Sam Hemelryk ae59c35eb9 Merge branch 'MDL-45765-moodle27' of https://github.com/StudiUM/moodle into MOODLE_27_STABLE 2014-07-14 12:09:50 +12:00
Sam Hemelryk 3c129829ce MDL-46138 post integratino phpdoc fixes 2014-07-14 10:50:42 +12:00
Sam Hemelryk 050720be90 Merge branch 'MDL-46138-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-07-14 10:40:37 +12:00
Sam Hemelryk 7573d5ff21 Merge branch 'wip-MDL-46280-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-07-14 10:32:42 +12:00
Gilles-Philippe Leblanc b3656b26be MDL-22469 auth_cas: CAS module : parameter authCAS=NOCAS not properly handled 2014-07-14 10:21:48 +12:00
Sam Hemelryk 804c22b8f1 Merge branch 'MDL-31089_27' of git://github.com/dmonllao/moodle into MOODLE_27_STABLE 2014-07-14 09:51:39 +12:00
Sam Hemelryk 8716b6c89f Merge branch 'MDL-45562-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-07-14 08:41:38 +12:00
Eloy Lafuente (stronk7) 8b3d19c2f5 Moodle release 2.7.1 2014-07-12 19:10:44 +02:00
David Monllao cf9ed67a4e MDL-31089 mod_forum: Filtering non-visible groups 2014-07-11 16:49:39 +08:00
Simey Lameze 417b6921d5 MDL-45562 blog: fixed issues when creating/editing an external blog. 2014-07-11 15:16:28 +08:00
Damyon Wiese f72a23d69b MDL-46138 tasks: The adhoc task is being too helpful with json_encoding/decoding. 2014-07-11 09:45:27 +08:00
Dan Marsden ca602b6beb MDL-31366 Feedback: decode htmlchars on output to excel 2014-07-11 13:28:59 +12:00
Brian Barnes 2b8647034a MDL-46197 core_calendar: Added label text to durations in minutes field 2014-07-11 09:09:10 +12:00
Brian Barnes 956ec418c6 MDL-46226 core: pix_icon no longer sets title to the alt text 2014-07-11 08:39:45 +12:00
Jean-Philippe Gaudreau 31d453f735 MDL-45765 Calendar import: Fix undefined variable in cron when updating calendar subscriptions 2014-07-10 16:09:04 -04:00
Eloy Lafuente (stronk7) b4d0a4479c weekly release 2.7+ 2014-07-10 19:15:41 +02:00
Eloy Lafuente (stronk7) 3e07b8a2f3 Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-07-10 19:15:37 +02:00
Ankit Agarwal 383776876b MDL-46148 qtype_calculated: low-level defence against bad formulas
This catches things like:
 * Malicious equations coming from backup files.
 * Malicious equations in old questions in the database.
2014-07-10 17:55:03 +08:00
Andrew Nicols 91c8d4da71 MDL-38990 mod_forum: Restrict ability to post to all groups in a forum
In order to post to all groups in a forum, you must have the
moodle/site:accessallgroups capability.

Thanks to Jakob Ackermann <jackermann@onlineschool.ca> for part of the fix
on this one.
2014-07-10 11:52:57 +08:00
Damyon Wiese 1721c8eb85 MDL-46148 questions: Added missing allow_commit for transaction 2014-07-10 11:36:57 +08:00
Andrew Davis ad3d9452bf MDL-46218 reshuffled access checks in blog and notes 2014-07-10 11:25:15 +08:00
Damyon Wiese c5f351435e Merge branch 'MDL-19270_moodle27stable' of https://github.com/nadavkav/moodle into MOODLE_27_STABLE
Conflicts:
	lib/graphlib.php
2014-07-10 09:58:44 +08:00
AMOS bot 03b06dedbc Automatically generated installer lang files 2014-07-10 00:47:09 +00:00
Tim Hunt da80885cc6 MDL-46148 qtype_calculatedsimple: fix notice
... when adding a dataset with a formula error.
2014-07-09 14:11:39 +01:00
Tim Hunt 94ac7a87fa MDL-46148 qtype_calculated: fix validation when importing.
In order to do this in a sane way, I cleaned up a lot of old mess,
inclduing:

1. Previously, qtype_calcuated used ->answeres when importing, and
->answer when saving the form. This was crazy, so I fixed it, and
stripped out the code that made the alternative variable name work.

2. Similarly, it could handle ->answer being either an array, such as
you would get form the HTML editor, or a simple string, which is what
you get form the form. I simplified that too.

3. Finally, I made import use a transaction around saving each
question, so we don't get half questions in the database when an error
occurs.
2014-07-09 14:11:38 +01:00
Tim Hunt 10b02d6d41 MDL-46148 qtype_calculated: removed unused method. 2014-07-09 14:11:38 +01:00
Nadav Kavalerchik ebb6f3e80b MDL-19270 - Quiz graph - Fix reverse display of Hebrew legend text in RTL mode 2014-07-09 16:07:56 +03:00
David Mudrák 7f4db6f4d9 MDL-46223 Fix frequently used comments in the marking guide
When the frequently used comment contains a character like >, re-use it
directly instead of its HTML entitiy.
2014-07-09 16:43:40 +08:00
David Mudrák 4fc5861cba MDL-46223 Improve the display of marking guide validation message 2014-07-09 16:43:37 +08:00
Dan Poltawski 40b205197c MDL-46227 fix typo 2014-07-09 08:23:14 +01:00
Dan Poltawski cb914a71aa MDL-44605 calendar: improved returnurl validation
Now we will only redirect to a local url (though sesskey was
already preventing this redirect from being open)
2014-07-09 01:06:35 +02:00
Eloy Lafuente (stronk7) 85f376892d Merge branch 'MDL-43849_27' of git://github.com/dmonllao/moodle into MOODLE_27_STABLE 2014-07-08 20:29:04 +02:00
Dan Poltawski e0708141f8 Merge branch 'MDL-45599-27-addons' of git://github.com/mudrd8mz/moodle into MOODLE_27_STABLE 2014-07-08 15:31:53 +01:00
Dan Poltawski 76b012d611 Merge branch 'MDL-44492_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-07-08 14:18:01 +01:00
Frederic Massart 53ca351f7a MDL-45471 javascript: Escape content of exception dialogs 2014-07-08 14:13:33 +01:00
Tim Hunt ea9f3057da MDL-44492 quiz: fix hilighting of graded attempt
In various places, when showing several attempts, we try to hilight the
most significant one (the one that gave the final grade if the quiz is
set to first/last/best attempt). That was not working because the table
zebra stripes were a more specific rule.

Also, the colour was inconsistent, not nice, and not very bootstrapy, so
I changed it.
2014-07-08 13:33:41 +01:00
Tim Hunt f1406d3b39 MDL-44492 quiz reports: revert some style overrides.
But add one more. This makes Clean theme look a lot better.
2014-07-08 13:33:38 +01:00
Tim Hunt 91251e4889 MDL-44492 Rough unit test for the report SQL.
We really ought to test more cases, but this hits one of the most tricky cases.
2014-07-08 13:33:36 +01:00
Tim Hunt 8994593332 MDL-44492 quiz reports: make show only graded attempt work.
It needs to only affect finished attempts, and the wording needs to be
modified to make it clear that is what it does.
2014-07-08 13:33:33 +01:00
Dan Poltawski 67b3704318 Merge branch 'MDL-45381_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-07-08 11:29:03 +01:00
Dan Poltawski 37e7d91b8c Merge branch 'MDL-45596-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-07-08 10:50:55 +01:00
Marina Glancy 3fe64cbd7d MDL-43948 forms: setting types to filemanager and editor elements 2014-07-08 10:47:35 +01:00
Dan Poltawski 22051a4e34 Merge branch 'MDL-46231-27-en_fix' of git://github.com/mudrd8mz/moodle into MOODLE_27_STABLE 2014-07-08 08:32:35 +01:00
Helen Foster e7cd680765 MDL-45599 Fix tiny grammatical errors in the plugin installer 2014-07-08 09:02:06 +02:00
Marina Glancy 84d2c6f761 Merge branch 'MDL-46229_27' of https://github.com/totara/openbadges into MOODLE_27_STABLE 2014-07-08 13:51:40 +08:00
Skylar Kelty f97581eda7 MDL-46227 Fix XSS in scheduled tasks 2014-07-08 13:38:01 +08:00
David Mudrák 2c0b608cda MDL-46223 Improve the marking guide output 2014-07-08 13:18:59 +08:00
David Mudrák eb1381de1d MDL-46223 Improve the rubric output 2014-07-08 13:18:58 +08:00
Marina Glancy c7bfbb01c6 MDL-46280 filter_activitynames: sort activities by length in reverse order 2014-07-08 10:55:25 +08:00
Sam Hemelryk 4eacb77012 Merge branch 'MDL-46016_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-07-08 14:28:02 +12:00
Sam Hemelryk 93835758f3 MDL-19270 core_text: added unit tests for strrev 2014-07-08 14:15:02 +12:00
Sam Hemelryk a238e7ed72 Merge branch 'MDL-19270_moodle27stable' of https://github.com/nadavkav/moodle into MOODLE_27_STABLE 2014-07-08 13:53:52 +12:00
Sam Hemelryk 98ac33bcb0 Merge branch 'MDL-46200-27' of git://github.com/danpoltawski/moodle into MOODLE_27_STABLE 2014-07-08 13:38:08 +12:00
Sam Hemelryk 0caa8c60d2 Merge branch 'mdl45982-moodle27' of https://github.com/tlock/moodle into MOODLE_27_STABLE 2014-07-08 13:26:58 +12:00
Sam Hemelryk 2dbdaedc3e Merge branch 'm27_MDL-46144' of https://github.com/totara/moodle into MOODLE_27_STABLE 2014-07-08 13:10:36 +12:00
Eloy Lafuente (stronk7) 30a264540b Merge branch '46208-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-07-08 02:13:44 +02:00
Sam Hemelryk 6d05bee940 Merge branch 'MDL-46212_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-07-08 10:45:01 +12:00
Sam Hemelryk 2535dfaf64 Merge branch 'MDL-46240-27' of git://github.com/danpoltawski/moodle into MOODLE_27_STABLE 2014-07-08 10:34:30 +12:00
Eloy Lafuente (stronk7) 35186e3725 Merge branch 'wip_MDL-45945_m27_mssqlcol' of https://github.com/skodak/moodle into MOODLE_27_STABLE 2014-07-08 00:32:09 +02:00
Sam Hemelryk bfe4417cb7 MDL-45678 cache: renamed new cache and better comments 2014-07-08 09:52:53 +12:00
Sam Hemelryk 6b6affec1f Merge branch 'MDL-45678-006-27' of https://github.com/dbezborodovrp/moodle into MOODLE_27_STABLE 2014-07-08 09:42:51 +12:00
Sam Hemelryk 9e13649c89 Merge branch 'wip_MDL-46126_m27_passnulls' of https://github.com/skodak/moodle into MOODLE_27_STABLE 2014-07-08 09:37:20 +12:00
Yuliya Bozhko 1465b22f7d MDL-46073 badges: Make sure html tags are not used in badge description
Signed-off-by: Yuliya Bozhko <yuliya.bozhko@totaralms.com>
2014-07-08 09:36:21 +12:00
Sam Hemelryk f549deed15 Merge branch 'MDL-43347-27' of https://github.com/mackensen/moodle into MOODLE_27_STABLE 2014-07-08 09:28:31 +12:00
Adrian Greeve ab59b7db71 MDL-46201 events: Sanitization of username before returning the description. 2014-07-07 18:19:11 +01:00
Yuliya Bozhko 200a2b7fad MDL-46042 badges: Clean up external badge data
Signed-off-by: Yuliya Bozhko <yuliya.bozhko@totaralms.com>
2014-07-07 16:37:44 +01:00
Dan Poltawski 9945bcec41 Merge branch 'MDL-42393-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-07-07 16:27:32 +01:00
Dan Poltawski b4ac5653ed Merge branch 'MDL-41389_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-07-07 16:10:26 +01:00
Osanda Malith Jayathissa 0207466e77 MDL-45683 user: Escaping Skype ID used in profile 2014-07-07 16:05:10 +01:00
Marina Glancy 2ca9e09dab MDL-45760 make sure to check permission before setting header 2014-07-07 15:06:40 +01:00
Tim Hunt 6eaf5ec8e3 MDL-46148 qtype_calculated: fix formula validation. 2014-07-07 14:34:02 +01:00
Frederic Massart 1d110af2d6 MDL-45417 mod_imscp: Prevent entity injections from package content 2014-07-07 13:03:05 +01:00
Frederic Massart 2d121036cc MDL-45463 mod_lti: Prevent XML entity injections from provider 2014-07-07 13:00:39 +01:00
Marina Glancy 61961447c2 MDL-45616 repositories: use json encoding instead of serialization 2014-07-07 15:17:42 +08:00
Marina Glancy 867f40990b MDL-45616 repositories: more clearly distinguish when we use source and when reference
Function repository::get_moodle_file() should always be called on packed reference and not on the source received from user.
Also added phpdocs to some other methods that were confusing source and reference
2014-07-07 15:17:42 +08:00
Jason Fowler da6ce47102 MDL-42752 File-picker: Fix tabbing to disabled icons 2014-07-07 14:30:17 +08:00
Dan Poltawski 78ba7d9e6b MDL-43848 messages: do not display message content in popups
The user is not in control of when these popups show up and it
may not be appropiate to have part of this content display whilst
in the presence of other users.
2014-07-07 13:46:35 +08:00
Nadav Kavalerchik 63010978b4 MDL-19270 - Quiz graph - Fix reverse display of Hebrew legend text in RTL mode 2014-07-06 19:00:23 +03:00
Helen Foster c5e9bc48f0 MDL-46231 Merge English strings from the en_fix language pack 2014-07-04 22:37:30 +02:00
Dan Poltawski cd90445d4a MDL-46200 fix missing space in failed login message 2014-07-04 14:55:43 +01:00
Dan Poltawski 0052796dbb MDL-46240 atto_collapse: fix icon url 2014-07-04 14:35:16 +01:00
David Mudrák b522356839 MDL-45599 Stop using the 'add-on' term
We now call them all as just 'plugins' for consistency. There where we need to
explicitly distinguish the source of the plugin, we say they are 'additional
plugins' on contrary to 'standards plugins' coming with the core.
2014-07-04 11:34:34 +02:00
David Mudrák 1d45b926f3 MDL-45599 Remove string editingnoncorelangfile from core_admin
This string mentions 'add-on' and has been greylisted in AMOS since 2.0. The
usage of it was removed in 00b41d.
2014-07-04 10:36:53 +02:00
Damien Bezborodov 0ba5f02b15 MDL-45678 assignsubmission_comments: Improve performance for permissions checking 2014-07-04 14:25:06 +09:30
Petr Skoda a31fdfb145 MDL-46126 upgrade: fix bogus nulls in user.password before changing precission
Note: there is no need to deal with Oracle empty strings here
because only MySQL running in non-strict mode is affected.
2014-07-04 16:29:40 +12:00
Frederic Massart d019ffd21f MDL-45596 roles: Escape filter value before using it in form field 2014-07-04 11:49:42 +08:00
Mark Nelson a93f8344ae MDL-41389 auth_db: added unit tests for events 2014-07-03 20:16:56 -07:00
Petr Skoda 2d7617aa18 MDL-45945 mssql: force default database collation in all tables including temp table 2014-07-04 15:05:24 +12:00
AMOS bot 84acc68175 Automatically generated installer lang files 2014-07-04 00:44:19 +00:00
Mark Nelson 38d8b7b703 MDL-46016 auth_shibboleth: updated misleading comment
Also generated a random string for the password field in case it is ever used.
2014-07-03 16:15:57 -07:00
Mark Nelson 69ddeb42e2 MDL-41389 auth_db: added user_updated/created event triggers 2014-07-03 14:28:44 -07:00
Sam Hemelryk 2bd9cd1077 MDL-46208 cachestore_mongo: fixed invalid collection name use 2014-07-04 08:11:24 +12:00
Tim Hunt 35588aa876 MDL-46212 question editing: extra answer fields notice.
It turns out that PHP does not interpret "$field[$key]" the way we were
expecting.
2014-07-03 13:40:38 +01:00
Dan Poltawski fc415ee908 weekly release 2.7+ 2014-07-03 10:53:27 +01:00
Dan Poltawski 10b4bda916 Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-07-03 10:53:24 +01:00
Marina Glancy 3708e1bb7c MDL-46163 question/quiz: fix elements ids and their labels 2014-07-03 10:13:23 +01:00
David Monllao e7e79055e1 MDL-43849 enrol_meta: Renaming methods according to what they test 2014-07-03 14:51:00 +08:00
David Monllao 3d4cf404df MDL-43849 mod_forum: Adding tests for observers 2014-07-03 14:50:52 +08:00
Frederic Massart 31c0efeac7 MDL-42393 calendar: Preventing open/close loop in events overlay 2014-07-03 10:17:41 +08:00
Yuliya Bozhko 3571cd46d2 MDL-46229 badges: Fix missing additional names fields
Signed-off-by: Yuliya Bozhko <yuliya.bozhko@totaralms.com>
2014-07-03 09:33:27 +12:00
Tim Hunt fa6db7b8c1 MDL-46163 quiz/questions: fix missing hidden fields.
I have done this by eliminating the duplication between the base class
and the subclass.

This was a regression introdcued by MDL-40313.
2014-07-02 15:04:56 +01:00
AMOS bot 947a90339a Automatically generated installer lang files 2014-07-02 00:44:40 +00:00
Eloy Lafuente (stronk7) dc30afaafc Merge branch 'wip-mdl-45889-m27' of https://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-07-02 00:36:26 +02:00
Eloy Lafuente (stronk7) 03a5278a38 Merge branch '45209-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-07-01 23:49:46 +02:00
Sam Hemelryk d683942c6a Merge branch 'wip-MDL-46147-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-07-02 09:31:25 +12:00
Mary Evans 24c0432bbc MDL-45507 theme_bootstrapbase: Fix regression for theme based custom menu
in renderers/core_renderer.php.
2014-07-02 09:22:43 +12:00
Eloy Lafuente (stronk7) c16de45a14 MDL-45961 user profile: track user on reset
It seems that redirect (after reset button) was also
missing the userid so the user track was lost.
2014-07-01 19:22:14 +02:00
Eloy Lafuente (stronk7) 9d19781014 Merge branch 'MDL-45961_MOODLE_27_STABLE' of https://github.com/NeillM/moodle into MOODLE_27_STABLE 2014-07-01 19:22:05 +02:00
Dan Poltawski ab6ae906cd Merge branch 'MDL-46063_27' of git://github.com/schach/moodle into MOODLE_27_STABLE 2014-07-01 17:29:16 +01:00
Dan Poltawski f45b59d427 Merge branch 'MDL-46036_survey_27' of https://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-07-01 16:34:29 +01:00
Charles Fulton 3add7d878f MDL-43347 grades: convert keep highest to text field 2014-07-01 07:34:23 -07:00
Charles Fulton c9bd902bd3 MDL-43347 grades: consistent interface for drop lowest setting 2014-07-01 07:34:11 -07:00
Dan Poltawski 366124d222 Merge branch 'MDL-46107_27' of https://github.com/totara/openbadges into MOODLE_27_STABLE 2014-07-01 14:20:53 +01:00
Dan Poltawski 89203e11a7 Merge branch 'MDL-4013-stable27' of https://github.com/MorrisR2/moodle into MOODLE_27_STABLE 2014-07-01 14:16:22 +01:00
Dan Poltawski dd83fbfbbc Merge branch 'wip_MDL-46099_m27_userglobal' of https://github.com/skodak/moodle into MOODLE_27_STABLE 2014-07-01 10:39:15 +01:00
Marina Glancy 1fb374121a MDL-46147 modinfo: performance improvement for course page (check filterall) 2014-07-01 15:30:28 +08:00
Damyon Wiese f3163a2002 MDL-46147 modinfo: performance improvement for course page
This is a big win in a specific situation, ie filters enabled for content+headings,
and no activity descriptions visible on the course page.
2014-07-01 15:30:22 +08:00
Mark Nelson 65764352dd MDL-45381 mod_forum: updated unit tests for subscription created/deleted events 2014-06-30 23:35:37 -07:00
Mark Nelson 2c7b800f2f MDL-45381 mod_forum: changed event URL for subscription created/deleted events 2014-06-30 23:35:36 -07:00
Brian Barnes ed7d676329 MDL-46144 core_calendar:Fixed label linking in calendar 2014-07-01 13:44:56 +12:00
Sam Hemelryk b23bc0a148 Merge branch 'MDL-40805-27' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-07-01 09:06:20 +12:00
Petr Skoda df9a669791 MDL-46099 session: fix use of references for session globals
This reverses the references used for global $USER and $SESSION,
the reason is that PHP does not allow references to references.
$USER is a reference to $GLOBALS['USER'] which means we cannot
put any references to it. Solution is to store the current user and session
objects in $GLOBALS['USER'] and $GLOBALS['SESSIOn'] are reference
them in $_SESSION.

This patch makes the session code behave the same way in CLI,
phpunit and normal web requests - this allows use to finally
unit test most aspects of the session code in Moodle.
2014-07-01 08:38:10 +12:00
Sam Hemelryk b1ab535efa Merge branch 'MDL-46118_27' of git://github.com/dmonllao/moodle into MOODLE_27_STABLE 2014-07-01 08:33:16 +12:00
Dan Poltawski 1e9dce0df4 Merge branch 'wip-mdl-45641-m27' of https://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-06-30 15:26:34 +01:00
Dan Poltawski 8dd0756226 Merge branch 'MDL-42467_database_27' of https://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-06-30 15:09:53 +01:00
Dan Poltawski 8458e3d2c2 Merge branch 'MDL-45833_27' of git://github.com/dmonllao/moodle into MOODLE_27_STABLE 2014-06-30 13:27:16 +01:00
Dan Poltawski 951a64f6ef Merge branch 'MDL-46044-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-06-30 11:45:29 +01:00
Heiko Schach b336cf98b4 MDL-46063 feedback: Fix user pictures 2014-06-30 13:27:39 +03:00
Dan Poltawski b6ac868d71 Merge branch 'MDL-40228-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-30 08:55:39 +01:00
AMOS bot 57ce05c631 Automatically generated installer lang files 2014-06-29 00:42:51 +00:00
Ray Morris f0538cee92 MDL-4013 Question bank: Category selector renders as nested form (invalid html) 2014-06-27 10:00:11 -05:00
NeillM f4f4965a1c MDL-45961 Customise this page button on user profile page only works correctly for users own profile 2014-06-27 09:05:49 +01:00
Rajesh Taneja 93a593daab MDL-45641 event: Ldap user_signup unit test added 2014-06-27 15:43:49 +08:00
Rajesh Taneja c8c1a2cb10 MDL-45641 event: Manually trigger event where needed.
Some places, user_created_user and user_updated_user
events should be triggred after profile data is saved.
2014-06-27 15:43:49 +08:00
Rajesh Taneja 793ab11d95 MDL-45641 event: Removed multiple user_updated event trigger
user_updated event was being triggred while
setting password, which is not correct. It now
trigger user_password_updated event. Few more
modifications done:
1. Correct event is being triggred.
2. Event is only triggred when password is chnaged.
3. Password is updated via single api.
4. Updated unit test
2014-06-27 15:43:49 +08:00
Rajesh Taneja 47221d5fdd MDL-45641 event: Option to trigger user event manually
On some pages full user data is not stored before user_created/
user_updated event is triggred. So giving option to trigger that
manually, so it can be triggred after all data is saved
2014-06-27 15:43:49 +08:00
Damyon Wiese 1affa3ea22 MDL-46044 Assign: Add conditions to the inner query for performance 2014-06-27 15:01:17 +08:00
Damyon Wiese 70971d43eb MDL-46044 Assign: Modify myhome query to only use the maxattempt from the submission
Using mismatches from the submissions/grades tables does not make much sense, we
should always only consider only the maxattempt from the submissions table.
2014-06-27 14:23:17 +08:00
Damyon Wiese 99e0bb23bf MDL-46044 Assign: Move common setup to setUp method (share it for all of lib_test.php) 2014-06-27 14:18:10 +08:00
Damyon Wiese d95453d903 MDL-46044 Assign: Fix print_overview function when there are multiple attempts 2014-06-27 14:17:53 +08:00
Damyon Wiese 53fb01aef0 MDL-46044 Assign: Update unit test to test multiple attempts on overview page 2014-06-27 14:17:44 +08:00
David Monllao cfd5ba4101 MDL-46118 report_log: No results limit when downloading 2014-06-27 11:35:06 +08:00
David Monllao 5eb386fd09 MDL-45833 event: Removing courseid as the context is higher than course context 2014-06-27 11:25:07 +08:00
Yuliya Bozhko 594848bb15 MDL-46107 badges: Fix badges navigation and remove empty breadcrumbs on pages using Clean
Signed-off-by: Yuliya Bozhko <yuliya.bozhko@totaralms.com>
2014-06-27 12:48:01 +12:00
Sam Hemelryk 64fea720ce MDL-45209 course: fixed navbar when creating,editing courses 2014-06-27 09:39:45 +12:00
Eloy Lafuente (stronk7) 83d08fcc21 weekly release 2.7+ 2014-06-26 10:35:58 +02:00
Eloy Lafuente (stronk7) 01e7204646 Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-06-26 10:35:54 +02:00
Eloy Lafuente (stronk7) 3152864fd5 Revert " MDL-45044 filter_tex: properly escape excutable pathnames for Windows"
This reverts commit 7eac026a02.
2014-06-26 10:05:49 +02:00
Rajesh Taneja 2997bd6dce MDL-45889 behat: Allow admin config to set by shortname 2014-06-26 13:18:32 +08:00
Andrew Davis 083d5a6f0c MDL-46036 mod_survey: added logic to prevent user trying to download when there are no results 2014-06-26 11:18:29 +08:00
Rajesh Taneja c1ee80fef5 MDL-46061 behat: Fixed blur event problem for atto_image
atto_image look for blur event after changing width/height
Added a new step to get focus off the element, so this can
work.
2014-06-26 10:29:35 +08:00
Andrew Davis 0a9815d14e MDL-42467 mod_data: added code to delete cached RSS feeds when database or glossary entries are deleted 2014-06-26 09:30:18 +08:00
Damyon Wiese 3ac5a3544c MDL-45983 Atto equation editor: Exclude phantomjs from this behat test because it's buggy 2014-06-25 15:05:01 +08:00
Jonathon Fowler b7cb9c60c1 MDL-46080 assign: fix offline grading worksheet marker column 2014-06-25 12:23:34 +10:00
AMOS bot 6f5ca6613f Automatically generated installer lang files 2014-06-25 00:45:27 +00:00
AMOS bot a16755314a Automatically generated installer lang files 2014-06-25 00:45:27 +00:00
Eloy Lafuente (stronk7) a4919abf4f Merge branch 'MDL-46079-m27' of https://github.com/sammarshallou/moodle into MOODLE_27_STABLE 2014-06-25 01:33:37 +02:00
Eloy Lafuente (stronk7) 022a58af8d Merge branch 'MDL-45445_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-25 00:47:43 +02:00
Eloy Lafuente (stronk7) 6480ec0c48 Merge branch 'MDL-41258-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE 2014-06-24 20:10:48 +02:00
Damyon Wiese 1e4e4a05d7 Merge branch 'MDL-45652_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-24 16:59:42 +08:00
Damyon Wiese 9dc9608795 Merge branch 'MDL-10115-27' of git://github.com/xow/moodle into MOODLE_27_STABLE 2014-06-24 16:03:53 +08:00
John Okely e08d290469 MDL-10115 User profile: Use title to aid in the ellipsis link being understood by screen readers 2014-06-24 15:38:58 +08:00
Marina Glancy 80bb90c3ca Merge branch 'MDL-45933-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-06-24 13:52:42 +08:00
Marina Glancy a3ddcab336 Merge branch 'MDL-45983-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-06-24 13:52:14 +08:00
Marina Glancy a839769c23 Merge branch 'MDL-46061-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-24 13:32:25 +08:00
Marina Glancy 1eb503b379 Merge branch 'MDL-45044-m27-master' of git://github.com/dthies/moodle into MOODLE_27_STABLE 2014-06-24 13:29:06 +08:00
Damyon Wiese cc5f8bd53f Merge branch 'wip-MDL-46038-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-06-24 13:10:52 +08:00
Damyon Wiese bb512f7c1f Merge branch 'MDL-46035_survey_27' of https://github.com/andyjdavis/moodle into MOODLE_27_STABLE 2014-06-24 13:08:17 +08:00
Damyon Wiese 5b5a73019d Merge branch 'MDL-46046-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-24 11:48:02 +08:00
Damyon Wiese ce0b9bb7ca Merge branch 'MDL-46056-27' of git://github.com/mudrd8mz/moodle into MOODLE_27_STABLE 2014-06-24 11:35:21 +08:00
Damyon Wiese 38063e7d1b Merge branch 'MDL-44512-27' of git://github.com/jethac/moodle into MOODLE_27_STABLE 2014-06-24 10:58:17 +08:00
Damyon Wiese ee5b9e137d Merge branch 'MDL-44773-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-24 10:19:16 +08:00
Eloy Lafuente (stronk7) 55103810f0 Merge branch 'MDL-45721_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-24 01:00:10 +02:00
Eloy Lafuente (stronk7) e5b111f26b Merge branch 'MDL-39883-27' of git://github.com/ankitagarwal/moodle into MOODLE_27_STABLE 2014-06-24 00:48:56 +02:00
Eloy Lafuente (stronk7) 7c2e2133cc Merge branch 'MDL-45764_generalTool_27' of https://github.com/moodlerooms/moodle into MOODLE_27_STABLE 2014-06-24 00:03:34 +02:00
Damyon Wiese 3352ffcfa2 Merge branch 'MDL-45580-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-23 15:20:14 +08:00
Simey Lameze 8e74bfa8e8 MDL-40805 auth_cas : Trigger user_loggedout event before CAS logout. 2014-06-23 15:19:07 +08:00
Frederic Massart 9f630b6cc4 MDL-45580 assignfeedback_editpdf: Save readonly version in backup 2014-06-23 14:56:08 +08:00
Frederic Massart c2779c9f29 MDL-45580 assignfeedback_editpdf: Delete draft content on new submission 2014-06-23 14:56:08 +08:00
Frederic Massart 7fecbba80b MDL-45580 assignfeedback_editpdf: Store a readonly version of the PDF 2014-06-23 14:56:08 +08:00
Damyon Wiese 80b81e5094 Merge branch '37145-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-06-23 14:39:56 +08:00
Damyon Wiese 6e977fcdd6 Merge branch 'MDL-38693-27' of git://github.com/jethac/moodle into MOODLE_27_STABLE 2014-06-23 14:15:36 +08:00
Damyon Wiese 9c8c5f2d01 MDL-41746 External api: Allow multiple calls to validate_context at different levels
(Only from webservices)
2014-06-23 13:39:21 +08:00
Damyon Wiese 9134f3f0df Merge branch 'MDL-35453_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-06-23 12:30:41 +08:00
Damyon Wiese b093752289 Merge branch 'MDL-46086_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-06-23 12:26:31 +08:00
Mark Nielsen bd87c3e225 MDL-46013 theme: Uninstall theme unconditionally unsets configs 2014-06-23 11:34:59 +08:00
Marina Glancy 7bea1ea240 Merge branch 'MDL-44124-27' of git://github.com/ankitagarwal/moodle into MOODLE_27_STABLE 2014-06-23 11:34:10 +08:00
Sam Hemelryk afd6e7d542 MDL-37145 caching: noted recommendation for dedicated memcache servers
Several reports have been made about the unexpected purging of entire
memcached servers when MUC is configured to use Memcache and caches
get purged.
This is expected and occurs because the memcache extenions don't
provide isolated containers. Moodle data is stored along side any other
data in the cache and when caches get purged all data gets removed
whether it belongs to Moodle or not.

The docs cover this point and here I've added notes about this to both
config-dist.php and cache/README.md
2014-06-23 11:01:51 +12:00
AMOS bot e29eef4bde Automatically generated installer lang files 2014-06-21 00:43:37 +00:00
Tim Hunt 63dd180030 MDL-46086 quiz: fix unit test on Oracle 2014-06-20 22:29:28 +01:00
Tim Hunt 8eacbd5a32 MDL-35453 quiz reports: don't order by id.
We were using ORDER BY id even though there was a perfectly good
attempt column to order the attempts by one user at one quiz.

Also, Oracle was complaining:
Debug info: ORA-01799: a column may not be outer-joined to a subquery
2014-06-20 16:55:35 +01:00
sam marshall 680ff52414 MDL-46079 Restore: Can run out of memory in get_records call 2014-06-20 14:14:53 +01:00
Frederic Massart 884e310a3b MDL-40228 backup: Settings were ignored during automated backups 2014-06-20 15:38:29 +08:00
Daniel Thies 7eac026a02 MDL-45044 filter_tex: properly escape excutable pathnames for Windows 2014-06-19 21:34:10 -05:00
Andrew Davis deaddfb6b8 MDL-46035 mod_survey: a string change to make an error message always correct 2014-06-20 09:17:47 +08:00
Frederic Massart 85b40b18d5 MDL-46061 atto_image: Improved tests to cover sizing feature 2014-06-19 16:00:47 +08:00
Frederic Massart 3b6987cea3 MDL-46061 atto_image: Prevent error when image does not have a size 2014-06-19 16:00:47 +08:00
Jetha Chan 14ff3d59b3 MDL-44512 themes: fix for custom menu submenu arrows on RTL languages 2014-06-19 15:16:52 +08:00
Damyon Wiese dd02a787d8 weekly release 2.7+ 2014-06-19 14:13:25 +08:00
Damyon Wiese cefe7c7f59 Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-06-19 14:13:20 +08:00
Frederic Massart d9fc73dc7a MDL-44773 atto_accessibilitychecker: Improved image test coverage 2014-06-19 13:38:36 +08:00
Frederic Massart 3bc1e345ca MDL-44773 atto_accessibilitychecker: Set focus on clicked warnings 2014-06-19 13:38:35 +08:00
AMOS bot 5d3fe21ab2 Automatically generated installer lang files 2014-06-19 00:42:51 +00:00
David Mudrák 17db3e8af1 MDL-46056 Remove invalid string definition from the workshop module
The correct version of the string is defined above.
2014-06-19 00:33:24 +02:00
Frederic Massart a0da864ac2 MDL-46046 atto_accessibilityhelper: Remove dead code from the plugin 2014-06-18 16:52:48 +08:00
Ankit Agarwal 0978aab839 MDL-39883 events: Trigger a module created event when duplicating a module 2014-06-18 16:02:23 +08:00
Ankit Agarwal 7d947ad66c MDL-39883 events: Create a new api create_from_cm for module create event 2014-06-18 15:46:26 +08:00
Damyon Wiese 5e63c8e57e MDL-45933 Assign: Prevent fatal error when there are no users in the grading table 2014-06-18 15:17:36 +08:00
Ankit Agarwal 34bcea8159 MDL-44124 libraries: Allow rrules with only one part during rrule validation checks 2014-06-18 14:14:49 +08:00
Marina Glancy 2a56e3c8b9 MDL-46038 repositories: added forgotten global 2014-06-18 13:39:43 +08:00
Mark Nelson 1fb1c6d456 MDL-45652 core_backup: display warning on restore destination form when necessary data is missing 2014-06-17 21:56:21 -07:00
Mark Nelson 469e7dd82d MDL-45721 core_backup: only trigger the course_restored event when restoring a course 2014-06-17 19:38:30 -07:00
AMOS bot 1461f9d664 Automatically generated installer lang files 2014-06-18 00:42:28 +00:00
Eloy Lafuente (stronk7) 8791525d88 Merge branch 'MDL-45978_27' of git://github.com/grabs/moodle into MOODLE_27_STABLE 2014-06-17 11:54:50 +02:00
Andrew Nicols a0f39f2b57 MDL-41258 Forum: Add additional unit tests for forum digest settings 2014-06-17 16:07:59 +08:00
Damyon Wiese 6fc2264a8a MDL-45983 Atto equation editor: Various bugs when editing an existing equation
(And a behat test for it).
2014-06-17 15:21:20 +08:00
Andreas Grabs 8893b111c2 MDL-45978 logging - added missing parameter id 2014-06-17 07:05:58 +02:00
Damyon Wiese 3362673173 MDL-45582 Editpdf: Prevent debugging when there is no pdf 2014-06-17 10:19:55 +08:00
Damyon Wiese 49703ecf1d Merge branch 'm27_MDL-45582' of git://github.com/greg-or/moodle-mod_assign into MOODLE_27_STABLE
Conflicts:
	mod/assign/feedback/editpdf/locallib.php
2014-06-17 10:17:55 +08:00
Eloy Lafuente (stronk7) d56f3531b4 Merge branch 'MDL-45970_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-06-17 01:15:47 +02:00
Eloy Lafuente (stronk7) 902a36137a Merge branch 'MDL-45611-27' of git://github.com/phalacee/moodle into MOODLE_27_STABLE
Conflicts:
	theme/bootstrapbase/style/moodle.css
2014-06-17 01:12:02 +02:00
Eloy Lafuente (stronk7) 19e4d5ada8 Merge branch 'wip-mdl-45719-m27' of https://github.com/deraadt/moodle into MOODLE_27_STABLE 2014-06-17 01:03:58 +02:00
Eloy Lafuente (stronk7) d81917322f Merge branch 'MDL-45870-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-17 00:51:33 +02:00
Marina Glancy b657f6db05 Merge branch 'MDL-45940-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-06-16 17:28:30 +08:00
Marina Glancy abd980d36d Merge branch 'MDL-45901_Quiz_MOODLE-27-STABLE' of git://github.com/nadavkav/moodle into MOODLE_27_STABLE 2014-06-16 17:27:40 +08:00
Rajneel Totaram 7b27045680 MDL-45967 admin lang: Fix typo 2014-06-16 17:26:50 +08:00
Marina Glancy e4a56bd9dd Merge branch 'MDL-43274-27' of git://github.com/xow/moodle into MOODLE_27_STABLE 2014-06-16 17:24:10 +08:00
Jonathon Fowler 5807b224d9 MDL-42531 assign: refactor batch operations to use forms properly
Avoids a lot of ugly optional_param() use. Also fixes the
non-functional cancel buttons.
2014-06-16 16:43:54 +08:00
Gregory Faller 8b1596c257 MDL-45582: Apply grades and feedback to entire group does not work with Annotate PDF feature 2014-06-16 18:06:09 +09:30
John Okely 2649eefe1c MDL-43274 Course: Remove message about course logs from upgrade.txt 2014-06-16 16:23:51 +08:00
Damyon Wiese b3bb3a4422 MDL-45940 Assign: Improved access check
Call can_edit() instead of repeating a (slightly wrong) access check.
2014-06-16 16:20:34 +08:00
Damyon Wiese 6e10f195c5 Merge branch 'm27_MDL-45582' of git://github.com/greg-or/moodle-mod_assign into MOODLE_27_STABLE 2014-06-16 14:29:51 +08:00
Daniel Neis ab7c329acf MDL-35648 adding missing distinct selector in sql on participation report 2014-06-16 14:22:46 +08:00
Marina Glancy 95d39aabc7 Merge branch 'MDL-45935-27' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE 2014-06-16 14:22:42 +08:00
John Okely 6e515be94f MDL-10115 User profile: Use moodle_url and html_writer::link for course links on user profiles 2014-06-16 14:08:44 +08:00
Damyon Wiese b3b4f9a4a4 Merge branch 'MDL-31998_27' of git://github.com/grabs/moodle into MOODLE_27_STABLE 2014-06-16 12:07:40 +08:00
Gregory Faller c71d8267ed MDL-45582: Apply grades and feedback to entire group does not work with Annotate PDF feature 2014-06-16 12:44:23 +09:30
Damyon Wiese 1742e76777 Merge branch 'wip-mdl-46001-m27' of https://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-06-16 11:13:45 +08:00
Rajesh Taneja 2797fcc75e MDL-46001 atto_clear: modfied behat test to work on xvfb 2014-06-16 11:10:29 +08:00
Damyon Wiese 2538e2dab1 Merge branch 'MDL-45803_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-16 11:01:04 +08:00
John Okely 6bf5eeed56 MDL-43274 Course: Remove ability to delete logs on a course during reset 2014-06-16 09:54:20 +08:00
AMOS bot c14d87daaa Automatically generated installer lang files 2014-06-15 00:42:44 +00:00
Nadav Kavalerchik cb201e866b MDL-45901 - Quiz - Random question category question are not visible, in RTL mode 2014-06-14 00:42:30 +03:00
Mark Nelson cc6a8bc792 MDL-45445 events: added '(optional)' to event params where applicable 2014-06-12 20:47:21 -07:00
Mark Nelson fa71841e9d MDL-45445 events: documented the additional validation 2014-06-12 20:47:21 -07:00
Mark Nelson be7809f5fd MDL-45445 events: added missing 'other' validation 2014-06-12 20:47:20 -07:00
Mark Nelson 655cdde2dc MDL-45445 events: added missing 'relateduserid' validation 2014-06-12 20:47:20 -07:00
Mark Nelson 7f75f1507e MDL-45445 events: trivial changes 2014-06-12 20:47:20 -07:00
Jason Fowler 3fbf089303 MDL-45611 Questions: Fixing the layout of the 'points box' 2014-06-13 10:24:20 +08:00
Tim Lock 8a453265d2 MDL-45982: Implement displaying of non error messages from a provider. 2014-06-13 10:13:57 +09:30
AMOS bot 807d45073a Merge branch 'MOODLE_27_STABLE' into install_27_STABLE 2014-06-13 00:41:59 +00:00
Andreas Grabs 253bbbb668 MDL-31998 mod_feedback - Feedback depend questions bug 2014-06-13 01:44:59 +02:00
Tim Hunt 8fbc1919df MDL-45970 quiz editing: fix display of random questions.
The pass by reference meant the function was clobbering the variable in
the calling function. Once that was change, it was not strictly
necessary to rename the variable in the function, but I did anyway for
clarity.

Thanks to Rajesh Taneja for finding the problem, and identifying which
bit of code was broken. I really just made the patch.
2014-06-12 19:43:42 +01:00
Eloy Lafuente (stronk7) c41ace2f7a weekly release 2.7+ 2014-06-12 18:59:06 +02:00
Eloy Lafuente (stronk7) 3be351cabc Merge branch 'MDL-44871-27' of git://github.com/damyon/moodle into MOODLE_27_STABLE 2014-06-12 11:38:37 +02:00
Damyon Wiese 53bd21e7d8 MDL-42835 Scorm: Fix for JS error because no nodes are selected in the toc. 2014-06-12 10:00:56 +02:00
John Okely 217530dfca MDL-10115 User profile: Allow full list of courses to be viewed on a user's profile 2014-06-12 15:03:27 +08:00
Rajesh Taneja 30271d87aa MDL-45808 enrol_self: Fixed behat to observe the group key policy 2014-06-12 14:20:37 +08:00
Damyon Wiese f271df32ec MDL-44871 Atto: Add missing tags to behat tests @editor and @editor_atto 2014-06-12 11:15:17 +08:00
Rajesh Taneja 77ae35faba MDL-44871 behat: Hack to make equation editor visible 2014-06-12 11:11:17 +08:00
Damyon Wiese 32d746479b MDL-44871 Atto behat: Use one less page load to get to profile edit page 2014-06-12 11:11:17 +08:00
Damyon Wiese b18fd23232 MDL-44871 Atto: Move custom select text step to atto specific step definition. 2014-06-12 11:11:17 +08:00
Damyon Wiese bbd644ea34 MDL-44871 Atto behat tests: Modified the tests to work around focus bugs with workspaces
The main changes here are that the "select the text in" step was modified to select only the
first text node in the editor field, and to focus on it's parent instead of the entire editable div.

Some tests had to be modified to match the new behaviour, and another "real" bug was found in the table plugin.
2014-06-12 11:11:17 +08:00
Damyon Wiese c4bfba91c2 MDL-44871 Behat: Add tests for Atto functionalities (some of them) 2014-06-12 11:11:17 +08:00
AMOS bot 6e7a7aecf3 Automatically generated installer lang files 2014-06-12 00:43:36 +00:00
Mark Nelson 635493f6dd MDL-45803 mod_quiz: removed the quiz_fire_attempt_started function
Also commented in mod/quiz/upgrade.txt to inform developers.
2014-06-11 13:57:24 -07:00
Mark Nelson 0f583e0c91 MDL-45803 mod_quiz: removed usage of the function quiz_fire_attempt_started_event 2014-06-11 13:57:24 -07:00
Mark Nelson 1a7ded8989 MDL-45803 mod_quiz: prevented the attempt_started event from being triggered twice 2014-06-11 13:57:23 -07:00
Mark Nelson 159e18c977 MDL-45803 mod_quiz: added attempt snapshot for the attempt and preview started events 2014-06-11 13:57:23 -07:00
Damyon Wiese 801dea3298 MDL-45763 Question types: Allow saving '0' as question text. 2014-06-11 17:29:26 +08:00
Marina Glancy d468b949f1 MDL-39726 backup: fix SQL syntax for Oracle 2014-06-11 17:16:40 +08:00
Marina Glancy a0881872c7 MDL-39726 backup: fix SQL syntax for Oracle 2014-06-11 12:17:25 +08:00
Marina Glancy a9e9cd31e1 MDL-45763 question: fix SQL syntax for Oracle 2014-06-11 12:17:25 +08:00
Frederic Massart 0085d95576 MDL-45870 mod_assign: Behat test covering some outcome usage 2014-06-11 10:34:44 +08:00
Frederic Massart e4226ddc26 MDL-45870 mod_assign: Outcomes are saved for each group member 2014-06-11 10:34:44 +08:00
Eloy Lafuente (stronk7) 4c7169437b Merge branch 'm27_MDL-29708_Typo_Extra_Slashes' of https://github.com/scara/moodle into MOODLE_27_STABLE 2014-06-11 01:36:56 +02:00
Frederic Massart b2cdd35a46 MDL-45808 group: Observe the group key policy upon group creation 2014-06-10 23:02:58 +02:00
Eloy Lafuente (stronk7) aa0fad65e3 Merge branch 'MDL-45579-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-10 22:25:54 +02:00
Eloy Lafuente (stronk7) 4c06cef684 Merge branch 'MDL-45418_27' of git://github.com/stronk7/moodle into MOODLE_27_STABLE 2014-06-10 20:13:28 +02:00
Barbara Ramiro 6871df272d MDL-45943: Replacement for publisher icons 2014-06-10 19:31:22 +02:00
Jason Fowler 40a4427420 MDL-45418 Files: Adding upgrade steps for publisher docs
Conflicts:
	lib/db/upgrade.php
	version.php
2014-06-10 19:31:04 +02:00
James McLean f76b5133a5 MDL-45418 Files: Adding publisher docs to Filetypes 2014-06-10 19:27:46 +02:00
Eric Merrill d5a7b7873e MDL-45763 question: Correct random question text if set to true or false 2014-06-10 20:08:25 +08:00
Marina Glancy ffa71ca45e Merge branch 'MDL-45813-scheduled_task_27' of git://github.com/mudrd8mz/moodle into MOODLE_27_STABLE 2014-06-10 15:42:56 +08:00
Marina Glancy 5248eb8831 Merge branch 'MDL-20154-27' of git://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-06-10 15:42:13 +08:00
Damyon Wiese 5468d02e60 Merge branch '45524-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-06-10 15:31:00 +08:00
Marina Glancy 251fd097bb Merge branch '27STABLE-wip-MDL45846' of git://github.com/jennymgray/moodle into MOODLE_27_STABLE 2014-06-10 14:20:02 +08:00
Daniel Neis Araujo 3ac721e5a3 MDL-45245 html_writer::select_time does not respect 5th parameter "attributes" 2014-06-10 14:19:29 +08:00
Damyon Wiese ecd99dc88a Merge branch 'wip-mdl-44309-m27' of https://github.com/deraadt/moodle into MOODLE_27_STABLE 2014-06-10 14:08:03 +08:00
Damyon Wiese 3097fca71c Merge branch 'MDL-45761-27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-06-10 14:00:58 +08:00
Damyon Wiese bc1c896692 Merge branch 'MDL-45767_returnInstanceid_27' of https://github.com/moodlerooms/moodle into MOODLE_27_STABLE 2014-06-10 13:53:43 +08:00
Damyon Wiese 6a927661f2 Merge branch 'MDL-45763-27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-06-10 13:12:07 +08:00
Andrew Nicols 601d32ae66 MDL-45935 tests: Specify step names during backup/restore tests 2014-06-10 12:14:09 +08:00
Michael de Raadt 2dde0b96da MDL-45719 mod_lti - Pass language strings to inline JS to allow for escaping 2014-06-10 11:39:12 +08:00
Eloy Lafuente (stronk7) d420bf952f Merge branch 'MDL-45789_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-10 01:17:00 +02:00
Eloy Lafuente (stronk7) a02d7831b6 Merge branch 'MDL-45804_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-10 01:14:29 +02:00
Jetha Chan 604db7d557 MDL-42782 usability: fix for extreme course page indenting 2014-06-10 01:10:31 +02:00
Nobelium 41ab96e7ff MDL-42835 mod_scorm: Close tree nodes using TreeView API 2014-06-10 00:37:16 +02:00
Eloy Lafuente (stronk7) 9dfb59fa28 Merge branch 'MDL-45574-m27' of https://github.com/sammarshallou/moodle into MOODLE_27_STABLE 2014-06-09 21:49:18 +02:00
Eloy Lafuente (stronk7) ad94e63238 Merge branch 'wip-MDL-44501-27' of git://github.com/abgreeve/moodle into MOODLE_27_STABLE 2014-06-09 18:59:22 +02:00
Jenny Gray 82c0485aab MDL-45846 Libraries custom user agent device detection unit test added 2014-06-09 13:59:10 +01:00
Eloy Lafuente (stronk7) 4524454ff2 Merge branch 'wip-mdl-45769-m27' of https://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-06-09 13:25:17 +02:00
Andrew Nicols 658bba713a MDL-45560 report_log: Close sessions before download only
If the session is closed too early, then preferences made in the body of
the page will not be saved to the session.
2014-06-09 17:24:56 +08:00
Marina Glancy 238c388016 Merge branch 'MDL-45634-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-06-09 17:24:36 +08:00
David Mudrák 5e10e88673 MDL-45813 Fix variable name in scheduled task 2014-06-09 09:47:01 +02:00
Jetha Chan 7b6bad24ee MDL-38693 themes: amended z-indexes
Amended #dock z-index level from 11000 to 5000 across all themes; amended z-index style of #page-header in Overlay theme such that elements no longer occlude TinyMCE.
2014-06-09 14:16:24 +08:00
Damyon Wiese 11be1e8b2b Merge branch 'MDL-39726-27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-06-09 12:43:27 +08:00
Rajesh Taneja 42126ff6a5 MDL-45769 behat: use final versions of symfony and behat 2014-06-09 09:59:19 +08:00
Rajesh Taneja f12f99241c MDL-45769 Behat: Fixed behat, was failing because of xpath chaining 2014-06-09 09:59:13 +08:00
Damyon Wiese 8fde6e8ef9 Merge branch 'MDL-45714-27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-06-09 08:56:00 +08:00
Sam Hemelryk 36bd6f3319 MDL-45524 navigation: fixed non-expandable node behat tests 2014-06-09 09:34:02 +12:00
Sam Hemelryk 0f52f263ca MDL-44711 navigation: improved expandable course calculation 2014-06-09 09:34:02 +12:00
Matteo Scaramuccia b9e1842e02 MDL-29708 Fixed file_exception() arguments in rename(). 2014-06-07 09:56:24 +02:00
Matteo Scaramuccia 99261fdf05 MDL-29708 Fixed extra slashes in $string['storedfilenotcreated']. 2014-06-07 09:56:23 +02:00
sam marshall 07388eaded MDL-45574 Backup progress: Can time out with large number of files
When there are many files inside a single resource, it's possible
for the backup to time out because it does not report progress
while adding entries to the backup_ids table.
2014-06-06 10:42:27 +01:00
Jenny Gray d983601e46 MDL-45846 Libraries Reinstate custom user agent device detection 2014-06-06 09:12:58 +01:00
Sam Chaffee fd85f4eeb9 MDL-45767: Fixed DB error when returning to course from external tool
The instance ID is not always returned from the external
tool provider.
2014-06-05 09:38:07 -07:00
Eric Merrill c11ac48868 MDL-20154 quiz: Remove unused random questions
When a random question is removed from a quiz, and it is not
in use elsewhere, it should be deleted.
2014-06-05 11:06:59 -04:00
Eric Merrill 0d5c68bfd8 MDL-20154 questions: question_delete_question should not check perms
By Moodle convention, library functions should not implement permission
checks, they are to be handled by the invoking code.
2014-06-05 11:06:59 -04:00
Eloy Lafuente (stronk7) a6b91c8407 weekly release 2.7+ 2014-06-05 16:58:54 +02:00
Eloy Lafuente (stronk7) f6cac05e9c Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-06-05 16:58:49 +02:00
Eric Merrill 9a2938c57c MDL-45761 assign Set inline comment format properly when plugin is empty
If a plugin says it is empty, skip it for for building the inline
comment.

If not format was found in any plugins, set to FORMAT_HTML, which is
the default for feedback anyways.
2014-06-05 08:58:09 -04:00
Michael de Raadt f4d6bab1b4 MDL-44309 Administration - correcting inproperly assigned column classes in environment table 2014-06-05 10:52:43 +08:00
Mark Nielsen ebfbd63b3c MDL-45764 mod_lti: Fix adding General Tool
This error only occurs when a ltisource
plugin is present that implements the
get_types callback.
2014-06-04 08:10:19 -07:00
Eric Merrill 9ec7228b03 MDL-39726 backup: Move question files by context, not one at a time
Use question category contexts to send file to the file pool in bulk.
Questions are only restored in whole category chunks, so this is safe
to do.
2014-06-04 09:19:52 -04:00
Adrian Greeve 0a1f0c4b1f MDL-44501 mod_data: Only attempt to export when a file exists.
The error only occurs when portfolios are enabled and there is only one field which is
a file field.
2014-06-04 15:30:03 +08:00
Frederic Massart 7180fb19c1 MDL-45579 group: Behat tests to cover group enrolment key rules 2014-06-04 15:12:12 +08:00
Frederic Massart ac2015f2ce MDL-45579 group: Prevent duplicate enrolment keys in course groups 2014-06-04 15:12:12 +08:00
Marina Glancy 6fc8187375 Merge branch 'MDL-18162-27-2' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE 2014-06-04 12:59:42 +08:00
Andrew Nicols 81e433d505 MDL-18162 mod_forum: Correct @param type in phpdoc to use stdClass 2014-06-04 11:26:10 +08:00
Damyon Wiese 9fbdee633a Merge branch 'MDL-45568_m27' of git://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-04 10:20:15 +08:00
Mark Nelson f1dee5ce23 MDL-45568 events: fixed the description for the 'course_module_completion_updated' event 2014-06-03 17:26:22 -07:00
Mark Nelson 1ffce0c735 MDL-45789 mod_wiki: removed undefined "$this->other['itemid']" from the comments_viewed event description 2014-06-03 15:23:50 -07:00
Eloy Lafuente (stronk7) 3e307259ac Merge branch 'MDL-44620_master' of git://github.com/dmonllao/moodle into MOODLE_27_STABLE 2014-06-03 18:11:37 +02:00
Dan Poltawski 8455124070 Merge branch '45333-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-06-03 15:26:01 +01:00
Tim Hunt a1d932bd82 MDL-44054 quiz_statistics fix lang string concatenation. 2014-06-03 13:01:25 +01:00
Jason Fowler d9ef98fc80 MDL-42953 Themes: Fixing CSS for headers of central blocks 2014-06-03 12:12:37 +02:00
Damyon Wiese 4affd3c42e Merge branch 'MDL-45592_27' of git://github.com/grabs/moodle into MOODLE_27_STABLE 2014-06-03 16:14:56 +08:00
Damyon Wiese 8771f49c0a Merge branch 'MDL-45677_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-06-03 14:38:57 +08:00
Damyon Wiese b018b44b49 Merge branch 'm27_MDL-44098' of git://github.com/greg-or/moodle-mod_assign into MOODLE_27_STABLE 2014-06-03 12:49:59 +08:00
Damyon Wiese 3d4f5c6bf8 MDL-45781 mod_quiz: Shifted files did not match CI version 2014-06-03 12:14:07 +08:00
Frederic Massart 6bbdb16bb1 MDL-45634 editor_atto: Adding type button to toolbar buttons
This prevents the browser to assume that those buttons are submit
buttons. In which case the submit action was stolen and the form
could not be submitted pressing the 'enter' key.
2014-06-03 12:09:46 +08:00
Damyon Wiese 07783f9c20 Merge branch 'MDL-45781_27' of git://github.com/timhunt/moodle into MOODLE_27_STABLE 2014-06-03 11:57:54 +08:00
Andrew Nicols b19370bd35 MDL-18162 mod_forum: Correct phpdoc for forum_clean_search_terms 2014-06-03 15:19:41 +12:00
Eric Merrill 9d18c714b8 MDL-45714 backup: Less aggressive removal of old backup dirs
The old 4 hour standard was too aggressive and can cause backup files
to be removed while they were still in use. Now the same as cron,
1 week.
2014-06-02 21:50:48 -04:00
Eloy Lafuente (stronk7) 474dd3da66 Merge branch 'm27_MDL-45726' of https://github.com/danmarsden/moodle into MOODLE_27_STABLE 2014-06-03 02:20:34 +02:00
Mark Nelson 5095725a00 MDL-45804 mod_workshop: fixed objecttable specified for the submission_reassessed event 2014-06-02 16:35:15 -07:00
Sam Hemelryk 02da49597c Merge branch 'MDL-33763-27' of git://github.com/ankitagarwal/moodle into MOODLE_27_STABLE 2014-06-03 08:57:39 +12:00
Eric Merrill 5f86aa9d14 MDL-45763 question Random qtype should use '0' or '1' question text.
Some time ago, it when from using '0' for no-subcategories to blank.
Change to properly define '0' or '1', update old questions, and make
sure to fix newly restored questions.
2014-06-02 15:33:00 -04:00
Albert Gasset ae916b5d6a MDL-35514 mod_forum: Fixed warning message to students in forums with groups 2014-06-02 18:25:21 +02:00
AMOS bot ea66859873 Automatically generated installer lang files 2014-05-31 01:06:17 +00:00
Tim Hunt 23f43bb4c4 MDL-45781 quiz autosave: detect and report when the session is lost.
and also other errors.
2014-05-30 16:29:56 +01:00
AMOS bot 108d281f6b Automatically generated installer lang files 2014-05-30 01:24:20 +00:00
AMOS bot 4a0e272c5b Automatically generated installer lang files 2014-05-30 01:24:20 +00:00
Ciaran Irvine 647a688de3 MDL-45726 SCORM: Correct check for forcenewattempt 2014-05-30 09:48:50 +12:00
Sam Hemelryk 3f9ea21ae3 MDL-45333 output: navbar is now wrapped in a <nav> tag 2014-05-30 08:41:34 +12:00
Andreas Grabs 34a46904c2 MDL-45592 mod_feedback - unwanted linebreak after import or duplicating a feedback 2014-05-29 17:16:10 +02:00
Eloy Lafuente (stronk7) d73b1f3e71 weekly release 2.7+ 2014-05-29 12:51:41 +02:00
Eloy Lafuente (stronk7) 2c356d8ecd Merge branch 'install_27_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_27_STABLE 2014-05-29 12:51:36 +02:00
Damyon Wiese 62c7d543f6 MDL-45654 Cron: Fix for unit test that was causing integer overflow in 32 bit php 2014-05-29 16:29:58 +12:00
Rajesh Taneja 008cfb2a1f MDL-45698 behat: Added extra setting, to avoid timout issue 2014-05-29 14:52:57 +12:00
Sam Hemelryk 243f766222 Merge branch 'wip-mdl-45698-m27' of https://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-05-29 14:28:13 +12:00
Rajesh Taneja 2b9259ed7f MDL-45698 behat: Fixed behat and symfony versions 2014-05-29 09:47:55 +08:00
Sam Hemelryk c5d9d36e79 MDL-45654 cron: fixed dataprovider timestamp issue 2014-05-29 11:31:13 +12:00
Sam Hemelryk 296029fadf Merge branch 'wip-mdl-45565-m27' of https://github.com/rajeshtaneja/moodle into MOODLE_27_STABLE 2014-05-29 08:12:43 +12:00
Eloy Lafuente (stronk7) 7e78f9c4a5 MDL-45503 upgrade: add v2.7.0 sep lines 2014-05-28 01:16:36 +02:00
Simey Lameze 83bc3ccfdf MDL-45544 events: Add event user_profile_viewed trigger to user/profile.php. 2014-05-27 07:50:35 +01:00
Rajesh Taneja 6a001a3223 MDL-45565 phpunit: Changed testsuite_name, so as to avoid class collision 2014-05-27 09:45:16 +08:00
Rajesh Taneja 1974f5ade7 MDL-45565 core_message: Reset internal users in phpunit 2014-05-27 09:45:15 +08:00
Gregory Faller 837e3741fd MDL-44098: Late submissions with extension calculate period of lateness incorrectly 2014-05-27 11:13:41 +09:30
AMOS bot 4bdb702918 Automatically generated installer lang files 2014-05-26 16:46:54 +00:00
AMOS bot e588f20b6c Automatically generated installer lang files 2014-05-26 16:46:54 +00:00
Dan Poltawski ad7d8edf0c Merge branch 'MDL-45676_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-05-26 12:02:41 +01:00
Dan Poltawski 9f4a69a8cd Merge branch 'MDL-45675_m27' of https://github.com/markn86/moodle into MOODLE_27_STABLE 2014-05-26 11:58:57 +01:00
Andrew Nicols fd4c7d7b69 MDL-45682 editor_atto: Ensure that the current editor is active when saving selections 2014-05-26 11:24:11 +01:00
Jetha Chan e77b4ac0de MDL-44482 mod_lti: use localized dates
Fixed an issue where LTI external tools had creation datestamps of NaN/NaN/NaN under particular non-English languages.
2014-05-26 14:46:21 +08:00
Damyon Wiese 4fe4fbba9d MDL-45661 Assign: Clean bad data from DB after MDL-42526 2014-05-26 14:43:10 +08:00
Marina Glancy 331298218b MDL-45688 added missing library requirement 2014-05-26 12:47:52 +08:00
Damyon Wiese db52d4058d Merge branch '45499-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-05-26 12:11:39 +08:00
Mark Nelson b5d1353575 MDL-45629 mod_assign: removed use of '$this->objectid' in the submission_status_viewed event 2014-05-26 11:59:25 +08:00
Mark Nielsen fb3663ae5c MDL-44014 Navigation: Set the correct context when retrieved via AJAX 2014-05-26 11:59:19 +08:00
Mark Nelson 6825f882e2 MDL-45677 mod_assign: removed treatment of an array as an object 2014-05-25 20:25:31 -07:00
Mark Nelson 04b949a8f5 MDL-45676 mod_data: added missing additional name fields 2014-05-25 20:23:13 -07:00
Ankit Agarwal 86976c5bd9 MDL-33763 notes: Fix issue with incorrect node highlighting in the nav tree 2014-05-26 10:42:14 +08:00
Mark Nelson 33238bb24b MDL-45675 mod_data: initialise options as an empty array to avoid error when there are none 2014-05-25 19:29:44 -07:00
Mark Nelson 2b548c27ee MDL-45650 events: ensure correct objectid passed when triggering user_profile_viewed event 2014-05-26 13:59:52 +12:00
David Monllao e0cd7e44db MDL-45192 behat: Replacing specific-selector steps by a generic one
Having a I click on we can use all our selectors rather
than having multiple steps for the same purpose. This
step allow us to manage JS native dialogues without
having to fail a scenario.

Credit for Mohamed Alsharaf.
2014-05-26 13:57:23 +12:00
Mohamed Alsharaf 184cdf0d52 MDL-45192 assign: added behat script & new definitions to handle alert dialog
The behat script is to test the batch action to lock and unlock submissions.
The new definitions are to prevent the "unexpected alert open" error in Selenium.
2014-05-26 13:57:18 +12:00
Tim Hunt 472896acdd MDL-45660 question statistics: make comparison more robust. 2014-05-26 11:53:06 +12:00
Sam Hemelryk 1ff977a5e5 Merge branch 'MDL-45686_27' of git://github.com/jmvedrine/moodle into MOODLE_27_STABLE 2014-05-26 10:55:17 +12:00
Andrew Nicols 68a1c2a8d9 MDL-45635 javascript: Make core dialogue translatable 2014-05-26 10:38:59 +12:00
Simon Coggins db77228155 MDL-45623: Fix assigned users count on role delete confirmation page 2014-05-26 10:00:51 +12:00
Mark Nelson 8a0dcb91cc MDL-45607 events: changed the context passed to the user_profile_viewed event 2014-05-26 09:54:42 +12:00
Sam Hemelryk 11b5d9b763 Merge branch 'MDL-42526-27' of git://github.com/jamiepratt/moodle into MOODLE_27_STABLE 2014-05-26 09:02:53 +12:00
Sam Hemelryk dc195425ee MDL-45499 admin: fixed error when displaying page settings 2014-05-26 09:01:14 +12:00
Sam Hemelryk 72cf8ec5eb Merge branch 'MDL-45654-27' of https://github.com/rtcn2/moodle into MOODLE_27_STABLE 2014-05-26 08:58:13 +12:00
Jean-Michel Vedrine 1130c181f9 MDL-45686 qtype_multichoice get_num_selected_choices return wrong result 2014-05-25 09:23:26 +02:00
Rajesh Taneja 443d4dae06 MDL-45565 core_message: Added unit tests. 2014-05-23 16:48:18 +08:00
Rajesh Taneja a2720952c2 MDL-45565 core_message: Fixed strangers array
Strangers get mixed with noreply user and support user,
if  noreply/support users real user.
To avoid duplication use userid as array index. Also,
avoid fetching data again for noreply and support users,
if they are real users, then data is already feteched.
2014-05-23 16:48:15 +08:00
Eloy Lafuente (stronk7) 89262fa9f1 weekly release 2.7+ 2014-05-22 16:47:19 +02:00
James Pratt bc3c2a8eed MDL-42526 mod_assignment : fix record insert with assigment.id 0 2014-05-22 13:01:47 +07:00
Andrew Nicols fb7e5c42cd MDL-45239 editor_atto: On Android do not restore focus in the callbackWrapper
It seems that Android automatically focuses the cursor in the last position
when the content editable region is programatically re-focused.

Whilst this does not cause an issue on it's own, when combined with the
behaviour of the dictionary auto-completion to restore focus on the start
of the word when a word has not yet been finished, this was causing us to
change focus when pressing buttons.
2014-05-22 13:02:26 +08:00
Andrew Nicols 2e2a229f58 MDL-45536 atto_html: Update the textarea size when switching to HTML view 2014-05-22 11:47:37 +08:00
Rod Norfor d12b20d022 MDL-45654 cron: fix non-empty directories deletion
Remove errors when attempting to delete non-empty directories when
child directories do not get removed since the mtime was updated when
files were removed from the child directory.
2014-05-21 17:20:16 +01:00
Sam Hemelryk 5ce5bc6bdd MDL-44711 course: fixed navigation expansion in course tests 2014-05-21 20:58:27 +12:00
Marina Glancy 54c9048405 MDL-45469 profile: make sure profile fields can be initialised without arguments 2014-05-21 12:04:48 +08:00
Marina Glancy 7b04f1fa49 MDL-45371 behat: Tests for block glossary_random 2014-05-21 10:03:26 +08:00
Marina Glancy eebd7f8964 MDL-45320 behat: change to block selector 2014-05-21 09:32:18 +12:00
Marina Glancy 871af2ebc5 MDL-45320 block_html: behat tests 2014-05-21 09:32:14 +12:00
Marina Glancy 0d4b11ff88 MDL-45320 behat: Step definitions for blocks 2014-05-21 09:32:12 +12:00
David Monllao e342149a37 MDL-45294 behat: Updating block references to aria label value
Also improving moodle selectors xpath expressions
readability.
2014-05-21 09:31:50 +12:00
David Monllao 9054cd2a25 MDL-45294 behat: Supporting an aria-label as a block ref 2014-05-21 09:31:46 +12:00
Dan Poltawski 7d5e56cffd Merge branch '44711-27-r2' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-05-20 20:32:10 +08:00
Sam Hemelryk 137c0261ee MDL-44711 block_navigation: fixed typo in behat tests 2014-05-20 23:39:17 +12:00
Damyon Wiese 1c500e2157 MDL-45606 Unit test fix for MySQL and added a comment about the removed code. 2014-05-20 18:07:13 +08:00
Dan Poltawski 46021b98b2 Merge branch 'MDL-45496-m27' of https://github.com/micaherne/moodle into MOODLE_27_STABLE 2014-05-20 15:55:12 +08:00
Dan Poltawski 55739cdfb6 Merge branch 'MDL-45563-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-20 15:50:29 +08:00
Tim Hunt 63e5416f5b MDL-45618 Fix @since PHPdoc tags. 2014-05-20 15:03:34 +08:00
Jetha Chan 689a8f383c MDL-45525 themes: minor forum improvements
Fixed an RTL style that wasn't kicking in properly.

Conflicts:
	theme/bootstrapbase/style/moodle.css
2014-05-20 14:29:25 +08:00
Andrew Nicols 10f981a794 MDL-45536 theme: Use width auto for inputs and textareas specifying them
Conflicts:
	theme/bootstrapbase/style/moodle.css
2014-05-20 14:25:45 +08:00
Adrian Greeve 556a760d0c MDL-45512 comments: Added full date to comment details. 2014-05-20 14:22:32 +08:00
Michael Aherne 2ba0565d7d MDL-43669 messaging Enable sending email only from no-reply address 2014-05-20 14:16:05 +08:00
Tim Hunt 16d5729223 MDL-44333 quiz reports: use consitent name for user pref
The Marks for each question setting was not being saved properly as a
user preference.
2014-05-20 14:11:39 +08:00
Mark Nelson 38ef7ab379 MDL-45571 events: included enrolment method in the 'user_enrolment_created' event description 2014-05-20 14:08:14 +08:00
Damyon Wiese 740cb942ce Merge branch 'master_MDL-45583' of github.com:danmarsden/moodle into MOODLE_27_STABLE 2014-05-20 13:30:51 +08:00
Damyon Wiese 3725adf852 Merge branch 'MDL-45323-master' of git://github.com/lameze/moodle into MOODLE_27_STABLE 2014-05-20 13:28:09 +08:00
Dan Poltawski b9c49aefb2 Merge branch 'MDL-45501-27' of git://github.com/ankitagarwal/moodle into MOODLE_27_STABLE 2014-05-20 13:23:40 +08:00
Dan Poltawski 60f8e19ce1 Merge branch 'MDL-45566-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-20 13:17:41 +08:00
Damyon Wiese d0f43772fb Merge branch 'MDL-45476-master' of git://github.com/phalacee/moodle into MOODLE_27_STABLE 2014-05-20 13:12:16 +08:00
Dan Poltawski 106be68e82 Merge branch 'MDL-45545-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-20 12:21:12 +08:00
Marina Glancy f12ad8521f MDL-45469 Move profile tests to the location recognised by phpunit 2014-05-20 11:59:58 +08:00
Marina Glancy 9efa210e32 MDL-45466 forum: performance improvement for mass (un)subscriptions 2014-05-20 11:52:23 +08:00
Dan Poltawski 79b146cb5c MDL-44323 admin: use correct css class for warning
The notifyproblem notification is consistent with the rest of
the warnings we report.

Conflicts:
	theme/bootstrapbase/style/moodle.css
2014-05-20 15:48:48 +12:00
Sam Hemelryk 8711ce1f4a Merge branch 'MDL-44027-27' of git://github.com/danpoltawski/moodle into MOODLE_27_STABLE 2014-05-20 15:39:36 +12:00
Damyon Wiese 417fa07162 MDL-45605 Phpunit: Do not call gc_collect_cycles as part of reset.
This takes 25% of the time in running tests and there is no benefit. The
behaviour of destructors is the same before/after the patch.
2014-05-20 10:51:58 +08:00
Dan Poltawski 1910d01a86 Merge branch 'MDL-45546-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-20 10:24:42 +08:00
Dan Poltawski c9c530fd6e Merge branch '44711-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-05-20 10:14:22 +08:00
Sam Hemelryk dadeff80c9 Merge branch 'MDL-45603-27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-05-20 13:59:36 +12:00
sam marshall cc41096ad5 MDL-45469 Conditional availability: Restrict by text area broken
It has never worked, because the data for text area fields is not
loaded into the $USER object.

Changing it so that the dropdown list does not include these types
of field.
2014-05-20 09:52:36 +08:00
Tim Hunt db9987c267 MDL-44449 quiz access rules should have a delete hook.
So they can clean up their settings when the quiz is deleted.

See
https://github.com/moodleou/moodle-quizaccess_honestycheck/commit/babf149c2cc6dd734c272cd332b2032cc19db7d8
for an example of using this.
2014-05-20 09:51:16 +08:00
Dan Poltawski 8d8a5e8035 Merge branch 'MDL-45550-m27' of https://github.com/sammarshallou/moodle into MOODLE_27_STABLE 2014-05-20 09:30:19 +08:00
Andrew Nicols b60373f3e4 MDL-45479 atto_image: Improve the preview area
This changes the preview area:
* to show the image at the requested size; and
* to fix the scaling issues.
2014-05-20 13:20:17 +12:00
Damyon Wiese 1d8bebfeaf Merge branch '44974-27' of git://github.com/samhemelryk/moodle into MOODLE_27_STABLE 2014-05-20 09:00:35 +08:00
Ankit Agarwal 41d178f9da MDL-45543 availability: Use correct namespace for global classes 2014-05-20 12:07:39 +12:00
Sam Hemelryk d144e53188 Merge branch 'MDL-45477-m27' of https://github.com/sammarshallou/moodle into MOODLE_27_STABLE 2014-05-20 11:58:24 +12:00
sam marshall 49b50ef5ab MDL-45535 CSS chunking breaks media rules if CSS invalid (IE)
Invalid CSS with extra } symbols, which previously (by fluke)
worked, was broken by recent chunking improvements. This change
makes the chunking code robust against this (stupid) situation.
2014-05-20 11:57:54 +12:00
Sam Hemelryk 4fac06549a Merge branch 'MDL-44953-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-20 11:43:17 +12:00
Sam Hemelryk 7141921ad4 Merge branch 'MDL-45474-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-20 10:46:34 +12:00
Sam Hemelryk 70e78a4315 Merge branch 'MDL-37838-27' of git://github.com/danpoltawski/moodle into MOODLE_27_STABLE 2014-05-20 10:42:23 +12:00
Sam Hemelryk 520592c43d Merge branch 'MDL-45380-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE
Conflicts:
	theme/bootstrapbase/style/moodle.css
2014-05-20 08:53:18 +12:00
Dan Poltawski 553b1e6f6d MDL-45135 mod_glossary: fix RTL alignment of table
Tablelib has a specific 'hook' to allow alignment to be corrected for
RTL languages, but needs to be specified direction in lowercase.
2014-05-20 08:49:01 +12:00
Damyon Wiese bb5652829f Merge branch 'MDL-45130-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-19 21:27:47 +08:00
Damyon Wiese 288a79ccd4 Merge branch 'MDL-45472-master' of git://github.com/andrewnicols/moodle into MOODLE_27_STABLE 2014-05-19 20:47:27 +08:00
Damyon Wiese 8f6d8a5653 Merge branch 'MDL-45447-master' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-19 20:23:09 +08:00
Tim Hunt c64368bb1d MDL-43833 quiz reports: persist states settings between pages. 2014-05-19 20:12:09 +08:00
Damyon Wiese 177beaf23a Merge branch 'MDL-45527-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-19 20:05:25 +08:00
Tim Hunt 147d7af758 MDL-45455 quiz cron must rollback transaction on error. 2014-05-19 19:57:21 +08:00
Tony Butler 20bd24b70d MDL-45432 mod_assign Declare character encoding in onlinetext export
Signed-off-by: Tony Butler <tonyjbutler@gmail.com>
2014-05-19 18:48:06 +08:00
sam marshall 7c75924319 MDL-45478 Conditional availability: Custom user restriction missing
There was an error in the JavaScript and custom user field
restrictions did not show correctly when editing the form.

Behat tests didn't cover custom user fields, so I added a
scenario.
2014-05-19 17:30:43 +08:00
Andrew Nicols d90846033b MDL-45239 editor_atto: The editor cannot be active if it is not the active element
FireFox thinks that you can have an active selection on an element which
currently does not have focus. How this can be the case is a mystery.

Conflicts:
	lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
2014-05-19 16:15:50 +08:00
Andrew Nicols da02a3c472 MDL-45468 editor_atto: Check that the common ancestor is within the editor
Conflicts:
	lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
2014-05-19 16:15:43 +08:00
Andrew Nicols 61609ec274 MDL-41109 dndupload: Add missing error string 2014-05-19 15:07:59 +08:00
Dan Poltawski 228fc821e0 Merge branch 'wip-MDL-34914-m27' of git://github.com/marinaglancy/moodle into MOODLE_27_STABLE 2014-05-19 14:58:51 +08:00
Damyon Wiese d44071ee09 MDL-32543 upgrade: Increment the version bump 2014-05-19 13:02:10 +08:00
Damyon Wiese 91fae7e9b4 Merge branch 'MDL-32543' of https://github.com/danielneis/moodle into MOODLE_27_STABLE 2014-05-19 13:00:00 +08:00
Damyon Wiese 3e7b9158f4 Merge branch 'MDL-23566' of https://github.com/aolley/moodle into MOODLE_27_STABLE 2014-05-19 12:44:31 +08:00
Marina Glancy 95f9c8f716 Merge branch 'MDL-45537-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-19 12:39:43 +08:00
Marina Glancy 170392d4a0 Merge branch 'wip-MDL-45483-MOODLE_27_STABLE' of https://github.com/kwiliarty/moodle into MOODLE_27_STABLE 2014-05-19 12:37:59 +08:00
Damyon Wiese 3724b3aa8d Merge branch 'MDL-45533-27' of git://github.com/FMCorz/moodle into MOODLE_27_STABLE 2014-05-19 12:28:10 +08:00
Damyon Wiese 9af90f03bb Merge branch 'MDL-44634-27' of https://github.com/dbezborodovrp/moodle into MOODLE_27_STABLE 2014-05-19 12:14:42 +08:00
Jetha Chan 64a2dfba1f MDL-45561 themes: horizontal scroll in RTL base 2014-05-19 13:38:22 +12:00
Sam Hemelryk 043cf8bab7 MDL-44974 admin: repositioned call to initialise renderer 2014-05-19 08:41:27 +12:00
Sam Hemelryk 832393cfc9 MDL-44711 navigation: better handling of course expansion exception 2014-05-19 08:41:12 +12:00
Eric Merrill d8e7fa9196 MDL-45603 cache Fix the mappingsonly option to work as advertised. 2014-05-17 23:58:05 -04:00
Marina Glancy 075e999c1a MDL-34914 cohorts: more understandable filter of user list by cohort 2014-05-16 17:14:29 +08:00
Frederic Massart 8efb66741f MDL-45566 message: Send blocking events when user is not in contact list 2014-05-15 16:43:01 +08:00
Frederic Massart fa348b5d46 MDL-45563 message: Inverting IDs in description of event message_viewed 2014-05-15 16:17:03 +08:00
Frederic Massart ac2eafee91 MDL-45537 mod_assign: Requiring locallib for class assign 2014-05-15 15:52:48 +08:00
Damyon Wiese e6c69d835d weekly release 2.7+ 2014-05-15 15:32:36 +08:00
Ankit Agarwal bfa6c5080e MDL-45501 availability: Add uninstall support for conditional plugins 2014-05-15 14:07:05 +08:00
Damyon Wiese 0f0729b157 MDL-41383 Filepicker: whitespace fix 2014-05-15 13:33:04 +08:00
Jetha Chan f75d82450a MDL-41383: RTL fix for base when zoomed out 2014-05-15 13:29:03 +08:00
Damien Bezborodov 3dd33e3862 MDL-44634 Regression: link to user profile in comments block fails due to double URI encoding 2014-05-15 11:46:32 +09:30
Damien Bezborodov e3b98ac6b6 MDL-44634 Regression: link to user profile in comments block fails due to double URI encoding 2014-05-15 10:43:06 +09:30
sam marshall 3951213860 MDL-45550 Conditional availability: Missing lang string for save settings error 2014-05-14 11:48:33 +01:00
sam marshall 24b81e0566 MDL-45477 Behat: List of steps takes too long to load, times out
Increase time limit to 300 seconds (5 minutes).
2014-05-14 11:05:38 +01:00
Juan Leyva 0ab271dcfd MDL-36670 logging: action parameter length restricted to 40 chars 2014-05-14 16:35:18 +08:00
Frederic Massart b9cb39eaf6 MDL-45546 mod_forum: Login the user before getting its context 2014-05-14 16:16:40 +08:00
Frederic Massart c83407f033 MDL-45545 csslib: Chunking handles commas in media query definitions 2014-05-14 15:28:11 +08:00
Jetha Chan da75ffce68 MDL-41383 theme: filepicker zoom resiliency (base)
Fixed an issue that broke the file picker on base when initial zoom level is less than 100%.
2014-05-14 15:07:44 +08:00
Frederic Massart d48b1de9f7 MDL-45474 atto_undo: Remove notice when undo stack is empty 2014-05-13 17:49:26 +08:00
Dan Poltawski 38d1c9a886 MDL-44027 groups: remove some junk html 2014-05-13 16:17:14 +08:00
Damyon Wiese 1c48d7e188 Merge branch 'MDL-41383-27' of git://github.com/jethac/moodle into MOODLE_27_STABLE 2014-05-13 16:01:50 +08:00
Dan Poltawski 11b39253d2 Merge branch 'MDL-45523_m27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-05-13 14:46:55 +08:00
Dan Poltawski 56e84a7985 Merge branch 'MDL-45522_m27' of https://github.com/merrill-oakland/moodle into MOODLE_27_STABLE 2014-05-13 14:37:23 +08:00
Dan Poltawski 133f83d557 MDL-37838 block_courseoverview: fix pluaralisation logic
Note that this kind of handling of plurals is extremely limited, see:

https://moodle.org/mod/forum/discuss.php?d=85897
http://search.cpan.org/~petdance/Locale-Maketext-1.12/lib/Locale/Maketext/TPJ13.pod

However, this is a simple fix to the existing logic
2014-05-13 14:18:16 +08:00
Eric Merrill 17e57aa07d MDL-45523 quiz Cleanup duplicate question instances. 2014-05-12 16:01:32 -04:00
Eric Merrill 710b364b44 MDL-45522 quiz Check that sumgrade is valid before saving. 2014-05-12 15:21:44 -04:00
Frederic Massart 81d72831b8 MDL-44953 theme_more: Removing odd-looking text-shadow 2014-05-12 16:51:37 +08:00
Frederic Massart 3cfabf7190 MDL-45130 editor_atto: Remove debugging messages for missing plugins
This is no longer required as the toolbar configuration prevents
missing plugins from being set. However, even if we do not output
any notice, we ignore missing plugins to prevent errors in case
one was uninstalled but left in the editor toolbar.
2014-05-12 16:09:40 +08:00
Michael Aherne 0e5791a6cd MDL-45496 core Added space to logged in as line 2014-05-12 08:58:41 +01:00
Frederic Massart da3e5e0c5c MDL-45380 theme_bootstrapbase: Restore config override highlight 2014-05-12 15:50:08 +08:00
Rajesh Taneja ae3b9e1e1f MDL-45514 behat: Fixed should_not_exist timout param 2014-05-12 14:13:21 +08:00
Kevin Wiliarty 3485ecf225 MDL-45483 mod_forum: corrects values for maxattachments in forum settings 2014-05-11 23:51:57 -04:00
4918 changed files with 115796 additions and 365996 deletions
-3
View File
@@ -1,3 +0,0 @@
--errors=errors,duplicate-properties
--warnings=known-properties,display-property-grouping,empty-rules,important
--exclude-list=vendor/,lib/editor/tinymce/,lib/yuilib/,theme/bootstrapbase/style/
-1
View File
@@ -35,4 +35,3 @@ composer.lock
/lib/yuilib/*/build/*/*-coverage.js
# lib/yuilib/version/module/module-coverage.js
/lib/yuilib/*/*/*-coverage.js
atlassian-ide-plugin.xml
+2 -1
View File
@@ -67,6 +67,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
}
$adminroot = admin_get_root(true); //reload tree
$settingspage = $adminroot->locate($category, true);
}
@@ -155,4 +156,4 @@ echo $outputhtml;
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
echo $OUTPUT->footer();
echo $OUTPUT->footer();
-76
View File
@@ -1,76 +0,0 @@
<?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/>.
/**
* Validate that the current db structure matches the install.xml files.
*
* @package core
* @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Petr Skoda <petr.skoda@totaralms.com>
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir.'/clilib.php');
$help = "Validate database structure
Options:
-h, --help Print out this help.
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/check_database_schema.php
";
list($options, $unrecognized) = cli_get_params(
array(
'help' => false,
),
array(
'h' => 'help',
)
);
if ($options['help']) {
echo $help;
exit(0);
}
if (empty($CFG->version)) {
echo "Database is not yet installed.\n";
exit(2);
}
$dbmanager = $DB->get_manager();
$schema = $dbmanager->get_install_xml_schema();
if (!$errors = $dbmanager->check_database_schema($schema)) {
echo "Database structure is ok.\n";
exit(0);
}
foreach ($errors as $table => $items) {
cli_separator();
echo "$table\n";
foreach ($items as $item) {
echo " * $item\n";
}
}
cli_separator();
exit(1);
-202
View File
@@ -1,202 +0,0 @@
<?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/>.
/**
* MySQL table row compression tool tool.
*
* @package core
* @copyright 2014 Totara Learning Solutions Ltd {@link http://www.totaralms.com/}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @author Petr Skoda <petr.skoda@totaralms.com>
*/
define('CLI_SCRIPT', true);
require(dirname(__FILE__).'/../../config.php');
require_once($CFG->libdir . '/clilib.php');
if ($DB->get_dbfamily() !== 'mysql') {
cli_error('This script is used for MySQL databases only.');
}
$engine = strtolower($DB->get_dbengine());
if ($engine !== 'innodb' and $engine !== 'xtradb') {
cli_error('This script is for MySQL servers using InnoDB or XtraDB engines only.');
}
list($options, $unrecognized) = cli_get_params(
array('help' => false, 'info' => false, 'list' => false, 'fix' => false, 'showsql' => false),
array('h' => 'help', 'i' => 'info', 'l' => 'list', 'f' => 'fix', 's' => 'showsql')
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$help =
"Script for detection of row size problems in MySQL InnoDB tables.
By default InnoDB storage table is using legacy Antelope file format
which has major restriction on database row size.
Use this script to detect and fix database tables with potential data
overflow problems.
Options:
-i, --info Show database information
-l, --list List problematic tables
-f, --fix Attempt to fix all tables (requires SUPER privilege)
-s, --showsql Print SQL statements for fixing of tables
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_compressed_rows.php -l
";
/** @var mysql_sql_generator $generator */
$generator = $DB->get_manager()->generator;
$info = $DB->get_server_info();
$filepertable = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_per_table'");
$filepertable = $filepertable ? $filepertable->value : '';
$fileformat = $DB->get_record_sql("SHOW VARIABLES LIKE 'innodb_file_format'");
$fileformat = $fileformat ? $fileformat->value : '';
$prefix = $DB->get_prefix();
$database = $CFG->dbname;
if (!empty($options['info'])) {
echo "Database version: " . $info['description'] . "\n";
echo "Database name: $database\n";
echo "Database engine: " . $DB->get_dbengine() . "\n";
echo "innodb_file_per_table: $filepertable\n";
echo "innodb_file_format: $fileformat\n";
exit(0);
} else if (!empty($options['list'])) {
$problem = false;
foreach ($DB->get_tables(false) as $table) {
$columns = $DB->get_columns($table, false);
$size = $generator->guess_antolope_row_size($columns);
$format = $DB->get_row_format($table);
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
continue;
}
echo str_pad($prefix . $table, 32, ' ', STR_PAD_RIGHT);
echo str_pad($format, 11, ' ', STR_PAD_RIGHT);
if ($format === 'Compact' or $format === 'Redundant') {
$problem = true;
echo " (needs fixing)\n";
} else if ($format !== 'Compressed' and $format !== 'Dynamic') {
echo " (unknown)\n";
} else {
echo "\n";
}
}
if ($problem) {
exit(1);
}
exit(0);
} else if (!empty($options['fix'])) {
$fixtables = array();
foreach ($DB->get_tables(false) as $table) {
$columns = $DB->get_columns($table, false);
$size = $generator->guess_antolope_row_size($columns);
$format = $DB->get_row_format($table);
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
continue;
}
if ($format === 'Compact' or $format === 'Redundant') {
$fixtables[$table] = $table;
}
}
if (!$fixtables) {
echo "No changes necessary\n";
exit(0);
}
if ($filepertable !== 'ON') {
try {
$DB->execute("SET GLOBAL innodb_file_per_table=1");
} catch (dml_exception $e) {
echo "Cannot enable GLOBAL innodb_file_per_table setting, use --showsql option and execute the statements manually.";
throw $e;
}
}
if ($fileformat !== 'Barracuda') {
try {
$DB->execute("SET GLOBAL innodb_file_format=Barracuda");
} catch (dml_exception $e) {
echo "Cannot change GLOBAL innodb_file_format setting, use --showsql option and execute the statements manually.";
throw $e;
}
}
if (!$DB->is_compressed_row_format_supported(false)) {
echo "MySQL server is not compatible with compressed row format.";
exit(1);
}
foreach ($fixtables as $table) {
$DB->change_database_structure("ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed");
echo str_pad($prefix . $table, 32, ' ', STR_PAD_RIGHT) . " ... Compressed\n";
}
exit(0);
} else if (!empty($options['showsql'])) {
$fixtables = array();
foreach ($DB->get_tables(false) as $table) {
$columns = $DB->get_columns($table, false);
$size = $generator->guess_antolope_row_size($columns);
$format = $DB->get_row_format($table);
if ($size <= $generator::ANTELOPE_MAX_ROW_SIZE) {
continue;
}
if ($format === 'Compact' or $format === 'Redundant') {
$fixtables[$table] = $table;
}
}
if (!$fixtables) {
echo "No changes necessary\n";
exit(0);
}
echo "Copy the following SQL statements and execute them using account with SUPER privilege:\n\n";
echo "USE $database;\n";
echo "SET SESSION sql_mode=STRICT_ALL_TABLES;\n";
echo "SET GLOBAL innodb_file_per_table=1;\n";
echo "SET GLOBAL innodb_file_format=Barracuda;\n";
foreach ($fixtables as $table) {
echo "ALTER TABLE {$prefix}$table ROW_FORMAT=Compressed;\n";
}
echo "\n";
exit(0);
} else {
echo $help;
die;
}
+2 -2
View File
@@ -45,7 +45,7 @@ admin_externalpage_setup('environment', '', $extraurlparams);
// Handle the 'updatecomponent' action
if ($action == 'updatecomponent' && confirm_sesskey()) {
// Create component installer and execute it
if ($cd = new component_installer('https://download.moodle.org',
if ($cd = new component_installer('http://download.moodle.org',
'environment',
'environment.zip')) {
$status = $cd->install(); //returns COMPONENT_(ERROR | UPTODATE | INSTALLED)
@@ -53,7 +53,7 @@ if ($action == 'updatecomponent' && confirm_sesskey()) {
case COMPONENT_ERROR:
if ($cd->get_error() == 'remotedownloaderror') {
$a = new stdClass();
$a->url = 'https://download.moodle.org/environment/environment.zip';
$a->url = 'http://download.moodle.org/environment/environment.zip';
$a->dest = $CFG->dataroot . '/';
print_error($cd->get_error(), 'error', $PAGE->url, $a);
die();
-123
View File
@@ -1136,127 +1136,4 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="2.8" requires="2.2">
<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.4.4" 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="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="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+1 -2
View File
@@ -555,8 +555,7 @@ if (isset($SESSION->pluginuninstallreturn)) {
// Print default admin page with notifications.
$errorsdisplayed = defined('WARN_DISPLAY_ERRORS_ENABLED');
// We make the assumption that at least one schedule task should run once per day.
$lastcron = $DB->get_field_sql('SELECT MAX(lastruntime) FROM {task_scheduled}');
$lastcron = $DB->get_field_sql('SELECT MAX(lastcron) FROM {modules}');
$cronoverdue = ($lastcron < time() - 3600 * 24);
$dbproblems = $DB->diagnose();
$maintenancemode = !empty($CFG->maintenance_enabled);
+1 -1
View File
@@ -1,4 +1,4 @@
<?php
<?PHP
// Allows the admin to configure mnet stuff
+9
View File
@@ -34,12 +34,21 @@ if (!defined('MOODLE_INTERNAL')) {
}
$strmnetservices = get_string('mnetservices', 'mnet');
$strmnetlog = get_string('mnetlog', 'mnet');
$strmnetedithost = get_string('reviewhostdetails', 'mnet');
$logurl = $CFG->wwwroot.
'/report/log/index.php?chooselog=1&amp;showusers=1&amp;showcourses=1&amp;host_course='.$mnet_peer->id.
'%2F1&amp;user='.'0'.
'&amp;date=0'.
'&amp;modid=&amp;modaction=0&amp;logformat=showashtml';
$tabs = array();
if (isset($mnet_peer->id) && $mnet_peer->id > 0) {
$tabs[] = new tabobject('mnetdetails', 'peers.php?step=update&amp;hostid='.$mnet_peer->id, $strmnetedithost, $strmnetedithost, false);
$tabs[] = new tabobject('mnetservices', 'services.php?hostid='.$mnet_peer->id, $strmnetservices, $strmnetservices, false);
if ($mnet_peer->application->name == 'moodle' && $mnet_peer->id != $CFG->mnet_all_hosts_id) {
$tabs[] = new tabobject('mnetlog', $logurl, $strmnetlog, $strmnetlog, false);
}
$tabs[] = new tabobject('mnetprofilefields', 'profilefields.php?hostid=' . $mnet_peer->id, get_string('profilefields', 'mnet'), get_string('profilefields', 'mnet'), false);
} else {
$tabs[] = new tabobject('mnetdetails', '#', $strmnetedithost, $strmnetedithost, false);
+11 -20
View File
@@ -1039,28 +1039,19 @@ class core_admin_renderer extends plugin_renderer_base {
}
foreach ($plugin->get_other_required_plugins() as $component => $requiredversion) {
$ok = true;
$otherplugin = $pluginman->get_plugin_info($component);
$actions = array();
if (is_null($otherplugin)) {
// The required plugin is not installed.
$class = 'requires-failed requires-missing';
$installurl = new moodle_url('https://moodle.org/plugins/view.php', array('plugin' => $component));
$uploadurl = new moodle_url('/admin/tool/installaddon/');
$actions[] = html_writer::link($installurl, get_string('dependencyinstall', 'core_plugin'));
$actions[] = html_writer::link($uploadurl, get_string('dependencyupload', 'core_plugin'));
$ok = false;
} else if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
// The required plugin is installed but needs to be updated.
$class = 'requires-failed requires-outdated';
if (!$otherplugin->is_standard()) {
$updateurl = new moodle_url($this->page->url, array('sesskey' => sesskey(), 'fetchupdates' => 1));
$actions[] = html_writer::link($updateurl, get_string('checkforupdates', 'core_plugin'));
}
$ok = false;
}
} else {
// Already installed plugin with sufficient version.
if ($ok) {
$class = 'requires-ok';
} else {
$class = 'requires-failed';
}
if ($requiredversion != ANY_VERSION) {
@@ -1068,11 +1059,11 @@ class core_admin_renderer extends plugin_renderer_base {
} else {
$str = 'otherplugin';
}
$componenturl = new moodle_url('https://moodle.org/plugins/view.php?plugin='.$component);
$componenturl = html_writer::tag('a', $component, array('href' => $componenturl->out()));
$requires[] = html_writer::tag('li',
html_writer::div(get_string($str, 'core_plugin',
array('component' => $component, 'version' => $requiredversion)), 'component').
html_writer::div(implode(' | ', $actions), 'actions'),
get_string($str, 'core_plugin',
array('component' => $componenturl, 'version' => $requiredversion)),
array('class' => $class));
}
+5 -14
View File
@@ -41,24 +41,15 @@ class core_role_existing_role_holders extends core_role_assign_user_selector_bas
list($sort, $sortparams) = users_order_by_sql('u', $search, $this->accesscontext);
$params = array_merge($params, $sortparams);
$fields = "SELECT ra.id AS raid," . $this->required_fields_sql('u') . ",ra.contextid,ra.component ";
$countfields = "SELECT COUNT(1) ";
$sql = "FROM {role_assignments} ra
$sql = "SELECT ra.id AS raid," . $this->required_fields_sql('u') . ",ra.contextid,ra.component
FROM {role_assignments} ra
JOIN {user} u ON u.id = ra.userid
JOIN {context} ctx ON ra.contextid = ctx.id
WHERE $wherecondition
AND ctx.id $ctxcondition
AND ra.roleid = :roleid";
$order = " ORDER BY ctx.depth DESC, ra.component, $sort";
if (!$this->is_validating()) {
$existinguserscount = $DB->count_records_sql($countfields . $sql, $params);
if ($existinguserscount > $this->maxusersperpage) {
return $this->too_many_results($search, $existinguserscount);
}
}
$contextusers = $DB->get_records_sql($fields . $sql . $order, $params);
AND ra.roleid = :roleid
ORDER BY ctx.depth DESC, ra.component, $sort";
$contextusers = $DB->get_records_sql($sql, $params);
// No users at all.
if (empty($contextusers)) {
@@ -48,12 +48,11 @@ class core_role_potential_assignees_below_course extends core_role_assign_user_s
$fields = 'SELECT ' . $this->required_fields_sql('u');
$countfields = 'SELECT COUNT(u.id)';
$sql = " FROM ($enrolsql) enrolled_users_view
JOIN {user} u ON u.id = enrolled_users_view.id
LEFT JOIN {role_assignments} ra ON (ra.userid = enrolled_users_view.id AND
ra.roleid = :roleid AND ra.contextid = :contextid)
WHERE ra.id IS NULL
$wherecondition";
$sql = " FROM {user} u
LEFT JOIN {role_assignments} ra ON (ra.userid = u.id AND ra.roleid = :roleid AND ra.contextid = :contextid)
WHERE u.id IN ($enrolsql)
$wherecondition
AND ra.id IS NULL";
$params['contextid'] = $this->context->id;
$params['roleid'] = $this->roleid;
+1 -1
View File
@@ -132,7 +132,7 @@ if ($courseid == SITEID) {
$PAGE->set_heading($course->fullname.': '.$fullname);
}
echo $OUTPUT->header();
echo $OUTPUT->heading($title);
echo $OUTPUT->heading($title, 3);
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');
// Display them.
+3 -1
View File
@@ -22,6 +22,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
if (admin_write_settings($data)) {
$statusmsg = get_string('changessaved');
}
$adminroot = admin_get_root(true); //reload tree
if (!empty($adminroot->errors)) {
$errormsg = get_string('errorwithsettings', 'admin');
@@ -43,9 +44,10 @@ if ($errormsg !== '') {
$resultshtml = admin_search_settings_html($query); // case insensitive search only
echo '<form action="' . $PAGE->url->out(true) . '" method="post" id="adminsettings">';
echo '<form action="search.php" method="post" id="adminsettings">';
echo '<div>';
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />';
echo '<input type="hidden" name="query" value="'.s($query).'" />';
echo '</div>';
echo '<fieldset>';
echo '<div class="clearer"><!-- --></div>';
+1
View File
@@ -48,6 +48,7 @@ if ($data = data_submitted() and confirm_sesskey()) {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
}
$adminroot = admin_get_root(true); //reload tree
$settingspage = $adminroot->locate($section, true);
}
-12
View File
@@ -23,17 +23,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
$temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('allowblockstodock', new lang_string('allowblockstodock', 'admin'), new lang_string('configallowblockstodock', 'admin'), 1));
$temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'), new lang_string('configcustommenuitems', 'admin'), '', PARAM_TEXT, '50', '10'));
$temp->add(new admin_setting_configtextarea(
'customusermenuitems',
new lang_string('customusermenuitems', 'admin'),
new lang_string('configcustomusermenuitems', 'admin'),
'messages,message|/message/index.php|message
myfiles,moodle|/user/files.php|download
mybadges,badges|/badges/mybadges.php|award',
PARAM_TEXT,
'50',
'10'
));
$temp->add(new admin_setting_configcheckbox('enabledevicedetection', new lang_string('enabledevicedetection', 'admin'), new lang_string('configenabledevicedetection', 'admin'), 1));
$temp->add(new admin_setting_devicedetectregex('devicedetectregex', new lang_string('devicedetectregex', 'admin'), new lang_string('devicedetectregex_desc', 'admin'), ''));
$ADMIN->add('themes', $temp);
@@ -133,7 +122,6 @@ mybadges,badges|/badges/mybadges.php|award',
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navexpandmycourses', new lang_string('navexpandmycourses', 'admin'), new lang_string('navexpandmycourses_desc', 'admin'), 1));
$sortoptions = array(
'sortorder' => new lang_string('sort_sortorder', 'admin'),
'fullname' => new lang_string('sort_fullname', 'admin'),
+1
View File
@@ -11,6 +11,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
//TODO: Re-enable cc-import once re-implemented in 2.0.x
//$temp->add(new admin_setting_configcheckbox('enableimsccimport', new lang_string('enable_cc_import', 'imscc'), new lang_string('enable_cc_import_description', 'imscc'), 0));
$temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', new lang_string('enablesafebrowserintegration', 'admin'), new lang_string('configenablesafebrowserintegration', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('enablegroupmembersonly', new lang_string('enablegroupmembersonly', 'admin'), new lang_string('configenablegroupmembersonly', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
// The CSS optimiser setting. When changed we need to reset the theme caches in order to ensure they are regenerated through the optimiser.
+6 -9
View File
@@ -68,10 +68,6 @@ if (has_capability('moodle/grade:manage', $systemcontext)
$temp->add(new admin_setting_special_gradelimiting());
$temp->add(new admin_setting_configcheckbox('grade_report_showmin',
get_string('minimum_show', 'grades'),
get_string('minimum_show_help', 'grades'), '1'));
$temp->add(new admin_setting_special_gradepointmax());
$temp->add(new admin_setting_special_gradepointdefault());
@@ -96,9 +92,11 @@ if (has_capability('moodle/grade:manage', $systemcontext)
GRADE_AGGREGATE_MODE =>new lang_string('aggregatemode', 'grades'),
GRADE_AGGREGATE_SUM =>new lang_string('aggregatesum', 'grades'));
$defaultvisible = array(GRADE_AGGREGATE_SUM);
$defaultvisible = array(GRADE_AGGREGATE_MEAN, GRADE_AGGREGATE_WEIGHTED_MEAN, GRADE_AGGREGATE_WEIGHTED_MEAN2,
GRADE_AGGREGATE_EXTRACREDIT_MEAN, GRADE_AGGREGATE_MEDIAN, GRADE_AGGREGATE_MIN,
GRADE_AGGREGATE_MAX, GRADE_AGGREGATE_MODE, GRADE_AGGREGATE_SUM);
$defaults = array('value' => GRADE_AGGREGATE_SUM, 'forced' => false, 'adv' => false);
$defaults = array('value'=>GRADE_AGGREGATE_WEIGHTED_MEAN2, 'forced'=>false, 'adv'=>false);
$temp->add(new admin_setting_gradecat_combo('grade_aggregation', new lang_string('aggregation', 'grades'), new lang_string('aggregation_help', 'grades'), $defaults, $options));
$temp->add(new admin_setting_configmultiselect('grade_aggregations_visible', new lang_string('aggregationsvisible', 'grades'),
@@ -112,6 +110,8 @@ if (has_capability('moodle/grade:manage', $systemcontext)
$defaults = array('value'=>0, 'forced'=>false, 'adv'=>true);
$temp->add(new admin_setting_gradecat_combo('grade_aggregateoutcomes', new lang_string('aggregateoutcomes', 'grades'),
new lang_string('aggregateoutcomes_help', 'grades'), $defaults, $options));
$temp->add(new admin_setting_gradecat_combo('grade_aggregatesubcats', new lang_string('aggregatesubcats', 'grades'),
new lang_string('aggregatesubcats_help', 'grades'), $defaults, $options));
$options = array(0 => new lang_string('none'));
for ($i=1; $i<=20; $i++) {
@@ -125,9 +125,6 @@ if (has_capability('moodle/grade:manage', $systemcontext)
$defaults['forced'] = false;
$temp->add(new admin_setting_gradecat_combo('grade_droplow', new lang_string('droplow', 'grades'),
new lang_string('droplow_help', 'grades'), $defaults, $options));
$temp->add(new admin_setting_configcheckbox('grade_overridecat', new lang_string('overridecat', 'grades'),
new lang_string('overridecat_help', 'grades'), 1));
}
$ADMIN->add('grades', $temp);
+4 -1
View File
@@ -278,6 +278,9 @@ if ($hassiteconfig) {
$ADMIN->add('webservicesettings', new admin_externalpage('webservicedocumentation', new lang_string('wsdocapi', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/documentation.php", 'moodle/site:config', false));
/// manage service
$temp = new admin_settingpage('externalservices', new lang_string('externalservices', 'webservice'));
$temp->add(new admin_setting_enablemobileservice('enablemobilewebservice',
new lang_string('enablemobilewebservice', 'admin'),
new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), 0));
$temp->add(new admin_setting_heading('manageserviceshelpexplaination', new lang_string('information', 'webservice'), new lang_string('servicehelpexplanation', 'webservice')));
$temp->add(new admin_setting_manageexternalservices());
$ADMIN->add('webservicesettings', $temp);
@@ -355,7 +358,7 @@ if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext))
2 => get_string('showmarkandmax', 'question'),
);
$settings->add(new admin_setting_configselect('question_preview/marks',
get_string('marks', 'question'), '', 2, $marksoptions));
get_string('marks', 'question'), '', 1, $marksoptions));
$settings->add(new admin_setting_configselect('question_preview/markdp',
get_string('decimalplacesingrades', 'question'), '', 2, array(0, 1, 2, 3, 4, 5, 6, 7)));
-1
View File
@@ -11,7 +11,6 @@ $temp = new admin_settingpage('systempaths', new lang_string('systempaths','admi
$temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'), new lang_string('configpathtodu', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'), new lang_string('edhelpaspellpath'), ''));
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'), new lang_string('pathtodot_help', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'), new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
$ADMIN->add('server', $temp);
-41
View File
@@ -24,44 +24,6 @@ if ($hassiteconfig
$ADMIN->add('accounts', new admin_externalpage('editusers', new lang_string('userlist','admin'), "$CFG->wwwroot/$CFG->admin/user.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('userbulk', new lang_string('userbulk','admin'), "$CFG->wwwroot/$CFG->admin/user/user_bulk.php", array('moodle/user:update', 'moodle/user:delete')));
$ADMIN->add('accounts', new admin_externalpage('addnewuser', new lang_string('addnewuser'), "$securewwwroot/user/editadvanced.php?id=-1", 'moodle/user:create'));
// "User default preferences" settingpage.
$temp = new admin_settingpage('userdefaultpreferences', new lang_string('userdefaultpreferences', 'admin'));
if ($ADMIN->fulltree) {
$choices = array();
$choices['0'] = new lang_string('emaildisplayno');
$choices['1'] = new lang_string('emaildisplayyes');
$choices['2'] = new lang_string('emaildisplaycourse');
$temp->add(new admin_setting_configselect('defaultpreference_maildisplay', new lang_string('emaildisplay'),
'', 2, $choices));
$choices = array();
$choices['0'] = new lang_string('textformat');
$choices['1'] = new lang_string('htmlformat');
$temp->add(new admin_setting_configselect('defaultpreference_mailformat', new lang_string('emailformat'), '', 1, $choices));
$choices = array();
$choices['0'] = new lang_string('emaildigestoff');
$choices['1'] = new lang_string('emaildigestcomplete');
$choices['2'] = new lang_string('emaildigestsubjects');
$temp->add(new admin_setting_configselect('defaultpreference_maildigest', new lang_string('emaildigest'),
new lang_string('emaildigest_help'), 0, $choices));
$choices = array();
$choices['1'] = new lang_string('autosubscribeyes');
$choices['0'] = new lang_string('autosubscribeno');
$temp->add(new admin_setting_configselect('defaultpreference_autosubscribe', new lang_string('autosubscribe'),
'', 1, $choices));
$choices = array();
$choices['0'] = new lang_string('trackforumsno');
$choices['1'] = new lang_string('trackforumsyes');
$temp->add(new admin_setting_configselect('defaultpreference_trackforums', new lang_string('trackforums'),
'', 0, $choices));
}
$ADMIN->add('accounts', $temp);
$ADMIN->add('accounts', new admin_externalpage('profilefields', new lang_string('profilefields','admin'), "$CFG->wwwroot/user/profile/index.php", 'moodle/site:config'));
$ADMIN->add('accounts', new admin_externalpage('cohorts', new lang_string('cohorts', 'cohort'), $CFG->wwwroot . '/cohort/index.php', array('moodle/cohort:manage', 'moodle/cohort:view')));
@@ -190,9 +152,6 @@ if ($hassiteconfig
'institution' => new lang_string('institution'),
)));
$temp->add(new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'), new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50));
$temp->add(new admin_setting_configtext('alternativefullnameformat', new lang_string('alternativefullnameformat', 'admin'),
new lang_string('alternativefullnameformat_desc', 'admin'),
'language', PARAM_RAW, 50));
$temp->add(new admin_setting_configtext('maxusersperpage', new lang_string('maxusersperpage','admin'), new lang_string('configmaxusersperpage','admin'), 100, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('enablegravatar', new lang_string('enablegravatar', 'admin'), new lang_string('enablegravatar_help', 'admin'), 0));
$temp->add(new admin_setting_configtext('gravatardefaulturl', new lang_string('gravatardefaulturl', 'admin'), new lang_string('gravatardefaulturl_help', 'admin'), 'mm'));
+3 -3
View File
@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000;
$plugin->requires = 2014110400;
$plugin->version = 2014051200;
$plugin->requires = 2014050800;
$plugin->component = 'tool_assignmentupgrade';
$plugin->dependencies = array('mod_assign' => 2014110400);
$plugin->dependencies = array('mod_assign' => 2014050800);
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000;
$plugin->requires = 2014110400;
$plugin->version = 2014051200;
$plugin->requires = 2014050800;
$plugin->component = 'tool_availabilityconditions';
@@ -185,12 +185,6 @@ Feature: Set up contextual data for tests
| url | Test url name | Test url description | C1 | url1 |
| wiki | Test wiki name | Test wiki description | C1 | wiki1 |
| workshop | Test workshop name | Test workshop description | C1 | workshop1 |
And the following "scales" exist:
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
And the following "activities" exist:
| activity | name | intro | course | idnumber | grade |
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
When I log in as "admin"
And I follow "Course 1"
Then I should see "Test assignment name"
@@ -220,10 +214,6 @@ Feature: Set up contextual data for tests
And I should see "Test workshop name"
And I follow "Test assignment name"
And I should see "Test assignment description"
And I follow "C1"
And I follow "Test assignment name with scale"
And I follow "Edit settings"
And the field "Type" matches value "Scale"
@javascript
Scenario: Add relations between users and groups
@@ -263,168 +253,24 @@ Feature: Set up contextual data for tests
And I set the field "groups" to "Group 2 (1)"
And the "members" select box should contain "Student 2"
Scenario: Add cohorts and cohort members with data generator
Scenario: Add cohorts with data generator
Given the following "categories" exist:
| name | category | idnumber |
| Cat 1 | 0 | CAT1 |
And the following "users" exist:
| username | firstname | lastname | email |
| student1 | Student | 1 | student1@asd.com |
| student2 | Student | 2 | student2@asd.com |
And the following "cohorts" exist:
| name | idnumber |
| System cohort A | CHSA |
| System cohort 1 | CH01 |
And the following "cohorts" exist:
| name | idnumber | contextlevel | reference |
| System cohort B | CHSB | System | |
| Cohort in category | CHC | Category | CAT1 |
| Empty cohort | CHE | Category | CAT1 |
And the following "cohort members" exist:
| user | cohort |
| student1 | CHSA |
| student2 | CHSB |
| student1 | CHSB |
| student1 | CHC |
| System cohort 2 | CH02 | System | |
| Cohort in category 1 | CH1 | Category | CAT1 |
When I log in as "admin"
And I navigate to "Cohorts" node in "Site administration > Users > Accounts"
Then the following should exist in the "cohorts" table:
| Name | Cohort size |
| System cohort A | 1 |
| System cohort B | 2 |
Then I should see "System cohort 1"
And I should see "System cohort 2"
And I should not see "Cohort in category"
And I follow "Courses"
And I follow "Cat 1"
And I follow "Cohorts"
And I should see "Cohort in category 1"
And I should not see "System cohort"
And the following should exist in the "cohorts" table:
| Name | Cohort size |
| Cohort in category | 1 |
| Empty cohort | 0 |
Scenario: Add grade categories with data generator
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "grade categories" exist:
| fullname | course |
| Grade category 1 | C1 |
And the following "grade categories" exist:
| fullname | course | gradecategory |
| Grade sub category 2 | C1 | Grade category 1 |
When I log in as "admin"
And I follow "Courses"
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
Then I should see "Grade category 1"
And I should see "Grade sub category 2"
Scenario: Add a bunch of grade items
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "grade categories" exist:
| fullname | course |
| Grade category 1 | C1 |
And the following "grade categories" exist:
| fullname | course | gradecategory |
| Grade sub category 2 | C1 | Grade category 1 |
And the following "grade items" exist:
| itemname | course |
| Test Grade Item 1 | C1 |
And the following "grade items" exist:
| itemname | course | gradecategory |
| Test Grade Item 2 | C1 | Grade category 1 |
| Test Grade Item 3 | C1 | Grade sub category 2 |
When I log in as "admin"
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
And I follow "Categories and items"
Then I should see "Test Grade Item 1"
And I follow "Edit Test Grade Item 1"
And I expand all fieldsets
And I should see "Course 1"
And I press "Cancel"
And I should see "Grade category 1"
And I should see "Test Grade Item 2"
And I follow "Edit Test Grade Item 2"
And I expand all fieldsets
And I should see "Grade category 1"
And I press "Cancel"
And I should see "Grade sub category 2"
And I should see "Test Grade Item 3"
And I follow "Edit Test Grade Item 3"
And I expand all fieldsets
And I should see "Grade sub category 2"
And I press "Cancel"
Scenario: Add a bunch of scales
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "scales" exist:
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
When I log in as "admin"
And I follow "Course 1"
And I follow "Grades"
And I follow "Scales"
Then I should see "Test Scale 1"
And I should see "Disappointing, Good, Very good, Excellent"
Scenario: Add a bunch of outcomes
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "scales" exist:
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | scale |
| Grade outcome 1 | OT1 | Test Scale 1 |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Grade outcome 2 | OT2 | C1 | Test Scale 1 |
When I log in as "admin"
And I set the following administration settings values:
| Enable outcomes | 1 |
And I follow "Home"
And I follow "Course 1"
And I follow "Outcomes"
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
And I should see "Grade outcome 2" in the "#removeoutcomes" "css_element"
And I follow "Edit outcomes"
And the following should exist in the "generaltable" table:
| Full name | Short name | Scale |
| Grade outcome 2 | OT2 | Test Scale 1 |
Scenario: Add a bunch of outcome grade items
Given the following "courses" exist:
| fullname | shortname |
| Course 1 | C1 |
And the following "scales" exist:
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
And the following "grade outcomes" exist:
| fullname | shortname | course | scale |
| Grade outcome 1 | OT1 | C1 | Test Scale 1 |
And the following "grade categories" exist:
| fullname | course |
| Grade category 1 | C1 |
And the following "grade items" exist:
| itemname | course | outcome | gradecategory |
| Test Outcome Grade Item 1 | C1 | OT1 | Grade category 1 |
When I log in as "admin"
And I set the following administration settings values:
| Enable outcomes | 1 |
And I follow "Home"
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
And I follow "Categories and items"
Then I should see "Test Outcome Grade Item 1"
And I follow "Edit Test Outcome Grade Item 1"
And the field "Outcome" matches value "Grade outcome 1"
And I expand all fieldsets
And "//div[contains(@class, 'fitem')]/div[contains(@class, 'fitemtitle')]/div[contains(@class, fstaticlabel) and contains(., 'Grade category')]/../../div[contains(@class, 'felement') and contains(., 'Grade category 1')]" "xpath_element" should exist
And I press "Cancel"
@@ -159,7 +159,6 @@ Feature: Verify that all form fields values can be get and set
And I add a "Lesson" to section "1"
And I set the following fields to these values:
| Name | Test lesson |
| Description | Test lesson description |
| available[enabled] | 1 |
And I set the field "deadline[enabled]" to "1"
# Checkbox (AJAX) - Checking "the field matches value" before saving.
@@ -11,7 +11,6 @@ Feature: Forms manipulation
When I set the field "First name" to "Field value"
And I set the field "Text editor" to "Plain text area"
And I set the field "Unmask" to "1"
And I expand all fieldsets
Then the field "First name" matches value "Field value"
And the "Text editor" select box should contain "Plain text area"
And the field "Unmask" matches value "1"
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014110400; // Requires this Moodle version
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014050800; // Requires this Moodle version
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014110400; // Requires this Moodle version.
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
-3
View File
@@ -48,8 +48,5 @@ function xmldb_tool_customlang_upgrade($oldversion) {
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000;
$plugin->requires = 2014110400;
$plugin->version = 2014051200;
$plugin->requires = 2014050800;
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014110400; // Requires this Moodle version.
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
@@ -308,7 +308,8 @@ class tool_generator_course_backend extends tool_generator_backend {
$username = 'tool_generator_' . $textnumber;
// Create user account.
$record = array('username' => $username, 'idnumber' => $number);
$record = array('firstname' => get_string('firstname', 'tool_generator'),
'lastname' => $number, 'username' => $username);
// We add a user password if it has been specified.
if (!empty($CFG->tool_generator_users_password)) {
@@ -62,6 +62,7 @@ $string['error_nonexistingcourse'] = 'The specified course does not exist';
$string['error_nopageinstances'] = 'The selected course does not contain page module instances';
$string['error_notdebugging'] = 'Not available on this server because debugging is not set to DEVELOPER';
$string['error_nouserspassword'] = 'You need to set $CFG->tool_generator_users_password in config.php to generate the test plan';
$string['firstname'] = 'Test course user';
$string['fullname'] = 'Test course: {$a->size}';
$string['maketestcourse'] = 'Make test course';
$string['maketestplan'] = 'Make JMeter test plan';
@@ -136,7 +136,7 @@ class tool_generator_maketestcourse_testcase extends advanced_testcase {
$lastusernumber = 0;
$discussionstarters = array();
foreach ($discussions as $discussion) {
$usernumber = core_user::get_user($discussion->userid, 'id, idnumber')->idnumber;
$usernumber = intval($discussion->lastname);
// Checks that the users are odd numbers.
$this->assertEquals(1, $usernumber % 2);
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000;
$plugin->requires = 2014110400;
$plugin->version = 2014051200;
$plugin->requires = 2014050800;
$plugin->component = 'tool_generator';
+2 -2
View File
@@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014110400; // Requires this Moodle version
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014050800; // Requires this Moodle version
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014110400; // Requires this Moodle version
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014050800; // Requires this Moodle version
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
@@ -66,7 +66,6 @@ $string['validationmsg_filenotexists'] = 'Extracted file not found';
$string['validationmsg_filesnumber'] = 'Not enough files found in the package';
$string['validationmsg_filestatus'] = 'Unable to extract all files';
$string['validationmsg_filestatus_info'] = 'Attempting to extract file {$a->file} resulted in error \'{$a->status}\'.';
$string['validationmsg_foundlangfile'] = 'Found language file';
$string['validationmsg_maturity'] = 'Declared maturity level';
$string['validationmsg_maturity_help'] = 'The plugin can declare its maturity level. If the maintainer considers the plugin stable, the declared maturity level will read MATURITY_STABLE. All other maturity levels (such as alpha or beta) should be considered unstable and a warning is raised.';
$string['validationmsg_missingexpectedlangenfile'] = 'English language file name mismatch';
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'tool_installaddon';
$plugin->version = 2014111000;
$plugin->requires = 2014110400;
$plugin->version = 2014051200;
$plugin->requires = 2014050800;
$plugin->maturity = MATURITY_STABLE;
@@ -1,211 +0,0 @@
<?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/>.
/**
* Lang import controller
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_langimport;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/componentlib.class.php');
/**
* Lang import controller
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class controller {
/** @var array list of informational messages */
public $info;
/** @var array list of error messages */
public $errors;
/** @var \lang_installer */
private $installer;
/** @var array languages available on the remote server */
public $availablelangs;
/**
* Constructor.
*/
public function __construct() {
make_temp_directory('');
make_upload_directory('lang');
$this->info = array();
$this->errors = array();
$this->installer = new \lang_installer();
$this->availablelangs = $this->installer->get_remote_list_of_languages();
}
/**
* Install language packs provided
*
* @param string|array $langs array of langcodes or individual langcodes
* @param bool $updating true if updating the langpacks
* @return int false if an error encountered or
* @throws \moodle_exception when error is encountered installing langpack
*/
public function install_languagepacks($langs, $updating = false) {
global $CFG;
$this->installer->set_queue($langs);
$results = $this->installer->run();
$updatedpacks = 0;
foreach ($results as $langcode => $langstatus) {
switch ($langstatus) {
case \lang_installer::RESULT_DOWNLOADERROR:
$a = new \stdClass();
$a->url = $this->installer->lang_pack_url($langcode);
$a->dest = $CFG->dataroot.'/lang';
$this->errors[] = get_string('remotedownloaderror', 'error', $a);
throw new \moodle_exception('remotedownloaderror', 'error', $a);
break;
case \lang_installer::RESULT_INSTALLED:
$updatedpacks++;
if ($updating) {
event\langpack_updated::event_with_langcode($langcode)->trigger();
$this->info[] = get_string('langpackupdated', 'tool_langimport', $langcode);
} else {
$this->info[] = get_string('langpackinstalled', 'tool_langimport', $langcode);
event\langpack_imported::event_with_langcode($langcode)->trigger();
}
break;
case \lang_installer::RESULT_UPTODATE:
$this->info[] = get_string('langpackuptodate', 'tool_langimport', $langcode);
break;
}
}
return $updatedpacks;
}
/**
* Uninstall language pack
*
* @param string $lang language code
* @return bool true if language succesfull installed
*/
public function uninstall_language($lang) {
global $CFG;
$dest1 = $CFG->dataroot.'/lang/'.$lang;
$dest2 = $CFG->dirroot.'/lang/'.$lang;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)) {
$rm1 = remove_dir($dest1);
}
if (file_exists($dest2)) {
$rm2 = remove_dir($dest2);
}
if ($rm1 or $rm2) {
$this->info[] = get_string('langpackremoved', 'tool_langimport', $lang);
event\langpack_removed::event_with_langcode($lang)->trigger();
return true;
} else { // Nothing deleted, possibly due to permission error.
$this->errors[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
return false;
}
}
/**
* Updated all install language packs with the latest found on servre
*
* @return bool true if languages succesfully updated.
*/
public function update_all_installed_languages() {
global $CFG;
if (!$availablelangs = $this->installer->get_remote_list_of_languages()) {
$this->errors[] = get_string('cannotdownloadlanguageupdatelist', 'error');
return false;
}
$md5array = array(); // Convert to (string)langcode => (string)md5.
foreach ($availablelangs as $alang) {
$md5array[$alang[0]] = $alang[1];
}
// Filter out unofficial packs.
$currentlangs = array_keys(get_string_manager()->get_list_of_translations(true));
$updateablelangs = array();
foreach ($currentlangs as $clang) {
if (!array_key_exists($clang, $md5array)) {
$this->info[] = get_string('langpackupdateskipped', 'tool_langimport', $clang);
continue;
}
$dest1 = $CFG->dataroot.'/lang/'.$clang;
$dest2 = $CFG->dirroot.'/lang/'.$clang;
if (file_exists($dest1.'/langconfig.php') || file_exists($dest2.'/langconfig.php')) {
$updateablelangs[] = $clang;
}
}
// Filter out packs that have the same md5 key.
$neededlangs = array();
foreach ($updateablelangs as $ulang) {
if (!$this->is_installed_lang($ulang, $md5array[$ulang])) {
$neededlangs[] = $ulang;
}
}
try {
$updated = $this->install_languagepacks($neededlangs, true);
} catch (\moodle_exception $e) {
$this->errors[] = 'An exception occurred while installing language packs: ' . $e->getMessage();
return false;
}
if ($updated) {
$this->info[] = get_string('langupdatecomplete', 'tool_langimport');
} else {
$this->info[] = get_string('nolangupdateneeded', 'tool_langimport');
}
return true;
}
/**
* checks the md5 of the zip file, grabbed from download.moodle.org,
* against the md5 of the local language file from last update
* @param string $lang language code
* @param string $md5check md5 to check
* @return bool true if installed
*/
public function is_installed_lang($lang, $md5check) {
global $CFG;
$md5file = $CFG->dataroot.'/lang/'.$lang.'/'.$lang.'.md5';
if (file_exists($md5file)) {
return (file_get_contents($md5file) == $md5check);
}
return false;
}
}
@@ -1,115 +0,0 @@
<?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/>.
/**
* The langimport langpack imported event.
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_langimport\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_langimport langpack imported event class.
*
* @property-read array $other {
* Extra information about event.
*
* - string langcode: the langpage pack code.
* }
*
* @package tool_langimport
* @since Moodle 2.8
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class langpack_imported extends \core\event\base {
/**
* Create instance of event.
*
* @param string $langcode
* @return langpack_updated
*/
public static function event_with_langcode($langcode) {
$data = array(
'context' => \context_system::instance(),
'other' => array(
'langcode' => $langcode,
)
);
return self::create($data);
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The language pack '{$this->other['langcode']}' was installed.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('langpackinstalledevent', 'tool_langimport');
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/langimport/');
}
/**
* Custom validation.
*
* @throws \coding_exception
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['langcode'])) {
throw new \coding_exception('The \'langcode\' value must be set');
}
// We can't use PARAM_LANG here as the string manager might not be aware of langpack yet.
$cleanedlang = clean_param($this->other['langcode'], PARAM_SAFEDIR);
if ($cleanedlang !== $this->other['langcode']) {
throw new \coding_exception('The \'langcode\' value must be set to a valid language code');
}
}
}
@@ -1,116 +0,0 @@
<?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/>.
/**
* The langimport langpack removed event.
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_langimport\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_langimport langpack removed event class.
*
* @property-read array $other {
* Extra information about event.
*
* - string langcode: the langpage pack code.
* }
*
* @package tool_langimport
* @since Moodle 2.8
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class langpack_removed extends \core\event\base {
/**
* Create instance of event.
*
* @param string $langcode
* @return langpack_updated
*/
public static function event_with_langcode($langcode) {
$data = array(
'context' => \context_system::instance(),
'other' => array(
'langcode' => $langcode,
)
);
return self::create($data);
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The language pack '{$this->other['langcode']}' was removed.";
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/langimport/');
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('langpackremovedevent', 'tool_langimport');
}
/**
* Custom validation.
*
* @throws \coding_exception
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['langcode'])) {
throw new \coding_exception('The \'langcode\' value must be set');
}
// We can't use PARAM_LANG here as it queries installed strings.
$cleanedlang = clean_param($this->other['langcode'], PARAM_SAFEDIR);
if ($cleanedlang !== $this->other['langcode']) {
throw new \coding_exception('The \'langcode\' value must be set to a valid language code');
}
}
}
@@ -1,115 +0,0 @@
<?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/>.
/**
* The langimport langpack updated event.
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_langimport\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_langimport langpack updated event class.
*
* @property-read array $other {
* Extra information about event.
*
* - string langcode: the langpage pack code.
* }
*
* @package tool_langimport
* @since Moodle 2.8
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class langpack_updated extends \core\event\base {
/**
* Create instance of event.
*
* @param string $langcode
* @return langpack_updated
*/
public static function event_with_langcode($langcode) {
$data = array(
'context' => \context_system::instance(),
'other' => array(
'langcode' => $langcode,
)
);
return self::create($data);
}
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The language pack '{$this->other['langcode']}' was updated.";
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('langpackupdatedevent', 'tool_langimport');
}
/**
* Returns relevant URL.
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/langimport/');
}
/**
* Custom validation.
*
* @throws \coding_exception
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['langcode'])) {
throw new \coding_exception('The \'langcode\' value must be set');
}
$cleanedlang = clean_param($this->other['langcode'], PARAM_LANG);
if ($cleanedlang !== $this->other['langcode']) {
throw new \coding_exception('The \'langcode\' value must be set to a valid language code');
}
}
}
@@ -1,71 +0,0 @@
<?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/>.
/**
* A scheduled task for updating langpacks.
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_langimport\task;
/**
* A scheduled task for updating langpacks.
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class update_langpacks_task extends \core\task\scheduled_task {
/**
* Get a descriptive name for this task (shown to admins).
*
* @return string
*/
public function get_name() {
return get_string('updatelangs', 'tool_langimport');
}
/**
* Run langpack update
*/
public function execute() {
global $CFG;
if (!empty($CFG->skiplangupgrade)) {
mtrace('Langpack update skipped. ($CFG->skiplangupgrade set)');
return;
}
$controller = new \tool_langimport\controller();
if ($controller->update_all_installed_languages()) {
foreach ($controller->info as $message) {
mtrace($message);
}
return true;
} else {
foreach ($controller->errors as $message) {
mtrace($message);
}
return false;
}
}
}
-38
View File
@@ -1,38 +0,0 @@
<?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/>.
/**
* Definition of langimport tasks
*
* @package tool_langimport
* @category task
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$tasks = array(
array(
'classname' => 'tool_langimport\task\update_langpacks_task',
'blocking' => 0,
'minute' => 'R',
'hour' => '4',
'day' => '*',
'month' => '*',
'dayofweek' => '*'
)
);
+166 -15
View File
@@ -17,7 +17,7 @@
/**
* Fetches language packages from download.moodle.org server
*
* Language packages are available at https://download.moodle.org/langpack/
* Language packages are available at http://download.moodle.org/langpack/
* in ZIP format together with a file languages.md5 containing their hashes
* and meta info.
* Locally, language packs are saved into $CFG->dataroot/lang/
@@ -28,8 +28,10 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__.'/../../../config.php');
require(dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/componentlib.class.php');
admin_externalpage_setup('toollangimport');
@@ -63,17 +65,37 @@ define('UPDATE_ALL_LANG', 5);
get_string_manager()->reset_caches();
$controller = new tool_langimport\controller();
$notice_ok = array();
$notice_error = array();
if (($mode == INSTALLATION_OF_SELECTED_LANG) and confirm_sesskey() and !empty($pack)) {
core_php_time_limit::raise();
$controller->install_languagepacks($pack);
make_temp_directory('');
make_upload_directory('lang');
$installer = new lang_installer($pack);
$results = $installer->run();
foreach ($results as $langcode => $langstatus) {
switch ($langstatus) {
case lang_installer::RESULT_DOWNLOADERROR:
$a = new stdClass();
$a->url = $installer->lang_pack_url($langcode);
$a->dest = $CFG->dataroot.'/lang';
print_error('remotedownloaderror', 'error', 'index.php', $a);
break;
case lang_installer::RESULT_INSTALLED:
$notice_ok[] = get_string('langpackinstalled', 'tool_langimport', $langcode);
break;
case lang_installer::RESULT_UPTODATE:
$notice_ok[] = get_string('langpackuptodate', 'tool_langimport', $langcode);
break;
}
}
}
if ($mode == DELETION_OF_SELECTED_LANG and !empty($uninstalllang)) {
if ($uninstalllang == 'en') {
// TODO.
$controller->errors[] = 'English language pack can not be uninstalled';
$notice_error[] = 'English language pack can not be uninstalled';
} else if (!$confirm and confirm_sesskey()) {
echo $OUTPUT->header();
@@ -84,13 +106,120 @@ if ($mode == DELETION_OF_SELECTED_LANG and !empty($uninstalllang)) {
die;
} else if (confirm_sesskey()) {
$controller->uninstall_language($uninstalllang);
$dest1 = $CFG->dataroot.'/lang/'.$uninstalllang;
$dest2 = $CFG->dirroot.'/lang/'.$uninstalllang;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)){
$rm1 = remove_dir($dest1);
}
if (file_exists($dest2)){
$rm2 = remove_dir($dest2);
}
if ($rm1 or $rm2) {
$notice_ok[] = get_string('langpackremoved', 'tool_langimport');
} else { //nothing deleted, possibly due to permission error
$notice_error[] = 'An error has occurred, language pack is not completely uninstalled, please check file permissions';
}
}
}
if ($mode == UPDATE_ALL_LANG) {
core_php_time_limit::raise();
$controller->update_all_installed_languages();
$installer = new lang_installer();
if (!$availablelangs = $installer->get_remote_list_of_languages()) {
print_error('cannotdownloadlanguageupdatelist', 'error');
}
$md5array = array(); // (string)langcode => (string)md5
foreach ($availablelangs as $alang) {
$md5array[$alang[0]] = $alang[1];
}
// filter out unofficial packs
$currentlangs = array_keys(get_string_manager()->get_list_of_translations(true));
$updateablelangs = array();
foreach ($currentlangs as $clang) {
if (!array_key_exists($clang, $md5array)) {
$notice_ok[] = get_string('langpackupdateskipped', 'tool_langimport', $clang);
continue;
}
$dest1 = $CFG->dataroot.'/lang/'.$clang;
$dest2 = $CFG->dirroot.'/lang/'.$clang;
if (file_exists($dest1.'/langconfig.php') || file_exists($dest2.'/langconfig.php')){
$updateablelangs[] = $clang;
}
}
// then filter out packs that have the same md5 key
$neededlangs = array(); // all the packs that needs updating
foreach ($updateablelangs as $ulang) {
if (!is_installed_lang($ulang, $md5array[$ulang])) {
$neededlangs[] = $ulang;
}
}
make_temp_directory('');
make_upload_directory('lang');
// clean-up currently installed versions of the packs
foreach ($neededlangs as $packindex => $pack) {
if ($pack == 'en') {
continue;
}
// delete old directories
$dest1 = $CFG->dataroot.'/lang/'.$pack;
$dest2 = $CFG->dirroot.'/lang/'.$pack;
$rm1 = false;
$rm2 = false;
if (file_exists($dest1)) {
if (!remove_dir($dest1)) {
$notice_error[] = 'Could not delete old directory '.$dest1.', update of '.$pack.' failed, please check permissions.';
unset($neededlangs[$packindex]);
continue;
}
}
if (file_exists($dest2)) {
if (!remove_dir($dest2)) {
$notice_error[] = 'Could not delete old directory '.$dest2.', update of '.$pack.' failed, please check permissions.';
unset($neededlangs[$packindex]);
continue;
}
}
}
// install all needed language packs
$installer->set_queue($neededlangs);
$results = $installer->run();
$updated = false; // any packs updated?
foreach ($results as $langcode => $langstatus) {
switch ($langstatus) {
case lang_installer::RESULT_DOWNLOADERROR:
$a = new stdClass();
$a->url = $installer->lang_pack_url($langcode);
$a->dest = $CFG->dataroot.'/lang';
print_error('remotedownloaderror', 'error', 'index.php', $a);
break;
case lang_installer::RESULT_INSTALLED:
$updated = true;
$notice_ok[] = get_string('langpackinstalled', 'tool_langimport', $langcode);
break;
case lang_installer::RESULT_UPTODATE:
$notice_ok[] = get_string('langpackuptodate', 'tool_langimport', $langcode);
break;
}
}
if ($updated) {
$notice_ok[] = get_string('langupdatecomplete', 'tool_langimport');
} else {
$notice_ok[] = get_string('nolangupdateneeded', 'tool_langimport');
}
unset($installer);
}
get_string_manager()->reset_caches();
@@ -110,7 +239,9 @@ foreach ($installedlangs as $installedlang => $unused) {
}
}
if ($availablelangs = $controller->availablelangs) {
$installer = new lang_installer();
if ($availablelangs = $installer->get_remote_list_of_languages()) {
$remote = true;
} else {
$remote = false;
@@ -120,18 +251,18 @@ if ($availablelangs = $controller->availablelangs) {
echo $OUTPUT->box_end();
}
if ($controller->info) {
$info = implode('<br />', $controller->info);
if ($notice_ok) {
$info = implode('<br />', $notice_ok);
echo $OUTPUT->notification($info, 'notifysuccess');
}
if ($controller->errors) {
$info = implode('<br />', $controller->errors);
if ($notice_error) {
$info = implode('<br />', $notice_error);
echo $OUTPUT->notification($info, 'notifyproblem');
}
if ($missingparents) {
foreach ($missingparents as $l => $parent) {
foreach ($missingparents as $l=>$parent) {
$a = new stdClass();
$a->lang = $installedlangs[$l];
$a->parent = $parent;
@@ -175,7 +306,7 @@ echo html_writer::end_tag('td');
// list of available languages
$options = array();
foreach ($availablelangs as $alang) {
if (!empty($alang[0]) and trim($alang[0]) !== 'en' and !$controller->is_installed_lang($alang[0], $alang[1])) {
if (!empty($alang[0]) and trim($alang[0]) !== 'en' and !is_installed_lang($alang[0], $alang[1])) {
$options[$alang[0]] = $alang[2].' ('.$alang[0].')';
}
}
@@ -200,3 +331,23 @@ echo html_writer::end_tag('table');
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
die();
////////////////////////////////////////////////////////////////////////////////
// Local functions /////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
/**
* checks the md5 of the zip file, grabbed from download.moodle.org,
* against the md5 of the local language file from last update
* @param string $lang
* @param string $md5check
* @return bool
*/
function is_installed_lang($lang, $md5check) {
global $CFG;
$md5file = $CFG->dataroot.'/lang/'.$lang.'/'.$lang.'.md5';
if (file_exists($md5file)){
return (file_get_contents($md5file) == $md5check);
}
return false;
}
@@ -27,21 +27,17 @@ $string['install'] = 'Install selected language pack(s)';
$string['installedlangs'] = 'Installed language packs';
$string['langimport'] = 'Language import utility';
$string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level. Do not forget to purge string caches after you do so.';
$string['langpackinstalled'] = 'Language pack \'{$a}\' was successfully installed';
$string['langpackinstalledevent'] = 'Language pack installed';
$string['langpackremoved'] = 'Language pack \'{$a}\' was uninstalled';
$string['langpackremovedevent'] = 'Language pack uninstalled';
$string['langpackupdateskipped'] = 'Update of \'{$a}\' language pack skipped';
$string['langpackuptodate'] = 'Language pack \'{$a}\' is up-to-date';
$string['langpackupdated'] = 'Language pack \'{$a}\' was successfully updated';
$string['langpackupdatedevent'] = 'Language pack updated';
$string['langpackinstalled'] = 'Language pack {$a} was successfully installed';
$string['langpackremoved'] = 'Language pack was uninstalled';
$string['langpackupdateskipped'] = 'Update of {$a} language pack skipped';
$string['langpackuptodate'] = 'Language pack {$a} is up-to-date';
$string['langupdatecomplete'] = 'Language pack update completed';
$string['missingcfglangotherroot'] = 'Missing configuration value $CFG->langotherroot';
$string['missinglangparent'] = 'Missing parent language <em>{$a->parent}</em> of <em>{$a->lang}</em>.';
$string['nolangupdateneeded'] = 'All your language packs are up to date, no update is needed';
$string['pluginname'] = 'Language packs';
$string['purgestringcaches'] = 'Purge string caches';
$string['remotelangnotavailable'] = 'Because Moodle cannot connect to download.moodle.org, it is not possible for language packs to be installed automatically. Please download the appropriate ZIP file(s) from <a href="https://download.moodle.org/langpack/">download.moodle.org/langpack</a>, copy them to your {$a} directory and unzip them manually.';
$string['remotelangnotavailable'] = 'Because Moodle cannot connect to download.moodle.org, it is not possible for language packs to be installed automatically. Please download the appropriate ZIP file(s) from <a href="http://download.moodle.org/langpack/">download.moodle.org/langpack</a>, copy them to your {$a} directory and unzip them manually.';
$string['uninstall'] = 'Uninstall selected language pack';
$string['uninstallconfirm'] = 'You are about to completely uninstall language pack {$a}, are you sure?';
$string['updatelangs'] = 'Update all installed language packs';
@@ -1,81 +0,0 @@
<?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/>.
/**
* Behat steps definitions for Language import tool
*
* @package tool_langimport
* @category test
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
require_once(__DIR__ . '/../../../../../lib/behat/behat_base.php');
use Moodle\BehatExtension\Exception\SkippedException;
/**
* Steps definitions related with the Language import tool
*
* @package tool_langimport
* @category test
* @copyright 2014 Dan Poltawski <dan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class behat_tool_langimport extends behat_base {
/**
* This step looks to see if the remote language import tests should be run (indicated by
* setting TOOL_LANGIMPORT_REMOTE_TESTS in config.php.
*
* @Given /^remote langimport tests are enabled$/
*/
public function remote_langimport_tests_are_enabled() {
if (!defined('TOOL_LANGIMPORT_REMOTE_TESTS')) {
throw new SkippedException('To run the remote langimport tests you must '.
'define TOOL_LANGIMPORT_REMOTE_TESTS in config.php');
}
}
/**
* Downloads a langpack and fakes it being outdated
*
* @param string $langcode The language code (e.g. en)
* @Given /^outdated langpack \'([^\']*)\' is installed$/
*/
public function outdated_langpack_is_installed($langcode) {
global $CFG;
require_once($CFG->libdir.'/componentlib.class.php');
// Download the langpack.
$dir = make_upload_directory('lang');
$installer = new lang_installer($langcode);
$result = $installer->run();
if ($result[$langcode] !== lang_installer::RESULT_INSTALLED) {
throw new coding_exception("Failed to install langpack '$langcode'");
}
$path = "$dir/$langcode/$langcode.md5";
if (!file_exists($path)) {
throw new coding_exception("Failed to find '$langcode' checksum");
}
file_put_contents($path, '000000');
}
}
@@ -1,59 +0,0 @@
@tool @tool_langimport
Feature: Manage language packs
In order to support different languages
As an administrator
I need to be able to add, update and remove language packs
Background:
Given remote langimport tests are enabled
# The pirate language pack is used for testing because its small to download.
Scenario: Install language pack
Given I log in as "admin"
And I navigate to "Language packs" node in "Site administration > Language"
When I set the field "Available language packs" to "English - Pirate (en_ar)"
And I press "Install selected language pack(s)"
Then I should see "Language pack 'en_ar' was successfully installed"
And the "Installed language packs" select box should contain "English - Pirate (en_ar)"
And I navigate to "Live logs" node in "Site administration > Reports"
And I should see "The language pack 'en_ar' was installed."
And I log out
Scenario: Update language pack
Given outdated langpack 'en_ar' is installed
And I log in as "admin"
And I navigate to "Language packs" node in "Site administration > Language"
When I press "Update all installed language packs"
Then I should see "Language pack 'en_ar' was successfully updated"
And I should see "Language pack update completed"
And I navigate to "Live logs" node in "Site administration > Reports"
And I should see "The language pack 'en_ar' was updated."
And I log out
Scenario: Try to uninstall language pack
Given I log in as "admin"
And I navigate to "Language packs" node in "Site administration > Language"
And I set the field "Available language packs" to "English - Pirate (en_ar)"
And I press "Install selected language pack(s)"
When I set the field "Installed language packs" to "English - Pirate (en_ar)"
And I press "Uninstall selected language pack"
And I press "Continue"
Then I should see "Language pack 'en_ar' was uninstalled"
And the "Installed language packs" select box should not contain "English - Pirate (en_ar)"
And the "Available language packs" select box should contain "English - Pirate (en_ar)"
And I navigate to "Live logs" node in "Site administration > Reports"
And I should see "The language pack 'en_ar' was removed."
And I should see "Language pack uninstalled"
And I log out
Scenario: Try to uninstall English language pack
Given I log in as "admin"
And I navigate to "Language packs" node in "Site administration > Language"
When I set the field "Installed language packs" to "English (en)"
And I press "Uninstall selected language pack"
Then I should see "English language pack can not be uninstalled"
And I navigate to "Live logs" node in "Site administration > Reports"
And I should not see "Language pack uninstalled"
And I log out
-102
View File
@@ -1,102 +0,0 @@
<?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/>.
/**
* Tests for langimport events.
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
defined('MOODLE_INTERNAL') || die();
/**
* Test class for langimport events.
*
* @package tool_langimport
* @copyright 2014 Dan Poltawski
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/
class tool_langimport_events_testcase extends advanced_testcase {
/**
* Setup testcase.
*/
public function setUp() {
$this->setAdminUser();
$this->resetAfterTest();
}
public function test_langpack_updated() {
global $CFG;
$event = \tool_langimport\event\langpack_updated::event_with_langcode($CFG->lang);
// Trigger and capture the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$event = reset($events);
$this->assertInstanceOf('\tool_langimport\event\langpack_updated', $event);
$this->assertEquals(context_system::instance(), $event->get_context());
}
public function test_langpack_updated_validation() {
$this->setExpectedException('coding_exception', 'The \'langcode\' value must be set to a valid language code');
\tool_langimport\event\langpack_updated::event_with_langcode('broken langcode');
}
public function test_langpack_installed() {
$event = \tool_langimport\event\langpack_imported::event_with_langcode('fr');
// Trigger and capture the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$event = reset($events);
$this->assertInstanceOf('\tool_langimport\event\langpack_imported', $event);
$this->assertEquals(context_system::instance(), $event->get_context());
}
public function test_langpack_installed_validation() {
$this->setExpectedException('coding_exception', 'The \'langcode\' value must be set to a valid language code');
\tool_langimport\event\langpack_imported::event_with_langcode('broken langcode');
}
public function test_langpack_removed() {
$event = \tool_langimport\event\langpack_removed::event_with_langcode('fr');
// Trigger and capture the event.
$sink = $this->redirectEvents();
$event->trigger();
$events = $sink->get_events();
$event = reset($events);
$this->assertInstanceOf('\tool_langimport\event\langpack_removed', $event);
$this->assertEquals(context_system::instance(), $event->get_context());
}
public function test_langpack_removed_validation() {
$this->setExpectedException('coding_exception', 'The \'langcode\' value must be set to a valid language code');
\tool_langimport\event\langpack_removed::event_with_langcode('broken langcode');
}
}
+2 -2
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014110400; // Requires this Moodle version
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2014050800; // Requires this Moodle version
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
+2 -5
View File
@@ -213,14 +213,11 @@ class manager implements \core\log\manager {
* @param string $info Additional description information
* @param int $cm The course_module->id if there is one
* @param int|\stdClass $user If log regards $user other than $USER
* @param string $ip Override the IP, should only be used for restore.
* @param int $time Override the log time, should only be used for restore.
*/
public function legacy_add_to_log($courseid, $module, $action, $url = '', $info = '',
$cm = 0, $user = 0, $ip = null, $time = null) {
public function legacy_add_to_log($courseid, $module, $action, $url = '', $info = '', $cm = 0, $user = 0) {
$this->init();
if (isset($this->stores['logstore_legacy'])) {
$this->stores['logstore_legacy']->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user, $ip, $time);
$this->stores['logstore_legacy']->legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user);
}
}
}
-3
View File
@@ -46,8 +46,5 @@ function xmldb_tool_log_upgrade($oldversion) {
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -36,8 +36,5 @@ function xmldb_logstore_database_upgrade($oldversion) {
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014110400; // Requires this Moodle version.
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
@@ -143,10 +143,8 @@ class store implements \tool_log\log\store, \core\log\sql_select_reader {
* @param string $info Additional description information
* @param int $cm The course_module->id if there is one
* @param int|\stdClass $user If log regards $user other than $USER
* @param string $ip Override the IP, should only be used for restore.
* @param int $time Override the log time, should only be used for restore.
*/
public function legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user, $ip = null, $time = null) {
public function legacy_add_to_log($courseid, $module, $action, $url, $info, $cm, $user) {
// Note that this function intentionally does not follow the normal Moodle DB access idioms.
// This is for a good reason: it is the most frequently used DB update function,
// so it has been optimised for speed.
@@ -174,9 +172,9 @@ class store implements \tool_log\log\store, \core\log\sql_select_reader {
}
}
$remoteaddr = (is_null($ip)) ? getremoteaddr() : $ip;
$remoteaddr = getremoteaddr();
$timenow = (is_null($time)) ? time() : $time;
$timenow = time();
if (!empty($url)) { // Could break doing html_entity_decode on an empty var.
$url = html_entity_decode($url, ENT_QUOTES, 'UTF-8');
} else {
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014110400; // Requires this Moodle version.
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'logstore_legacy'; // Full name of the plugin (used for diagnostics).
@@ -114,8 +114,5 @@ function xmldb_logstore_standard_upgrade($oldversion) {
// Moodle v2.7.0 release upgrade line.
// Put any upgrade step following this.
// Moodle v2.8.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014110400; // Requires this Moodle version.
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
+2 -2
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2014111000; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014110400; // Requires this Moodle version.
$plugin->version = 2014051200; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014050800; // Requires this Moodle version.
$plugin->component = 'tool_log'; // Full name of the plugin (used for diagnostics).
@@ -1,139 +0,0 @@
<?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/>.
/**
* Form to edit handlers.
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/formslib.php');
/**
* Form to edit handlers.
*
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_messageinbound_edit_handler_form extends moodleform {
public function definition() {
$mform = $this->_form;
$handler = $this->_customdata['handler'];
// Set up the options for formatting text for descriptions, etc.
$formatoptions = new stdClass();
$formatoptions->trusted = false;
$formatoptions->noclean = false;
$formatoptions->smiley = false;
$formatoptions->filter = false;
$formatoptions->para = true;
$formatoptions->newlines = false;
$formatoptions->overflowdiv = true;
// General information about the handler.
$mform->addElement('header', 'general', get_string('general'));
$mform->addElement('static', 'name', get_string('name', 'tool_messageinbound'),
$handler->name);
$mform->addElement('static', 'classname', get_string('classname', 'tool_messageinbound'));
$description = format_text($handler->description, FORMAT_MARKDOWN, $formatoptions);
$mform->addElement('static', 'description', get_string('description', 'tool_messageinbound'),
$description);
// Items which can be configured.
$mform->addElement('header', 'configuration', get_string('configuration'));
if ($handler->can_change_defaultexpiration()) {
// Show option to change expiry only if the handler supports it.
$options = array(
HOURSECS => get_string('onehour', 'tool_messageinbound'),
DAYSECS => get_string('oneday', 'tool_messageinbound'),
WEEKSECS => get_string('oneweek', 'tool_messageinbound'),
YEARSECS => get_string('oneyear', 'tool_messageinbound'),
0 => get_string('noexpiry', 'tool_messageinbound'),
);
$mform->addElement('select', 'defaultexpiration', get_string('defaultexpiration', 'tool_messageinbound'), $options);
$mform->addHelpButton('defaultexpiration', 'defaultexpiration', 'tool_messageinbound');
} else {
$text = $this->get_defaultexpiration_text($handler);
$mform->addElement('static', 'defaultexpiration_fake', get_string('defaultexpiration', 'tool_messageinbound'), $text);
$mform->addElement('hidden', 'defaultexpiration');
$mform->addHelpButton('defaultexpiration_fake', 'defaultexpiration', 'tool_messageinbound');
$mform->setType('defaultexpiration', PARAM_INT);
}
if ($handler->can_change_validateaddress()) {
$mform->addElement('checkbox', 'validateaddress', get_string('requirevalidation', 'tool_messageinbound'));
$mform->addHelpButton('validateaddress', 'validateaddress', 'tool_messageinbound');
} else {
if ($handler->validateaddress) {
$text = get_string('yes');
} else {
$text = get_string('no');
}
$mform->addElement('static', 'validateaddress_fake', get_string('requirevalidation', 'tool_messageinbound'), $text);
$mform->addElement('hidden', 'validateaddress');
$mform->addHelpButton('validateaddress_fake', 'fixedvalidateaddress', 'tool_messageinbound');
$mform->setType('validateaddress', PARAM_INT);
}
if ($handler->can_change_enabled()) {
$mform->addElement('checkbox', 'enabled', get_string('enabled', 'tool_messageinbound'));
} else {
if ($handler->enabled) {
$text = get_string('yes');
} else {
$text = get_string('no');
}
$mform->addElement('static', 'enabled_fake', get_string('enabled', 'tool_messageinbound'), $text);
$mform->addHelpButton('enabled', 'fixedenabled', 'tool_messageinbound');
$mform->addElement('hidden', 'enabled');
$mform->setType('enabled', PARAM_INT);
}
$this->add_action_buttons(true, get_string('savechanges'));
}
/**
* Return a text string representing the selected default expiration for the handler.
*
* @param \core\message\inbound\handler $handler handler instance.
*
* @return string localised text string.
*/
protected function get_defaultexpiration_text(\core\message\inbound\handler $handler) {
switch($handler->defaultexpiration) {
case HOURSECS :
return get_string('onehour', 'tool_messageinbound');
case DAYSECS :
return get_string('oneday', 'tool_messageinbound');
case WEEKSECS :
return get_string('oneweek', 'tool_messageinbound');
case YEARSECS :
return get_string('oneyear', 'tool_messageinbound');
case 0:
return get_string('noexpiry', 'tool_messageinbound');
default:
return ''; // Should never happen.
}
}
}
@@ -1,998 +0,0 @@
<?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/>.
/**
* The Mail Pickup Manager.
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_messageinbound;
defined('MOODLE_INTERNAL') || die();
/**
* Mail Pickup Manager.
*
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class manager {
/**
* @var string The main mailbox to check.
*/
const MAILBOX = 'INBOX';
/**
* @var string The mailbox to store messages in when they are awaiting confirmation.
*/
const CONFIRMATIONFOLDER = 'tobeconfirmed';
/**
* @var string The flag for seen/read messages.
*/
const MESSAGE_SEEN = '\seen';
/**
* @var string The flag for flagged messages.
*/
const MESSAGE_FLAGGED = '\flagged';
/**
* @var string The flag for deleted messages.
*/
const MESSAGE_DELETED = '\deleted';
/**
* @var Horde_Imap_Client_Socket A reference to the IMAP client.
*/
protected $client = null;
/**
* @var \core\message\inbound\address_manager A reference to the Inbound Message Address Manager instance.
*/
protected $addressmanager = null;
/**
* @var stdClass The data for the current message being processed.
*/
protected $currentmessagedata = null;
/**
* Retrieve the connection to the IMAP client.
*
* @return bool Whether a connection was successfully established.
*/
protected function get_imap_client() {
global $CFG;
if (!\core\message\inbound\manager::is_enabled()) {
// E-mail processing not set up.
mtrace("Inbound Message not fully configured - exiting early.");
return false;
}
mtrace("Connecting to {$CFG->messageinbound_host} as {$CFG->messageinbound_hostuser}...");
$configuration = array(
'username' => $CFG->messageinbound_hostuser,
'password' => $CFG->messageinbound_hostpass,
'hostspec' => $CFG->messageinbound_host,
'secure' => $CFG->messageinbound_hostssl,
);
$this->client = new \Horde_Imap_Client_Socket($configuration);
try {
$this->client->login();
mtrace("Connection established.");
return true;
} catch (\Horde_Imap_Client_Exception $e) {
$message = $e->getMessage();
mtrace("Unable to connect to IMAP server. Failed with '{$message}'");
return false;
}
}
/**
* Shutdown and close the connection to the IMAP client.
*/
protected function close_connection() {
if ($this->client) {
$this->client->close();
}
$this->client = null;
}
/**
* Get the current mailbox information.
*
* @return \Horde_Imap_Client_Mailbox
*/
protected function get_mailbox() {
// Get the current mailbox.
$mailbox = $this->client->currentMailbox();
if (isset($mailbox['mailbox'])) {
return $mailbox['mailbox'];
} else {
throw new \core\message\inbound\processing_failed_exception('couldnotopenmailbox', 'tool_messageinbound');
}
}
/**
* Execute the main Inbound Message pickup task.
*/
public function pickup_messages() {
if (!$this->get_imap_client()) {
return false;
}
// Restrict results to messages which are unseen, and have not been flagged.
$search = new \Horde_Imap_Client_Search_Query();
$search->flag(self::MESSAGE_SEEN, false);
$search->flag(self::MESSAGE_FLAGGED, false);
mtrace("Searching for Unseen, Unflagged email in the folder '" . self::MAILBOX . "'");
$results = $this->client->search(self::MAILBOX, $search);
// We require the envelope data and structure of each message.
$query = new \Horde_Imap_Client_Fetch_Query();
$query->envelope();
$query->structure();
// Retrieve the message id.
$messages = $this->client->fetch(self::MAILBOX, $query, array('ids' => $results['match']));
mtrace("Found " . $messages->count() . " messages to parse. Parsing...");
$this->addressmanager = new \core\message\inbound\address_manager();
foreach ($messages as $message) {
$this->process_message($message);
}
// Close the client connection.
$this->close_connection();
return true;
}
/**
* Process a message received and validated by the Inbound Message processor.
*
* @param stdClass $maildata The data retrieved from the database for the current record.
* @return bool Whether the message was successfully processed.
*/
public function process_existing_message(\stdClass $maildata) {
// Grab the new IMAP client.
if (!$this->get_imap_client()) {
return false;
}
// Build the search.
$search = new \Horde_Imap_Client_Search_Query();
// When dealing with Inbound Message messages, we mark them as flagged and seen. Restrict the search to those criterion.
$search->flag(self::MESSAGE_SEEN, true);
$search->flag(self::MESSAGE_FLAGGED, true);
mtrace("Searching for a Seen, Flagged message in the folder '" . self::CONFIRMATIONFOLDER . "'");
// Match the message ID.
$search->headerText('message-id', $maildata->messageid);
$search->headerText('to', $maildata->address);
$results = $this->client->search(self::CONFIRMATIONFOLDER, $search);
// Build the base query.
$query = new \Horde_Imap_Client_Fetch_Query();
$query->envelope();
$query->structure();
// Fetch the first message from the client.
$messages = $this->client->fetch(self::CONFIRMATIONFOLDER, $query, array('ids' => $results['match']));
$this->addressmanager = new \core\message\inbound\address_manager();
if ($message = $messages->first()) {
mtrace("--> Found the message. Passing back to the pickup system.");
// Process the message.
$this->process_message($message, true, true);
// Close the client connection.
$this->close_connection();
mtrace("============================================================================");
return true;
} else {
// Close the client connection.
$this->close_connection();
mtrace("============================================================================");
throw new \core\message\inbound\processing_failed_exception('oldmessagenotfound', 'tool_messageinbound');
}
}
/**
* Tidy up old messages in the confirmation folder.
*
* @return bool Whether tidying occurred successfully.
*/
public function tidy_old_messages() {
// Grab the new IMAP client.
if (!$this->get_imap_client()) {
return false;
}
// Open the mailbox.
mtrace("Searching for messages older than 24 hours in the '" .
self::CONFIRMATIONFOLDER . "' folder.");
$this->client->openMailbox(self::CONFIRMATIONFOLDER);
$mailbox = $this->get_mailbox();
// Build the search.
$search = new \Horde_Imap_Client_Search_Query();
// Delete messages older than 24 hours old.
$search->intervalSearch(DAYSECS, \Horde_Imap_Client_Search_Query::INTERVAL_OLDER);
$results = $this->client->search($mailbox, $search);
// Build the base query.
$query = new \Horde_Imap_Client_Fetch_Query();
$query->envelope();
// Retrieve the messages and mark them for removal.
$messages = $this->client->fetch($mailbox, $query, array('ids' => $results['match']));
mtrace("Found " . $messages->count() . " messages for removal.");
foreach ($messages as $message) {
$this->add_flag_to_message($message->getUid(), self::MESSAGE_DELETED);
}
mtrace("Finished removing messages.");
$this->close_connection();
return true;
}
/**
* Process a message and pass it through the Inbound Message handling systems.
*
* @param Horde_Imap_Client_Data_Fetch $message The message to process
* @param bool $viewreadmessages Whether to also look at messages which have been marked as read
* @param bool $skipsenderverification Whether to skip the sender verificiation stage
*/
public function process_message(
\Horde_Imap_Client_Data_Fetch $message,
$viewreadmessages = false,
$skipsenderverification = false) {
global $USER;
// We use the Client IDs several times - store them here.
$messageid = new \Horde_Imap_Client_Ids($message->getUid());
mtrace("- Parsing message " . $messageid);
// First flag this message to prevent another running hitting this message while we look at the headers.
$this->add_flag_to_message($messageid, self::MESSAGE_FLAGGED);
if ($this->is_bulk_message($message, $messageid)) {
mtrace("- The message has a bulk header set. This is likely an auto-generated reply - discarding.");
return;
}
// Record the user that this script is currently being run as. This is important when re-processing existing
// messages, as cron_setup_user is called multiple times.
$originaluser = $USER;
$envelope = $message->getEnvelope();
$recipients = $envelope->to->bare_addresses;
foreach ($recipients as $recipient) {
if (!\core\message\inbound\address_manager::is_correct_format($recipient)) {
// Message did not contain a subaddress.
mtrace("- Recipient '{$recipient}' did not match Inbound Message headers.");
continue;
}
// Message contained a match.
$senders = $message->getEnvelope()->from->bare_addresses;
if (count($senders) !== 1) {
mtrace("- Received multiple senders. Only the first sender will be used.");
}
$sender = array_shift($senders);
mtrace("-- Subject:\t" . $envelope->subject);
mtrace("-- From:\t" . $sender);
mtrace("-- Recipient:\t" . $recipient);
// Grab messagedata including flags.
$query = new \Horde_Imap_Client_Fetch_Query();
$query->structure();
$messagedata = $this->client->fetch($this->get_mailbox(), $query, array(
'ids' => $messageid,
))->first();
if (!$viewreadmessages && $this->message_has_flag($messageid, self::MESSAGE_SEEN)) {
// Something else has already seen this message. Skip it now.
mtrace("-- Skipping the message - it has been marked as seen - perhaps by another process.");
continue;
}
// Mark it as read to lock the message.
$this->add_flag_to_message($messageid, self::MESSAGE_SEEN);
// Now pass it through the Inbound Message processor.
$status = $this->addressmanager->process_envelope($recipient, $sender);
if (($status & ~ \core\message\inbound\address_manager::VALIDATION_DISABLED_HANDLER) !== $status) {
// The handler is disabled.
mtrace("-- Skipped message - Handler is disabled. Fail code {$status}");
// In order to handle the user error, we need more information about the message being failed.
$this->process_message_data($envelope, $messagedata, $messageid);
$this->inform_user_of_error(get_string('handlerdisabled', 'tool_messageinbound', $this->currentmessagedata));
return;
}
// Check the validation status early. No point processing garbage messages, but we do need to process it
// for some validation failure types.
if (!$this->passes_key_validation($status, $messageid)) {
// None of the above validation failures were found. Skip this message.
mtrace("-- Skipped message - it does not appear to relate to a Inbound Message pickup. Fail code {$status}");
// Remove the seen flag from the message as there may be multiple recipients.
$this->remove_flag_from_message($messageid, self::MESSAGE_SEEN);
// Skip further processing for this recipient.
continue;
}
// Process the message as the user.
$user = $this->addressmanager->get_data()->user;
mtrace("-- Processing the message as user {$user->id} ({$user->username}).");
cron_setup_user($user);
// Process and retrieve the message data for this message.
// This includes fetching the full content, as well as all headers, and attachments.
if (!$this->process_message_data($envelope, $messagedata, $messageid)) {
mtrace("--- Message could not be found on the server. Is another process removing messages?");
return;
}
// When processing validation replies, we need to skip the sender verification phase as this has been
// manually completed.
if (!$skipsenderverification && $status !== 0) {
// Check the validation status for failure types which require confirmation.
// The validation result is tested in a bitwise operation.
mtrace("-- Message did not meet validation but is possibly recoverable. Fail code {$status}");
// This is a recoverable error, but requires user input.
if ($this->handle_verification_failure($messageid, $recipient)) {
mtrace("--- Original message retained on mail server and confirmation message sent to user.");
} else {
mtrace("--- Invalid Recipient Handler - unable to save. Informing the user of the failure.");
$this->inform_user_of_error(get_string('invalidrecipientfinal', 'tool_messageinbound', $this->currentmessagedata));
}
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
return;
}
// Add the content and attachment data.
mtrace("-- Validation completed. Fetching rest of message content.");
$this->process_message_data_body($messagedata, $messageid);
// The message processor throws exceptions upon failure. These must be caught and notifications sent to
// the user here.
try {
$result = $this->send_to_handler();
} catch (\core\message\inbound\processing_failed_exception $e) {
// We know about these kinds of errors and they should result in the user being notified of the
// failure. Send the user a notification here.
$this->inform_user_of_error($e->getMessage());
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
return;
} catch (\Exception $e) {
// An unknown error occurred. The user is not informed, but the administrator is.
mtrace("-- Message processing failed. An unexpected exception was thrown. Details follow.");
mtrace($e->getMessage());
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
return;
}
if ($result) {
// Handle message cleanup. Messages are deleted once fully processed.
mtrace("-- Marking the message for removal.");
$this->add_flag_to_message($messageid, self::MESSAGE_DELETED);
} else {
mtrace("-- The Inbound Message processor did not return a success status. Skipping message removal.");
}
// Returning to normal cron user.
mtrace("-- Returning to the original user.");
cron_setup_user($originaluser);
mtrace("-- Finished processing " . $message->getUid());
// Skip the outer loop too. The message has already been processed and it could be possible for there to
// be two recipients in the envelope which match somehow.
return;
}
}
/**
* Process a message to retrieve it's header data without body and attachemnts.
*
* @param Horde_Imap_Client_Data_Envelope $envelope The Envelope of the message
* @param Horde_Imap_Client_Data_Fetch $messagedata The structure and part of the message body
* @param string|Horde_Imap_Client_Ids $messageid The Hore message Uid
* @return \stdClass The current value of the messagedata
*/
private function process_message_data(
\Horde_Imap_Client_Data_Envelope $envelope,
\Horde_Imap_Client_Data_Fetch $basemessagedata,
$messageid) {
// Get the current mailbox.
$mailbox = $this->get_mailbox();
// We need the structure at various points below.
$structure = $basemessagedata->getStructure();
// Now fetch the rest of the message content.
$query = new \Horde_Imap_Client_Fetch_Query();
$query->imapDate();
// Fetch the message header.
$query->headerText();
// Retrieve the message with the above components.
$messagedata = $this->client->fetch($mailbox, $query, array('ids' => $messageid))->first();
if (!$messagedata) {
// Message was not found! Somehow it has been removed or is no longer returned.
return null;
}
// The message ID should always be in the first part.
$data = new \stdClass();
$data->messageid = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('Message-ID');
$data->subject = $envelope->subject;
$data->timestamp = $messagedata->getImapDate()->__toString();
$data->envelope = $envelope;
$data->data = $this->addressmanager->get_data();
$data->headers = $messagedata->getHeaderText();
$this->currentmessagedata = $data;
return $this->currentmessagedata;
}
/**
* Process a message again to add body and attachment data.
*
* @param \Horde_Imap_Client_Data_Fetch $basemessagedata The structure and part of the message body
* @param string|\Horde_Imap_Client_Ids $messageid The Hore message Uid
* @return \stdClass The current value of the messagedata
*/
private function process_message_data_body(
\Horde_Imap_Client_Data_Fetch $basemessagedata,
$messageid) {
global $CFG;
// Get the current mailbox.
$mailbox = $this->get_mailbox();
// We need the structure at various points below.
$structure = $basemessagedata->getStructure();
// Now fetch the rest of the message content.
$query = new \Horde_Imap_Client_Fetch_Query();
$query->fullText();
// Fetch all of the message parts too.
$typemap = $structure->contentTypeMap();
foreach ($typemap as $part => $type) {
// The body of the part - attempt to decode it on the server.
$query->bodyPart($part, array(
'decode' => true,
'peek' => true,
));
$query->bodyPartSize($part);
}
$messagedata = $this->client->fetch($mailbox, $query, array('ids' => $messageid))->first();
// Store the data for this message.
$contentplain = '';
$contenthtml = '';
$attachments = array(
'inline' => array(),
'attachment' => array(),
);
$plainpartid = $structure->findBody('plain');
$htmlpartid = $structure->findBody('html');
foreach ($typemap as $part => $type) {
// Get the message data from the body part, and combine it with the structure to give a fully-formed output.
$stream = $messagedata->getBodyPart($part, true);
$partdata = $structure->getPart($part);
$partdata->setContents($stream, array(
'usestream' => true,
));
if ($part === $plainpartid) {
$contentplain = $this->process_message_part_body($messagedata, $partdata, $part);
} else if ($part === $htmlpartid) {
$contenthtml = $this->process_message_part_body($messagedata, $partdata, $part);
} else if ($filename = $partdata->getName($part)) {
if ($attachment = $this->process_message_part_attachment($messagedata, $partdata, $part, $filename)) {
// The disposition should be one of 'attachment', 'inline'.
// If an empty string is provided, default to 'attachment'.
$disposition = $partdata->getDisposition();
$disposition = $disposition == 'inline' ? 'inline' : 'attachment';
$attachments[$disposition][] = $attachment;
}
}
// We don't handle any of the other MIME content at this stage.
}
// The message ID should always be in the first part.
$this->currentmessagedata->plain = $contentplain;
$this->currentmessagedata->html = $contenthtml;
$this->currentmessagedata->attachments = $attachments;
return $this->currentmessagedata;
}
/**
* Process the messagedata and part data to extract the content of this part.
*
* @param $messagedata The structure and part of the message body
* @param $partdata The part data
* @param $part The part ID
* @return string
*/
private function process_message_part_body($messagedata, $partdata, $part) {
// This is a content section for the main body.
// Get the string version of it.
$content = $messagedata->getBodyPart($part);
if (!$messagedata->getBodyPartDecode($part)) {
// Decode the content.
$partdata->setContents($content);
$content = $partdata->getContents();
}
// Convert the text from the current encoding to UTF8.
$content = \core_text::convert($content, $partdata->getCharset());
// Fix any invalid UTF8 characters.
// Note: XSS cleaning is not the responsibility of this code. It occurs immediately before display when
// format_text is called.
$content = clean_param($content, PARAM_RAW);
return $content;
}
/**
* Process a message again to add body and attachment data.
*
* @param $messagedata The structure and part of the message body
* @param $partdata The part data
* @param $filename The filename of the attachment
* @return \stdClass
*/
private function process_message_part_attachment($messagedata, $partdata, $part, $filename) {
global $CFG;
// For Antivirus, the repository/lib.php must be included as it is not autoloaded.
require_once($CFG->dirroot . '/repository/lib.php');
// If a filename is present, assume that this part is an attachment.
$attachment = new \stdClass();
$attachment->filename = $filename;
$attachment->type = $partdata->getType();
$attachment->content = $partdata->getContents();
$attachment->charset = $partdata->getCharset();
$attachment->description = $partdata->getDescription();
$attachment->contentid = $partdata->getContentId();
$attachment->filesize = $messagedata->getBodyPartSize($part);
if (empty($CFG->runclamonupload) or empty($CFG->pathtoclam)) {
mtrace("--> Attempting virus scan of '{$attachment->filename}'");
// Store the file on disk - it will need to be virus scanned first.
$itemid = rand(1, 999999999);;
$directory = make_temp_directory("/messageinbound/{$itemid}", false);
$filepath = $directory . "/" . $attachment->filename;
if (!$fp = fopen($filepath, "w")) {
// Unable to open the temporary file to write this to disk.
mtrace("--> Unable to save the file to disk for virus scanning. Check file permissions.");
throw new \core\message\inbound\processing_failed_exception('attachmentfilepermissionsfailed',
'tool_messageinbound');
}
fwrite($fp, $attachment->content);
fclose($fp);
// Perform a virus scan now.
try {
\repository::antivir_scan_file($filepath, $attachment->filename, true);
} catch (\moodle_exception $e) {
mtrace("--> A virus was found in the attachment '{$attachment->filename}'.");
$this->inform_attachment_virus();
return;
}
}
return $attachment;
}
/**
* Check whether the key provided is valid.
*
* @param $status The Message to process
* @param $messageid The Hore message Uid
* @return bool
*/
private function passes_key_validation($status, $messageid) {
// The validation result is tested in a bitwise operation.
if ((
$status & ~ \core\message\inbound\address_manager::VALIDATION_SUCCESS
& ~ \core\message\inbound\address_manager::VALIDATION_UNKNOWN_DATAKEY
& ~ \core\message\inbound\address_manager::VALIDATION_EXPIRED_DATAKEY
& ~ \core\message\inbound\address_manager::VALIDATION_INVALID_HASH
& ~ \core\message\inbound\address_manager::VALIDATION_ADDRESS_MISMATCH) !== 0) {
// One of the above bits was found in the status - fail the validation.
return false;
}
return true;
}
/**
* Add the specified flag to the message.
*
* @param $messageid
* @param string $flag The flag to add
*/
private function add_flag_to_message($messageid, $flag) {
// Get the current mailbox.
$mailbox = $this->get_mailbox();
// Mark it as read to lock the message.
$this->client->store($mailbox, array(
'ids' => new \Horde_Imap_Client_Ids($messageid),
'add' => $flag,
));
}
/**
* Remove the specified flag from the message.
*
* @param $messageid
* @param string $flag The flag to remove
*/
private function remove_flag_from_message($messageid, $flag) {
// Get the current mailbox.
$mailbox = $this->get_mailbox();
// Mark it as read to lock the message.
$this->client->store($mailbox, array(
'ids' => $messageid,
'delete' => $flag,
));
}
/**
* Check whether the message has the specified flag
*
* @param $messageid
* @param string $flag The flag to check
* @return bool
*/
private function message_has_flag($messageid, $flag) {
// Get the current mailbox.
$mailbox = $this->get_mailbox();
// Grab messagedata including flags.
$query = new \Horde_Imap_Client_Fetch_Query();
$query->flags();
$query->structure();
$messagedata = $this->client->fetch($mailbox, $query, array(
'ids' => $messageid,
))->first();
$flags = $messagedata->getFlags();
return in_array($flag, $flags);
}
/**
* Attempt to determine whether this message is a bulk message (e.g. automated reply).
*
* @param \Horde_Imap_Client_Data_Fetch $message The message to process
* @param string|\Horde_Imap_Client_Ids $messageid The Hore message Uid
* @return boolean
*/
private function is_bulk_message(
\Horde_Imap_Client_Data_Fetch $message,
$messageid) {
$query = new \Horde_Imap_Client_Fetch_Query();
$query->headerText(array('peek' => true));
$messagedata = $this->client->fetch($this->get_mailbox(), $query, array('ids' => $messageid))->first();
// Assume that this message is not bulk to begin with.
$isbulk = false;
// An auto-reply may itself include the Bulk Precedence.
$precedence = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('Precedence');
$isbulk = $isbulk || strtolower($precedence) == 'bulk';
// If the X-Autoreply header is set, and not 'no', then this is an automatic reply.
$autoreply = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('X-Autoreply');
$isbulk = $isbulk || ($autoreply && $autoreply != 'no');
// If the X-Autorespond header is set, and not 'no', then this is an automatic response.
$autorespond = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('X-Autorespond');
$isbulk = $isbulk || ($autorespond && $autorespond != 'no');
// If the Auto-Submitted header is set, and not 'no', then this is a non-human response.
$autosubmitted = $messagedata->getHeaderText(0, \Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->getValue('Auto-Submitted');
$isbulk = $isbulk || ($autosubmitted && $autosubmitted != 'no');
return $isbulk;
}
/**
* Send the message to the appropriate handler.
*
*/
private function send_to_handler() {
try {
mtrace("--> Passing to Inbound Message handler {$this->addressmanager->get_handler()->classname}");
if ($result = $this->addressmanager->handle_message($this->currentmessagedata)) {
$this->inform_user_of_success($this->currentmessagedata, $result);
// Request that this message be marked for deletion.
return true;
}
} catch (\core\message\inbound\processing_failed_exception $e) {
mtrace("-> The Inbound Message handler threw an exception. Unable to process this message. The user has been informed.");
mtrace("--> " . $e->getMessage());
// Throw the exception again, with additional data.
$error = new \stdClass();
$error->subject = $this->currentmessagedata->envelope->subject;
$error->message = $e->getMessage();
throw new \core\message\inbound\processing_failed_exception('messageprocessingfailed', 'tool_messageinbound', $error);
} catch (\Exception $e) {
mtrace("-> The Inbound Message handler threw an exception. Unable to process this message. User informed.");
mtrace("--> " . $e->getMessage());
// An unknown error occurred. Still inform the user but, this time do not include the specific
// message information.
$error = new \stdClass();
$error->subject = $this->currentmessagedata->envelope->subject;
throw new \core\message\inbound\processing_failed_exception('messageprocessingfailedunknown',
'tool_messageinbound', $error);
}
// Something went wrong and the message was not handled well in the Inbound Message handler.
mtrace("-> The Inbound Message handler reported an error. The message may not have been processed.");
// It is the responsiblity of the handler to throw an appropriate exception if the message was not processed.
// Do not inform the user at this point.
return false;
}
/**
* Handle failure of sender verification.
*
* This will send a notification to the user identified in the Inbound Message address informing them that a message has been
* stored. The message includes a verification link and reply-to address which is handled by the
* invalid_recipient_handler.
*
* @param $recipient The message recipient
*/
private function handle_verification_failure(
\Horde_Imap_Client_Ids $messageids,
$recipient) {
global $DB, $USER;
if (!$messageid = $this->currentmessagedata->messageid) {
mtrace("---> Warning: Unable to determine the Message-ID of the message.");
return false;
}
// Move the message into a new mailbox.
$this->client->copy(self::MAILBOX, self::CONFIRMATIONFOLDER, array(
'create' => true,
'ids' => $messageids,
'move' => true,
));
// Store the data from the failed message in the associated table.
$record = new \stdClass();
$record->messageid = $messageid;
$record->userid = $USER->id;
$record->address = $recipient;
$record->timecreated = time();
$record->id = $DB->insert_record('messageinbound_messagelist', $record);
// Setup the Inbound Message generator for the invalid recipient handler.
$addressmanager = new \core\message\inbound\address_manager();
$addressmanager->set_handler('\tool_messageinbound\message\inbound\invalid_recipient_handler');
$addressmanager->set_data($record->id);
$eventdata = new \stdClass();
$eventdata->component = 'tool_messageinbound';
$eventdata->name = 'invalidrecipienthandler';
$userfrom = clone $USER;
$userfrom->customheaders = array();
// Adding the In-Reply-To header ensures that it is seen as a reply.
$userfrom->customheaders[] = 'In-Reply-To: ' . $messageid;
// The message will be sent from the intended user.
$eventdata->userfrom = \core_user::get_noreply_user();
$eventdata->userto = $USER;
$eventdata->subject = $this->get_reply_subject($this->currentmessagedata->envelope->subject);
$eventdata->fullmessage = get_string('invalidrecipientdescription', 'tool_messageinbound', $this->currentmessagedata);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = get_string('invalidrecipientdescriptionhtml', 'tool_messageinbound', $this->currentmessagedata);
$eventdata->smallmessage = $eventdata->fullmessage;
$eventdata->notification = 1;
$eventdata->replyto = $addressmanager->generate($USER->id);
mtrace("--> Sending a message to the user to report an verification failure.");
if (!message_send($eventdata)) {
mtrace("---> Warning: Message could not be sent.");
return false;
}
return true;
}
/**
* Inform the identified sender of a processing error.
*
* @param string $error The error message
*/
private function inform_user_of_error($error) {
global $USER;
// The message will be sent from the intended user.
$userfrom = clone $USER;
$userfrom->customheaders = array();
if ($messageid = $this->currentmessagedata->messageid) {
// Adding the In-Reply-To header ensures that it is seen as a reply and threading is maintained.
$userfrom->customheaders[] = 'In-Reply-To: ' . $messageid;
}
$messagedata = new \stdClass();
$messagedata->subject = $this->currentmessagedata->envelope->subject;
$messagedata->error = $error;
$eventdata = new \stdClass();
$eventdata->component = 'tool_messageinbound';
$eventdata->name = 'messageprocessingerror';
$eventdata->userfrom = $userfrom;
$eventdata->userto = $USER;
$eventdata->subject = self::get_reply_subject($this->currentmessagedata->envelope->subject);
$eventdata->fullmessage = get_string('messageprocessingerror', 'tool_messageinbound', $messagedata);
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = get_string('messageprocessingerrorhtml', 'tool_messageinbound', $messagedata);
$eventdata->smallmessage = $eventdata->fullmessage;
$eventdata->notification = 1;
if (message_send($eventdata)) {
mtrace("---> Notification sent to {$USER->email}.");
} else {
mtrace("---> Unable to send notification.");
}
}
/**
* Inform the identified sender that message processing was successful.
*
* @param stdClass $messagedata The data for the current message being processed.
* @param mixed $handlerresult The result returned by the handler.
*/
private function inform_user_of_success(\stdClass $messagedata, $handlerresult) {
global $USER;
// Check whether the handler has a success notification.
$handler = $this->addressmanager->get_handler();
$message = $handler->get_success_message($messagedata, $handlerresult);
if (!$message) {
mtrace("---> Handler has not defined a success notification e-mail.");
return false;
}
// Wrap the message in the notification wrapper.
$messageparams = new \stdClass();
$messageparams->html = $message->html;
$messageparams->plain = $message->plain;
$messagepreferencesurl = new \moodle_url("/message/edit.php", array('id' => $USER->id));
$messageparams->messagepreferencesurl = $messagepreferencesurl->out();
$htmlmessage = get_string('messageprocessingsuccesshtml', 'tool_messageinbound', $messageparams);
$plainmessage = get_string('messageprocessingsuccess', 'tool_messageinbound', $messageparams);
// The message will be sent from the intended user.
$userfrom = clone $USER;
$userfrom->customheaders = array();
if ($messageid = $this->currentmessagedata->messageid) {
// Adding the In-Reply-To header ensures that it is seen as a reply and threading is maintained.
$userfrom->customheaders[] = 'In-Reply-To: ' . $messageid;
}
$messagedata = new \stdClass();
$messagedata->subject = $this->currentmessagedata->envelope->subject;
$eventdata = new \stdClass();
$eventdata->component = 'tool_messageinbound';
$eventdata->name = 'messageprocessingsuccess';
$eventdata->userfrom = $userfrom;
$eventdata->userto = $USER;
$eventdata->subject = self::get_reply_subject($this->currentmessagedata->envelope->subject);
$eventdata->fullmessage = $plainmessage;
$eventdata->fullmessageformat = FORMAT_PLAIN;
$eventdata->fullmessagehtml = $htmlmessage;
$eventdata->smallmessage = $eventdata->fullmessage;
$eventdata->notification = 1;
if (message_send($eventdata)) {
mtrace("---> Success notification sent to {$USER->email}.");
} else {
mtrace("---> Unable to send success notification.");
}
return true;
}
/**
* Return a formatted subject line for replies.
*
* @param $subject string The subject string
* @return string The formatted reply subject
*/
private function get_reply_subject($subject) {
$prefix = get_string('replysubjectprefix', 'tool_messageinbound');
if (!(substr($subject, 0, strlen($prefix)) == $prefix)) {
$subject = $prefix . ' ' . $subject;
}
return $subject;
}
}
@@ -1,95 +0,0 @@
<?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/>.
/**
* A Handler to re-process messages which previously failed sender
* verification.
*
* @package task_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_messageinbound\message\inbound;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/repository/lib.php');
/**
* A Handler to re-process messages which previously failed sender
* verification.
*
* This may happen if the user did not use their registerd e-mail address,
* the verification hash used had expired, or if some erroneous content was
* introduced into the content hash.
*
* @package task
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class invalid_recipient_handler extends \core\message\inbound\handler {
/**
* Do not allow changes to the address validation setting.
*/
public function can_change_validateaddress() {
return false;
}
/**
* Return a description for the current handler.
*
* @return string
*/
public function get_description() {
return get_string('invalid_recipient_handler', 'tool_messageinbound');
}
/**
* Return a name for the current handler.
* This appears in the admin pages as a human-readable name.
*
* @return string
*/
public function get_name() {
return get_string('invalid_recipient_handler_name', 'tool_messageinbound');
}
/**
* Process a message received and validated by the Inbound Message processor.
*
* @param $messagedata The Inbound Message record
* @param $messagedata The message data packet.
* @return bool Whether the message was successfully processed.
*/
public function process_message(\stdClass $record, \stdClass $data) {
global $DB;
if (!$maildata = $DB->get_record('messageinbound_messagelist', array('id' => $record->datavalue))) {
// The message requested couldn't be found. Failing here will alert the user that we failed.
throw new \core\message\inbound\processing_failed_exception('oldmessagenotfound', 'tool_messageinbound');
}
mtrace("=== Request to re-process message {$record->datavalue} from server.");
mtrace("=== Message-Id:\t{$maildata->messageid}");
mtrace("=== Recipient:\t{$maildata->address}");
$manager = new \tool_messageinbound\manager();
return $manager->process_existing_message($maildata);
}
}
@@ -1,53 +0,0 @@
<?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/>.
/**
* A scheduled task to handle cleanup of old, unconfirmed e-mails.
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_messageinbound\task;
defined('MOODLE_INTERNAL') || die();
/**
* A scheduled task to handle cleanup of old, unconfirmed e-mails.
*
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class cleanup_task extends \core\task\scheduled_task {
/**
* Get a descriptive name for this task (shown to admins).
*
* @return string
*/
public function get_name() {
return get_string('taskcleanup', 'tool_messageinbound');
}
/**
* Execute the main Inbound Message pickup task.
*/
public function execute() {
$manager = new \tool_messageinbound\manager();
return $manager->tidy_old_messages();
}
}
@@ -1,53 +0,0 @@
<?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/>.
/**
* A scheduled task to handle Inbound Message e-mail pickup.
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_messageinbound\task;
defined('MOODLE_INTERNAL') || die();
/**
* A scheduled task to handle Inbound Message e-mail pickup.
*
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class pickup_task extends \core\task\scheduled_task {
/**
* Get a descriptive name for this task (shown to admins).
*
* @return string
*/
public function get_name() {
return get_string('taskpickup', 'tool_messageinbound');
}
/**
* Execute the main Inbound Message pickup task.
*/
public function execute() {
$manager = new \tool_messageinbound\manager();
return $manager->pickup_messages();
}
}
@@ -1,34 +0,0 @@
<?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/>.
/**
* Handlers for tool_messageinbound.
*
* @package task
* @category tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$handlers = array(
array(
'classname' => '\tool_messageinbound\message\inbound\invalid_recipient_handler',
'enabled' => true,
'validateaddress' => false,
),
);
-35
View File
@@ -1,35 +0,0 @@
<?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/>.
/**
* Message Providers for task_messageinbound.
*
* @package task
* @category messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$messageproviders = array (
// Invalid recipient handler.
'invalidrecipienthandler' => array(),
// A generic message processing error.
'messageprocessingerror' => array(),
// A generic message processing success message.
'messageprocessingsuccess' => array(),
);
-47
View File
@@ -1,47 +0,0 @@
<?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/>.
/**
* The Main Manager tasks.
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$tasks = array(
array(
'classname' => '\tool_messageinbound\task\pickup_task',
'blocking' => 0,
'minute' => '*',
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
),
array(
'classname' => '\tool_messageinbound\task\cleanup_task',
'blocking' => 0,
'minute' => '55',
'hour' => '1',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
),
);
-87
View File
@@ -1,87 +0,0 @@
<?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/>.
/**
* Inbound Message Settings pages.
*
* @package tool_messageinbound
* @copyright 2014 Andrew NIcols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__) . '/../../../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('messageinbound_handlers');
$classname = optional_param('classname', '', PARAM_RAW);
$pageurl = new moodle_url('/admin/tool/messageinbound/index.php');
if (empty($classname)) {
$renderer = $PAGE->get_renderer('tool_messageinbound');
$records = $DB->get_recordset('messageinbound_handlers', null, 'enabled desc', 'classname');
$instances = array();
foreach ($records as $record) {
$instances[] = \core\message\inbound\manager::get_handler($record->classname);
}
echo $OUTPUT->header();
echo $renderer->messageinbound_handlers_table($instances);
echo $OUTPUT->footer();
} else {
// Retrieve the handler and its record.
$handler = \core\message\inbound\manager::get_handler($classname);
$record = \core\message\inbound\manager::record_from_handler($handler);
$formurl = new moodle_url($PAGE->url, array('classname' => $classname));
$mform = new tool_messageinbound_edit_handler_form($formurl, array(
'handler' => $handler,
));
if ($mform->is_cancelled()) {
redirect($PAGE->url);
} else if ($data = $mform->get_data()) {
// Update the record from the form.
if ($handler->can_change_defaultexpiration()) {
$record->defaultexpiration = (int) $data->defaultexpiration;
}
if ($handler->can_change_validateaddress()) {
$record->validateaddress = !empty($data->validateaddress);
}
if ($handler->can_change_enabled()) {
$record->enabled = !empty($data->enabled);
}
$DB->update_record('messageinbound_handlers', $record);
redirect($PAGE->url);
}
// Add the breadcrumb.
$pageurl->param('classname', $handler->classname);
$PAGE->navbar->add($handler->name, $pageurl);
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('editinghandler', 'tool_messageinbound', $handler->name));
$mform->set_data($record);
$mform->display();
echo $OUTPUT->footer();
}
@@ -1,112 +0,0 @@
<?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/>.
/**
* Strings for component 'tool_messageinbound', language 'en'
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['classname'] = 'Class name';
$string['component'] = 'Component';
$string['configmessageinboundhost'] = 'The address of the server that Moodle should check mail against. To specify a non-default port, you can use the [server]:[port], for example mail.example.com:587 format. If you leave this field blank, Moodle will use the default port for the type of mail server you specify.';
$string['defaultexpiration'] = 'Default address expiry period';
$string['defaultexpiration_help'] = 'When an email address is generated by the handler, it can be set to automatically expire after a period of time, so that it can no longer be used. It is advisable to set an expiry period.';
$string['description'] = 'Description';
$string['domain'] = 'Email domain';
$string['edit'] = 'Edit';
$string['edithandler'] = 'Edit settings for the {$a} handler';
$string['editinghandler'] = 'Editing {$a}';
$string['enabled'] = 'Enabled';
$string['fixedvalidateaddress'] = 'Validate sender address';
$string['fixedvalidateaddress_help'] = 'You cannot change the address validation for this handler. This may be because the handler requires a specific setting.';
$string['fixedenabled_help'] = 'You cannot change the state of this handler. This may be because the handler is required by other handlers.';
$string['handlerdisabled'] = 'The email handler you tried to contact has been disabled. Unable to process message at this time.';
$string['incomingmailconfiguration'] = 'Incoming mail configuration';
$string['incomingmailserversettings'] = 'Incoming mail server settings';
$string['incomingmailserversettings_desc'] = 'Moodle is capable of connecting to appropriately configured IMAP servers. You can specify the settings used to connect to your IMAP server here.';
$string['invalid_recipient_handler'] = 'If a valid message is received but the sender cannot be authenticated, the message is stored on the email server and the user is contacted using the email address in their user profile. The user is given the chance to reply to confirm the authenticity of the original message.
This handler processes those replies.
It is not possible to disable sender verification of this handler because the user may reply from an incorrect email address if their email client configuration is incorrect.';
$string['invalid_recipient_handler_name'] = 'Invalid recipient handler';
$string['invalidrecipientdescription'] = 'The message "{$a->subject}" could not be authenticated, since it was sent from a different email address than in your user profile. For the message to be authenticated, you need to reply to this message.';
$string['invalidrecipientdescriptionhtml'] = 'The message "{$a->subject}" could not be authenticated, since it was sent from a different email address than in your user profile. For the message to be authenticated, you need to reply to this message.';
$string['invalidrecipientfinal'] = 'The message "{$a->subject}" could not be authenticated. Please check that you are sending your message from the same email address as in your profile.';
$string['mailbox'] = 'Mailbox name';
$string['mailboxconfiguration'] = 'Mailbox configuration';
$string['mailboxdescription'] = '[mailbox]+subaddress@[domain]';
$string['mailsettings'] = 'Mail settings';
$string['message_handlers'] = 'Message handlers';
$string['messageprocessingerror'] = 'You recently sent an email "{$a->subject}" but unfortunately it could not be processed.
The details of the error are shown below.
{$a->error}';
$string['messageprocessingerrorhtml'] = '<p>You recently sent an email "{$a->subject}" but unfortunately it could not be processed.</p>
<p>The details of the error are shown below.</p>
<p>{$a->error}</p>';
$string['messageprocessingfailed'] = 'The email "{$a->subject}" could not be processed. The error is as follows: "{$a->message}".';
$string['messageprocessingfailedunknown'] = 'The email "{$a->subject}" could not be processed. Contact your administrator for further information.';
$string['messageprocessingsuccess'] = '{$a->plain}
If you do not wish to receive these notifications in the future, you can edit your personal messaging preferences by opening {$a->messagepreferencesurl} in your browser.';
$string['messageprocessingsuccesshtml'] = '{$a->html}
<p>If you do not wish to receive these notifications in the future, you can <a href="{$a->messagepreferencesurl}">edit your personal messaging preferences</a>.</p>';
$string['messageinbound'] = 'Message Inbound';
$string['messageinboundenabled'] = 'Enable incoming mail processing';
$string['messageinboundenabled_desc'] = 'Incoming mail processing must be enabled in order for messages to be sent with the appropriate information.';
$string['messageinboundgeneralconfiguration'] = 'General configuration';
$string['messageinboundgeneralconfiguration_desc'] = 'Inbound message processing allows you to receive and process email within Moodle. This has applications such as sending email replies to forum posts or adding files to a user\'s private files.';
$string['messageinboundhost'] = 'Incoming Mail Server';
$string['messageinboundhostpass'] = 'Password';
$string['messageinboundhostpass_desc'] = 'This is the password your service provider will have provided to log in to your email account with.';
$string['messageinboundhostssl'] = 'Use SSL';
$string['messageinboundhostssl_desc'] = 'Some mail servers support an additional level of security by encrypting communication between Moodle and your server. We recommend using this SSL encryption if your server supports it.';
$string['messageinboundhosttype'] = 'Server type';
$string['messageinboundhostuser'] = 'Username';
$string['messageinboundhostuser_desc'] = 'This is the username your service provider will have provided to log in to your email account with.';
$string['messageinboundmailboxconfiguration_desc'] = 'When messages are sent out, they fit into the format address+data@example.com. To reliably generate addresses from Moodle, please specify the address that you would normally use before the @ sign, and the domain after the @ sign separately. For example, the Mailbox name in the example would be "address", and the E-mail domain would be "example.com". You should use a dedicated e-mail account for this purpose.';
$string['messageprovider:invalidrecipienthandler'] = 'Message to confirm that an inbound message came from you';
$string['messageprovider:messageprocessingerror'] = 'Warning when an inbound message could not be processed';
$string['messageprovider:messageprocessingsuccess'] = 'Confirmation that a message was successfully processed';
$string['noencryption'] = 'Off - No encryption';
$string['noexpiry'] = 'No expiry';
$string['oldmessagenotfound'] = 'You tried to manually authenticate a message, but the message could not be found. This could be because it has already been processed, or because the message expired.';
$string['oneday'] = 'One day';
$string['onehour'] = 'One hour';
$string['oneweek'] = 'One week';
$string['oneyear'] = 'One year';
$string['pluginname'] = 'Inbound message configuration';
$string['replysubjectprefix'] = 'Re:';
$string['requirevalidation'] = 'Validate sender address';
$string['name'] = 'Name';
$string['ssl'] = 'SSL (Auto-detect SSL version)';
$string['sslv2'] = 'SSLv2 (Force SSL Version 2)';
$string['sslv3'] = 'SSLv2 (Force SSL Version 3)';
$string['taskcleanup'] = 'Cleanup of unverified incoming email';
$string['taskpickup'] = 'Incoming email pickup';
$string['tls'] = 'TLS (TLS; started via protocol-level negotiation over unencrypted channel; RECOMMENDED way of initiating secure connection)';
$string['tlsv1'] = 'TLSv1 (TLS direct version 1.x connection to server)';
$string['validateaddress'] = 'Validate sender email address';
$string['validateaddress_help'] = 'When a message is received from a user, Moodle attempts to validate the message by comparing the email address of the sender with the email address in their user profile.
If the sender does not match, then the user is sent a notification to confirm that they really did send the email.
If this setting is disabled, then the email address of the sender is not checked at all.';
-109
View File
@@ -1,109 +0,0 @@
<?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/>.
/**
* Output rendering for the plugin.
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Implements the plugin renderer
*
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_messageinbound_renderer extends plugin_renderer_base {
/**
* Render a table listing all of the Inbound Message handlers.
*
* @param array $handlers - list of all messageinbound handlers.
* @return string HTML to output.
*/
public function messageinbound_handlers_table(array $handlers) {
global $CFG;
$table = new html_table();
$handlername = new html_table_cell(get_string('name', 'tool_messageinbound') . "\n" .
html_writer::tag('span', get_string('classname', 'tool_messageinbound'), array('class' => 'handler-function')));
// Prepare some of the rows with additional styling.
$enabled = new html_table_cell(get_string('enabled', 'tool_messageinbound'));
$enabled->attributes['class'] = 'state';
$edit = new html_table_cell(get_string('edit', 'tool_messageinbound'));
$edit->attributes['class'] = 'edit';
$table->head = array(
$handlername,
get_string('description', 'tool_messageinbound'),
$enabled,
$edit,
);
$table->attributes['class'] = 'admintable generaltable messageinboundhandlers';
$yes = get_string('yes');
$no = get_string('no');
$data = array();
// Options for description formatting.
$descriptionoptions = new stdClass();
$descriptionoptions->trusted = false;
$descriptionoptions->noclean = false;
$descriptionoptions->smiley = false;
$descriptionoptions->filter = false;
$descriptionoptions->para = true;
$descriptionoptions->newlines = false;
$descriptionoptions->overflowdiv = true;
$editurlbase = new moodle_url('/admin/tool/messageinbound/index.php');
foreach ($handlers as $handler) {
$handlername = new html_table_cell($handler->name . "\n" .
html_writer::tag('span', $handler->classname, array('class' => 'handler-function')));
$handlername->header = true;
$editurl = new moodle_url($editurlbase, array('classname' => $handler->classname));
$editlink = $this->action_icon($editurl, new pix_icon('t/edit',
get_string('edithandler', 'tool_messageinbound', $handler->classname)));
// Prepare some of the rows with additional styling.
$enabled = new html_table_cell($handler->enabled ? $yes : $no);
$enabled->attributes['class'] = 'state';
$edit = new html_table_cell($editlink);
$edit->attributes['class'] = 'edit';
// Add the row.
$row = new html_table_row(array(
$handlername,
format_text($handler->description, FORMAT_MARKDOWN, $descriptionoptions),
$enabled,
$edit,
));
if (!$handler->enabled) {
$row->attributes['class'] = 'disabled';
}
$data[] = $row;
}
$table->data = $data;
return html_writer::table($table);
}
}
-87
View File
@@ -1,87 +0,0 @@
<?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/>.
/**
* Inbound Message Settings.
*
* @package tool_messageinbound
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
if ($hassiteconfig) {
$category = new admin_category('messageinbound', new lang_string('incomingmailconfiguration', 'tool_messageinbound'));
// Create a settings page for all of the mail server settings.
$settings = new admin_settingpage('messageinbound_mailsettings', new lang_string('mailsettings', 'tool_messageinbound'));
$settings->add(new admin_setting_heading('messageinbound_generalconfiguration',
new lang_string('messageinboundgeneralconfiguration', 'tool_messageinbound'),
new lang_string('messageinboundgeneralconfiguration_desc', 'tool_messageinbound'), ''));
$settings->add(new admin_setting_configcheckbox('messageinbound_enabled',
new lang_string('messageinboundenabled', 'tool_messageinbound'),
new lang_string('messageinboundenabled_desc', 'tool_messageinbound'), 0));
// These settings are used when generating a Inbound Message address.
$settings->add(new admin_setting_heading('messageinbound_mailboxconfiguration',
new lang_string('mailboxconfiguration', 'tool_messageinbound'),
new lang_string('messageinboundmailboxconfiguration_desc', 'tool_messageinbound'), ''));
$settings->add(new admin_setting_configtext('messageinbound_mailbox',
new lang_string('mailbox', 'tool_messageinbound'),
null, '', PARAM_RAW));
$settings->add(new admin_setting_configtext('messageinbound_domain',
new lang_string('domain', 'tool_messageinbound'),
null, '', PARAM_RAW));
// These settings are used when checking the incoming mailbox for mail.
$settings->add(new admin_setting_heading('messageinbound_serversettings',
new lang_string('incomingmailserversettings', 'tool_messageinbound'),
new lang_string('incomingmailserversettings_desc', 'tool_messageinbound'), ''));
$settings->add(new admin_setting_configtext('messageinbound_host',
new lang_string('messageinboundhost', 'tool_messageinbound'),
new lang_string('configmessageinboundhost', 'tool_messageinbound'), '', PARAM_RAW));
$options = array(
'' => get_string('noencryption', 'tool_messageinbound'),
'ssl' => get_string('ssl', 'tool_messageinbound'),
'sslv2' => get_string('sslv2', 'tool_messageinbound'),
'sslv3' => get_string('sslv3', 'tool_messageinbound'),
'tls' => get_string('tls', 'tool_messageinbound'),
'tlsv1' => get_string('tlsv1', 'tool_messageinbound'),
);
$settings->add(new admin_setting_configselect('messageinbound_hostssl',
new lang_string('messageinboundhostssl', 'tool_messageinbound'),
new lang_string('messageinboundhostssl_desc', 'tool_messageinbound'), 'ssl', $options));
$settings->add(new admin_setting_configtext('messageinbound_hostuser',
new lang_string('messageinboundhostuser', 'tool_messageinbound'),
new lang_string('messageinboundhostuser_desc', 'tool_messageinbound'), '', PARAM_NOTAGS));
$settings->add(new admin_setting_configpasswordunmask('messageinbound_hostpass',
new lang_string('messageinboundhostpass', 'tool_messageinbound'),
new lang_string('messageinboundhostpass_desc', 'tool_messageinbound'), ''));
$category->add('messageinbound', $settings);
// Link to the external page for Inbound Message handler configuration.
$category->add('messageinbound', new admin_externalpage('messageinbound_handlers',
new lang_string('message_handlers', 'tool_messageinbound'),
"$CFG->wwwroot/$CFG->admin/tool/messageinbound/index.php"));
// Add the category to the admin tree.
$ADMIN->add('server', $category);
}
-11
View File
@@ -1,11 +0,0 @@
#page-admin-tool-messageinbound-index .handler-function {
display: block;
padding: 0 0.5em;
color: #888;
font-size: 0.75em;
}
#page-admin-tool-messageinbound-index .state,
#page-admin-tool-messageinbound-index .edit {
text-align: center;
}
@@ -1,77 +0,0 @@
<?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/>.
/**
* The tool_monitor rule created event.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_monitor rule created event class.
*
* @package tool_monitor
* @since Moodle 2.8
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class rule_created extends \core\event\base {
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['objecttable'] = 'tool_monitor_rules';
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventrulecreated', 'tool_monitor');
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created the event monitor rule with id '$this->objectid'.";
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/monitor/edit.php', array('ruleid' => $this->objectid,
'courseid' => $this->courseid));
}
}
@@ -1,76 +0,0 @@
<?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/>.
/**
* The tool_monitor rule deleted event.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_monitor rule deleted event class.
*
* @package tool_monitor
* @since Moodle 2.8
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class rule_deleted extends \core\event\base {
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['objecttable'] = 'tool_monitor_rules';
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventruledeleted', 'tool_monitor');
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the event monitor rule with id '$this->objectid'.";
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/monitor/managerules.php', array('courseid' => $this->courseid));
}
}
@@ -1,77 +0,0 @@
<?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/>.
/**
* The tool_monitor rule updated event.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_monitor rule updated event class.
*
* @package tool_monitor
* @since Moodle 2.8
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class rule_updated extends \core\event\base {
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['objecttable'] = 'tool_monitor_rules';
$this->data['crud'] = 'u';
$this->data['edulevel'] = self::LEVEL_OTHER;
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventruleupdated', 'tool_monitor');
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' updated the event monitor rule with id '$this->objectid'.";
}
/**
* Get URL related to the action
*
* @return \moodle_url
*/
public function get_url() {
return new \moodle_url('/admin/tool/monitor/edit.php', array('ruleid' => $this->objectid,
'courseid' => $this->courseid));
}
}
@@ -1,67 +0,0 @@
<?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/>.
/**
* The tool_monitor subscription created event.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_monitor subscription created event class.
*
* @package tool_monitor
* @since Moodle 2.8
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subscription_created extends \core\event\base {
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['objecttable'] = 'tool_monitor_subscriptions';
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventsubcreated', 'tool_monitor');
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' created the event monitor subscription with id '$this->objectid'.";
}
}
@@ -1,86 +0,0 @@
<?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/>.
/**
* The tool_monitor subscription criteria met event.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_monitor subscription criteria met event class.
*
* @property-read array $other {
* Extra information about event.
*
* - string subscriptionid: id of the subscription.
* }
*
* @package tool_monitor
* @since Moodle 2.8
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subscription_criteria_met extends \core\event\base {
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['crud'] = 'c';
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventsubcriteriamet', 'tool_monitor');
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The criteria for the subscription with id '{$this->other['subscriptionid']}' was met.";
}
/**
* Custom validation.
*
* @throws \coding_exception
* @return void
*/
protected function validate_data() {
parent::validate_data();
if (!isset($this->other['subscriptionid'])) {
throw new \coding_exception('The \'subscriptionid\' value must be set in other.');
}
}
}
@@ -1,67 +0,0 @@
<?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/>.
/**
* The tool_monitor subscription deleted event.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\event;
defined('MOODLE_INTERNAL') || die();
/**
* The tool_monitor subscription deleted event class.
*
* @package tool_monitor
* @since Moodle 2.8
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subscription_deleted extends \core\event\base {
/**
* Init method.
*
* @return void
*/
protected function init() {
$this->data['objecttable'] = 'tool_monitor_subscriptions';
$this->data['crud'] = 'd';
$this->data['edulevel'] = self::LEVEL_TEACHING;
}
/**
* Return localised event name.
*
* @return string
*/
public static function get_name() {
return get_string('eventsubdeleted', 'tool_monitor');
}
/**
* Returns description of what happened.
*
* @return string
*/
public function get_description() {
return "The user with id '$this->userid' deleted the event monitor subscription with id '$this->objectid'.";
}
}
-221
View File
@@ -1,221 +0,0 @@
<?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/>.
/**
* Event documentation
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor;
defined('MOODLE_INTERNAL') || die();
/**
* Class for returning event information.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class eventlist {
/**
* Return all of the core event files.
*
* @return array Core events.
*/
protected static function get_core_eventlist() {
global $CFG;
// Disable developer debugging as deprecated events will fire warnings.
// Setup backup variables to restore the following settings back to what they were when we are finished.
$debuglevel = $CFG->debug;
$debugdisplay = $CFG->debugdisplay;
$debugdeveloper = $CFG->debugdeveloper;
$CFG->debug = 0;
$CFG->debugdisplay = false;
$CFG->debugdeveloper = false;
$eventinformation = array();
$directory = $CFG->libdir . '/classes/event';
$files = self::get_file_list($directory);
// Remove exceptional events that will cause problems being displayed.
if (isset($files['unknown_logged'])) {
unset($files['unknown_logged']);
}
foreach ($files as $file => $location) {
$classname = '\\core\\event\\' . $file;
// Check to see if this is actually a valid event.
if (method_exists($classname, 'get_static_info')) {
$ref = new \ReflectionClass($classname);
// Ignore abstracts.
if (!$ref->isAbstract() && $file != 'manager') {
$eventinformation[$classname] = $classname::get_name();
}
}
}
// Now enable developer debugging as event information has been retrieved.
$CFG->debug = $debuglevel;
$CFG->debugdisplay = $debugdisplay;
$CFG->debugdeveloper = $debugdeveloper;
return $eventinformation;
}
/**
* This function returns an array of all events for the plugins of the system.
*
* @param bool $withoutcomponent Return an eventlist without associated components.
*
* @return array A list of events from all plug-ins.
*/
protected static function get_non_core_eventlist($withoutcomponent = false) {
global $CFG;
// Disable developer debugging as deprecated events will fire warnings.
// Setup backup variables to restore the following settings back to what they were when we are finished.
$debuglevel = $CFG->debug;
$debugdisplay = $CFG->debugdisplay;
$debugdeveloper = $CFG->debugdeveloper;
$CFG->debug = 0;
$CFG->debugdisplay = false;
$CFG->debugdeveloper = false;
$noncorepluginlist = array();
$plugintypes = \core_component::get_plugin_types();
foreach ($plugintypes as $plugintype => $notused) {
$pluginlist = \core_component::get_plugin_list($plugintype);
foreach ($pluginlist as $plugin => $directory) {
$plugindirectory = $directory . '/classes/event';
foreach (self::get_file_list($plugindirectory) as $eventname => $notused) {
$plugineventname = '\\' . $plugintype . '_' . $plugin . '\\event\\' . $eventname;
// Check that this is actually an event.
if (method_exists($plugineventname, 'get_static_info') && $plugin != 'monitor') { // No selfie here.
$ref = new \ReflectionClass($plugineventname);
if (!$ref->isAbstract() && $plugin != 'legacy') {
if ($withoutcomponent) {
$noncorepluginlist[$plugineventname] = $plugineventname::get_name();
} else {
$noncorepluginlist[$plugintype . '_' . $plugin][$plugineventname] = $plugineventname::get_name();
}
}
}
}
}
}
// Now enable developer debugging as event information has been retrieved.
$CFG->debug = $debuglevel;
$CFG->debugdisplay = $debugdisplay;
$CFG->debugdeveloper = $debugdeveloper;
return $noncorepluginlist;
}
/**
* Returns a list of files with a full directory path in a specified directory.
*
* @param string $directory location of files.
* @return array full location of files from the specified directory.
*/
protected static function get_file_list($directory) {
global $CFG;
$directoryroot = $CFG->dirroot;
$finalfiles = array();
if (is_dir($directory)) {
if ($handle = opendir($directory)) {
$files = scandir($directory);
foreach ($files as $file) {
if ($file != '.' && $file != '..') {
// Ignore the file if it is external to the system.
if (strrpos($directory, $directoryroot) !== false) {
$location = substr($directory, strlen($directoryroot));
$name = substr($file, 0, -4);
$finalfiles[$name] = $location . '/' . $file;
}
}
}
}
}
return $finalfiles;
}
/**
* Get a list of events present in the system.
*
* @param bool $withoutcomponent Return an eventlist without associated components.
*
* @return array list of events present in the system.
*/
public static function get_all_eventlist($withoutcomponent = false) {
if ($withoutcomponent) {
$return = array_merge(self::get_core_eventlist(), self::get_non_core_eventlist($withoutcomponent));
array_multisort($return, SORT_NATURAL);
} else {
$return = array_merge(array('core' => self::get_core_eventlist()),
self::get_non_core_eventlist($withoutcomponent = false));
}
return $return;
}
/**
* Return list of plugins that have events.
*
* @param array $eventlist a list of events present in the system {@link eventlist::get_all_eventlist}.
*
* @return array list of plugins with human readable name.
*/
public static function get_plugin_list($eventlist = array()) {
if (empty($eventlist)) {
$eventlist = self::get_all_eventlist();
}
$plugins = array_keys($eventlist);
$return = array();
foreach ($plugins as $plugin) {
if ($plugin === 'core') {
$return[$plugin] = get_string('core', 'tool_monitor');
} else if (get_string_manager()->string_exists('pluginname', $plugin)) {
$return[$plugin] = get_string('pluginname', $plugin);
} else {
$return[$plugin] = $plugin;
}
}
return $return;
}
/**
* validate if the given event belongs to the given plugin.
*
* @param string $plugin Frankenstyle name of the plugin.
* @param string $eventname Full qualified event name.
* @param array $eventlist List of events generated by {@link eventlist::get_all_eventlist}
*
* @return bool Returns true if the selected event belongs to the selected plugin, false otherwise.
*/
public static function validate_event_plugin($plugin, $eventname, $eventlist = array()) {
if (empty($eventlist)) {
$eventlist = self::get_all_eventlist();
}
if (isset($eventlist[$plugin][$eventname])) {
return true;
}
return false;
}
}
@@ -1,253 +0,0 @@
<?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/>.
/**
* Observer class containing methods monitoring various events.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor;
defined('MOODLE_INTERNAL') || die();
/**
* Observer class containing methods monitoring various events.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class eventobservers {
/** @var array $buffer buffer of events. */
protected $buffer = array();
/** @var int Number of entries in the buffer. */
protected $count = 0;
/** @var eventobservers a reference to a self instance. */
protected static $instance;
/**
* Course delete event observer.
* This observer monitors course delete event, and when a course is deleted it deletes any rules and subscriptions associated
* with it, so no orphan data is left behind.
*
* @param \core\event\course_deleted $event The course deleted event.
*/
public static function course_deleted(\core\event\course_deleted $event) {
$rules = rule_manager::get_rules_by_courseid($event->courseid, 0, 0, false);
foreach ($rules as $rule) {
rule_manager::delete_rule($rule->id, $event->get_context());
}
}
/**
* The observer monitoring all the events.
*
* This observers puts small event objects in buffer for later writing to the database. At the end of the request the buffer
* is cleaned up and all data dumped into the tool_monitor_events table.
*
* @param \core\event\base $event event object
*/
public static function process_event(\core\event\base $event) {
if (!get_config('tool_monitor', 'enablemonitor')) {
return; // The tool is disabled. Nothing to do.
}
if (empty(self::$instance)) {
self::$instance = new static();
// Register shutdown handler - this is useful for buffering, processing events, etc.
\core_shutdown_manager::register_function(array(self::$instance, 'process_buffer'));
}
self::$instance->buffer_event($event);
if (PHPUNIT_TEST) {
// Process buffer after every event when unit testing.
self::$instance->process_buffer();
}
}
/**
* Api to buffer events to store, to reduce db queries.
*
* @param \core\event\base $event
*/
protected function buffer_event(\core\event\base $event) {
// If there are no subscriptions for this event do not buffer it.
if (!\tool_monitor\subscription_manager::event_has_subscriptions($event->eventname, $event->courseid)) {
return;
}
$eventdata = $event->get_data();
$eventobj = new \stdClass();
$eventobj->eventname = $eventdata['eventname'];
$eventobj->contextid = $eventdata['contextid'];
$eventobj->contextlevel = $eventdata['contextlevel'];
$eventobj->contextinstanceid = $eventdata['contextinstanceid'];
if ($event->get_url()) {
// Get link url if exists.
$eventobj->link = $event->get_url()->out();
} else {
$eventobj->link = '';
}
$eventobj->courseid = $eventdata['courseid'];
$eventobj->timecreated = $eventdata['timecreated'];
$this->buffer[] = $eventobj;
$this->count++;
}
/**
* This method process all events stored in the buffer.
*
* This is a multi purpose api. It does the following:-
* 1. Write event data to tool_monitor_events
* 2. Find out users that need to be notified about rule completion and schedule a task to send them messages.
*/
public function process_buffer() {
global $DB;
$events = $this->flush(); // Flush data.
$select = "SELECT COUNT(id) FROM {tool_monitor_events} ";
$now = time();
$messagestosend = array();
$allsubids = array();
// Let us now process the events and check for subscriptions.
foreach ($events as $eventobj) {
$subscriptions = subscription_manager::get_subscriptions_by_event($eventobj);
$idstosend = array();
foreach ($subscriptions as $subscription) {
$starttime = $now - $subscription->timewindow;
$starttime = ($starttime > $subscription->lastnotificationsent) ? $starttime : $subscription->lastnotificationsent;
if ($subscription->courseid == 0) {
// Site level subscription. Count all events.
$where = "eventname = :eventname AND timecreated > :starttime";
$params = array('eventname' => $eventobj->eventname, 'starttime' => $starttime);
} else {
// Course level subscription.
if ($subscription->cmid == 0) {
// All modules.
$where = "eventname = :eventname AND courseid = :courseid AND timecreated > :starttime";
$params = array('eventname' => $eventobj->eventname, 'courseid' => $eventobj->courseid,
'starttime' => $starttime);
} else {
// Specific module.
$where = "eventname = :eventname AND courseid = :courseid AND contextinstanceid = :cmid
AND timecreated > :starttime";
$params = array('eventname' => $eventobj->eventname, 'courseid' => $eventobj->courseid,
'cmid' => $eventobj->contextinstanceid, 'starttime' => $starttime);
}
}
$sql = $select . "WHERE " . $where;
$count = $DB->count_records_sql($sql, $params);
if (!empty($count) && $count >= $subscription->frequency) {
$idstosend[] = $subscription->id;
// Trigger a subscription_criteria_met event.
// It's possible that the course has been deleted since the criteria was met, so in that case use
// the system context. Set it here and change later if needed.
$context = \context_system::instance();
// We can't perform if (!empty($subscription->courseid)) below as it uses the magic method
// __get to return the variable, which will always result in being empty.
$courseid = $subscription->courseid;
if (!empty($courseid)) {
if ($coursecontext = \context_course::instance($courseid, IGNORE_MISSING)) {
$context = $coursecontext;
}
}
$params = array(
'userid' => $subscription->userid,
'courseid' => $subscription->courseid,
'context' => $context,
'other' => array(
'subscriptionid' => $subscription->id
)
);
$event = \tool_monitor\event\subscription_criteria_met::create($params);
$event->trigger();
}
}
if (!empty($idstosend)) {
$messagestosend[] = array('subscriptionids' => $idstosend, 'event' => $eventobj);
$allsubids = array_merge($allsubids, $idstosend);
}
}
if (!empty($allsubids)) {
// Update the last trigger flag.
list($sql, $params) = $DB->get_in_or_equal($allsubids, SQL_PARAMS_NAMED);
$params['now'] = $now;
$sql = "UPDATE {tool_monitor_subscriptions} SET lastnotificationsent = :now WHERE id $sql";
$DB->execute($sql, $params);
}
// Schedule a task to send notification.
if (!empty($messagestosend)) {
$adhocktask = new notification_task();
$adhocktask->set_custom_data($messagestosend);
$adhocktask->set_component('tool_monitor');
\core\task\manager::queue_adhoc_task($adhocktask);
}
}
/**
* Protected method that flushes the buffer of events and writes them to the database.
*
* @return array a copy of the events buffer.
*/
protected function flush() {
global $DB;
// Flush the buffer to the db.
$events = $this->buffer;
$DB->insert_records('tool_monitor_events', $events); // Insert the whole chunk into the database.
$this->buffer = array();
$this->count = 0;
return $events;
}
/**
* Observer that monitors user deleted event and delete user subscriptions.
*
* @param \core\event\user_deleted $event the event object.
*/
public static function user_deleted(\core\event\user_deleted $event) {
$userid = $event->objectid;
subscription_manager::delete_user_subscriptions($userid);
}
/**
* Observer that monitors course module deleted event and delete user subscriptions.
*
* @param \core\event\course_module_deleted $event the event object.
*/
public static function course_module_deleted(\core\event\course_module_deleted $event) {
$cmid = $event->contextinstanceid;
subscription_manager::delete_cm_subscriptions($cmid);
}
}
@@ -1,124 +0,0 @@
<?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/>.
/**
* This file defines an adhoc task to send notifications.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor;
defined('MOODLE_INTERNAL') || die();
/**
* Adhock class, used to send notifications to users.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class notification_task extends \core\task\adhoc_task {
/**
* Send out messages.
*/
public function execute() {
foreach ($this->get_custom_data() as $data) {
$eventobj = $data->event;
$subscriptionids = $data->subscriptionids;
foreach ($subscriptionids as $id) {
if ($message = $this->generate_message($id, $eventobj)) {
mtrace("Sending message to the user with id " . $message->userto->id . " for the subscription with id $id...");
message_send($message);
mtrace("Sent.");
}
}
}
}
/**
* Generates the message object for a give subscription and event.
*
* @param int $subscriptionid Subscription instance
* @param \stdClass $eventobj Event data
*
* @return false|\stdClass message object
*/
protected function generate_message($subscriptionid, \stdClass $eventobj) {
try {
$subscription = subscription_manager::get_subscription($subscriptionid);
} catch (\dml_exception $e) {
// Race condition, someone deleted the subscription.
return false;
}
$user = \core_user::get_user($subscription->userid);
if (empty($user)) {
// User doesn't exist. Should never happen, nothing to do return.
return false;
}
$context = \context_user::instance($user->id, IGNORE_MISSING);
if ($context === false) {
// User context doesn't exist. Should never happen, nothing to do return.
return false;
}
$template = $subscription->template;
$template = $this->replace_placeholders($template, $subscription, $eventobj, $context);
$msgdata = new \stdClass();
$msgdata->component = 'tool_monitor'; // Your component name.
$msgdata->name = 'notification'; // This is the message name from messages.php.
$msgdata->userfrom = \core_user::get_noreply_user();
$msgdata->userto = $user;
$msgdata->subject = $subscription->get_name($context);
$msgdata->fullmessage = format_text($template, $subscription->templateformat, array('context' => $context));
$msgdata->fullmessageformat = $subscription->templateformat;
$msgdata->fullmessagehtml = format_text($template, $subscription->templateformat, array('context' => $context));
$msgdata->smallmessage = '';
$msgdata->notification = 1; // This is only set to 0 for personal messages between users.
return $msgdata;
}
/**
* Replace place holders in the template with respective content.
*
* @param string $template Message template.
* @param subscription $subscription subscription instance
* @param \stdclass $eventobj Event data
* @param \context $context context object
*
* @return mixed final template string.
*/
protected function replace_placeholders($template, subscription $subscription, $eventobj, $context) {
$template = str_replace('{link}', $eventobj->link, $template);
if ($eventobj->contextlevel == CONTEXT_MODULE && !empty($eventobj->contextinstanceid)
&& (strpos($template, '{modulelink}') !== false)) {
$cm = get_fast_modinfo($eventobj->courseid)->get_cm($eventobj->contextinstanceid);
$modulelink = $cm->url;
$template = str_replace('{modulelink}', $modulelink, $template);
}
$template = str_replace('{rulename}', $subscription->get_name($context), $template);
$template = str_replace('{description}', $subscription->get_description($context), $template);
$template = str_replace('{eventname}', $subscription->get_event_name(), $template);
return $template;
}
}
@@ -1,214 +0,0 @@
<?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/>.
/**
* Renderable class for manage rules page.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\output\managerules;
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir . '/tablelib.php');
/**
* Renderable class for manage rules page.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderable extends \table_sql implements \renderable {
/**
* @var int course id.
*/
public $courseid;
/**
* @var \context_course|\context_system context of the page to be rendered.
*/
protected $context;
/**
* @var bool Does the user have capability to manage rules at site context.
*/
protected $hassystemcap;
/**
* Sets up the table_log parameters.
*
* @param string $uniqueid unique id of form.
* @param \moodle_url $url url where this table is displayed.
* @param int $courseid course id.
* @param int $perpage Number of rules to display per page.
*/
public function __construct($uniqueid, \moodle_url $url, $courseid = 0, $perpage = 100) {
parent::__construct($uniqueid);
$this->set_attribute('id', 'toolmonitorrules_table');
$this->set_attribute('class', 'toolmonitor managerules generaltable generalbox');
$this->define_columns(array('name', 'description', 'course', 'plugin', 'eventname', 'filters', 'manage'));
$this->define_headers(array(
get_string('rulename', 'tool_monitor'),
get_string('description'),
get_string('course'),
get_string('area', 'tool_monitor'),
get_string('event', 'tool_monitor'),
get_string('frequency', 'tool_monitor'),
get_string('manage', 'tool_monitor'),
)
);
$this->courseid = $courseid;
$this->pagesize = $perpage;
$systemcontext = \context_system::instance();
$this->context = empty($courseid) ? $systemcontext : \context_course::instance($courseid);
$this->hassystemcap = has_capability('tool/monitor:managerules', $systemcontext);
$this->collapsible(false);
$this->sortable(false);
$this->pageable(true);
$this->is_downloadable(false);
$this->define_baseurl($url);
}
/**
* Generate content for name column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the column field.
*/
public function col_name(\tool_monitor\rule $rule) {
return $rule->get_name($this->context);
}
/**
* Generate content for description column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the column field.
*/
public function col_description(\tool_monitor\rule $rule) {
return $rule->get_description($this->context);
}
/**
* Generate content for course column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the context column field.
*/
public function col_course(\tool_monitor\rule $rule) {
$coursename = $rule->get_course_name($this->context);
$courseid = $rule->courseid;
if (empty($courseid)) {
return $coursename;
} else {
return \html_writer::link(new \moodle_url('/course/view.php', array('id' => $courseid)), $coursename);
}
}
/**
* Generate content for plugin column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the column field.
*/
public function col_plugin(\tool_monitor\rule $rule) {
return $rule->get_plugin_name();
}
/**
* Generate content for eventname column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the column field.
*/
public function col_eventname(\tool_monitor\rule $rule) {
return $rule->get_event_name();
}
/**
* Generate content for filters column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the filters column field.
*/
public function col_filters(\tool_monitor\rule $rule) {
return $rule->get_filters_description();
}
/**
* Generate content for manage column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the manage column field.
*/
public function col_manage(\tool_monitor\rule $rule) {
global $OUTPUT, $CFG;
$manage = '';
// Do not allow the user to edit the rule unless they have the system capability, or we are viewing the rules
// for a course, and not the site. Note - we don't need to check for the capability at a course level since
// the user is never shown this page otherwise.
if ($this->hassystemcap || ($rule->courseid != 0)) {
$editurl = new \moodle_url($CFG->wwwroot. '/admin/tool/monitor/edit.php', array('ruleid' => $rule->id,
'courseid' => $rule->courseid, 'sesskey' => sesskey()));
$icon = $OUTPUT->render(new \pix_icon('t/edit', get_string('editrule', 'tool_monitor')));
$manage .= \html_writer::link($editurl, $icon, array('class' => 'action-icon'));
}
// The user should always be able to copy the rule if they are able to view the page.
$copyurl = new \moodle_url($CFG->wwwroot. '/admin/tool/monitor/managerules.php',
array('ruleid' => $rule->id, 'action' => 'copy', 'courseid' => $this->courseid, 'sesskey' => sesskey()));
$icon = $OUTPUT->render(new \pix_icon('t/copy', get_string('duplicaterule', 'tool_monitor')));
$manage .= \html_writer::link($copyurl, $icon, array('class' => 'action-icon'));
if ($this->hassystemcap || ($rule->courseid != 0)) {
$deleteurl = new \moodle_url($CFG->wwwroot. '/admin/tool/monitor/managerules.php', array('ruleid' => $rule->id,
'action' => 'delete', 'courseid' => $rule->courseid, 'sesskey' => sesskey()));
$icon = $OUTPUT->render(new \pix_icon('t/delete', get_string('deleterule', 'tool_monitor')));
$manage .= \html_writer::link($deleteurl, $icon, array('class' => 'action-icon'));
}
return $manage;
}
/**
* Query the reader. Store results in the object for use by build_table.
*
* @param int $pagesize size of page for paginated displayed table.
* @param bool $useinitialsbar do you want to use the initials bar.
*/
public function query_db($pagesize, $useinitialsbar = true) {
$total = \tool_monitor\rule_manager::count_rules_by_courseid($this->courseid);
$this->pagesize($pagesize, $total);
$rules = \tool_monitor\rule_manager::get_rules_by_courseid($this->courseid, $this->get_page_start(),
$this->get_page_size());
$this->rawdata = $rules;
// Set initial bars.
if ($useinitialsbar) {
$this->initialbars($total > $pagesize);
}
}
}
@@ -1,99 +0,0 @@
<?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/>.
/**
* Renderer class for manage rules page.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\output\managerules;
defined('MOODLE_INTERNAL') || die;
/**
* Renderer class for manage rules page.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends \plugin_renderer_base {
/**
* Get html to display on the page.
*
* @param renderable $renderable renderable widget
*
* @return string to display on the mangerules page.
*/
protected function render_renderable(renderable $renderable) {
$o = $this->render_table($renderable);
$o .= $this->render_add_button($renderable->courseid);
return $o;
}
/**
* Get html to display on the page.
*
* @param renderable $renderable renderable widget
*
* @return string to display on the mangerules page.
*/
protected function render_table(renderable $renderable) {
$o = '';
ob_start();
$renderable->out($renderable->pagesize, true);
$o = ob_get_contents();
ob_end_clean();
return $o;
}
/**
* Html to add a button for adding a new rule.
*
* @param int $courseid course id.
*
* @return string html for the button.
*/
protected function render_add_button($courseid) {
global $CFG;
$button = \html_writer::tag('button', get_string('addrule', 'tool_monitor'));
$addurl = new \moodle_url($CFG->wwwroot. '/admin/tool/monitor/edit.php', array('courseid' => $courseid));
return \html_writer::link($addurl, $button);
}
/**
* Html to add a link to go to the subscription page.
*
* @param moodle_url $manageurl The url of the subscription page.
*
* @return string html for the link to the subscription page.
*/
public function render_subscriptions_link($manageurl) {
echo \html_writer::start_div();
$a = \html_writer::link($manageurl, get_string('managesubscriptions', 'tool_monitor'));
$link = \html_writer::tag('span', get_string('managesubscriptionslink', 'tool_monitor', $a));
echo $link;
echo \html_writer::end_div();
}
}
@@ -1,110 +0,0 @@
<?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/>.
/**
* Renderer class for manage subscriptions page.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\output\managesubs;
defined('MOODLE_INTERNAL') || die;
/**
* Renderer class for manage subscriptions page.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class renderer extends \plugin_renderer_base {
/**
* Get html to display on the page.
*
* @param subs $renderable renderable widget
*
* @return string to display on the mangesubs page.
*/
protected function render_subs(subs $renderable) {
$o = $this->render_table($renderable);
return $o;
}
/**
* Get html to display on the page.
*
* @param rules $renderable renderable widget
*
* @return string to display on the mangesubs page.
*/
protected function render_rules(rules $renderable) {
$o = $this->render_course_select($renderable);
if (!empty($renderable->totalcount)) {
$o .= $this->render_table($renderable);
}
return $o;
}
/**
* Get html to display on the page for select dropdown..
*
* @param rules $renderable renderable widget
*
* @return string to display on the mangesubs page.
*/
protected function render_course_select(rules $renderable) {
if ($select = $renderable->get_user_courses_select()) {
return $this->render($select);
}
}
/**
* Get html to display on the page.
*
* @param rules|subs $renderable renderable widget
*
* @return string to display on the mangesubs page.
*/
protected function render_table($renderable) {
$o = '';
ob_start();
$renderable->out($renderable->pagesize, true);
$o = ob_get_contents();
ob_end_clean();
return $o;
}
/**
* Html to add a link to go to the rule manager page.
*
* @param moodle_url $ruleurl The url of the rule manager page.
*
* @return string html for the link to the rule manager page.
*/
public function render_rules_link($ruleurl) {
echo \html_writer::start_div();
$a = \html_writer::link($ruleurl, get_string('managerules', 'tool_monitor'));
$link = \html_writer::tag('span', get_string('manageruleslink', 'tool_monitor', $a));
echo $link;
echo \html_writer::end_div();
}
}
@@ -1,230 +0,0 @@
<?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/>.
/**
* Renderable class to display a set of rules in the manage subscriptions page.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\output\managesubs;
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir . '/tablelib.php');
/**
* Renderable class to display a set of rules in the manage subscriptions page.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class rules extends \table_sql implements \renderable {
/**
* @var int course id.
*/
public $courseid;
/**
* @var int total rules present.
*/
public $totalcount = 0;
/**
* @var \context_course|\context_system context of the page to be rendered.
*/
protected $context;
/**
* Sets up the table_log parameters.
*
* @param string $uniqueid unique id of form.
* @param \moodle_url $url url where this table is displayed.
* @param int $courseid course id.
* @param int $perpage Number of rules to display per page.
*/
public function __construct($uniqueid, \moodle_url $url, $courseid = 0, $perpage = 100) {
parent::__construct($uniqueid);
$this->set_attribute('class', 'toolmonitor subscriberules generaltable generalbox');
$this->define_columns(array('name', 'description', 'course', 'plugin', 'eventname', 'filters', 'select'));
$this->define_headers(array(
get_string('rulename', 'tool_monitor'),
get_string('description'),
get_string('course'),
get_string('area', 'tool_monitor'),
get_string('event', 'tool_monitor'),
get_string('frequency', 'tool_monitor'),
''
)
);
$this->courseid = $courseid;
$this->pagesize = $perpage;
$systemcontext = \context_system::instance();
$this->context = empty($courseid) ? $systemcontext : \context_course::instance($courseid);
$this->collapsible(false);
$this->sortable(false);
$this->pageable(true);
$this->is_downloadable(false);
$this->define_baseurl($url);
$total = \tool_monitor\rule_manager::count_rules_by_courseid($this->courseid);
$this->totalcount = $total;
}
/**
* Generate content for name column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the rule name.
*/
public function col_name(\tool_monitor\rule $rule) {
return $rule->get_name($this->context);
}
/**
* Generate content for description column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the description.
*/
public function col_description(\tool_monitor\rule $rule) {
return $rule->get_description($this->context);
}
/**
* Generate content for course column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the course name.
*/
public function col_course(\tool_monitor\rule $rule) {
$coursename = $rule->get_course_name($this->context);
$courseid = $rule->courseid;
if (empty($courseid)) {
return $coursename;
} else {
return \html_writer::link(new \moodle_url('/course/view.php', array('id' => $this->courseid)), $coursename);
}
}
/**
* Generate content for plugin column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the plugin name.
*/
public function col_plugin(\tool_monitor\rule $rule) {
return $rule->get_plugin_name();
}
/**
* Generate content for eventname column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the event name.
*/
public function col_eventname(\tool_monitor\rule $rule) {
return $rule->get_event_name();
}
/**
* Generate content for filters column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the filters.
*/
public function col_filters(\tool_monitor\rule $rule) {
return $rule->get_filters_description();
}
/**
* Generate content for select column.
*
* @param \tool_monitor\rule $rule rule object
* @return string html used to display the select field.
*/
public function col_select(\tool_monitor\rule $rule) {
global $OUTPUT;
$options = $rule->get_subscribe_options($this->courseid);
$text = get_string('subscribeto', 'tool_monitor', $rule->get_name($this->context));
if ($options instanceof \single_select) {
$options->set_label($text, array('class' => 'accesshide'));
return $OUTPUT->render($options);
} else if ($options instanceof \moodle_url) {
// A \moodle_url to subscribe.
$icon = $OUTPUT->pix_icon('t/add', $text);
$link = new \action_link($options, $icon);
return $OUTPUT->render($link);
} else {
return $options;
}
}
/**
* Query the reader. Store results in the object for use by build_table.
*
* @param int $pagesize size of page for paginated displayed table.
* @param bool $useinitialsbar do you want to use the initials bar.
*/
public function query_db($pagesize, $useinitialsbar = true) {
$total = \tool_monitor\rule_manager::count_rules_by_courseid($this->courseid);
$this->pagesize($pagesize, $total);
$rules = \tool_monitor\rule_manager::get_rules_by_courseid($this->courseid, $this->get_page_start(),
$this->get_page_size());
$this->rawdata = $rules;
// Set initial bars.
if ($useinitialsbar) {
$this->initialbars($total > $pagesize);
}
}
/**
* Gets a list of courses where the current user can subscribe to rules as a dropdown.
*
* @return \single_select|bool returns the list of courses, or false if the select box
* should not be displayed.
*/
public function get_user_courses_select() {
global $DB;
// If the number of courses on the site exceed the maximum drop down limit do not display the select box.
$numcourses = $DB->count_records('course');
if ($numcourses > COURSE_MAX_COURSES_PER_DROPDOWN) {
return false;
}
$orderby = 'visible DESC, sortorder ASC';
$options = array(0 => get_string('site'));
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname', $orderby)) {
foreach ($courses as $course) {
$options[$course->id] = format_string($course->fullname, true,
array('context' => \context_course::instance($course->id)));
}
}
$url = new \moodle_url('/admin/tool/monitor/index.php');
$select = new \single_select($url, 'courseid', $options, $this->courseid);
$select->set_label(get_string('selectacourse', 'tool_monitor'));
return $select;
}
}
@@ -1,197 +0,0 @@
<?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/>.
/**
* Renderable class to display a set of subscriptions in the manage subscriptions page.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\output\managesubs;
defined('MOODLE_INTERNAL') || die;
require_once($CFG->libdir . '/tablelib.php');
/**
* Renderable class to display a set of subscriptions in the manage subscriptions page.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subs extends \table_sql implements \renderable {
/**
* @var int course id.
*/
public $courseid;
/**
* @var \context_course|\context_system context of the page to be rendered.
*/
protected $context;
/**
* Sets up the table_log parameters.
*
* @param string $uniqueid unique id of form.
* @param \moodle_url $url url where this table is displayed.
* @param int $courseid course id.
* @param int $perpage Number of rules to display per page.
*/
public function __construct($uniqueid, \moodle_url $url, $courseid = 0, $perpage = 100) {
parent::__construct($uniqueid);
$this->set_attribute('class', 'toolmonitor subscriptions generaltable generalbox');
$this->define_columns(array('name', 'description', 'course', 'plugin', 'instance', 'eventname',
'filters', 'unsubscribe'));
$this->define_headers(array(
get_string('rulename', 'tool_monitor'),
get_string('description'),
get_string('course'),
get_string('area', 'tool_monitor'),
get_string('moduleinstance', 'tool_monitor'),
get_string('event', 'tool_monitor'),
get_string('frequency', 'tool_monitor'),
get_string('unsubscribe', 'tool_monitor')
)
);
$this->courseid = $courseid;
$this->pagesize = $perpage;
$systemcontext = \context_system::instance();
$this->context = empty($courseid) ? $systemcontext : \context_course::instance($courseid);
$this->collapsible(false);
$this->sortable(false);
$this->pageable(true);
$this->is_downloadable(false);
$this->define_baseurl($url);
}
/**
* Generate content for name column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the rule name.
*/
public function col_name(\tool_monitor\subscription $sub) {
return $sub->get_name($this->context);
}
/**
* Generate content for description column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the description.
*/
public function col_description(\tool_monitor\subscription $sub) {
return $sub->get_description($this->context);
}
/**
* Generate content for course column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the course name.
*/
public function col_course(\tool_monitor\subscription $sub) {
$coursename = $sub->get_course_name($this->context);
$courseid = $sub->courseid;
if (empty($courseid)) {
return $coursename;
} else {
return \html_writer::link(new \moodle_url('/course/view.php', array('id' => $courseid)), $coursename);
}
}
/**
* Generate content for plugin column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the plugin name.
*/
public function col_plugin(\tool_monitor\subscription $sub) {
return $sub->get_plugin_name();
}
/**
* Generate content for instance column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the instance name.
*/
public function col_instance(\tool_monitor\subscription $sub) {
return $sub->get_instance_name();
}
/**
* Generate content for eventname column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the event name.
*/
public function col_eventname(\tool_monitor\subscription $sub) {
return $sub->get_event_name();
}
/**
* Generate content for filters column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the filters.
*/
public function col_filters(\tool_monitor\subscription $sub) {
return $sub->get_filters_description();
}
/**
* Generate content for unsubscribe column.
*
* @param \tool_monitor\subscription $sub subscription object
* @return string html used to display the unsubscribe field.
*/
public function col_unsubscribe(\tool_monitor\subscription $sub) {
global $OUTPUT, $CFG;
$deleteurl = new \moodle_url($CFG->wwwroot. '/admin/tool/monitor/index.php', array('subscriptionid' => $sub->id,
'action' => 'unsubscribe', 'courseid' => $this->courseid, 'sesskey' => sesskey()));
$icon = $OUTPUT->render(new \pix_icon('t/delete', get_string('deletesubscription', 'tool_monitor')));
return \html_writer::link($deleteurl, $icon, array('class' => 'action-icon'));
}
/**
* Query the reader. Store results in the object for use by build_table.
*
* @param int $pagesize size of page for paginated displayed table.
* @param bool $useinitialsbar do you want to use the initials bar.
*/
public function query_db($pagesize, $useinitialsbar = true) {
$total = \tool_monitor\subscription_manager::count_user_subscriptions();
$this->pagesize($pagesize, $total);
$subs = \tool_monitor\subscription_manager::get_user_subscriptions($this->get_page_start(), $this->get_page_size());
$this->rawdata = $subs;
// Set initial bars.
if ($useinitialsbar) {
$this->initialbars($total > $pagesize);
}
}
}
-274
View File
@@ -1,274 +0,0 @@
<?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/>.
/**
* Class represents a single rule.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor;
defined('MOODLE_INTERNAL') || die();
/**
* Class represents a single rule.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class rule {
/**
* @var \stdClass The rule object form database.
*/
protected $rule;
/**
* Constructor.
*
* @param \stdClass $rule A rule object from database.
*/
public function __construct($rule) {
$this->rule = $rule;
}
/**
* Can the current user manage this rule?
*
* @return bool true if the current user can manage this rule, else false.
*/
public function can_manage_rule() {
$courseid = $this->courseid;
$context = empty($courseid) ? \context_system::instance() : \context_course::instance($this->courseid);
return has_capability('tool/monitor:managerules', $context);
}
/**
* Api to duplicate a rule in a given courseid.
*
* @param int $finalcourseid Final course id.
*/
public function duplicate_rule($finalcourseid) {
$rule = fullclone($this->rule);
unset($rule->id);
$rule->courseid = $finalcourseid;
$time = time();
$rule->timecreated = $time;
$rule->timemodified = $time;
rule_manager::add_rule($rule);
}
/**
* Delete this rule.
*
* Note: It also removes all associated subscriptions.
*/
public function delete_rule() {
rule_manager::delete_rule($this->id);
}
/**
* Gets the rule subscribe options for a given course and rule.
*
* Could be a select drop down with a list of possible module
* instances or a single link to subscribe if the rule plugin
* is not a module.
*
* @param int $courseid course id
*
* @return \single_select|\moodle_url|string
* @throws \coding_exception
*/
public function get_subscribe_options($courseid) {
global $CFG;
$url = new \moodle_url($CFG->wwwroot. '/admin/tool/monitor/index.php', array(
'courseid' => $courseid,
'ruleid' => $this->id,
'action' => 'subscribe',
'sesskey' => sesskey()
));
if (strpos($this->plugin, 'mod_') !== 0) {
return $url;
} else {
// Single select when the plugin is an activity.
$options = array();
$options[0] = get_string('allmodules', 'tool_monitor');
if ($courseid == 0) {
// They need to be in a course to select module instance.
return get_string('selectcourse', 'tool_monitor');
}
// Let them select an instance.
$cms = get_fast_modinfo($courseid);
$instances = $cms->get_instances_of(str_replace('mod_', '', $this->plugin));
foreach ($instances as $cminfo) {
// Don't list instances that are not visible or available to the user.
if ($cminfo->uservisible && $cminfo->available) {
$options[$cminfo->id] = $cminfo->get_formatted_name();
}
}
return new \single_select($url, 'cmid', $options);
}
}
/**
* Subscribe an user to this rule.
*
* @param int $courseid Course id.
* @param int $cmid Course module id.
* @param int $userid User id.
*
* @throws \coding_exception
*/
public function subscribe_user($courseid, $cmid, $userid = 0) {
global $USER;
if ($this->courseid != $courseid && $this->courseid != 0) {
// Trying to subscribe to a rule that belongs to a different course. Should never happen.
throw new \coding_exception('Can not subscribe to rules from a different course');
}
if ($cmid !== 0) {
$cms = get_fast_modinfo($courseid);
$cminfo = $cms->get_cm($cmid);
if (!$cminfo->uservisible || !$cminfo->available) {
// Trying to subscribe to a hidden or restricted cm. Should never happen.
throw new \coding_exception('You cannot do that');
}
}
$userid = empty($userid) ? $USER->id : $userid;
subscription_manager::create_subscription($this->id, $courseid, $cmid, $userid);
}
/**
* Magic get method.
*
* @param string $prop property to get.
*
* @return mixed
* @throws \coding_exception
*/
public function __get($prop) {
if (property_exists($this->rule, $prop)) {
return $this->rule->$prop;
}
throw new \coding_exception('Property "' . $prop . '" doesn\'t exist');
}
/**
* Return the rule data to be used while setting mform.
*
* @throws \coding_exception
*/
public function get_mform_set_data() {
if (!empty($this->rule)) {
$rule = fullclone($this->rule);
$rule->description = array('text' => $rule->description, 'format' => $rule->descriptionformat);
$rule->template = array('text' => $rule->template, 'format' => $rule->templateformat);
return $rule;
}
throw new \coding_exception('Invalid call to get_mform_set_data.');
}
/**
* Method to get event name.
*
* @return string
* @throws \coding_exception
*/
public function get_event_name() {
$eventclass = $this->eventname;
if (class_exists($eventclass)) {
return $eventclass::get_name();
}
return get_string('eventnotfound', 'tool_monitor');
}
/**
* Get filter description.
*
* @return string
*/
public function get_filters_description() {
$a = new \stdClass();
$a->freq = $this->frequency;
$mins = $this->timewindow / MINSECS; // Convert seconds to minutes.
$a->mins = $mins;
return get_string('freqdesc', 'tool_monitor', $a);
}
/**
* Get properly formatted name of the course associated.
*
* @param \context $context context where this name would be displayed.
* @return string The course fullname.
*/
public function get_course_name($context) {
$courseid = $this->courseid;
if (empty($courseid)) {
return get_string('site');
} else {
$course = get_course($courseid);
return format_string($course->fullname, true, array('context' => $context));
}
}
/**
* Get properly formatted name of the rule associated.
*
* @param \context $context context where this name would be displayed.
* @return string Formatted name of the rule.
*/
public function get_name(\context $context) {
return format_text($this->name, FORMAT_HTML, array('context' => $context));
}
/**
* Get properly formatted description of the rule associated.
*
* @param \context $context context where this description would be displayed.
* @return string Formatted description of the rule.
*/
public function get_description(\context $context) {
return format_text($this->description, $this->descriptionformat, array('context' => $context));
}
/**
* Get name of the plugin associated with this rule
*
* @return string Plugin name.
*/
public function get_plugin_name() {
if ($this->plugin === 'core') {
$string = get_string('core', 'tool_monitor');
} else if (get_string_manager()->string_exists('pluginname', $this->plugin)) {
$string = get_string('pluginname', $this->plugin);
} else {
$string = $this->plugin;
}
return $string;
}
}
-152
View File
@@ -1,152 +0,0 @@
<?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/>.
/**
* The mform for creating and editing a rule.
*
* @copyright 2014 onwards Simey Lameze <lameze@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package tool_monitor
*/
namespace tool_monitor;
require_once($CFG->dirroot.'/lib/formslib.php');
/**
* The mform for creating and editing a rule.
*
* @since Moodle 2.8
* @copyright 2014 onwards Simey Lameze <lameze@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @package tool_monitor
*/
class rule_form extends \moodleform {
/**
* Mform class definition
*
*/
public function definition () {
$mform = $this->_form;
$eventlist = $this->_customdata['eventlist'];
$pluginlist = $this->_customdata['pluginlist'];
$rule = $this->_customdata['rule'];
$courseid = $this->_customdata['courseid'];
$subscriptioncount = $this->_customdata['subscriptioncount'];
// General section header.
$mform->addElement('header', 'general', get_string('general'));
// Hidden course ID.
$mform->addElement('hidden', 'courseid');
$mform->setType('courseid', PARAM_INT);
// We are editing a existing rule.
if (!empty($rule->id)) {
// Hidden rule id.
$mform->addElement('hidden', 'ruleid');
$mform->setType('ruleid', PARAM_INT);
$mform->setConstant('ruleid', $rule->id);
// Force course id.
$courseid = $rule->courseid;
}
// Make course id a constant.
$mform->setConstant('courseid', $courseid);
if (empty($courseid)) {
$context = \context_system::instance();
} else {
$context = \context_course::instance($courseid);
}
$editoroptions = array(
'subdirs' => 0,
'maxbytes' => 0,
'maxfiles' => 0,
'changeformat' => 0,
'context' => $context,
'noclean' => 0,
'trusttext' => 0
);
// Name field.
$mform->addElement('text', 'name', get_string('rulename', 'tool_monitor'), 'size="50"');
$mform->addRule('name', get_string('required'), 'required');
$mform->setType('name', PARAM_TEXT);
// Plugin field.
$mform->addElement('select', 'plugin', get_string('areatomonitor', 'tool_monitor'), $pluginlist);
$mform->addRule('plugin', get_string('required'), 'required');
// Event field.
$mform->addElement('select', 'eventname', get_string('event', 'tool_monitor'), $eventlist);
$mform->addRule('eventname', get_string('required'), 'required');
// Freeze plugin and event fields for editing if there's a subscription for this rule.
if ($subscriptioncount > 0) {
$mform->freeze('plugin');
$mform->setConstant('plugin', $rule->plugin);
$mform->freeze('eventname');
$mform->setConstant('eventname', $rule->eventname);
}
// Description field.
$mform->addElement('editor', 'description', get_string('description'), $editoroptions);
// Filters.
$freq = array(1 => 1, 5 => 5, 10 => 10, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 60 => 60, 70 => 70, 80 => 80, 90 => 90,
100 => 100, 1000 => 1000);
$mform->addElement('select', 'frequency', get_string('frequency', 'tool_monitor'), $freq);
$mform->addRule('frequency', get_string('required'), 'required');
$mform->addHelpButton('frequency', 'frequency', 'tool_monitor');
$mins = array(1 => 1, 5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50,
55 => 55, 60 => 60);
$mform->addElement('select', 'minutes', get_string('inminutes', 'tool_monitor'), $mins);
$mform->addRule('minutes', get_string('required'), 'required');
// Message template.
$mform->addElement('editor', 'template', get_string('messagetemplate', 'tool_monitor'), $editoroptions);
$mform->setDefault('template', array('text' => get_string('defaultmessagetemplate', 'tool_monitor'),
'format' => FORMAT_HTML));
$mform->addRule('template', get_string('required'), 'required');
$mform->addHelpButton('template', 'messagetemplate', 'tool_monitor');
// Action buttons.
$this->add_action_buttons(true, get_string('savechanges'));
}
/**
* Form validation
*
* @param array $data data from the form.
* @param array $files files uploaded.
*
* @return array of errors.
*/
public function validation($data, $files) {
$errors = parent::validation($data, $files);
if (!eventlist::validate_event_plugin($data['plugin'], $data['eventname'])) {
$errors['eventname'] = get_string('errorincorrectevent', 'tool_monitor');
}
return $errors;
}
}
-290
View File
@@ -1,290 +0,0 @@
<?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/>.
/**
* Rule manager class.
*
* @package tool_monitor
* @copyright 2014 onwards Simey Lameze <lameze@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor;
defined('MOODLE_INTERNAL') || die();
/**
* Rule manager class.
*
* @package tool_monitor
* @copyright 2014 onwards Simey Lameze <lameze@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class rule_manager {
/**
* Create a new rule.
*
* @param \stdClass $ruledata data to insert as new rule entry.
*
* @return rule An instance of rule class.
*/
public static function add_rule($ruledata) {
global $DB;
$now = time();
$ruledata->timecreated = $now;
$ruledata->timemodified = $now;
$ruledata->id = $DB->insert_record('tool_monitor_rules', $ruledata);
// Trigger a rule created event.
if ($ruledata->id) {
if (!empty($ruledata->courseid)) {
$courseid = $ruledata->courseid;
$context = \context_course::instance($ruledata->courseid);
} else {
$courseid = 0;
$context = \context_system::instance();
}
$params = array(
'objectid' => $ruledata->id,
'courseid' => $courseid,
'context' => $context
);
$event = \tool_monitor\event\rule_created::create($params);
$event->trigger();
}
return new rule($ruledata);
}
/**
* Clean data submitted by mform.
*
* @param \stdClass $mformdata data to insert as new rule entry.
*
* @return \stdClass Cleaned rule data.
*/
public static function clean_ruledata_form($mformdata) {
global $USER;
$rule = new \stdClass();
if (!empty($mformdata->ruleid)) {
$rule->id = $mformdata->ruleid;
}
$rule->userid = empty($mformdata->userid) ? $USER->id : $mformdata->userid;
$rule->courseid = $mformdata->courseid;
$rule->name = $mformdata->name;
$rule->plugin = $mformdata->plugin;
$rule->eventname = $mformdata->eventname;
$rule->description = $mformdata->description['text'];
$rule->descriptionformat = $mformdata->description['format'];
$rule->frequency = $mformdata->frequency;
$rule->timewindow = $mformdata->minutes * MINSECS;
$rule->template = $mformdata->template['text'];
$rule->templateformat = $mformdata->template['format'];
return $rule;
}
/**
* Delete a rule and associated subscriptions, by rule id.
*
* @param int $ruleid id of rule to be deleted.
* @param \context|null $coursecontext the context of the course - this is passed when we
* can not get the context via \context_course as the course has been deleted.
*
* @return bool
*/
public static function delete_rule($ruleid, $coursecontext = null) {
global $DB;
subscription_manager::remove_all_subscriptions_for_rule($ruleid, $coursecontext);
// Retrieve the rule from the DB before we delete it, so we have a record when we trigger a rule deleted event.
$rule = $DB->get_record('tool_monitor_rules', array('id' => $ruleid));
$success = $DB->delete_records('tool_monitor_rules', array('id' => $ruleid));
// If successful trigger a rule deleted event.
if ($success) {
// It is possible that we are deleting rules associated with a deleted course, so we should be
// passing the context as the second parameter.
if (!is_null($coursecontext)) {
$context = $coursecontext;
$courseid = $rule->courseid;
} else if (!empty($rule->courseid) && ($context = \context_course::instance($rule->courseid,
IGNORE_MISSING))) {
$courseid = $rule->courseid;
} else {
$courseid = 0;
$context = \context_system::instance();
}
$params = array(
'objectid' => $rule->id,
'courseid' => $courseid,
'context' => $context
);
$event = \tool_monitor\event\rule_deleted::create($params);
$event->add_record_snapshot('tool_monitor_rules', $rule);
$event->trigger();
}
return $success;
}
/**
* Get an instance of rule class.
*
* @param \stdClass|int $ruleorid A rule object from database or rule id.
*
* @return rule object with rule id.
*/
public static function get_rule($ruleorid) {
global $DB;
if (!is_object($ruleorid)) {
$rule = $DB->get_record('tool_monitor_rules', array('id' => $ruleorid), '*', MUST_EXIST);
} else {
$rule = $ruleorid;
}
return new rule($rule);
}
/**
* Update rule data.
*
* @throws \coding_exception if $record->ruleid is invalid.
* @param object $ruledata rule data to be updated.
*
* @return bool
*/
public static function update_rule($ruledata) {
global $DB;
if (!self::get_rule($ruledata->id)) {
throw new \coding_exception('Invalid rule ID.');
}
$ruledata->timemodified = time();
$success = $DB->update_record('tool_monitor_rules', $ruledata);
// If successful trigger a rule updated event.
if ($success) {
// If we do not have the course id we need to retrieve it.
if (!isset($ruledata->courseid)) {
$courseid = $DB->get_field('tool_monitor_rules', 'courseid', array('id' => $ruledata->id), MUST_EXIST);
} else {
$courseid = $ruledata->courseid;
}
if (!empty($courseid)) {
$context = \context_course::instance($courseid);
} else {
$context = \context_system::instance();
}
$params = array(
'objectid' => $ruledata->id,
'courseid' => $courseid,
'context' => $context
);
$event = \tool_monitor\event\rule_updated::create($params);
$event->trigger();
}
return $success;
}
/**
* Get rules by course id.
*
* @param int $courseid course id of the rule.
* @param int $limitfrom Limit from which to fetch rules.
* @param int $limitto Limit to which rules need to be fetched.
* @param bool $includesite Determines whether we return site wide rules or not.
*
* @return array List of rules for the given course id, if specified will also include site rules.
*/
public static function get_rules_by_courseid($courseid, $limitfrom = 0, $limitto = 0, $includesite = true) {
global $DB;
$select = 'courseid = ?';
$params = array();
$params[] = $courseid;
if ($includesite) {
$select .= ' OR courseid = ?';
$params[] = 0;
}
$orderby = 'courseid DESC, name ASC';
return self::get_instances($DB->get_records_select('tool_monitor_rules', $select, $params, $orderby,
'*', $limitfrom, $limitto));
}
/**
* Get rule count by course id.
*
* @param int $courseid course id of the rule.
*
* @return int count of rules present in system visible in the given course id.
*/
public static function count_rules_by_courseid($courseid) {
global $DB;
$select = "courseid = ? OR courseid = ?";
return $DB->count_records_select('tool_monitor_rules', $select, array(0, $courseid));
}
/**
* Get rules by plugin name.
*
* @param string $plugin plugin name of the rule.
*
* @return array List of rules for the given plugin name.
*/
public static function get_rules_by_plugin($plugin) {
global $DB;
return self::get_instances($DB->get_records('tool_monitor_rules', array('plugin' => $plugin)));
}
/**
* Get rules by event name.
*
* @param string $eventname event name of the rule.
*
* @return array List of rules for the given event.
*/
public static function get_rules_by_event($eventname) {
global $DB;
return self::get_instances($DB->get_records('tool_monitor_rules', array('eventname' => $eventname)));
}
/**
* Helper method to convert db records to instances.
*
* @param array $arr of rules.
*
* @return array of rules as instances.
*/
protected static function get_instances($arr) {
$result = array();
foreach ($arr as $key => $sub) {
$result[$key] = new rule($sub);
}
return $result;
}
}
-185
View File
@@ -1,185 +0,0 @@
<?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/>.
/**
* Class represents a single subscription.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor;
defined('MOODLE_INTERNAL') || die();
/**
* Class represents a single subscription instance (i.e with all the subscription info).
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subscription {
/**
* @var \stdClass
*/
protected $subscription;
/**
* Constructor.
*
* use {@link \tool_monitor\subscription_manager::get_subscription} to get an instance instead of directly calling this method.
*
* @param \stdClass $subscription
*/
public function __construct($subscription) {
$this->subscription = $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)) {
return $this->subscription->$prop;
}
throw new \coding_exception('Property "' . $prop . '" doesn\'t exist');
}
/**
* Get a human readable name for instances associated with this subscription.
*
* @return string
* @throws \coding_exception
*/
public function get_instance_name() {
if ($this->plugin === 'core') {
$string = get_string('allevents', 'tool_monitor');
} else {
if ($this->cmid == 0) {
$string = get_string('allmodules', 'tool_monitor');
} else {
$cms = get_fast_modinfo($this->courseid);
$cms = $cms->get_cms();
if (isset($cms[$this->cmid])) {
$string = $cms[$this->cmid]->get_formatted_name(); // Instance name.
} else {
// Something is wrong, instance is not present anymore.
$string = get_string('invalidmodule', 'tool_monitor');
}
}
}
return $string;
}
/**
* Method to get event name.
*
* @return string
* @throws \coding_exception
*/
public function get_event_name() {
$eventclass = $this->eventname;
if (class_exists($eventclass)) {
return $eventclass::get_name();
}
return get_string('eventnotfound', 'tool_monitor');
}
/**
* Get filter description.
*
* @return string
*/
public function get_filters_description() {
$a = new \stdClass();
$a->freq = $this->frequency;
$mins = $this->timewindow / MINSECS; // Convert seconds to minutes.
$a->mins = $mins;
return get_string('freqdesc', 'tool_monitor', $a);
}
/**
* Get properly formatted name of the rule associated.
*
* @param \context $context context where this name would be displayed.
* @return string Formatted name of the rule.
*/
public function get_name(\context $context) {
return format_text($this->name, FORMAT_HTML, array('context' => $context));
}
/**
* Get properly formatted description of the rule associated.
*
* @param \context $context context where this description would be displayed.
* @return string Formatted description of the rule.
*/
public function get_description(\context $context) {
return format_text($this->description, $this->descriptionformat, array('context' => $context));
}
/**
* Get name of the plugin associated with this rule
*
* @return string Plugin name.
*/
public function get_plugin_name() {
if ($this->plugin === 'core') {
$string = get_string('core', 'tool_monitor');
} else if (get_string_manager()->string_exists('pluginname', $this->plugin)) {
$string = get_string('pluginname', $this->plugin);
} else {
$string = $this->plugin;
}
return $string;
}
/**
* Get properly formatted name of the course associated.
*
* @param \context $context context where this name would be displayed.
* @return string Formatted name of the rule.
*/
public function get_course_name(\context $context) {
$courseid = $this->courseid;
if (empty($courseid)) {
return get_string('site');
} else {
$course = get_course($courseid);
return format_string($course->fullname, true, array('context' => $context));
}
}
/**
* Can the current user manage the rule associate with this subscription?
*
* @return bool true if the current user can manage this rule, else false.
*/
public function can_manage_rule() {
$courseid = $this->rulecourseid;
$context = empty($courseid) ? \context_system::instance() : \context_course::instance($courseid);
return has_capability('tool/monitor:managerules', $context);
}
}
@@ -1,459 +0,0 @@
<?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/>.
/**
* Class to manage subscriptions.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor;
defined('MOODLE_INTERNAL') || die();
/**
* Class to manage subscriptions.
*
* @since Moodle 2.8
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class subscription_manager {
/**
* Subscribe a user to a given rule.
*
* @param int $ruleid Rule id.
* @param int $courseid Course id.
* @param int $cmid Course module id.
* @param int $userid User who is subscribing, defaults to $USER.
*
* @return bool|int returns id of the created subscription.
*/
public static function create_subscription($ruleid, $courseid, $cmid, $userid = 0) {
global $DB, $USER;
$subscription = new \stdClass();
$subscription->ruleid = $ruleid;
$subscription->courseid = $courseid;
$subscription->cmid = $cmid;
$subscription->userid = empty($userid) ? $USER->id : $userid;
if ($DB->record_exists('tool_monitor_subscriptions', (array)$subscription)) {
// Subscription already exists.
return false;
}
$subscription->timecreated = time();
$subscription->id = $DB->insert_record('tool_monitor_subscriptions', $subscription);
// Trigger a subscription created event.
if ($subscription->id) {
if (!empty($subscription->courseid)) {
$courseid = $subscription->courseid;
$context = \context_course::instance($subscription->courseid);
} else {
$courseid = 0;
$context = \context_system::instance();
}
$params = array(
'objectid' => $subscription->id,
'courseid' => $courseid,
'context' => $context
);
$event = \tool_monitor\event\subscription_created::create($params);
$event->trigger();
// Let's invalidate the cache.
$cache = \cache::make('tool_monitor', 'eventsubscriptions');
$cache->delete($courseid);
}
return $subscription->id;
}
/**
* Delete a subscription.
*
* @param subscription|int $subscriptionorid an instance of subscription class or id.
* @param bool $checkuser Check if the subscription belongs to current user before deleting.
*
* @return bool
* @throws \coding_exception if $checkuser is true and the subscription doesn't belong to the current user.
*/
public static function delete_subscription($subscriptionorid, $checkuser = true) {
global $DB, $USER;
if (is_object($subscriptionorid)) {
$subscription = $subscriptionorid;
} else {
$subscription = self::get_subscription($subscriptionorid);
}
if ($checkuser && $subscription->userid != $USER->id) {
throw new \coding_exception('Invalid subscription supplied');
}
// Store the subscription before we delete it.
$subscription = $DB->get_record('tool_monitor_subscriptions', array('id' => $subscription->id));
$success = $DB->delete_records('tool_monitor_subscriptions', array('id' => $subscription->id));
// If successful trigger a subscription_deleted event.
if ($success) {
if (!empty($subscription->courseid)) {
$courseid = $subscription->courseid;
$context = \context_course::instance($subscription->courseid);
} else {
$courseid = 0;
$context = \context_system::instance();
}
$params = array(
'objectid' => $subscription->id,
'courseid' => $courseid,
'context' => $context
);
$event = \tool_monitor\event\subscription_deleted::create($params);
$event->add_record_snapshot('tool_monitor_subscriptions', $subscription);
$event->trigger();
// Let's invalidate the cache.
$cache = \cache::make('tool_monitor', 'eventsubscriptions');
$cache->delete($courseid);
}
return $success;
}
/**
* Delete all subscriptions for a user.
*
* @param int $userid user id.
*
* @return mixed
*/
public static function delete_user_subscriptions($userid) {
global $DB;
return $DB->delete_records('tool_monitor_subscriptions', array('userid' => $userid));
}
/**
* Delete all subscriptions for a course module.
*
* @param int $cmid cm id.
*
* @return mixed
*/
public static function delete_cm_subscriptions($cmid) {
global $DB;
return $DB->delete_records('tool_monitor_subscriptions', array('cmid' => $cmid));
}
/**
* Delete all subscribers for a given rule.
*
* @param int $ruleid rule id.
* @param \context|null $coursecontext the context of the course - this is passed when we
* can not get the context via \context_course as the course has been deleted.
*
* @return bool
*/
public static function remove_all_subscriptions_for_rule($ruleid, $coursecontext = null) {
global $DB;
// Store all the subscriptions we have to delete.
$subscriptions = $DB->get_recordset('tool_monitor_subscriptions', array('ruleid' => $ruleid));
// Now delete them.
$success = $DB->delete_records('tool_monitor_subscriptions', array('ruleid' => $ruleid));
// If successful and there were subscriptions that were deleted trigger a subscription deleted event.
if ($success && $subscriptions) {
foreach ($subscriptions as $subscription) {
// It is possible that we are deleting rules associated with a deleted course, so we should be
// passing the context as the second parameter.
if (!is_null($coursecontext)) {
$context = $coursecontext;
$courseid = $subscription->courseid;
} else if (!empty($subscription->courseid) && ($coursecontext =
\context_course::instance($subscription->courseid, IGNORE_MISSING))) {
$courseid = $subscription->courseid;
$context = $coursecontext;
} else {
$courseid = 0;
$context = \context_system::instance();
}
$params = array(
'objectid' => $subscription->id,
'courseid' => $courseid,
'context' => $context
);
$event = \tool_monitor\event\subscription_deleted::create($params);
$event->add_record_snapshot('tool_monitor_subscriptions', $subscription);
$event->trigger();
// Let's invalidate the cache.
$cache = \cache::make('tool_monitor', 'eventsubscriptions');
$cache->delete($courseid);
}
}
$subscriptions->close();
return $success;
}
/**
* Get a subscription instance for an given subscription id.
*
* @param subscription|int $subscriptionorid an instance of subscription class or id.
*
* @return subscription returns a instance of subscription class.
*/
public static function get_subscription($subscriptionorid) {
global $DB;
if (is_object($subscriptionorid)) {
return new subscription($subscriptionorid);
}
$sql = self::get_subscription_join_rule_sql();
$sql .= "WHERE s.id = :id";
$sub = $DB->get_record_sql($sql, array('id' => $subscriptionorid), MUST_EXIST);
return new subscription($sub);
}
/**
* Get an array of subscriptions for a given user in a given course.
*
* @param int $courseid course id.
* @param int $limitfrom Limit from which to fetch rules.
* @param int $limitto Limit to which rules need to be fetched.
* @param int $userid Id of the user for which the subscription needs to be fetched. Defaults to $USER;
* @param string $order Order to sort the subscriptions.
*
* @return array list of subscriptions
*/
public static function get_user_subscriptions_for_course($courseid, $limitfrom = 0, $limitto = 0, $userid = 0,
$order = 's.timecreated DESC' ) {
global $DB, $USER;
if ($userid == 0) {
$userid = $USER->id;
}
$sql = self::get_subscription_join_rule_sql();
$sql .= "WHERE s.courseid = :courseid AND s.userid = :userid ORDER BY $order";
return self::get_instances($DB->get_records_sql($sql, array('courseid' => $courseid, 'userid' => $userid), $limitfrom,
$limitto));
}
/**
* Get count of subscriptions for a given user in a given course.
*
* @param int $courseid course id.
* @param int $userid Id of the user for which the subscription needs to be fetched. Defaults to $USER;
*
* @return int number of subscriptions
*/
public static function count_user_subscriptions_for_course($courseid, $userid = 0) {
global $DB, $USER;
if ($userid == 0) {
$userid = $USER->id;
}
$sql = self::get_subscription_join_rule_sql(true);
$sql .= "WHERE s.courseid = :courseid AND s.userid = :userid";
return $DB->count_records_sql($sql, array('courseid' => $courseid, 'userid' => $userid));
}
/**
* Get an array of subscriptions for a given user.
*
* @param int $limitfrom Limit from which to fetch rules.
* @param int $limitto Limit to which rules need to be fetched.
* @param int $userid Id of the user for which the subscription needs to be fetched. Defaults to $USER;
* @param string $order Order to sort the subscriptions.
*
* @return array list of subscriptions
*/
public static function get_user_subscriptions($limitfrom = 0, $limitto = 0, $userid = 0,
$order = 's.courseid ASC, r.name' ) {
global $DB, $USER;
if ($userid == 0) {
$userid = $USER->id;
}
$sql = self::get_subscription_join_rule_sql();
$sql .= "WHERE s.userid = :userid ORDER BY $order";
return self::get_instances($DB->get_records_sql($sql, array('userid' => $userid), $limitfrom, $limitto));
}
/**
* Get count of subscriptions for a given user.
*
* @param int $userid Id of the user for which the subscription needs to be fetched. Defaults to $USER;
*
* @return int number of subscriptions
*/
public static function count_user_subscriptions($userid = 0) {
global $DB, $USER;;
if ($userid == 0) {
$userid = $USER->id;
}
$sql = self::get_subscription_join_rule_sql(true);
$sql .= "WHERE s.userid = :userid";
return $DB->count_records_sql($sql, array('userid' => $userid));
}
/**
* Return a list of subscriptions for a given event.
*
* @param \stdClass $event the event object.
*
* @return array
*/
public static function get_subscriptions_by_event(\stdClass $event) {
global $DB;
$sql = self::get_subscription_join_rule_sql();
if ($event->contextlevel == CONTEXT_MODULE && $event->contextinstanceid != 0) {
$sql .= "WHERE r.eventname = :eventname AND s.courseid = :courseid AND (s.cmid = :cmid OR s.cmid = 0)";
$params = array('eventname' => $event->eventname, 'courseid' => $event->courseid, 'cmid' => $event->contextinstanceid);
} else {
$sql .= "WHERE r.eventname = :eventname AND (s.courseid = :courseid OR s.courseid = 0)";
$params = array('eventname' => $event->eventname, 'courseid' => $event->courseid);
}
return self::get_instances($DB->get_records_sql($sql, $params));
}
/**
* Return sql to join rule and subscription table.
*
* @param bool $count Weather if this is a count query or not.
*
* @return string the sql.
*/
protected static function get_subscription_join_rule_sql($count = false) {
if ($count) {
$select = "SELECT COUNT(s.id) ";
} else {
$select = "SELECT s.*, r.description, r.descriptionformat, r.name, r.userid as ruleuserid, r.courseid as rulecourseid,
r.plugin, r.eventname, r.template, r.templateformat, r.frequency, r.timewindow";
}
$sql = $select . "
FROM {tool_monitor_rules} r
JOIN {tool_monitor_subscriptions} s
ON r.id = s.ruleid ";
return $sql;
}
/**
* Helper method to convert db records to instances.
*
* @param array $arr of subscriptions.
*
* @return array of subscriptions as instances.
*/
protected static function get_instances($arr) {
$result = array();
foreach ($arr as $key => $sub) {
$result[$key] = new subscription($sub);
}
return $result;
}
/**
* Get count of subscriptions for a given rule.
*
* @param int $ruleid rule id of the subscription.
*
* @return int number of subscriptions
*/
public static function count_rule_subscriptions($ruleid) {
global $DB;
$sql = self::get_subscription_join_rule_sql(true);
$sql .= "WHERE s.ruleid = :ruleid";
return $DB->count_records_sql($sql, array('ruleid' => $ruleid));
}
/**
* Returns true if an event in a particular course has a subscription.
*
* @param string $eventname the name of the event
* @param int $courseid the course id
* @return bool returns true if the event has subscriptions in a given course, false otherwise.
*/
public static function event_has_subscriptions($eventname, $courseid) {
global $DB;
// Check if we can return these from cache.
$cache = \cache::make('tool_monitor', 'eventsubscriptions');
// The SQL we will be using to fill the cache if it is empty.
$sql = "SELECT DISTINCT(r.eventname)
FROM {tool_monitor_subscriptions} s
INNER JOIN {tool_monitor_rules} r
ON s.ruleid = r.id
WHERE s.courseid = :courseid";
$sitesubscriptions = $cache->get(0);
// If we do not have the site subscriptions in the cache then return them from the DB.
if ($sitesubscriptions === false) {
// Set the array for the cache.
$sitesubscriptions = array();
if ($subscriptions = $DB->get_records_sql($sql, array('courseid' => 0))) {
foreach ($subscriptions as $subscription) {
$sitesubscriptions[$subscription->eventname] = true;
}
}
$cache->set(0, $sitesubscriptions);
}
// Check if a subscription exists for this event site wide.
if (isset($sitesubscriptions[$eventname])) {
return true;
}
// If the course id is for the site, and we reached here then there is no site wide subscription for this event.
if (empty($courseid)) {
return false;
}
$coursesubscriptions = $cache->get($courseid);
// If we do not have the course subscriptions in the cache then return them from the DB.
if ($coursesubscriptions === false) {
// Set the array for the cache.
$coursesubscriptions = array();
if ($subscriptions = $DB->get_records_sql($sql, array('courseid' => $courseid))) {
foreach ($subscriptions as $subscription) {
$coursesubscriptions[$subscription->eventname] = true;
}
}
$cache->set($courseid, $coursesubscriptions);
}
// Check if a subscription exists for this event in this course.
if (isset($coursesubscriptions[$eventname])) {
return true;
}
return false;
}
}
@@ -1,146 +0,0 @@
<?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/>.
/**
* Clean the tool_monitor_events table.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_monitor\task;
/**
* Simple task to clean the tool_monitor_events table.
*/
class clean_events extends \core\task\scheduled_task {
/**
* Get a descriptive name for this task.
*
* @return string
*/
public function get_name() {
return get_string('taskcleanevents', 'tool_monitor');
}
/**
* Performs the cleaning of events.
*/
public function execute() {
global $DB;
if (!get_config('tool_monitor', 'enablemonitor')) {
return; // The tool is disabled. Nothing to do.
}
// Array to store which events have been triggered in which course.
$courses = array();
// Firstly, let's go through the site wide rules. There may be multiple rules for the site that rely on
// the same event being triggered, so we only remove the events when they reach the max timewindow.
if ($siterules = $DB->get_recordset('tool_monitor_rules', array('courseid' => 0), 'timewindow DESC')) {
// Go through each rule and check if there are any events we can remove.
foreach ($siterules as $rule) {
// Check if we have already processed this event.
if (isset($courses[$rule->courseid][$rule->eventname])) {
continue;
}
// Store the timewindow for this event.
$courses[$rule->courseid][$rule->eventname] = $rule->timewindow;
// Delete any events that may exist that have exceeded the timewindow.
$DB->delete_records_select('tool_monitor_events', 'eventname = :eventname AND
courseid = :courseid AND timecreated <= :timewindow',
array('eventname' => $rule->eventname, 'courseid' => $rule->courseid,
'timewindow' => time() - $rule->timewindow));
}
// Free resources.
$siterules->close();
}
// Now, get the course rules. The same applies here - there may be multiple rules for the course that rely on
// the same event being triggered, so we only remove the events when they reach the max timewindow.
if ($rules = $DB->get_recordset_select('tool_monitor_rules', 'courseid != 0', array(), 'timewindow DESC')) {
// Go through each rule and check if there are any events we can remove.
foreach ($rules as $rule) {
// Check if we have already processed this event for this particular course.
if (isset($courses[$rule->courseid][$rule->eventname])) {
continue;
}
// Add the course and event to the list.
$courses[$rule->courseid][$rule->eventname] = $rule->timewindow;
// If there is a site wide rule listening for this event do not remove it unless the maximum
// timewindow between the two has exceeded.
$timewindow = $rule->timewindow;
if (isset($courses[0][$rule->eventname]) && ($courses[0][$rule->eventname] > $timewindow)) {
$timewindow = $courses[0][$rule->eventname];
}
// Delete any events that may exist that have exceeded the timewindow.
$DB->delete_records_select('tool_monitor_events', 'eventname = :eventname AND
courseid = :courseid AND timecreated <= :timewindow',
array('eventname' => $rule->eventname, 'courseid' => $rule->courseid,
'timewindow' => time() - $timewindow));
}
// Free resources.
$rules->close();
}
if ($siterules || $rules) { // Check that there are rules present.
// Get a list of all the events we have been through.
$allevents = array();
foreach ($courses as $key => $value) {
foreach ($courses[$key] as $event => $notused) {
$allevents[] = $event;
}
}
// Remove all the events in the table that are not applicable to any rule. There may be a rule in one course
// listening for a certain event, but not in another course, so we can delete the event from the course
// where there is no rule. We also have to consider site wide rules. We may have an event that is triggered
// in a course we can't remove because there is a site wide rule for this event.
if ($events = $DB->get_recordset('tool_monitor_events')) {
// Array to store which events we need to remove.
$eventstodelete = array();
// Store the current time.
$now = time();
foreach ($events as $event) {
// If the event is not required for a course rule and there is no site wide rule for it, or
// it has extended past or equal to the timewindow for the site rule - it can be deleted.
if (!isset($courses[$event->courseid][$event->eventname]) && (!isset($courses[0][$event->eventname])
|| $courses[0][$event->eventname] <= ($now - $event->timecreated))) {
$eventstodelete[] = $event->id;
}
}
// Free resources.
$events->close();
// Remove the events.
if (!empty($eventstodelete)) {
list($eventidsql, $params) = $DB->get_in_or_equal($eventstodelete);
$DB->delete_records_select('tool_monitor_events', "id $eventidsql", $params);
}
}
// Remove all the events in the table that are not used by any rule.
if (!empty($allevents)) {
list($eventnamesql, $params) = $DB->get_in_or_equal($allevents, SQL_PARAMS_QM, 'param', false);
$DB->delete_records_select('tool_monitor_events', "eventname $eventnamesql", $params);
}
} else { // No rules, just remove everything.
$DB->delete_records('tool_monitor_events');
}
}
}
-61
View File
@@ -1,61 +0,0 @@
<?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/>.
/**
* Capabilities.
*
* This files lists capabilities related to tool_monitor.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$capabilities = array(
'tool/monitor:subscribe' => array(
'riskbitmask' => RISK_PERSONAL,
'captype' => 'read',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
'tool/monitor:managerules' => array(
'riskbitmask' => RISK_XSS,
'captype' => 'write',
'contextlevel' => CONTEXT_COURSE,
'archetypes' => array(
'teacher' => CAP_ALLOW,
'editingteacher' => CAP_ALLOW,
'manager' => CAP_ALLOW
),
),
'tool/monitor:managetool' => array(
'riskbitmask' => RISK_XSS, RISK_CONFIG,
'captype' => 'write',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW
),
),
);
-35
View File
@@ -1,35 +0,0 @@
<?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/>.
/**
* Event monitor cache definitions.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
$definitions = array(
'eventsubscriptions' => array(
'mode' => cache_store::MODE_APPLICATION,
'simplekeys' => true,
'simpledata' => true,
'staticacceleration' => true,
'staticaccelerationsize' => 10
)
);
-44
View File
@@ -1,44 +0,0 @@
<?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/>.
/**
* This file definies observers needed by the tool.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// List of observers.
$observers = array(
array(
'eventname' => '\core\event\course_deleted',
'priority' => 1,
'callback' => '\tool_monitor\eventobservers::course_deleted',
),
array(
'eventname' => '*',
'callback' => '\tool_monitor\eventobservers::process_event',
),
array(
'eventname' => '\core\event\user_deleted',
'callback' => '\tool_monitor\eventobservers::user_deleted',
),
array(
'eventname' => '\core\event\course_module_deleted',
'callback' => '\tool_monitor\eventobservers::course_module_deleted',
)
);
-81
View File
@@ -1,81 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<XMLDB PATH="tool/monitor/db" VERSION="20141103" COMMENT="XMLDB file for Moodle tool/monitor"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="../../../lib/xmldb/xmldb.xsd"
>
<TABLES>
<TABLE NAME="tool_monitor_rules" COMMENT="Table to store rules">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="description" TYPE="text" NOTNULL="false" SEQUENCE="false" COMMENT="Description of the rule"/>
<FIELD NAME="descriptionformat" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false" COMMENT="Description format"/>
<FIELD NAME="name" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" COMMENT="Name of the rule"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Id of user who created the rule"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Id of course to which this rule belongs."/>
<FIELD NAME="plugin" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" COMMENT="Frankenstlye name of the plguin"/>
<FIELD NAME="eventname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" COMMENT="Fully qualified name of the event"/>
<FIELD NAME="template" TYPE="text" NOTNULL="true" SEQUENCE="false" COMMENT="Message template"/>
<FIELD NAME="templateformat" TYPE="int" LENGTH="1" NOTNULL="true" SEQUENCE="false" COMMENT="Template format"/>
<FIELD NAME="frequency" TYPE="int" LENGTH="4" NOTNULL="true" SEQUENCE="false" COMMENT="Frequency"/>
<FIELD NAME="timewindow" TYPE="int" LENGTH="5" NOTNULL="true" SEQUENCE="false" COMMENT="Time window in seconds"/>
<FIELD NAME="timemodified" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Timestamp when this rule was last modified"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Time stamp of when this rule was created"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="courseanduser" UNIQUE="false" FIELDS="courseid, userid" COMMENT="Index on courseid and userid"/>
<INDEX NAME="eventname" UNIQUE="false" FIELDS="eventname" COMMENT="eventname"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_monitor_subscriptions" COMMENT="Table to store user subscriptions to various rules">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Course id of the subscription"/>
<FIELD NAME="ruleid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Rule id"/>
<FIELD NAME="cmid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Course module id"/>
<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."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="rulekey" TYPE="foreign" FIELDS="ruleid" REFTABLE="tool_monitor_rules" REFFIELDS="id" COMMENT="Foreign key"/>
</KEYS>
<INDEXES>
<INDEX NAME="courseanduser" UNIQUE="false" FIELDS="courseid, userid" COMMENT="Course and user"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_monitor_history" COMMENT="Table to store history of message notifications sent">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="sid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Subscription id"/>
<FIELD NAME="userid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="User to whom this notification was sent"/>
<FIELD NAME="timesent" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Timestamp of when the message was sent."/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
<KEY NAME="subscrptionid" TYPE="foreign" FIELDS="sid" REFTABLE="tool_monitor_subscriptions" REFFIELDS="id"/>
</KEYS>
<INDEXES>
<INDEX NAME="sid_userid_timesent" UNIQUE="true" FIELDS="sid, userid, timesent"/>
</INDEXES>
</TABLE>
<TABLE NAME="tool_monitor_events" COMMENT="A table that keeps a log of events related to subscriptions">
<FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="eventname" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" COMMENT="Event name"/>
<FIELD NAME="contextid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Context id"/>
<FIELD NAME="contextlevel" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Context level"/>
<FIELD NAME="contextinstanceid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Context instance id"/>
<FIELD NAME="link" TYPE="char" LENGTH="254" NOTNULL="true" SEQUENCE="false" COMMENT="Link to the event location"/>
<FIELD NAME="courseid" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="course id"/>
<FIELD NAME="timecreated" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="false" COMMENT="Time created"/>
</FIELDS>
<KEYS>
<KEY NAME="primary" TYPE="primary" FIELDS="id"/>
</KEYS>
</TABLE>
</TABLES>
</XMLDB>
-32
View File
@@ -1,32 +0,0 @@
<?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/>.
/**
* Message providers list.
*
* @package tool_monitor
* @copyright 2014 onwards Ankit Agarwal <ankit.agrr@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$messageproviders = array (
// Notify a user that a rule has happened.
'notification' => array (
'capability' => 'tool/monitor:subscribe'
)
);
-36
View File
@@ -1,36 +0,0 @@
<?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/>.
/**
* This file defines tasks performed by the tool.
*
* @package tool_monitor
* @copyright 2014 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// List of tasks.
$tasks = array(
array(
'classname' => 'tool_monitor\task\clean_events',
'blocking' => 0,
'minute' => '*',
'hour' => '*',
'day' => '*',
'dayofweek' => '*',
'month' => '*'
)
);

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