Compare commits

..

819 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) 476626d39e Moodle release 2.2.2 2012-03-11 16:00:29 +01:00
Eloy Lafuente (stronk7) 5f51b09aec Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-03-09 11:56:33 +01:00
AMOS bot 4ed9533352 Automatically generated installer lang files 2012-03-09 11:54:16 +01:00
Eloy Lafuente (stronk7) 6c43ac23f8 weekly release 2.2.1+ 2012-03-09 11:13:49 +01:00
Eloy Lafuente (stronk7) 9be61d94fd Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-03-09 11:04:06 +01:00
Eloy Lafuente (stronk7) c44c8eb96b Merge branch 'wip-MDL-31248-MOODLE_22_STABLE-v3' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2012-03-09 09:46:35 +01:00
Eloy Lafuente (stronk7) be0b3ea0ea Revert "MDL-31248 - lib - Alteration to the rc4encrypt function to allow for old password use."
This reverts commit 6f3e759ecb.
2012-03-09 09:37:43 +01:00
Adrian Greeve 9e7fa5f2bb MDL-31248 - lib - Retaining the old password key and creating a new cookie prefix. 2012-03-09 13:37:40 +08:00
Eloy Lafuente (stronk7) 009d72139f Revert "[MDL-31708] - wiki 2.0 non-group member can see edit option in navigation block."
This reverts commit c583993d8c.
2012-03-09 02:21:30 +01:00
Eloy Lafuente (stronk7) 478207515c Revert "MDL-31708 wiki groups: whitespace fix"
This reverts commit 27da392f3c.
2012-03-09 02:21:26 +01:00
Eloy Lafuente (stronk7) 1312ff8740 Merge branch 'wip-MDL-31248-MOODLE_22_STABLE-v2' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2012-03-08 02:28:41 +01:00
AMOS bot bb3b8185a9 Automatically generated installer lang files 2012-03-08 00:31:39 +00:00
Adrian Greeve 6f3e759ecb MDL-31248 - lib - Alteration to the rc4encrypt function to allow for old password use. 2012-03-08 08:08:05 +08:00
Eloy Lafuente (stronk7) 2615855713 Merge branch 'wip-MDL-29086-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2012-03-08 00:48:22 +01:00
Eloy Lafuente (stronk7) c904abc752 Merge branch 'MDL-31712_M22' of git://github.com/kordan/moodle into MOODLE_22_STABLE 2012-03-07 15:40:50 +01:00
Petr Skoda bfcb69ef70 MDL-31689 fix moodle_database:execute() description
Conflicts:

	lib/dml/moodle_database.php
2012-03-07 12:43:00 +01:00
Eloy Lafuente (stronk7) 4d4e00682b MDL-31832 CLI upgrade will return 0 exit status if no upgrade is needed
Discussed with David, both points were valid but finally
we agreed about to consider the "no upgrade needed" exit
a normal/succesful one, mainly because it keeps previous
behavior the same (exit non-zero only for real errors).
2012-03-07 11:02:47 +01:00
David Mudrak 1acc431b98 MDL-31832 CLI upgrade checks if the upgrade is actually needed 2012-03-07 11:02:10 +01:00
Eloy Lafuente (stronk7) 251ed425e4 MDL-28364 whitespace fixes 2012-03-07 04:01:36 +01:00
Eloy Lafuente (stronk7) 5da8f5d11e Merge branch 'MDL-28364_22' of git://github.com/jonof/moodle into MOODLE_22_STABLE 2012-03-07 04:01:09 +01:00
Eloy Lafuente (stronk7) 49b4703187 MDL-23787 data: Init 2 arrays (global scope) that may conflict with other global scope code 2012-03-07 01:49:07 +01:00
Marina Glancy 0736188d75 MDL-23787 added possibility to embed images into textarea fields in database activity 2012-03-07 01:49:02 +01:00
AMOS bot 20640e3597 Automatically generated installer lang files 2012-03-07 00:31:46 +00:00
Ruslan Kabalin 1555c3d89f MDL-31255 Fix move of highlighted section when JS is off 2012-03-07 00:19:05 +01:00
Sam Hemelryk deaf559402 Merge branch 'MDL-28387-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-03-07 11:46:32 +13:00
Gootvilig David Hai 8d11716bfc MDL-31876 questionlib: fix question_has_capability_on memory bloat 2012-03-06 21:31:55 +01:00
Eloy Lafuente (stronk7) a9b03dc661 Merge branch 'MDL-31829_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-03-06 21:23:44 +01:00
Eloy Lafuente (stronk7) fc7776f50a Merge branch 'w10_MDL-31785_m22_htmlpurifier' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-03-06 13:11:41 +01:00
Eloy Lafuente (stronk7) 27da392f3c MDL-31708 wiki groups: whitespace fix 2012-03-06 11:46:22 +01:00
Gilles-Philippe Leblanc c583993d8c [MDL-31708] - wiki 2.0 non-group member can see edit option in navigation block. 2012-03-06 10:20:51 +08:00
Sam Hemelryk bd87189222 Merge branch 'MDL-27764_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-03-06 10:19:00 +13:00
Mary Evans ad7ecc08d3 MDL-31328_master theme_sky_high: fixed report layout and related files + updated css + added horizontal scroll 2012-03-06 09:59:27 +13:00
Sam Hemelryk 575a553094 Merge branch 'MDL-31828_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-03-05 17:03:20 +13:00
Sam Hemelryk 7d6c1a19bb Merge branch 'w10_MDL-31807_m22_cohort' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-03-05 16:56:05 +13:00
Sam Hemelryk 94cfcb36a5 Merge branch 'MDL-29347-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-03-05 16:13:08 +13:00
Sam Hemelryk ec5a34443c MDL-30724 mod_assignment: Minor fixes during integration 2012-03-05 16:09:50 +13:00
Sam Hemelryk 0c0ae1c696 Merge branch '22_MDL-30724_count_real_submissions_eloy_suggests' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-03-05 16:08:30 +13:00
Tony Levi 3d1573914c MDL-31819: admin: allow install to proceed when multiple admins exist already 2012-03-05 15:54:39 +13:00
Sam Hemelryk 9772d6d376 MDL-31794 theme_formalwhite: Fixed up tabs 2012-03-05 15:29:27 +13:00
Sam Hemelryk f8c24829ab Merge branch 'MDL-31707_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-03-05 15:21:19 +13:00
Kordan 141f588d8e MDL-29367 theme_formalwhite: Lines between RSS and upcoming events 2012-03-05 15:15:57 +13:00
Kordan 835ecea7fe MDL-31786 theme_formalwhite: bigger userid and password fields size in login page 2012-03-05 15:07:40 +13:00
kordan 053a3ad67d MDL-31794 theme_formalwhite: let tab-bar give evidence of the current tab and page 2012-03-05 15:01:50 +13:00
Eloy Lafuente (stronk7) dfa28b875d MDL-27764 restore - always restore as much info as possible (1.9 approach)
In 2.0 we had reduced the types of restore operations where we allow
to load the section names and section descriptions, only proceeding
when restoring to new course or to existing course, deleting.

With this patch, we change to the old 1.9 way, that was to restore
the section information always, no matter of the type of restore
operation (course restore, import, to new or to existing course,
deleting or adding). The only exception is that it's always checked that
the target section names and descriptions are empty.
2012-03-05 02:48:56 +01:00
Sam Hemelryk 4e738cab73 Merge branch 'MDL-26037_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-03-05 14:03:26 +13:00
Sam Hemelryk 62a2c4fd22 Merge branch 'MDL-29248_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-03-05 13:54:27 +13:00
Kordan f8c083e968 MDL-29127 theme_formalwhite: highlight for unread forum post 2012-03-05 12:37:37 +13:00
Sam Hemelryk bf4649edb5 Merge branch 'm22_MDL-31749' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-03-05 12:30:05 +13:00
Sam Hemelryk e6f2103ce7 Merge branch 'MDL-24235-22' of https://github.com/mackensen/moodle into MOODLE_22_STABLE 2012-03-05 12:22:19 +13:00
Sam Hemelryk fecb44d7b5 Merge branch 'MDL-31806-22' of https://github.com/mackensen/moodle into MOODLE_22_STABLE 2012-03-05 12:05:39 +13:00
Sam Hemelryk c71b744a43 Merge branch 'MDL-30893-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-03-05 11:52:45 +13:00
Sam Hemelryk 5c3c0a8ce5 Merge branch 'MDL-31466-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-03-05 11:30:53 +13:00
AMOS bot c3f525dc49 Automatically generated installer lang files 2012-03-04 00:31:48 +00:00
Petr Skoda 9e8fe8469b MDL-31785 fix and improve htmlpurifier tests 2012-03-03 11:25:34 +01:00
Petr Skoda 54ef6f4b01 MDL-31785 import HTMLPurifier 4.4.0+
Includes one extra fix for _blank 8c9d461a6259d7b8ac4ae5c9c9e95ab176cfcda3 compared to 4.4.0 release.
2012-03-03 11:25:34 +01:00
Petr Skoda 0908a1a327 MDL-31807 fix invalid nulls in cohort components
Credit goes to Stephen.
2012-03-03 10:57:16 +01:00
AMOS bot 5cb002eaa6 Automatically generated installer lang files 2012-03-03 00:31:38 +00:00
Charles Fulton 683c8259ea MDL-24235 bennu: remove dependency on mbstring from library 2012-03-02 07:59:15 -08:00
Adrian Greeve d1deac2d80 MDL-29086 - data - Fix for allowing the deletion of database activity presets.
Thank you to Matthias Hunstock for providing the patch for this.
2012-03-02 14:32:37 +08:00
Ankit Agarwal 43956b2c68 MDL-28387 logs: Log data when a user is deleted 2012-03-02 13:18:32 +08:00
Ankit Agarwal 72ffaf4e39 MDL-31466 Tags Adding a capability check to make sure hidden courses are not displayed in tag search results 2012-03-02 12:09:59 +08:00
Ankit Agarwal d2943aa711 MDL-30893 Accessibility Submit button in forgot password page now have separate ids 2012-03-02 11:30:07 +08:00
Andrew Davis d736ed90f7 MDL-31353 grade: added a missing YUI requires 2012-03-02 09:48:03 +07:00
Dan Marsden 50147ef444 MDL-31749 - remove extra space from scorm pop-up - especially for afterburner theme 2012-03-02 09:13:32 +13:00
Tim Hunt 2db787e242 MDL-31829 question engine SQL typo breaks some regrades.
Also, some MySQL-only code had not been updated.

This problem only affected a small minority of question attempts, like
this:
1. Suppose you have a shortanswer question with correct answer 'Toad'
and some hints.
2. Suppose a student attempts this using the interactive behaviour and
on the first try responds 'Frog', and on the second try responds 'Toad'.
3. Then suppose the teacher edits the question to make 'Frog' correct.
4. Then, when the quiz is regraded, the question_attempt_step for the
second try will need to be deleted. That is where the buggy code was.
2012-03-01 12:38:51 +00:00
Eloy Lafuente (stronk7) dff99bd6c5 MDL-26037 restore: fixes for mssql, php 5.4 and small improvs 2012-03-01 13:19:24 +01:00
Tony Levi 80d78f3aae MDL-26037: import: display search box even when no courses are currently displayed 2012-03-01 13:19:24 +01:00
Tony Levi 9b3a01563c MDL-26037: restore/import: check through all courses instead of only first 250 2012-03-01 13:19:23 +01:00
Eloy Lafuente (stronk7) 9f4ad8a5dd MDL-29248 backup: take rid of the setting and code handling the 'private' user filearea 2012-03-01 13:16:01 +01:00
Eloy Lafuente (stronk7) 6339bf1051 MDL-29248 backup: delete user_files settings, lang strings and uses
Conflicts:

	admin/settings/courses.php
	version.php
2012-03-01 13:15:46 +01:00
Tim Hunt 21356da7ee MDL-31828 attachements to essay questions do not work on Oracle. 2012-03-01 12:12:14 +00:00
Eloy Lafuente (stronk7) ce3cd1f122 MDL-31707 environment - add check for the hash extension 2012-03-01 12:52:07 +01:00
Eloy Lafuente (stronk7) e356fb68fd weekly release 2.2.1+ 2012-03-01 11:30:35 +01:00
Eloy Lafuente (stronk7) e8681669bc Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-03-01 11:26:02 +01:00
Aparup Banerjee 6d29b2989f MDL-27793 themes : anomaly theme rtl+ltr login box element widths fixed to be acceptable for IE and FF. 2012-03-01 09:23:29 +01:00
Sam Hemelryk ebbb914346 Merge branch 'MDL-31831_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-03-01 14:34:52 +13:00
Eloy Lafuente (stronk7) ee3d7d8a71 MDL-31831 whitespace clean - take2 2012-03-01 02:07:51 +01:00
Charles Fulton 044cd0a0d6 MDL-31806 tags: remove second occurrence of id in query string 2012-02-29 05:19:34 -08:00
Aparup Banerjee 2e2ca2af54 MDL-25027 web service: moved validation to before changes to DB transaction. 2012-02-29 09:57:25 +01:00
Eloy Lafuente (stronk7) f2a6db61a9 Merge branch 'wip-mdl-29274-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-29 02:19:19 +01:00
Eloy Lafuente (stronk7) 3716fb55e1 Merge branch 'MDL-31748_M22' of git://github.com/lazydaisy/moodle into MOODLE_22_STABLE 2012-02-29 02:10:48 +01:00
Eloy Lafuente (stronk7) cafbb73f5b Merge branch 'MDL-26496_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2012-02-29 02:06:07 +01:00
AMOS bot efd5bc7eb0 Automatically generated installer lang files 2012-02-29 00:31:17 +00:00
Eloy Lafuente (stronk7) 46ccd8b12b Merge branch 'wip-MDL-31738-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-02-29 00:30:27 +01:00
Eloy Lafuente (stronk7) 313f98c88a Merge branch 'MDL-25027_stable_consistency_fix_m22' of git://github.com/nebgor/moodle into MOODLE_22_STABLE 2012-02-28 17:34:12 +01:00
Aparup Banerjee 2e0d0590da Merge branch 'MDL-14837_show-time-on-no-duration-events_22_STABLE' of https://github.com/ncsu-delta/moodle into MOODLE_22_STABLE 2012-02-28 16:41:52 +08:00
Aparup Banerjee 91470a354e Merge branch '22_MDL-31419_fix_auth_typo' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-28 16:23:21 +08:00
Aparup Banerjee 01c7382881 Merge branch 'MDL-30878-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-28 15:37:36 +08:00
Aparup Banerjee 9a7310e80b Merge branch 'MDL-28386-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-02-28 14:42:08 +08:00
Dan Marsden 8b4e28f87e MDL-31086 Calendar : fix sql to get distinct list of courses 2012-02-28 14:37:10 +08:00
Aparup Banerjee 415dd485a5 Merge branch 'MDL-31335_mtrace_email_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-02-28 14:15:37 +08:00
Aparup Banerjee 844d4f0ce0 Merge branch 'wip-mdl-22896-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-28 13:48:40 +08:00
Aparup Banerjee fe4e706f3a Merge branch 'MDL-31399_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2012-02-28 12:05:20 +08:00
Gerard (Gerry) Caulfield ca3cfd88cc MDL-31419 Fixing "Suspended acount" typo in auth.php 2012-02-28 11:28:07 +08:00
Eloy Lafuente (stronk7) e61fabb720 Merge branch 'MDL-27793_m22' of git://github.com/nebgor/moodle into MOODLE_22_STABLE 2012-02-28 03:52:53 +01:00
Jonathon Fowler bb98f4fda3 MDL-28364 handle question formats that support multiple file types 2012-02-28 09:24:54 +10:00
Eloy Lafuente (stronk7) 845b165edf MDL-29161 weblib: added one more test about un-keyed array params 2012-02-27 22:21:57 +01:00
Eloy Lafuente (stronk7) aaa24bb35c Merge branch 'MDL-29161_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-02-27 22:21:50 +01:00
Eloy Lafuente (stronk7) 0c93bbde9e Merge branch 'MDL-31721_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-02-27 22:06:46 +01:00
Eloy Lafuente (stronk7) bd4b665ed6 Merge branch 'MDL-31729_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-02-27 19:02:42 +01:00
Eloy Lafuente (stronk7) edb03ff65b Merge branch 'MDL-29256-resource-format_22_STABLE' of git://github.com/mudrd8mz/moodle into MOODLE_22_STABLE 2012-02-27 18:54:35 +01:00
Eloy Lafuente (stronk7) 98e9b0f21e Merge branch 'MDL-29199' of git://github.com/danpoltawski/moodle into MOODLE_22_STABLE 2012-02-27 18:47:51 +01:00
Eloy Lafuente (stronk7) 515acf7914 Merge branch 'MDL-29229' of git://github.com/danpoltawski/moodle into MOODLE_22_STABLE 2012-02-27 17:07:24 +01:00
Eloy Lafuente (stronk7) 1415ba2319 Merge branch 'MDL-29523' of git://github.com/danpoltawski/moodle into MOODLE_22_STABLE 2012-02-27 16:51:54 +01:00
Eloy Lafuente (stronk7) bcf5427193 Merge branch 'MDL-29592' of git://github.com/danpoltawski/moodle into MOODLE_22_STABLE 2012-02-27 16:06:19 +01:00
Eloy Lafuente (stronk7) 0d40a799e5 Merge branch 'MDL-31348' of git://github.com/danpoltawski/moodle into MOODLE_22_STABLE 2012-02-27 15:57:09 +01:00
Eloy Lafuente (stronk7) 5775c7ec63 Merge branch 'MDL-31546' of git://github.com/danpoltawski/moodle into MOODLE_22_STABLE 2012-02-27 15:44:28 +01:00
Marina Glancy ccd6fa9e44 MDL-31738: added functions mod_xxx_get_file_info() to glossary and data modules 2012-02-27 14:14:03 +08:00
Gerard (Gerry) Caulfield 69beea7165 MDL-30724 Limit assignment_count_real_submissions() to only select real
submissions

I've also refactored some code so that it is more structured and allows
for easier overriding of function associated with counting submissions
and updated associated doc blocks.
2012-02-27 12:30:30 +08:00
Dongsheng Cai d049031e95 MDL-29347 core_enrol_get_enrolled_users web service should limit the number of participants - Jerome/Dongsheng 2012-02-27 11:45:04 +08:00
Sun Zhigang e91dd85ed7 MDL-29523 filemanager: Fix a hardcode string 2012-02-27 09:28:14 +08:00
AMOS bot 5b5ff2dac6 Automatically generated installer lang files 2012-02-27 00:31:17 +00:00
Dan Poltawski 170c23d2d2 MDL-29592 weblib: prevent warnings when $USER not set 2012-02-26 18:39:40 +08:00
Mary Evans 0bad02fd57 MDL-31748_master theme_afterburner: added min-width to fix missing horizontal scroll bar when page is reduced in browser window 2012-02-25 18:12:41 +00:00
Glenn Ansley afb0b3f421 MDL-14837 Calendar: Display start time on calendar events with no duration 2012-02-24 09:10:40 -05:00
Rajesh Taneja f013b576ec MDL-29274 blocks: people block will use course context for making url and not module context 2012-02-24 16:39:51 +08:00
Dan Poltawski ca69aa758f MDL-31651 course/info: Fix hardcoded string 2012-02-24 16:12:54 +08:00
Kordan f6df6e93db accessibility colors for formal_white M22 2012-02-24 07:35:56 +01:00
Dan Poltawski 9ee937eb33 MDL-29199 dml: fix query logging on Oracle
thanks to Jonathon Fowler for the fix
2012-02-24 11:55:14 +08:00
Dan Poltawski 08bcf220b3 MDL-31546 wiki: remove stray semicolon
causing errors on oracle

Thanks to Jonathon Fowler for the patch
2012-02-24 11:39:56 +08:00
Rajesh Taneja cd1a0a72a5 MDL-22896 libraries: Updated regular expression in html2text, for replacing unknown/unhandled entities 2012-02-24 10:10:08 +08:00
Adam Olley ed53f70413 MDL-29229 message: Set contactlist pull-down width to not exceed parent columns width 2012-02-24 10:08:55 +08:00
Aparup Banerjee f356ebc979 MDL-27793 Themes : review changes - removed .dir-rtl from .loginbox selector rule to be default css rule. made them same width too. 2012-02-24 09:52:40 +08:00
Aparup Banerjee 26c1694fdc MDL-27793 Themes : fixed "remember username" wrapping unnecessarily. 2012-02-24 09:52:40 +08:00
Aparup Banerjee 89ec652e10 MDL-27793 Themes : fixed base (and other themes) theme's loginbox
- fixed translated lengthy terms were being clipped
 - fixed clipping and positioning of loginbox in rtl and ltr languages both
2012-02-24 09:52:40 +08:00
AMOS bot 82f50464f1 Automatically generated installer lang files 2012-02-24 00:31:45 +00:00
Tim Hunt ea9f1a8faa MDL-31729 questions: files for hints are not moved or deleted.
The files that belong to the question hints are neither moved when the
question is moved to another context, nor deleted when the question is
deleted.

Oops! How come no one noticed that until today.
2012-02-23 12:04:30 +00:00
Tim Hunt db15713237 MDL-31721 question editing: improve working for Show num correct
AMOS BEGIN
 CPY [shownumpartscorrect,question],[shownumpartscorrectwhenfinished,question]
AMOS END
2012-02-23 12:04:10 +00:00
Tim Hunt 94cd982f84 MDL-29161 weblib: moodle_ulr::out does not cope with array params. 2012-02-23 12:03:50 +00:00
Eloy Lafuente (stronk7) d1c12af76e weekly release 2.2.1+ 2012-02-23 11:38:57 +01:00
Eloy Lafuente (stronk7) 17d8e3ec8a Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-02-23 11:34:52 +01:00
Rossiani Wijaya 4fbf7ca46c MDL-31399 Lesson Module: Fixed horizontal scroll bar issue when using rtl language format (eg: arabic) 2012-02-23 15:08:21 +08:00
Dan Poltawski b69337ee63 MDL-31348 calendar: event links not using user timezone
thanks to Ben Thomas for the patch
2012-02-23 14:56:08 +08:00
Eduardo Pinto c468eab4f0 MDL-26496 Lesson Module: removed warning when no answer is selected from single choice question 2012-02-23 14:05:07 +08:00
AMOS bot 23aa41015a Automatically generated installer lang files 2012-02-23 00:31:08 +00:00
AMOS bot cf38e1f2ef Automatically generated installer lang files 2012-02-22 00:31:15 +00:00
Sam Hemelryk 68eeca8621 Merge branch 'MDL-30910_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2012-02-22 10:21:53 +13:00
Eloy Lafuente (stronk7) 7b1890513f Merge branch 'wip-MDL-30830-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2012-02-21 21:19:33 +01:00
David Mudrak 2d89ead370 MDL-29256 Fixed incorrect calculation of contentformat
Legacy Resource modules of the type Web page force the HTML format for
their content. The format stored in the reference field is valid only
for legacy resources of the type Plain text page. See page_20_migrate()
function.
2012-02-21 11:12:00 +01:00
Eloy Lafuente (stronk7) 52f37a943c Merge branch '22_MDL-25996_making_language_editing_terms_user_friendly' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-21 10:48:20 +01:00
Aparup Banerjee d45c949f64 MDL-25027 Web Service: added email validation to create_users() - just like GUI 2012-02-21 15:29:20 +08:00
Aparup Banerjee 758e086b1c MDL-25027 Web Service: removed user info(firstname,lastname) truncation for GUI-WS consistency.
Currently there is no validation on user info (firstname/lastname) in user/editadvanced_form.php
2012-02-21 15:29:11 +08:00
Rossiani Wijaya 9551675cf9 MDL-30910: Lesson Module: fix lesson progress bar for screen readers
AMOS BEGIN
   CPY [progresscompleted, mod_lesson]
AMOS END
2012-02-21 12:38:33 +08:00
EVAN Irving-Pease a92ed77229 MDL-28386 Authentication Fixing user id issue with logs when a new user is added 2012-02-21 07:48:19 +05:30
Gerard (Gerry) Caulfield c39546eb72 MDL-25996 Updating languaged editing interface terms to make them user
friendly
2012-02-21 09:59:34 +08:00
Sam Hemelryk 31593361a8 Merge branch 'MDL-30249-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-21 14:56:13 +13:00
Darko Miletic 3a9104cb54 MDL-31561: Implemented fix for honoring correct number of course
sections
2012-02-21 02:30:50 +01:00
Darko Miletic 9f260add10 MDL-31562: Implemented support for exporting labels, minor additional
cleanups
2012-02-21 02:29:10 +01:00
Eloy Lafuente (stronk7) 894c5e0b86 Merge branch 'wip-mdl-25432-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-21 02:10:29 +01:00
AMOS bot a8ea83c89b Automatically generated installer lang files 2012-02-21 00:31:16 +00:00
Sam Hemelryk f231525992 Merge branch 'MDL-29402-22' of https://github.com/mackensen/moodle into MOODLE_22_STABLE 2012-02-21 10:43:41 +13:00
Andrew Robert Nicols e546d72787 MDL-19421 Correct lesson dependency mapping on restore 2012-02-20 17:17:12 +01:00
Eloy Lafuente (stronk7) 9b228afffe Merge branch 'MDL-31345_M22' of git://github.com/lazydaisy/moodle into MOODLE_22_STABLE 2012-02-20 15:40:02 +01:00
Eloy Lafuente (stronk7) f24d063a5e Merge branch 'wip-MDL-25299-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2012-02-20 12:59:11 +01:00
Sam Hemelryk ab04c70d56 Merge branch 'wip-mdl-29967-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-20 18:20:22 +13:00
Sam Hemelryk ace2654b5d Merged MDL-29254 with conflict resolution 2012-02-20 18:06:06 +13:00
Sam Hemelryk c8072f8b50 Merge branch 'wip-MDL-30780-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-02-20 17:29:33 +13:00
Sam Hemelryk e86284fefd Merge branch 'wip-MDL-31627-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-02-20 17:25:36 +13:00
Sam Hemelryk c63a91d44a Merge branch '22_MDL-31388_fix_enrol_LDAP_typo' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-20 17:13:25 +13:00
Sam Hemelryk cf6fa5025d Merge branch 'MDL-31532_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-02-20 17:10:39 +13:00
Sam Hemelryk 5a91cf1e2a Merge branch 'm22_MDL-31381' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-20 17:04:30 +13:00
Sam Hemelryk 3ba632dce5 Merge branch 'MDL-31432_messaging_popup_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-02-20 16:58:20 +13:00
Sam Hemelryk 10701ea814 Merge branch '22_MDL-30957_adding_assignment_completion_status_method_and_call' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-20 16:52:35 +13:00
Gerard (Gerry) Caulfield 0ac0d06efb MDL-30957 Adding a new method "is_complete" to assignment lib for
testing if a submission has actually been submitted and then adding a
call to it before displaying the the assignment submission date header

As recommended I've simplified the functions and split the logic out into appropriate upload classes.
2012-02-20 11:37:45 +08:00
Andrew Davis a648791534 MDL-31335 message: wrapped calls to mtrace() in email_to_user() within a check to make sure its a CLI script 2012-02-20 10:35:07 +07:00
Andrew Davis e6510e0920 MDL-31432 message: prevent messaging popups while viewing messages 2012-02-20 10:14:27 +07:00
Sam Hemelryk 7654fe5811 Merge branch 'm22_MDL-31397' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-20 16:03:08 +13:00
Sam Hemelryk 34d7e1ce9b Merge branch 'm22_MDL-31652' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-20 15:53:36 +13:00
Sam Hemelryk 6f22c38b48 Merge branch 'MDL-30965-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-02-20 15:44:47 +13:00
Andrew Robert Nicols 9ef38abc49 MDL-31589 Sort order of lesson answers before restoring them 2012-02-20 15:19:20 +13:00
Andrew Robert Nicols 22f94b8ef7 MDL-31590 Correct title of error dialogue on filepicker
Thanks to Gilles-Philippe Leblanc for this patch
2012-02-20 15:01:47 +13:00
Rajesh Taneja 21144ea8c6 MDL-29254 blog: added check in upgrade for summary and content to be null fields 2012-02-20 09:35:58 +08:00
Rajesh Taneja 7e19c5e1f5 MDL-25432 backup: Catching exception for orphan course modules and it's block (if any), and logging them, no exception will be thrown for this now. 2012-02-20 09:29:26 +08:00
Eloy Lafuente (stronk7) 47ac7c3668 MDL-31532 restore: avoid null course->hiddensections problems. Credit goes to Petri Asikainen. Thanks! 2012-02-20 01:36:23 +01:00
AMOS bot c05b26f9c9 Automatically generated installer lang files 2012-02-20 00:31:19 +00:00
Sam Hemelryk a55688b394 Merge branch 'MDL-31556_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2012-02-20 12:39:02 +13:00
Sam Hemelryk bc392be2a8 Merge branch 'MDL-31647-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2012-02-20 11:54:30 +13:00
Sam Hemelryk 11a3fcb1be Merge branch 'MDL-30495-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-20 11:50:39 +13:00
Sam Hemelryk 8a40b2d894 MDL-30521 upgrade: Corrected version bump for uniquehash field upgrade 2012-02-20 10:56:56 +13:00
Sam Hemelryk 3fe335c455 Merge branch 'wip-mdl-30521-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-20 10:29:46 +13:00
AMOS bot 1acda0143c Automatically generated installer lang files 2012-02-18 00:31:28 +00:00
sam marshall ac98193cf3 MDL-31647 Glossary: Links to glossary entries from glossary main page should not be popups 2012-02-17 10:37:24 +00:00
Jerome Mouneyrac e90d5dcfb2 MDL-30249 Display warning when downloading/uploading a file 2012-02-17 17:05:27 +08:00
Dan Marsden bb8d8346ad SCORM MDL-31381 decrease max width of TOC to prevent SCORM content from being hidden, remove padding from pop-up and improve maxheight calculation 2012-02-17 17:14:53 +13:00
Sam Hemelryk 5ac02b6e21 MDL-25299 mnet: Fixed validation when no public key is provided 2012-02-17 16:47:37 +13:00
Gerard (Gerry) Caulfield 517609f295 MDL-31388 Fixing typo in enrol_ldap 2012-02-17 11:45:47 +08:00
Ankit Agarwal 2b6f171390 MDL-30965 SCORM Removing unused variable ->head 2012-02-17 09:14:42 +05:30
Marina Glancy 18a44d8a77 MDL-31627: Arialist theme do not resize content when there are no blocks 2012-02-17 11:01:14 +08:00
Marina Glancy cffba6db62 MDL-30780: fixing the disappearance of right part of the very wide rubric 2012-02-17 11:01:07 +08:00
Dan Marsden dc71212c3c MDL-31652 SCORM - hide updatefreq setting and remove it if not required. 2012-02-17 15:32:13 +13:00
Dan Marsden 731882b52d SCORM MDL-31397 - add slashes to js string 2012-02-17 15:24:08 +13:00
Sam Hemelryk 644262726c MDL-30830 dock: Added the title using accesshide for screen readers 2012-02-17 14:52:32 +13:00
Eloy Lafuente (stronk7) ad5202771a weekly release 2.2.1+ 2012-02-17 01:48:09 +01:00
Eloy Lafuente (stronk7) cad211198a Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-02-17 01:43:38 +01:00
AMOS bot 1d2b681ec0 Automatically generated installer lang files 2012-02-17 00:31:13 +00:00
Joseph Rezeau 6404d22954 MDL-31556 Lesson Module: fixed missing 'lesson closes' event in calendar 2012-02-16 16:00:31 +08:00
Sam Hemelryk 124e846e83 Merge branch '22_MDL-30935_lti_change_instructor_role_to_teacher' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-16 15:40:38 +13:00
Sam Hemelryk 671fc51e00 Revert "MDL-30935_in_lti_change_role_from_instructor_to_teacher"
This reverts commit 76fe39b8d8.
2012-02-16 15:40:34 +13:00
Gerard (Gerry) Caulfield 4821f14caa MDL-30935_in_lti_change_role_from_instructor_to_teacher 2012-02-16 10:25:09 +08:00
Jerome Mouneyrac 4b9f199c65 MDL-30495 HTML5 apps cannot call Webservices functions if a HTTP resource is retrieved from the Moodle installation 2012-02-15 11:36:38 +08:00
Sam Hemelryk 7a419e5789 MDL-30888 course-search: Fixed typo 2012-02-15 16:28:55 +13:00
Sam Hemelryk 646704c8d0 Merge branch 'wip-mdl-30388-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-15 16:23:33 +13:00
Rajesh Taneja 1ff9608513 MDL-30388 Blocks: navigation block is visible on block search page 2012-02-15 10:19:58 +08:00
Rajesh Taneja 943056a9e5 MDL-30388 Blocks: Search view for block instances fixed, with proper page url and pagination 2012-02-15 10:19:47 +08:00
Andrew Robert Nicols 9e6edb0ee6 [MDL-31386] Correctly order answers in a lesson backup 2012-02-15 03:15:26 +01:00
Michael Aherne b81c860628 MDL-31495 Performance improvement in question engine upgrade SQL 2012-02-15 09:37:51 +08:00
AMOS bot 5b45d2d0fa Automatically generated installer lang files 2012-02-15 00:31:16 +00:00
Sam Hemelryk 269754e487 MDL-30709 mod_assignment: Renamed callback to mod_assignment_get_file_info 2012-02-15 11:27:01 +13:00
Charles Fulton 8cd38f2535 MDL-29402 QandA forum questions should be emailed 2012-02-14 05:59:40 -08:00
Eloy Lafuente (stronk7) 32d4d0d1ce Merge branch 'MDL-30126-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-14 13:12:44 +01:00
Davo Smith 4ab3a01586 MDL-31527 XMLDB Editor - make sure default tables are created with correct plugin prefix 2012-02-14 12:12:22 +01:00
Iñaki Arenaza 9c867cfef8 MDL-29667 Plugins overview shows incorrect availability for auth & enrol plugins
We store the enabled plugins as array values but later look them up as array
keys. Just flip the array when we build it.
2012-02-14 15:49:01 +08:00
Aparup Banerjee 7fda50ccee Merge branch 'wip-mdl-28101-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-14 15:39:04 +08:00
Rajesh Taneja 83e83887e3 MDL-30521 blog: Updated uniquehash field preceision to 255 in post table 2012-02-14 14:17:50 +08:00
Davo Smith 0c8c2969d0 MDL-31541 Repositories - make sure all repository instances have unique 'sortorder' values when retrieved 2012-02-14 13:31:59 +08:00
Sam Hemelryk ebeacb73c9 Merge branch 'MDL-30911_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2012-02-14 17:41:45 +13:00
Sam Hemelryk 47e6717105 MDL-30709 mod_assignment Fixed phpdocs for assignment_get_file_info 2012-02-14 17:15:05 +13:00
Sam Hemelryk 43c6a29cc6 Merge branch 'wip-MDL-30709-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-02-14 17:14:22 +13:00
Jerome Mouneyrac 9c228a616a MDL-30126 rest client should be updated fo json support 2012-02-14 12:03:06 +08:00
Sam Hemelryk 01348282b4 Merge branch 'wip-MDL-30771-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-02-14 17:00:25 +13:00
Aparup Banerjee bef1428345 Merge branch 'MDL-29471-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-14 11:43:03 +08:00
Sam Hemelryk 4e01042343 Merge branch 'MDL-30688-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-14 15:53:46 +13:00
Sam Hemelryk 8348cea56a Merge branch 'MDL-31604-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-14 15:48:09 +13:00
Sam Hemelryk 5129af8051 Merge branch '22_MDL-26807_remove_withselectedusers_strings_and_references' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-14 15:32:00 +13:00
Sam Hemelryk a6f81e7fd8 Merge branch '22_MDL-27285_fixing_grammar_on_wiki_links_page' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-14 15:27:57 +13:00
Sam Hemelryk af61dca6d0 Merge branch '22_MDL-27654_add_space_to_somefieldrequired_string' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-14 15:21:07 +13:00
Sam Hemelryk 03134095f9 Merge branch '22_MDL-30935_lti_change_instructor_role_to_teacher' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-14 15:12:22 +13:00
Sam Hemelryk 908de866bd Merge branch '22_MDL-31107_fixing_below_typos' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-14 15:08:13 +13:00
Mary Evans 959ea1241a MDL-31345_master theme_afterburner: adds horizontal scroll bar to pagelayout-report 2012-02-14 01:48:23 +00:00
Sam Hemelryk 01080b468f Merge branch 'MDL-28283-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-02-14 13:59:04 +13:00
Sam Hemelryk 66bd7ae432 Merge branch 'MDL-30815-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-02-14 13:44:52 +13:00
Andrew Robert Nicols 08b213beea MDL-31515 Allow for subsequent files to overwrite old files in database activity records 2012-02-14 10:57:06 +13:00
Sam Hemelryk 2787eeb9b3 Merge branch 'MDL-29080_export_hidden2_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-02-14 10:47:30 +13:00
Jerome Mouneyrac 6049f806f9 MDL-30688 REST simpleserver does not accept the moodlewsrestformat parameter 2012-02-13 16:43:33 +08:00
Sam Hemelryk bc967db3d4 Merge branch '22_MDL-29153_fix_typo_in_resource' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-13 18:04:06 +13:00
Sam Hemelryk 877d9f8430 Merge branch '22_MDL-30723_fixing_several_english_typos' of git://github.com/gerrywastaken/moodle into MOODLE_22_STABLE 2012-02-13 18:00:23 +13:00
Sam Hemelryk a87151d552 Merge branch 'm22_MDL-31085' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-13 17:52:36 +13:00
Andrew Robert Nicols 8c51b948d6 MDL-31502 Check whether a category has subcategories or courses within it before using those variables 2012-02-13 17:48:51 +13:00
Sam Hemelryk f7562f72fb Merge branch 'wip-MDL-25185-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2012-02-13 17:34:39 +13:00
Sam Hemelryk 38d0571f23 Merge branch 'wip-MDL-31396-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2012-02-13 17:17:29 +13:00
Sam Hemelryk ff60281e4f Merge branch 'wip-MDL-31463-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2012-02-13 17:02:32 +13:00
Anita Viglinoe 04773f2508 MDL-28283-master Completion Future dates can now be set as completion criteria 2012-02-13 09:02:49 +05:30
Rossiani Wijaya 254a642146 MDL-30911: mod_lesson: fix sub-heading level to be lower than lesson title. This issue is an improvement of accessibility compliance 2012-02-13 11:29:39 +08:00
Ankit Agarwal af7a1f2999 MDL-30815 Choice Labels are now explicitly tied with input elements 2012-02-13 08:44:12 +05:30
Eloy Lafuente 12ba874956 MDL-31604 Fix capabilities displayed without spaces causing text going out of the screen 2012-02-13 10:49:48 +08:00
Sam Hemelryk 8b927cfb8b Merge branch 'wip-mdl-31576-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-02-13 15:30:13 +13:00
Rajesh Taneja b71bd1e6ec MDL-28101 wiki2.0: escape bold and italics for NWIKI formatting 2012-02-13 10:27:40 +08:00
Sam Hemelryk 5eb8ad6129 Merge branch 'MDL-31554_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-02-13 15:26:21 +13:00
Sam Hemelryk 8342143862 Merge branch 'MDL-25883-22' of https://github.com/mackensen/moodle into MOODLE_22_STABLE 2012-02-13 14:36:14 +13:00
Eloy Lafuente (stronk7) ea75a579d1 weekly release 2.2.1+ 2012-02-13 01:18:28 +01:00
Eloy Lafuente (stronk7) a72cf89d5e Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-02-13 01:14:51 +01:00
Eloy Lafuente (stronk7) 6ea4bd74a4 Revert "MDL-31345 theme_afterburner fixes pagelayout-report overflow"
This reverts commit 018f49465c.
2012-02-12 23:23:43 +01:00
Gerard (Gerry) Caulfield 23071bd4ab MDL-31107 Fixing instaces of below where it is written as bellow (two L's) 2012-02-10 15:05:16 +08:00
Gerard (Gerry) Caulfield ddb931d3ab MDL-29153 Fixing typo, "Bellow" should be "Below" 2012-02-10 14:37:43 +08:00
Marina Glancy e8d5c5a8ca MDL-30771: Enable students to view rubric definition prior to submission
Also allow advanced grading plugin to extend course module navigation, it is not necessary only definition previewing
Added option to rubric whether to show it to the students before submission and option to view description
2012-02-10 13:05:05 +08:00
Gerard (Gerry) Caulfield 76fe39b8d8 MDL-30935_in_lti_change_role_from_instructor_to_teacher 2012-02-10 10:24:04 +08:00
Gerard (Gerry) Caulfield 9f77a5bcfe MDL-27285 Updating string grammar on the wiki module's links page 2012-02-10 07:56:25 +08:00
Gerard (Gerry) Caulfield e336dd6438 MDL-26807 Updating the withselectedusers_help string 2012-02-10 02:17:35 +08:00
Gerard (Gerry) Caulfield f8b8874dcf MDL-30723 Fixing English typo(s) 2012-02-10 01:49:21 +08:00
Gerard (Gerry) Caulfield 742cf42171 MDL-27654 Insert a space into the somefieldrequired string 2012-02-10 01:26:22 +08:00
Rajesh Taneja 2080cbc2eb MDL-31576 core: Duplicate message definition removed from get_core_subsystem 2012-02-09 17:13:11 +08:00
Marina Glancy d8b6bb542c MDL-30709: Fixed bug with inserting files from Recent files repository
Two parts of changes: in assignment module function assignment_get_file_info was missing
and when populating the list of recent files the function get_file_info was not called, which caused populating the list of recent files with the files that could not later be inserted
2012-02-09 13:58:11 +08:00
Adrian Greeve 6318805a04 MDL-31463 - navigation - added a context check in the navigation for fullname permission. 2012-02-09 09:57:17 +08:00
Aparup Banerjee 3509aa0275 Merge branch 'wip-MDL-31417-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-02-09 09:45:08 +08:00
Andrew Davis feba87f45e MDL-29080 grade: simplified bug fix to prevent users without the required capabilities from being able to export hidden grade items 2012-02-09 08:35:58 +07:00
Adrian Greeve 4ec0b1caec MDL-25185 - data - Allowing data from the database to be exported according to group roles. 2012-02-09 09:29:45 +08:00
AMOS bot f26a347c25 Automatically generated installer lang files 2012-02-09 00:31:11 +00:00
Tim Hunt 025a0e65cd MDL-31554 quiz view.php notices when guest / no enroled. 2012-02-08 15:45:22 +00:00
Eloy Lafuente (stronk7) 13c25d0f87 MDL-27891 tag logs: minibump version 2012-02-08 11:44:53 +01:00
Eloy Lafuente (stronk7) 948a4d8c94 Merge branch 'MDL-27891-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-02-08 11:44:19 +01:00
Eloy Lafuente (stronk7) 2ffd822e63 Merge branch 'MDL-31345_M22' of git://github.com/lazydaisy/moodle into MOODLE_22_STABLE 2012-02-08 11:17:26 +01:00
Ruslan Kabalin 0c657454d6 MDL-31316 Fix block controls when default home is My Moodle 2012-02-08 11:08:22 +01:00
Mary Evans 018f49465c MDL-31345 theme_afterburner fixes pagelayout-report overflow 2012-02-08 03:59:42 +00:00
Aparup Banerjee e5f77fdae4 Merge branch 'MDL-31407_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-02-08 11:27:39 +08:00
Eloy Lafuente (stronk7) 47475df527 Merge branch 'MDL-29892_overview_hidden_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-02-08 03:38:44 +01:00
Ankit Agarwal eb4d0c0d51 MDL-27891 Tags Flagging tags is now logged 2012-02-08 07:57:36 +05:30
Aparup Banerjee 4bd74c8ddc Merge branch 'm22_MDL-31461' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-08 10:12:26 +08:00
Aparup Banerjee 822790437e Merge branch 'MDL-31482-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2012-02-08 09:59:04 +08:00
Eloy Lafuente (stronk7) 76456cf5f2 Merge branch 'MDL-30722_forum_unsubscribe_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-02-08 02:37:46 +01:00
Eloy Lafuente (stronk7) 6fe3c3907b Merge branch 'wip-MDL-30540-stable22' of git://github.com/phalacee/moodle into MOODLE_22_STABLE 2012-02-08 01:18:09 +01:00
Eloy Lafuente (stronk7) 16f5ffacd4 Merge branch 'MDL-26384-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-02-08 00:53:15 +01:00
Eloy Lafuente (stronk7) c2db2793d2 Merge branch 'MDL-27360-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-02-07 23:49:19 +01:00
Eloy Lafuente (stronk7) 357274c6b9 Merge branch 'm22_MDL-31374' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-07 22:41:39 +01:00
sam marshall e455406b69 MDL-31482 Lib: IE8/IE7 (even with stupid user agent) should not be 'legacy' device type 2012-02-07 17:42:07 +00:00
Aparup Banerjee 3e299e464d Merge branch 'MDL-31469_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-02-07 15:12:26 +08:00
Dan Marsden 5796c9223c MDL-31985 - fix quotes in filter 2012-02-07 09:51:56 +13:00
Marina Glancy cdff347baa MDL-31417: updated list of world currencies
Some countries do not exist any more, some currencies do not exist. Some countries (and currencies) started to exist recently. Some currency codes are changed (mistype or result of denomination).

Also I tried to keep the moodle formation of the name of the currencies. The first word is not the country name but the 'belonging-to-country', i.e. not 'Sweden Krona' but 'Swedish Krona'. For some countries it was not so easy to find the correct spelling.

And finally there were some mistakes in the list, like 'Schilling' instead of 'Shilling', 'Riyal' instead of 'Rial', etc. I used currencies spelling from ISO.
2012-02-06 09:58:20 +08:00
Adrian Greeve 688c43ac3e wip-MDL-31396 - data - Exporting a preset as a zip code changed to remove errors. 2012-02-06 09:49:33 +08:00
Ankit Agarwal 6e1cf8fde8 MDL-26384 Tags Fixed redirect issue when editing is toggled 2012-02-03 14:54:04 +05:30
Jason Fowler f2301c3258 MDL-30540 - BLOG - Fixing context problems for single blog entries - Thanks Aparup and Sam for the help 2012-02-03 10:50:42 +08:00
Andrew Davis 2ad0278bd2 MDL-29892 grade: added a check to prevent hidden courses appearing on student overview reports 2012-02-03 08:56:10 +07:00
Dan Marsden 733196d843 MDL-31461 Plagiarism - adjust api functions to allow better support for renderers 2012-02-03 11:38:33 +13:00
Petr Skoda 0007843de0 MDL-29684 improve enrol_meta plugin
List of changes:
* configurable unenrol action
* new setting for synchronisation of all enrolled users or users with at least one role
* cron period increased to 1 hour in order to lower server load, courses should not get out of sync often
* CLI sync script for debugging or manual sync
* phpdocs fixes
* when plugin is disabled all roles are removed, enrollments are kept
* uninstall script
* other bugfixing
2012-02-03 11:29:47 +13:00
Tim Hunt e8e2f4f62c MDL-31469 formslib: fix invalid for="" attributes on optional dates 2012-02-02 18:16:07 +00:00
Anthony Forth 648cf3397d MDL-31445 formslib: add a nice id and class to the wrapper div for CSS 2012-02-02 18:15:31 +00:00
Tim Hunt e1ded0ff55 MDL-31407 quiz: review all uses of global $USER 2012-02-02 18:13:34 +00:00
Kyle Temkin c31783bb34 MDL-31407 quiz: finish_attempt method should not rely on $USER 2012-02-02 18:13:30 +00:00
Eloy Lafuente (stronk7) 4d2f89f85b weekly release 2.2.1+ 2012-02-02 12:13:28 +01:00
Eloy Lafuente (stronk7) 18a727e6fd Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-02-02 12:08:48 +01:00
Jerome Mouneyrac 28a3a568aa MDL-27360 Web service tokens are displayed for deleted users 2012-02-02 16:23:56 +08:00
Aparup Banerjee 6432e1b4e1 Merge branch 'm22_MDL-31360' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-02 11:13:22 +08:00
Dan Marsden 52453939f2 MDL-31360 use extra param in get_in_or_equal - one less line of code... 2012-02-01 23:09:49 +13:00
Eloy Lafuente (stronk7) be15c303e0 Merge branch 'wip-MDL-31160-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2012-02-01 00:54:14 +01:00
Eloy Lafuente (stronk7) acef9e8a7f Merge branch 'wip-MDL-31197-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2012-02-01 00:50:38 +01:00
Eloy Lafuente (stronk7) 6badc27a66 Merge branch 'm22_MDL-31039' of git://github.com/danmarsden/moodle into MOODLE_22_STABLE 2012-02-01 00:41:47 +01:00
Andrew Robert Nicols c904d241d5 MDL-31000 Respect sortorder of repositories when displaying the filepicker 2012-02-01 00:33:54 +01:00
Glenn Ansley 7da14ca7c5 MDL-31448 Replaced incorrect PHP comment 2012-01-31 23:58:06 +01:00
Eloy Lafuente (stronk7) 14b273b3c8 MDL-30714 theme_afterburner: better, output the information, LOL 2012-01-31 23:36:35 +01:00
Mary Evans b1591e5081 MDL-30714 theme_afterburner: logo link to home page 2012-01-31 23:19:51 +01:00
Eloy Lafuente (stronk7) f22c2e015a Merge branch 'MDL-31015-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2012-01-31 23:02:56 +01:00
Eloy Lafuente (stronk7) d4184875ce Merge branch 'MDL-30854_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-31 19:38:48 +01:00
Eloy Lafuente (stronk7) 26be1bf17a Merge branch 'MDL-30484_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-31 17:16:51 +01:00
Eloy Lafuente (stronk7) 5a1e6f2a6c Merge branch 'MDL-31314_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-31 17:06:14 +01:00
Aparup Banerjee cfbde86579 Merge branch 'MDL-30828_feedback_sort_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-01-31 16:51:08 +08:00
Aparup Banerjee 5684c6ab99 Merge branch 'MDL-30707_forum_log_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-01-31 16:43:46 +08:00
Aparup Banerjee a5f1f8c0e2 Merge branch 'MDL-29097_mod_update_create_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-01-31 14:36:15 +08:00
Dan Marsden 7759183593 MDL-28522 Choice : View reports now correctly shows unanswered column - thanks to Marcus Boon for the patch 2012-01-31 12:23:35 +08:00
Aparup Banerjee 3d257cbf08 Merge branch 'MDL-31426_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-01-31 11:52:24 +08:00
Aparup Banerjee 611d3bd71d Merge branch 'MDL-31428_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-01-31 11:15:55 +08:00
AMOS bot fc9ca7eca3 Automatically generated installer lang files 2012-01-31 00:31:14 +00:00
Eloy Lafuente (stronk7) 94e62d8d02 MDL-31428 forum: prevent some warnings with debug enabled 2012-01-31 00:25:42 +01:00
Eloy Lafuente (stronk7) e163fbc943 MDL-31426 forum: don't show/allow any subscription to not enrolled users 2012-01-30 23:22:05 +01:00
Tim Hunt 699f075ad2 MDL-30484 question engine: don't lose response files when regrading.
The problem was mostly that, in the past, we did not worry if
question_attempt_step.id changed during regrade (because we deleted the
old step row and inserted a new one). However, now that steps can have
associated files, we can't be that slack, becuase the step id is used as
the file itemid.

So, now, we have to update the existing rows during a regrade. We do
this by having the question engine tell the question_engine_unit_of_work
that the step has first been deleted, and then added back. Then we make
the unit-of-work spot that delete + add = update.

This also means that during regrading, we have to pass around some extra
ids so that new steps know the id of the step they are replacing.

Naturally, this requires some quite trickly logic, so I finally got
around to writing unit tests for question_engine_unit_of_work, which is
a good thing.

Along the way I also got around to renaming
question_attempt->set_number_in_usage, which got missed out when
everthing else was renamed to slot ages ago.

Finally, while working on this code, I noticed and fixed some PHPdoc
comments.
2012-01-30 17:05:56 +00:00
Tim Hunt a3b0c9462f MDL-31314 gradebook restore: fix category.depth on restore.
Without this, restoring backups made with the OU's custom 'restore from
1.9' feature, and possibly other people's custom converstion code, does
not work properly.

Also, fix poor recordset code.
2012-01-30 12:31:30 +00:00
Tim Hunt d4d8a51fae MDL-30854 quiz/question editing: fix create calc question & add on page.
This was one of those innocent seeming issues where, once you start
digging, you find a mess. In this case, the code that is now in
question_wizard_form::add_hidden_fields used to exist in four different
places, in four inconsistent versions. This is now all nicely
re-factored, and that solves the problem.

Along the way, I found and fixed some wrong string references in
qtype_random, and stripped out some unnecessary &s in function
declarations.
2012-01-30 12:31:02 +00:00
Aparup Banerjee db78068443 Merge branch 'MDL-26260_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-30 16:26:47 +08:00
Aparup Banerjee c8a11c7410 Merge branch 'MDL-31392_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-30 14:25:35 +08:00
AMOS bot 53cd3d4278 Automatically generated installer lang files 2012-01-30 00:31:21 +00:00
sam marshall 8c8a31c21d MDL-31015 File/URL resource 'Open' and 'Force download' options should work consistently 2012-01-27 16:02:50 +00:00
Jerome Mouneyrac 049c70ea9d MDL-29471 php warning when adding function to a new web service 2012-01-27 16:11:47 +08:00
David Mudrak 17b629d458 MDL-31317 original_site_identifier_hash falls back to null during the backup conversion
Even if the site identifier is not defined in the source 1.9 backup then the
converted 2.0 version should still contain the element to prevent PHP
notices on direct assignment.
2012-01-27 08:50:02 +01:00
Jerome Mouneyrac 15dd454840 MDL-30878 core_user_update_users user password is reset if not specified 2012-01-27 15:26:10 +08:00
Fábio Souto 1dee84c2be Updated bugfix according to Jerome suggestions
password check is done at lib.php instead of externallib.php

Conflicts:

	user/lib.php
2012-01-27 15:26:01 +08:00
Dan Marsden bfeca9d6b9 SCORM AICC MDL-31039 update external AICC url correctly - thanks to Albert Rhemrev for report/fix 2012-01-27 19:42:30 +13:00
Dan Marsden 68e719927e MDL-31360 Don't use get_in_or_equal if array is empty, tidy up structure of $extracaps array 2012-01-27 19:40:38 +13:00
Eloy Lafuente (stronk7) d4b3034bb4 weekly release 2.2.1+ 2012-01-27 02:26:26 +01:00
Eloy Lafuente (stronk7) 61622d9709 Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-01-27 02:20:16 +01:00
AMOS bot d692e80d6b Automatically generated installer lang files 2012-01-27 00:31:16 +00:00
Tim Hunt e2a4d8f9d0 MDL-31392 qeupgradehelper partial upgrade support broken since 2.2 2012-01-26 16:32:10 +00:00
Sam Hemelryk 887ec885b1 Merge branch 'w04_MDL-30509_m22_slowcohort' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-25 10:29:22 +08:00
Eloy Lafuente (stronk7) b292cea475 Merge branch 'MDL-31122-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2012-01-25 01:52:36 +01:00
Eloy Lafuente (stronk7) fe3130a07d Merge branch 'MDL-29896-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2012-01-25 01:17:06 +01:00
Eloy Lafuente (stronk7) 264189da87 Merge branch 'MDL-31113_multiple_files_file_manager_22' of https://github.com/davosmith/moodle into MOODLE_22_STABLE 2012-01-25 01:06:56 +01:00
Eloy Lafuente (stronk7) 9e3824a63d Merge branch 'w04_MDL-31238_m22_php54' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-24 23:55:36 +01:00
Andrew Robert Nicols 2af7ab97d6 MDL-31245 Add missing 'icon' class to highlight button in topics format 2012-01-24 18:47:56 +01:00
Aparup Banerjee c327996e6b Merge branch 'wip-MDL-31224-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2012-01-24 23:01:26 +08:00
Eloy Lafuente (stronk7) ea5be5a976 MDL-31189 whitespace fixes 2012-01-24 13:21:00 +01:00
Eloy Lafuente (stronk7) ba09a2619e Merge branch 'w04_MDL-31183_m22_gloscounts' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-24 12:25:55 +01:00
M Kassaei 5d2dce09b3 MDL-31306 question preview: disable 'Fill correct' for qtypes that can't 2012-01-24 13:27:34 +08:00
Sam Hemelryk d0c82a5609 Merge branch 'MDL-31205_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-24 11:28:38 +08:00
Sam Hemelryk 11942210a2 Merge branch 'MDL-31189_M22' of git://github.com/lazydaisy/moodle into MOODLE_22_STABLE 2012-01-24 11:07:00 +08:00
Sam Hemelryk a67a3a8eec Merge branch 'MDL-31231_M22' of git://github.com/lazydaisy/moodle into MOODLE_22_STABLE 2012-01-24 11:03:02 +08:00
Eloy Lafuente (stronk7) ac2a99b1b8 Merge branch 'w04_MDL-31176_m22_groupcontext' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-24 01:30:02 +01:00
Aparup Banerjee b7c8fb6610 Merge branch 'wip-MDL-28352-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-01-24 07:12:31 +08:00
Eloy Lafuente (stronk7) 2581c3cb70 Merge branch 'MDL-30033_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-24 00:09:20 +01:00
Eloy Lafuente (stronk7) b19a440a04 Merge branch 'MDL-31065_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-24 00:07:06 +01:00
Aparup Banerjee 787c2eefd3 Merge branch 'w04_MDL-31184_m22_glosreset' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-24 06:58:33 +08:00
Mary Evans 9440efcd97 MDL-31189_M22 theme_sky_high: fixed footer so page, perfomance and validators can be seen if enabled 2012-01-23 21:41:39 +00:00
Petr Skoda 3b1e1d8964 MDL-31081 limit query to one course in forum_get_subscribed_forums()
This improves performance on the forum index page. Credit goes to Mark Nielsen.
2012-01-23 21:34:05 +01:00
Mary Evans ec5bfaf5e0 MDL-31231 fixes docked navigation menu in theme_afterburner 2012-01-23 12:45:23 +00:00
Petr Skoda 58ac441cae MDL-31172 fix variable name typo in backup file logger 2012-01-23 16:10:10 +08:00
Petr Skoda ddb621b78d MDL-31173 fix variable name typo when throwing invalid $rule param exception in restore decode processor 2012-01-23 16:07:06 +08:00
Sam Hemelryk 6f421476a9 Merge branch 'w04_MDL-31177_m22_odsexport' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-23 15:37:48 +08:00
Sam Hemelryk 3c6d27b44b Merge branch 'w04_MDL-31178_m22_enrolledws' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-23 15:15:52 +08:00
Sam Hemelryk f536a092d4 Merge branch 'w04_MDL-31182_m22_messprefs' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-23 14:45:50 +08:00
Sam Hemelryk d5d5ae432c Merge branch 'w04_MDL-31186_m22_extprofiles' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-23 14:31:48 +08:00
Petr Skoda 5125c0e332 MDL-31202 do not try sending emails to invalid addresses
The use of mtrace() in email_to_user() is most probably incorrect, I am going to use it only in CLI scripts (which includes cron). This should not be considered a security issue because we should be already validating emails when accepting them from untrusted users.
2012-01-23 14:24:43 +08:00
Mary Evans a141bd9ca2 MDL-31269 theme_magazine: fixes login pagelayout in theme_magazine 2012-01-23 13:25:49 +08:00
Mary Evans 8772dd9202 MDL-31324 fixes custom css settings in theme_afterburner 2012-01-23 13:13:51 +08:00
Andrew Davis b0b6a8dac6 MDL-29097 course: refactored to avoid having two seperate calls to events_trigger() 2012-01-23 11:56:00 +07:00
Andrew Davis 35888eee0d MDL-30722 mod_forum: prevented users being auto-logged in as guest when they access /mod/forum/unsubscribeall.php 2012-01-23 11:23:34 +07:00
Andrew Davis ec0118dd5d MDL-30707 mod_forum: fixed a add_to_log() call that was causing invalid URLs to be added to the log 2012-01-23 11:05:45 +07:00
Sam Hemelryk cd5189e266 Merge branch 'MDL-31077-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2012-01-23 11:48:25 +08:00
Sam Hemelryk c95efa3936 Merge branch 'MDL-31329_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-01-23 11:25:42 +08:00
Andrew Robert Nicols abb58a56f4 MDL-31013 Add iconsmall class to 'Export to portfolio' icon 2012-01-23 11:08:51 +08:00
Eloy Lafuente (stronk7) 7ce803eeae Merge branch 'wip-MDL-31179-MOODLE_22_STABLE' of github.com:marinaglancy/moodle into MOODLE_22_STABLE 2012-01-23 01:19:45 +01:00
Petr Skoda 196eedebb1 MDL-31180 fix coding error in fake_recordset iterator 2012-01-23 01:12:32 +01:00
Eloy Lafuente (stronk7) ed6af81b50 Merge branch 'w04_MDL-31181_m22_fitlertestcfg' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-23 01:04:17 +01:00
Eloy Lafuente (stronk7) 9e2f748669 Merge branch 'MDL-31058_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-23 00:56:24 +01:00
Eloy Lafuente (stronk7) 6daa6285cc Merge branch 'w04_MDL-31185_m22_postscfg' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-23 00:28:28 +01:00
Eloy Lafuente (stronk7) 984616805e MDL-31329 timezones: updated to 2011n 2012-01-22 21:32:07 +01:00
Petr Skoda ec6c7d98f9 MDL-31176 add missing global $DB when looking for group related context in calendar 2012-01-21 19:57:33 +01:00
Petr Skoda 918bcdcfab MDL-31177 fix notices when exporting logs to ods 2012-01-21 19:51:58 +01:00
Petr Skoda d0eb3fcf88 MDL-31178 fix broken core_enrol_external::get_enrolled_users() 2012-01-21 17:59:14 +01:00
Petr Skoda ea5214d534 MDL-31181 fix missing global $CFG that was breaking unit test teardown 2012-01-21 17:08:43 +01:00
Petr Skoda c73dbf667d MDL-31182 fix fatal error when problem detected in finding messaging defaults 2012-01-21 16:59:47 +01:00
Petr Skoda 3397a096ba MDL-31183 fix non-functional glossary_count_unrated_entries() 2012-01-21 16:47:28 +01:00
Petr Skoda 47649d4328 MDL-31184 fix multiple problems when reseting individual glossary types 2012-01-21 16:31:28 +01:00
Petr Skoda 3370262bae MDL-31185 fix missing CFG in forum_get_posts_by_user() 2012-01-21 16:17:33 +01:00
Petr Skoda 06f7eb2a36 MDL-31186 fix wrong context preloading sql 2012-01-21 16:09:01 +01:00
Petr Skoda 13a1eb3c10 MDL-30509 backport perf improvement in role cleanup in cohort sync
This patch simplifies the role cleanup sql, it is not necessary to look for roles without enrolment instance because all roles are automatically unassigned when deleting enrol instances.
2012-01-21 11:55:32 +01:00
Petr Skoda caa4912f70 MDL-31208 fix obsolete get_record_sql() parameter
Credit goes to Rajesh Taneja.
2012-01-21 11:36:52 +01:00
Petr Skoda 68d4c5bc1f MDL-31238 remove now unnecessary null to stdClass conversion for plugin settings 2012-01-21 11:17:18 +01:00
Petr Skoda 057d39bbc1 MDL-31238 always return object for plugin settings from get_config()
This prevents multiple creations of objects from NULL which is note a warnings in php54
2012-01-21 11:17:18 +01:00
Tim Hunt 2f7d4b4213 MDL-31058 qtype match 1.9 restore: fix restore of dodgy questions. 2012-01-20 18:06:53 +00:00
Tim Hunt 4eac963a41 MDL-31065 question stats: fix analysis of responses not matching a given answer
When shortanswer, numerical, calculated and calculatedsimple questions
did not have a '*' match-anything answer, then any student response that
did not match any of the teacher-given answers were classified as
'[No response]', which was not right.

This patch fixes that. Such responses are now classified as
[Did not match any answer].

While I was doing this, I noticed that the display of tolerance
intervals for numerical questions in the response analysis was horrible,
so I improved it.
2012-01-20 17:46:01 +00:00
Tim Hunt 2b18b65f9a MDL-31065 qtype shortanswer: refactor the unit tests to use a proper helper. 2012-01-20 17:45:56 +00:00
Tim Hunt 277106de6e MDL-31205 quiz 'secure' window: scrollbars missing.
Embarrassing type in the arguments to openpopup
2012-01-20 16:58:32 +00:00
Tim Hunt bc8e22c4cc MDL-30033 quiz overall feedback not show for attempts with a -ve grade
This can happen, for example, if a student does really badly on a CBM quiz.
2012-01-20 16:57:26 +00:00
Jason Ilicic 8f8db0fc5f MDL-26260 Fix quiz right-click prevention loophole. 2012-01-20 16:56:59 +00:00
sam marshall 125e250a85 MDL-29896 Navigation: Make links, files clickable in nav block 2012-01-20 10:33:05 +00:00
Andrew Davis 04d9550434 MDL-30828 mod_feedback: fixed sorting when viewing responses 2012-01-20 15:51:58 +07:00
Marina Glancy e58dbe0fe8 MDL-28352: Fixed bug in html_writer::select_time causing not autoselecting month 2012-01-20 16:27:39 +08:00
Sam Hemelryk 135de8d007 MDL-31197 navigation: Fixed issue withing require_login for courses that are hidden or unavailable 2012-01-20 12:51:48 +08:00
Sam Hemelryk ac41de6697 MDL-31224 block_navigation: Fixed display of icons for node with an action_link action 2012-01-20 11:19:20 +08:00
David Penner 5a479aa628 MDL-31160 block_navigation: Fixed incorrect thrid arg to substr. 2012-01-20 11:14:21 +08:00
Marina Glancy 288503b780 MDL-31179: added missing global 2012-01-20 10:33:23 +08:00
AMOS bot 5b01459102 Automatically generated installer lang files 2012-01-20 00:31:23 +00:00
Davo Smith 6d3c3b02a6 MDL-31113 filemanager element - refresh file list from server on load 2012-01-19 19:50:05 +00:00
sam marshall 54b1dc4950 MDL-31122 Navigation: Do not show week in navigation if it contains only labels 2012-01-19 14:46:34 +00:00
Eloy Lafuente (stronk7) 269c884874 weekly release 2.2.1+ 2012-01-19 13:33:36 +01:00
Eloy Lafuente (stronk7) 4a4c146e9f Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-01-19 13:28:42 +01:00
AMOS bot bd9cbc32f5 Automatically generated installer lang files 2012-01-19 00:31:22 +00:00
Andrew Robert Nicols e639d0cca8 MDL-31242 Prevent redefinition of MOODLE_INTERNAL when loading multiple YUI modules from Moodle 2012-01-18 15:40:36 +01:00
Tim Hunt e7a8905fc9 MDL-31157 quiz cron: another regression from MDL-30635 2012-01-18 10:27:06 +01:00
Eloy Lafuente (stronk7) 4416991914 MDL-31006 revert partially @ get_config()
The change from null to stdClass() in get_config() was leading to:

1) unit tests not passing.
2) non-equivalent evaluation in conditions (null evals false,
   stdClassi() evals true)
2012-01-18 02:11:53 +01:00
AMOS bot 11bb61041b Automatically generated installer lang files 2012-01-18 00:31:36 +00:00
Petr Skoda a1317d1b99 MDL-31006 some more PHP54 notices
PHP54 compatibility - PhpStorm IDE is the best tool for this kind of work!!
2012-01-18 01:17:09 +01:00
Petr Skoda 88e2bbae6d MDL-31006 fix various notices in PHP54
PHP54 compatibility
2012-01-18 01:04:45 +01:00
Eloy Lafuente (stronk7) 2aa4f06a88 Merge branch 'w03_MDL-31213_m22_attributesmess' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-17 12:37:28 +01:00
Petr Skoda fc0a71999e MDL-31213 fix incorrect modifications of quickforms attributes 2012-01-17 11:21:10 +01:00
Jerome Mouneyrac 4bc3f5a2da MDL-31077 REST server should return null if nothing fail and if the description function return null. 2012-01-17 15:50:37 +08:00
Eloy Lafuente (stronk7) 14a49d6d28 Merge branch 'w03_MDL-31053_m22_contextpreloading' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-17 02:26:25 +01:00
Eloy Lafuente (stronk7) b837c9e84d Merge branch 'w03_MDL-31127_m22_switchaccessinit' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-17 02:11:36 +01:00
Eloy Lafuente (stronk7) 8838b16705 Merge branch 'w03_MDL-31161_m22_reqpluginnotice' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-17 02:06:06 +01:00
Eloy Lafuente (stronk7) e4715ab74a Merge branch 'MDL-31080_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-17 02:01:49 +01:00
Eloy Lafuente (stronk7) 87be88ad2f Merge branch 'w03_MDL-31142_m22_slowiconv' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-17 01:39:07 +01:00
Eloy Lafuente (stronk7) 27dd6a7c57 Merge branch 'w03_MDL-31171_m22_blogattachment' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-17 01:32:17 +01:00
AMOS bot fba6d4c169 Automatically generated installer lang files 2012-01-17 00:31:12 +00:00
Eloy Lafuente (stronk7) 9690f66447 Merge branch 'w03_MDL-31170_m22_blogblocks' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-17 00:55:45 +01:00
Sam Hemelryk 1c1b04c994 Merge branch 'MDL-31095_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-16 16:59:27 +08:00
Sam Hemelryk 8a9edd6dba Merge branch 'MDL-31135_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-16 16:41:24 +08:00
Sam Hemelryk 282dcd3c03 Merge branch 'MDL-31102_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-16 16:27:38 +08:00
Petr Skoda 76917f764f MDL-31142 fix textlib::substr() performance, invalid length in iconv_substr; use mbstring by default 2012-01-16 09:17:36 +01:00
Sam Hemelryk d5c88f9333 Merge remote-tracking branch 'skodak/w03_MDL-27165_m22_confirmed' into MOODLE_22_STABLE 2012-01-16 16:17:09 +08:00
Aparup Banerjee 1a3b5c6cfc Merge branch 'MDL-31143_22' of https://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-16 15:29:30 +08:00
Sam Hemelryk 199ba4286b Merge remote-tracking branch 'skodak/w03_MDL-29102_m22_autogrouping' into MOODLE_22_STABLE 2012-01-16 15:11:07 +08:00
Sam Hemelryk f0987e98ad Merge remote-tracking branch 'skodak/w03_MDL-30891_m22_repository' into MOODLE_22_STABLE 2012-01-16 15:01:09 +08:00
Sam Hemelryk 735d8ce2ce Merge remote-tracking branch 'skodak/w03_MDL-30958_m22_yuissl' into MOODLE_22_STABLE 2012-01-16 14:56:06 +08:00
Aparup Banerjee 0a52c0d63d Merge branch 'w03_MDL-31166_m22_clipath' of https://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-16 14:52:48 +08:00
Sam Hemelryk ec9cd69156 MDL-31011 course: Fixed typo in comment 2012-01-16 14:49:28 +08:00
Sam Hemelryk 43812bf883 Merge remote-tracking branch 'skodak/w03_MDL-31011_m22_loglinks' into MOODLE_22_STABLE 2012-01-16 14:49:28 +08:00
Aparup Banerjee 7b3dae9096 Merge branch 'w03_MDL-21992_m22_customscripts' of https://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-16 14:48:16 +08:00
Sam Hemelryk 6f960202e7 Merge remote-tracking branch 'skodak/w03_MDL-31035_m22_identitynotice' into MOODLE_22_STABLE 2012-01-16 14:38:36 +08:00
Sam Hemelryk ff65ab25c2 Merge remote-tracking branch 'skodak/w03_MDL-31117_m22_grouptodo' into MOODLE_22_STABLE 2012-01-16 14:34:58 +08:00
Sam Hemelryk ac0d9c6411 Merge remote-tracking branch 'skodak/w03_MDL-31109_m22_maintenance' into MOODLE_22_STABLE 2012-01-16 14:33:01 +08:00
Sam Hemelryk 1480ead173 Merge branch 'wip-MDL-31060-MOODLE_22_STABLE' of git://github.com/marinaglancy/moodle into MOODLE_22_STABLE 2012-01-16 12:00:12 +08:00
Sam Hemelryk 2d48474f2a Merge branch 'MDL-31130_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-16 11:48:50 +08:00
Aparup Banerjee 94828bec35 Merge branch 'wip-MDL-31072-MOODLE_22_STABLE' of github.com:marinaglancy/moodle into MOODLE_22_STABLE 2012-01-16 11:39:43 +08:00
Andrew Robert Nicols 6a226839d0 MDL-31018 Improve consistency of horizontal alignment across grade reports 2012-01-16 11:14:46 +08:00
Sam Hemelryk 6bf567100a Merge branch 'MDL-31040-MOODLE_22_STABLE-3' of git://git.luns.net.uk/moodle into MOODLE_22_STABLE 2012-01-16 10:59:41 +08:00
Mayank Gupa 00e4cad952 MDL-30578, Updating CMILongIdentifer read comments at tracker 2012-01-16 10:16:50 +08:00
Mayank Gupa 754eb73b23 MDL-30578, Updating CMILongIdentifer to check for valid URI (RFC 3986 [6]) and URN syntax as per RFC 2141 [3] 2012-01-16 10:16:41 +08:00
Eloy Lafuente (stronk7) e09cfa968b Merge branch 'w03_MDL-31165_m22_innodbconv' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-16 02:06:57 +01:00
Eloy Lafuente (stronk7) 8b23f31909 Merge branch 'MDL-31157_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-16 01:43:20 +01:00
Charles Fulton 534f9fec11 MDL-25883 correct element name for wiki comments editor 2012-01-15 10:35:23 -08:00
Petr Skoda cee1176862 MDL-29102 fix notice when auto-creating groups in existing grouping 2012-01-15 19:27:08 +01:00
Petr Skoda 5274209ac1 MDL-31171 fix blog attachment serving in BLOG_USER_LEVEL 2012-01-15 19:11:41 +01:00
Petr Skoda 12f2dc577d MDL-31011 fix report links in logs 2012-01-15 19:02:34 +01:00
Petr Skoda 7e6f69b9af MDL-31035 fix showuseridentity notice before settings upgrade 2012-01-15 17:13:11 +01:00
Petr Skoda 7991c4c000 MDL-21992 fix custom scripts on https pages and CLI 2012-01-15 16:00:45 +01:00
Petr Skoda 7fdb5afc08 MDL-31161 fix notice when checking plugin requirements
Credit goes to Joseph Rézeau, thanks.
2012-01-15 15:35:20 +01:00
Petr Skoda a2c5642872 MDL-30958 do not use Yahoo CDN on https sites
Browsers do not like mixing of ssl and non-use content on one page. Unfortunately YAHOO does not provide the files over SSL yet - see http://yuilibrary.com/yui/docs/tutorials/faq/#does-yahoos-cdn-support-ssl
2012-01-15 15:25:01 +01:00
Petr Skoda fde76de588 MDL-31170 fix automatic blog blocks hiding/unhiding after blog level change 2012-01-15 13:40:37 +01:00
Petr Skoda 45d88e56cb MDL-31166 do not try to cleanup data root paths in CLI install script
PARAM_TYPE can not be used for full OS paths. Admins have to enter correct data there, if not they get directory creation error.
2012-01-15 11:05:30 +01:00
Petr Skoda 22d6b3da4f MDL-31165 fix InnoDB conversion query to use ENGINE parameter instead of legacy TYPE 2012-01-15 10:32:29 +01:00
AMOS bot f7ff057d0b Automatically generated installer lang files 2012-01-15 00:31:12 +00:00
Petr Skoda 04c0a7d205 MDL-31109 fix maintenance link value in get_string() 2012-01-15 00:56:29 +01:00
Petr Skoda f543eea9d6 MDL-31117 delete obsolete TODO
This TODO was added when we were still using moodledata folder for group images, it is not relevant any more because group images are in new file API which supports DB transaction rollbacks.
2012-01-15 00:44:04 +01:00
Petr Skoda a5a993abc2 MDL-31127 init USER->access when switching roles
Only admins were affected by this problem because has_capability() does not init USER->access for them.
2012-01-15 00:15:17 +01:00
Petr Skoda 38d341b0d7 MDL-27165 fix broken confirmed user filtering 2012-01-14 22:14:58 +01:00
Petr Skoda 1c83b13343 MDL-30891 fix invalid hardcoded capability check when disable legacy files repo 2012-01-14 21:58:33 +01:00
Petr Skoda 182f5cc6f6 MDL-31053 fix invalid context preloading in get_user_capability_course() 2012-01-14 21:36:32 +01:00
Tim Hunt d8b06a25b2 MDL-31157 quiz cron: timenow was not being initialised 2012-01-13 22:33:16 +00:00
Tim Hunt ef0376f4ef MDL-31095 quiz editing: only set quiz->grade to 0 if really necessary.
It is only necessary when there are (non-preview) attempts. However,
after making this change we have to ensure users cannot start attempts
when ->grade > 0 and ->sumgrades = 0.

Display ->grade on the order and paging tab of edit.php, so it is clear
what is going on when you are using that tab.

Finally, improve the error message a student gets if they try to start a
quiz with no questions.
2012-01-13 11:42:57 +00:00
Tim Hunt 090d2f90e8 MDL-31095 quiz: fix bug in quiz::has_questions. 2012-01-13 11:42:55 +00:00
Marina Glancy ee5cf900f8 MDL-31072: Fixed bug causing memory overflow for many-user systems:
when function find_users was supposed to be used for user validation but no userids were passed to it, it retrieved all users in the system.
This caused memory overflow on systems with too many users (like moodle.org).
Now we make sure that find_users is not called for validation if there is nobody to validate.

Also improved query inside find_users to make it work faster
2012-01-13 10:13:04 +08:00
Marina Glancy e5a9af0a70 MDL-31060: removed unnecessary fields from query which also caused problems in MSSQL 2012-01-13 10:12:55 +08:00
Tim Hunt b3c02fae54 MDL-31143 quiz reports: average grade of null causes php error. 2012-01-12 16:46:12 +00:00
Andrew Robert Nicols 87b8419f80 MDL-31040 Correct LTR language issue and inconsistency in display 2012-01-12 14:01:51 +00:00
Jonathon Fowler 0a2569e55c MDL-31130 question bank: toggling show all / 20 per page broken. 2012-01-12 12:44:44 +00:00
Tim Hunt a8f912faf1 MDL-31135 question instances report: 'All' option broken 2012-01-12 12:44:15 +00:00
Tim Hunt 16f75808c7 MDL-31102 question preview: fix HTML validation errors. 2012-01-12 11:33:00 +00:00
Tim Hunt a364362b95 MDL-31100 unit tests: don't mangle UTF-8 in failure messages. 2012-01-12 11:32:41 +00:00
Tim Hunt d16597b557 MDL-31080 quiz editing, must be able to see and delete missing questions 2012-01-12 11:32:22 +00:00
Eloy Lafuente (stronk7) f70f6e9ad1 weekly release 2.2.1+ 2012-01-12 11:33:19 +01:00
Eloy Lafuente (stronk7) cb5d7dbe14 Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-01-12 11:25:01 +01:00
Tim Hunt 7ecee68542 MDL-26469 upgrade: cope with modules that do not set $module->cron. 2012-01-11 19:08:13 +01:00
Tim Hunt 18930123e3 MDL-26469 upgrade: module cron setting not updated. 2012-01-11 14:04:16 +00:00
Tim Hunt f40f4013f1 MDL-30635 quiz cron: fixup - enable in version.php & fn name quiz_statistics_cron 2012-01-11 14:02:17 +00:00
AMOS bot 86645a5e91 Automatically generated installer lang files 2012-01-11 00:31:22 +00:00
Eloy Lafuente (stronk7) e516577ec7 Merge branch 'MDL-31101_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-10 23:35:15 +01:00
Tim Hunt 8261570853 MDL-31101 format_string: Don't mangle < and > in strings like x < 1. 2012-01-10 14:54:40 +00:00
Rajesh Taneja 4cb258fbdf MDL-30452 Repositories: Changed default capability on repos - Thanks Michael
Signed-off-by: Rajesh Taneja <rajesh@moodle.org>
2012-01-10 11:11:34 +01:00
Sam Hemelryk 859624f26c Merge branch 'MDL-24394_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-10 14:30:22 +13:00
Sam Hemelryk 10c3c6d49c Merge branch 'MDL-31019_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-10 14:26:36 +13:00
Sam Hemelryk 7e9f29178e MDL-31000 Added comment about the importance of repository array keys 2012-01-10 12:27:38 +13:00
Sam Hemelryk 7984be4a13 Revert "MDL-31000 Respect sortorder of repositories when displaying the filepicker"
This reverts commit ce40b669cc.
2012-01-10 12:25:11 +13:00
Eloy Lafuente (stronk7) efabe26141 Merge branch 'wip-mdl-30608-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-01-09 22:19:11 +01:00
Darko Miletic a7e79bfe78 MDL-30783: Implemented fix 2012-01-09 21:51:41 +01:00
Tim Hunt c4989dc75f MDL-24394 qtype_match: should be able to use multilang for the choices. 2012-01-09 18:06:11 +00:00
Tim Hunt 0f504be67b MDL-31019 quiz secure mode. Fix typo that breaks submit. 2012-01-09 17:10:19 +00:00
Aparup Banerjee 54afb1ca01 Merge branch 'w02_MDL-30718_m22_usertimedb' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-09 12:20:34 +08:00
Sam Hemelryk da744e0065 Merge branch 'w02_MDL-31005_m22_contextlevelname' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-09 16:12:38 +13:00
Sam Hemelryk 7a44fb4d97 MDL-30608 Blocks: Fixed block disappering from search page 2012-01-09 11:04:44 +08:00
Aleksey Avdeev d43c4284e1 MDL-29046 use of install/distrolib.php in the CLI installer
Signed-off-by: Aleksey Avdeev <solo@altlinux.ru>
2012-01-09 02:32:37 +01:00
Eloy Lafuente (stronk7) f36884dde7 Merge branch 'MDL-30031-22' of git://github.com/bostelm/moodle into MOODLE_22_STABLE 2012-01-09 02:14:31 +01:00
Sam Hemelryk 5dff4c565f Merge branch 'w02_MDL-30717_m22_usercreated' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-09 14:03:00 +13:00
Sam Hemelryk 0ca7b84953 MDL-30928 lib: Fixed whitespace 2012-01-09 13:57:23 +13:00
Sam Hemelryk 995294dfa3 Merge branch 'w02_MDL-30928_m22_deletetimes' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-09 13:48:37 +13:00
Sam Hemelryk cef1e7f444 Merge branch 'w02_MDL-30969_m22_suspendedcsv' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-09 13:02:21 +13:00
Darko Miletic 23758a4588 MDL-30778: Implemented intendeduserrole support 2012-01-09 00:42:48 +01:00
Eloy Lafuente (stronk7) f35cacdc83 Merge branch 'MDL-30966-print-object_22_STABLE' of git://github.com/mudrd8mz/moodle into MOODLE_22_STABLE 2012-01-09 00:33:31 +01:00
Eloy Lafuente (stronk7) 7e20d8e330 Merge branch 'MDL-30635_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-09 00:18:18 +01:00
Sam Hemelryk ade2e5955e Merge branch 'MDL-30652_m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2012-01-09 12:00:22 +13:00
Andrew Robert Nicols ce40b669cc MDL-31000 Respect sortorder of repositories when displaying the filepicker 2012-01-09 11:53:53 +13:00
Petr Skoda 05042a7ed8 MDL-31005 fix strict coding style warning in context_helper
PHP54 compatibility
2012-01-08 15:42:34 +01:00
Petr Skoda 2824832a18 MDL-30717 update user->timemodified in update_user_record() 2012-01-08 15:04:06 +01:00
Petr Skoda 17330e8aae MDL-30717 add missing time created info in create_user_record()
Credit goes to Luis Gustavo Mueller de Alcantara.
2012-01-08 15:04:05 +01:00
Petr Skoda 6ac158e9e3 MDL-30718 add missing timecraeted and timeupdated, fix user undeleting 2012-01-08 14:51:47 +01:00
Petr Skoda dfff77eedd MDL-30928 include course and user deletion time in event
Credit goes to Luis Gustavo Mueller de Alcantara.
2012-01-08 14:30:06 +01:00
Petr Skoda 77536bd387 MDL-30969 add support for suspending in uploaduser admin tool 2012-01-08 14:01:49 +01:00
AMOS bot c56a8d4441 Merge branch 'MOODLE_22_STABLE' into install_22_STABLE 2012-01-08 00:31:21 +00:00
Eloy Lafuente (stronk7) a1d246334b Moodle release 2.2.1 2012-01-07 17:04:34 +01:00
AMOS bot e71389830c Automatically generated installer lang files 2012-01-07 00:31:19 +00:00
David Mudrak b886841fc8 MDL-30966 print_object() output made CLI-friendly 2012-01-06 22:47:11 +01:00
Tim Hunt 25200f80f7 MDL-30635 let quiz reports do cron in the standard way.
The old legacy way is still supported in 2.2, but this support will be
dropped in 2.3.
2012-01-06 18:13:13 +00:00
AMOS bot fdac23f168 Automatically generated installer lang files 2012-01-06 00:31:29 +00:00
Eloy Lafuente (stronk7) 7ca0ece0db weekly release 2.2+ 2012-01-05 15:06:46 +01:00
Eloy Lafuente (stronk7) dcfc7a875a Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-01-05 12:50:26 +01:00
Sam Hemelryk ffd6212152 Merge branch 'MDL-31017_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-01-05 11:17:13 +13:00
Eloy Lafuente (stronk7) 1cf721e235 MDL-31017 whitespace clean - take1 2012-01-04 16:28:59 +01:00
Eloy Lafuente (stronk7) aed7f32783 Merge branch 'MDL-30865-workshop-unittest_22_STABLE' of git://github.com/mudrd8mz/moodle into MOODLE_22_STABLE 2012-01-04 02:19:11 +01:00
Eloy Lafuente (stronk7) dbc7d20cf5 Merge branch 'MDL-30879-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2012-01-04 02:14:34 +01:00
Petr Skoda 6357d61912 MDL-30945 add support for unenrolling of individual users + code cleanup 2012-01-04 01:53:33 +01:00
AMOS bot 3acce7a095 Automatically generated installer lang files 2012-01-04 00:31:17 +00:00
Petr Skoda a36531da4f MDL-30948 do not generate new passwords for suspended accounts because they would not get any emails 2012-01-04 00:49:04 +01:00
Petr Skoda 7d1906cf7c MDL-30948 stop messaging suspended and deleted users 2012-01-04 00:49:03 +01:00
Petr Skoda 8be58774cd MDL-30951 prevent fatal error when category sync enrolment not configured 2012-01-04 00:40:26 +01:00
Petr Skoda ffbcd681f3 MDL-29917 prevent form autocompletion in most Moodle forms
The password autocompletion in case of Moodle makes sense only on the login page, the form autocompletion in general is most probably useful only on the user signup page.

This patch is compatible with html 5, unfortunately we have to ignore strict warnings in legacy xhtml 1.0 standard.
2012-01-04 10:58:31 +13:00
Petr Skoda dc49c2d461 MDL-30548 support user suspended flag in admin UI
This patch includes:
* user management suspend UI tweaks and other coding style improvements
* suspended info in user profiles
* suspend option in advanced edit form
* suspended user filtering
* hidden user fields option for suspended field

Thanks Sam Hemelryk for valuable feedback.
2012-01-04 10:51:04 +13:00
Petr Skoda 10357af3ef MDL-30950 remove references to removed admin block
Credit goes to Ralf Hilgenstock.
2012-01-03 22:35:00 +01:00
sam marshall 1800b35bf6 MDL-30879 Course page: missing space after class for new 'description on course page' feature 2012-01-03 12:42:24 +00:00
Rossiani Wijaya 6ca2f1d3ce MDL-30600 Fix mymobile theme choice renderer 2012-01-03 17:54:34 +08:00
Ankit Kumar Agarwal 9f097a7248 MDL-30652 SCORM Fixing report prefrences display for interactions report 2012-01-03 12:10:52 +05:30
Ankit Kumar Agarwal 8755b6aaca MDL-30652 SCORM Fixing report prefrences display issue for basic report 2012-01-03 12:10:43 +05:30
Ankit Kumar Agarwal bea916ae7c MDL-30652 Scorm adding proper comments 2012-01-03 12:10:21 +05:30
Aparup Banerjee 8ef685cf4c Merge branch 'wip-mdl-29844-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2012-01-03 12:31:22 +08:00
Eloy Lafuente e4b1208377 MDL-29844 Administration: Added new config for users to login for viewing profile image 2012-01-03 12:02:59 +08:00
Sam Hemelryk cd735560d3 Merge branch 'w52_MDL-30786_m22_todelete' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2012-01-03 16:35:26 +13:00
Petr Skoda a770897929 MDL-30673 fix login autocompletion protection 2012-01-03 14:09:36 +13:00
AMOS bot 40ff6e3663 Automatically generated installer lang files 2012-01-03 00:31:16 +00:00
Petr Skoda b408061558 MDL-30809 do not add guest info to add course form if default instance prevented 2012-01-03 13:05:38 +13:00
Petr Skoda be1af716b7 MDL-30924 merge upstream pspell fix
See https://github.com/moodle/custom-tinymce_spellchecker_php/tree/MOODLE_22_2.0.6a
2012-01-03 12:49:38 +13:00
Petr Skoda f69ff3b72e MDL-30926 fix course and module blog associations 2012-01-03 12:39:17 +13:00
Petr Skoda 0543bb679b MDL-30934 fix module delete cleanup
Credit goes to Rajiv Navada.
2012-01-03 12:26:35 +13:00
Petr Skoda 9cad3e182d MDL-30943 fix forgotten admin/report/ references 2012-01-03 12:23:43 +13:00
Sam Hemelryk 1243bf814b Merge branch 'MDL-30802_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-03 11:25:50 +13:00
Sam Hemelryk e972cdc5ad Merge branch 'MDL-30766_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-03 11:23:00 +13:00
Sam Hemelryk dc8d309c88 Merge branch 'MDL-30168_tim2_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-03 11:14:10 +13:00
Sam Hemelryk 860848dca8 Merge branch 'MDL-27200_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2012-01-03 11:12:01 +13:00
Henning Bostelmann aafe1618f8 MDL-29266 Assignment grading: save state of "send notifications" box 2012-01-03 11:09:59 +13:00
Petr Skoda 358e5cf791 MDL-13572 fix incorrect value printing 2012-01-03 11:01:29 +13:00
Petr Skoda a2c591662b MDL-13572 fix incorrect value printing 2012-01-03 11:01:29 +13:00
Petr Skoda 64550fa6c1 MDL-13572 do not send emails to invalid addresses 2012-01-03 11:01:29 +13:00
Mary Evans 267ff8cd27 MDL-30868 Fix for assignment view in theme_boxxie 2012-01-03 10:39:03 +13:00
Henning Bostelmann 32bbc36039 MDL-29821 Navigation tree: fix link to course notes page 2012-01-03 10:12:56 +13:00
Dan Poltawski 8129b01641 MDL-30706 mymobile: don't send login pages through ajax
By doing 'real requests' we can allow external authentication to happen
(e.g. apache module which does a redirect to external SSO system)
2012-01-03 10:09:43 +13:00
Andrew Robert Nicols a39a53fa6f MDL-30804 Rename the 'onthispage' fieldset for block configuration 2012-01-03 10:06:53 +13:00
Andrew Robert Nicols c50d05671b MDL-30805 Require HTML content for the HTML block configuration 2012-01-03 10:03:23 +13:00
Sam Hemelryk 7f7d9ce6e8 Merge branch 'MDL-13572_validate_email_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2012-01-03 09:57:14 +13:00
Eloy Lafuente (stronk7) 58a44ab228 Merge branch 'MDL-30851_22_wip' of git://github.com/grabs/moodle into MOODLE_22_STABLE 2012-01-02 20:26:40 +01:00
Petr Skoda b43c2e9d39 MDL-30953 fix utf-8 support in PSpell class
Credit for discover and proposed fix goes to David Hai Gootvilig, this patch is part of https://github.com/moodle/custom-tinymce_spellchecker_php/tree/MOODLE_22_2.0.6b which will be used in the next tinymce import. It was reported upstream as https://github.com/tinymce/tinymce_spellchecker_php/pull/5
2012-01-02 20:20:08 +01:00
AMOS bot 42cbe9be98 Automatically generated installer lang files 2011-12-29 00:31:19 +00:00
Henning Bostelmann fb93cfac00 MDL-30031 Adaptive question behaviour: ignore invalid answers without penalty 2011-12-28 17:20:51 +00:00
AMOS bot 0ba9f5a5e9 Automatically generated installer lang files 2011-12-24 00:31:35 +00:00
Andreas Grabs 9d1963b421 MDL-30851 - Syntax error in analysis_course.php 2011-12-23 17:39:16 +01:00
Tim Hunt ed82e03798 MDL-30873 quiz: display an overall grade for preview users.
Also, don't display an overall grade unless there is at least one finished attempt.
2011-12-23 11:49:59 +00:00
Tim Hunt a89d501b72 MDL-30802 question nav: fix questions link in front page course. 2011-12-23 11:49:38 +00:00
Tim Hunt 4587d4f5b7 MDL-30766 mod_quiz: fix edge cases of repaginate function. 2011-12-23 11:49:18 +00:00
Tim Hunt cb0318b633 MDL-30168 formslib: untangle automatic id generation.
Previously, we had overridden the _generateId method in almost all
subclasses; and then we mostly, but not always; ignored the value that
was generated there, and instead generated new (nicer) values in
MoodleQuickForm_Renderer::renderElement. Of course, that is not really a
logical place to (re)generate ids.

I have fixed the code so that the _generateId method now uses the 'nice
id' algorithm from renderElement. This should make the whole code flow
more logical.

This make all our overriding of _generateId unnecessary.

We do need a special _generateId for radio buttons, because you often
have different radio buttons with the same name but different values.

This change should only change the ids on radio, checkbox and
advcheckbox elements. Previously, those were essentially random, so I
don't think anyone could have been relying on the particular values.

This commit also has new unit tests, first to test the basic _generateId
algorithm, and then to create and render an example form (including some
tricky things like repeat_elements) and chech the acutal ids in the
generated HTML.
2011-12-23 11:19:48 +00:00
Tim Hunt 404e01f59e MDL-27200 missing {} in various lang strings. 2011-12-23 11:19:24 +00:00
Petr Skoda 96ebc911d7 MDL-30786 fix overview status of standard plugins to be deleted 2011-12-23 10:36:12 +01:00
David Mudrak 7d8c4fb5af MDL-30865 Workshop method aggregate_grading_grades_process() accepts explicit aggregation timestamp 2011-12-23 09:21:09 +01:00
Eloy Lafuente (stronk7) 929c26ccf1 weekly release 2.2+ 2011-12-23 03:03:32 +01:00
Eloy Lafuente (stronk7) c994fe7430 Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2011-12-23 02:53:07 +01:00
AMOS bot 1d4262608c Automatically generated installer lang files 2011-12-23 00:31:21 +00:00
Eloy Lafuente (stronk7) 0016ed0115 MDL-30760 question engine: reduce summary max size
MySQL only accepts 65536 (aprox) bytes in default TEXT
columns. So we define the max allowed as 32000 to allow
99.9% of utf-8 contents to fit. If some day MDL-19603 is
implemented and all current TEXTs are moved (MySQL) to
the BIG counterparts, this restriction can be out (MDL-19603).
2011-12-23 01:16:00 +01:00
Gerard (Gerry) Caulfield 0c5e3d4564 MDL-29400 Fixing unset object bug encountered by Rajesh during testing 2011-12-22 09:55:38 +01:00
Sam Hemelryk e0c00395b7 Merge branch 'wip-MDL-18128-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2011-12-22 11:44:34 +13:00
Sam Hemelryk 9e9e0732f5 MDL-30639 mod_lesson: Used a consistent format for users display of answer 2011-12-22 11:23:15 +13:00
Sam Hemelryk 965344c08f Merge branch 'MDL-30639_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2011-12-22 11:21:08 +13:00
Tim Hunt 0f97c8afdb MDL-30704 quiz_overview: fixup, add missing rescaling.
Thanks Micheal de Raadt for catching this in testing.
2011-12-21 18:33:32 +01:00
Eloy Lafuente (stronk7) 1b5afe64c4 MDL-20245 grade: added tests for set_user_preference() and the 1333 limit
Added to tests to check that both the "limit" case of using 1333
chars is allowed and 1334 causes coding exception to happen
2011-12-21 16:30:57 +01:00
Eloy Lafuente (stronk7) 5831b4c70c MDL-20245 grade: fix version numbers
This commit puts the 22_STABLE and master main
versions back to "on-sync" mode (very first
weeks after major release).

Conflicts:

	lib/db/upgrade.php
	version.php
2011-12-21 12:25:11 +01:00
Andrew Davis 223e753520 MDL-20245 grade: increased the size of the user_preferences value column and added php validation of the data going into that column
Conflicts:

	lib/db/upgrade.php
	version.php
2011-12-21 12:23:50 +01:00
adrian@moodle.com 72682b8868 MDL-18128 - forum - Addition of group editing for forums. 2011-12-21 15:40:09 +08:00
Aparup Banerjee 8fe13ecf1a Merge branch 'wip-MDL-30541-stable22' of git://github.com/phalacee/moodle into MOODLE_22_STABLE 2011-12-21 14:16:55 +08:00
Aparup Banerjee dbfa519ad9 MDL-28126 webservice : resolved integration conflicts 2011-12-21 11:28:33 +08:00
Sam Hemelryk 6ff99dde45 Merge branch 'MDL-29239_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2011-12-21 15:00:41 +13:00
Jason Fowler 332748dd7e MDL-30541 - Blog - Fixing the context for RSS Feed headers on the single blog entry pages 2011-12-21 09:35:52 +08:00
Sam Hemelryk db65026449 Merge branch 'MDL-30704_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-21 14:30:27 +13:00
Eloy Lafuente (stronk7) 45c920b0af MDL-30777: whitespace fix 2011-12-21 00:41:20 +01:00
Darko Miletic 1be36988ac MDL-30777: Properly implemented error message 2011-12-21 00:41:09 +01:00
Eloy Lafuente (stronk7) d7964ccf87 Merge branch 'MDL-30170-mnet-undelete_22_STABLE' of git://github.com/mudrd8mz/moodle into MOODLE_22_STABLE 2011-12-20 23:33:19 +01:00
Gerard (Gerry) Caulfield efa9f19281 MDL-29400 Update the upload and uploadsingle assignment classes to so
that they only display the assignment submitted status when it has
actually been submitted.
2011-12-20 22:55:23 +01:00
Eloy Lafuente (stronk7) 6662dee76d MDL-30761 make it work under Oracle. To revisit after MDL-29765 is done. 2011-12-20 22:38:21 +01:00
Eloy Lafuente (stronk7) 1729746211 Merge branch 'w51_MDL-30761_m22_slowmysql' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-20 22:38:09 +01:00
Darko Miletic fe2a74db60 MDL-30631: Fixed the default grade import for the question for both CC
1.0 and 1.1
2011-12-20 22:02:51 +01:00
Eloy Lafuente (stronk7) 72b01fbeb3 Merge branch 'MDL-30603_m22' of https://github.com/nebgor/moodle into MOODLE_22_STABLE 2011-12-20 19:49:45 +01:00
Eloy Lafuente (stronk7) 7259dbc551 Merge branch 'MDL-29048-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-20 18:56:01 +01:00
Eloy Lafuente (stronk7) 39949b56ad Merge branch 'wip-MDL-30733-MOODLE_22_STABLE' of github.com:marinaglancy/moodle into MOODLE_22_STABLE 2011-12-20 18:52:48 +01:00
Aparup Banerjee 7110207a34 MDL-25561 Gradebook : fixed whitespaces 2011-12-20 19:15:48 +08:00
Aparup Banerjee 40b67fca0a Merge branch 'MDL-25561_user_report_name_clickable_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-20 19:15:20 +08:00
Andrew Robert Nicols b9c38ef120 MDL-30627 Ensure that the dialogue is always shown in the current view window 2011-12-20 13:38:41 +08:00
Rossiani Wijaya b8e5740796 MDL-30636 Lesson Module: fixed essay answer display format 2011-12-20 12:51:52 +08:00
Andrew Robert Nicols 8c9d533f3d MDL-30641 Stop italicising and underlining folder names in the filepicker 2011-12-20 11:55:12 +08:00
Aparup Banerjee 18952a18fd Merge branch 'MDL-30569-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-20 11:11:02 +08:00
Eloy Lafuente (stronk7) 53516a8ece Merge branch 'wip-mdl-29067-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2011-12-20 03:12:55 +01:00
Sam Hemelryk a5f35b4cf2 MDL-30770 admin: Fixed notice about missing variable 2011-12-20 02:26:34 +01:00
Eloy Lafuente (stronk7) fbb829b82d MDL-30739 add one test to confirm the solution is cross-db 2011-12-20 02:23:55 +01:00
Eloy Lafuente (stronk7) ceec817f95 Merge branch 'MDL-30739_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-20 02:21:30 +01:00
Sam Hemelryk 0cba7c0408 Merge branch 'MDL-30764-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2011-12-20 14:15:43 +13:00
Eloy Lafuente (stronk7) 2df28fda6c Merge branch 'MDL-30738_22_STABLE' of git://github.com/kiklop74/moodle into MOODLE_22_STABLE 2011-12-20 02:01:29 +01:00
Sam Hemelryk 9f83ba0887 Merge branch 'MDL-30760_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-20 13:34:53 +13:00
AMOS bot 956d1a3ab5 Automatically generated installer lang files 2011-12-20 00:31:22 +00:00
Sam Hemelryk 6005434b55 Merge branch 'MDL-30646_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-20 13:21:11 +13:00
Sam Hemelryk a8fb78b142 Merge branch 'MDL-29846_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-20 13:16:20 +13:00
Sam Hemelryk b3af6c110a Merge branch 'w51_MDL-30787_m22_coursemodedit' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-20 12:08:09 +13:00
Eloy Lafuente (stronk7) 58ca2c4b71 Merge branch 'MDL-30741_m22' of git://github.com/jfilip/moodle into MOODLE_22_STABLE 2011-12-20 00:05:13 +01:00
Sam Hemelryk 4e77491aff Merge branch 'wip-MDL-28948-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2011-12-20 10:42:45 +13:00
Petr Skoda c2ca1a3793 MDL-30779 add port and socket to dbtansfer tool 2011-12-20 10:29:11 +13:00
Sam Hemelryk 1f3933bee6 Merge branch 'w51_MDL-30765_m22_context' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-20 10:09:27 +13:00
Sam Hemelryk e7af814b0d Merge branch 'w51_MDL-30697_m22_roleslink' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-20 10:03:59 +13:00
Tim Hunt 365e163946 MDL-30704 Quiz grades report shows inconsistent averages.
Previously, for the overall grade, we averaged the final marks for each
student; while for the individual question grades, we averaged all
grades.

The report now works consistently on the principle that the averages
should include exactly what is currenlty being shown in the report. This
is more logical, and so should be easier for users to understand.

If you want to see the averages that are currently shown (e.g. just the
average of each student's highers grade) then the report options let you
do that.
2011-12-19 15:03:56 +00:00
Tim Hunt 9f689071a8 MDL-29846 qbehaviours admin: correct $needed logic.
Also, fix a notice.
2011-12-19 14:34:09 +00:00
Aparup Banerjee 85daa5926c Merge branch 'w51_MDL-30735_m22_cron' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-19 11:53:32 +08:00
Sam Hemelryk 415be0ff94 Merge branch 'w51_MDL-30789_m22_enrolupdatestatus' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-19 16:26:01 +13:00
Mary Evans e50e70d12e MDL-30500 Fix for Sky High report & print layout 2011-12-19 15:22:41 +13:00
Ankit Kumar Agarwal 8c14856d86 MDL-30569 Administration Fixing the redirect after editting is toggeled on the front page 2011-12-19 07:42:49 +05:30
Sam Hemelryk d613d7d78e Merge branch 'MDL-37049_22' of git://github.com/jamiepratt/moodle into MOODLE_22_STABLE 2011-12-19 15:05:42 +13:00
Sam Hemelryk 7c19940ca6 Merge branch 'MDL-30683_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-19 14:14:55 +13:00
Sam Hemelryk ead158db7e Merge branch 'MDL-29176_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-19 12:23:36 +13:00
Sam Hemelryk 3bcb2c1dff Merge branch 'MDL-30734_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-19 11:52:32 +13:00
Sam Hemelryk 265dbb3a54 Merge branch 'MDL-30742_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-19 11:30:42 +13:00
Sam Hemelryk 2253ea2592 Merge branch 'MDL-30744_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-19 10:53:57 +13:00
Sam Hemelryk 5ff8144cc8 Merge branch 'MDL-30758_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-19 09:28:10 +13:00
Petr Skoda 9cf83e67a1 MDL-30789 add new update_status() method to enrol plugins and improve enrol cache invalidation 2011-12-18 17:31:12 +01:00
Petr Skoda 4d199d6b33 MDL-30787 fix use of module and section edit capabilities 2011-12-18 13:55:31 +01:00
AMOS bot 8109fce46d Automatically generated installer lang files 2011-12-18 00:31:19 +00:00
Petr Skoda cb6ff0a71c MDL-30697 fix incorrect capability for role assign button
Credit goes to Alexander Bias.
2011-12-17 14:47:17 +01:00
Petr Skoda d107f1e2cd MDL-30735 fix cron maintenancerun detection
Credit goes to Rodrigo Belluomini Cardilli.
2011-12-17 14:18:22 +01:00
Petr Skoda ebad6e2f6f MDL-30765 fix invalid context variable 2011-12-16 23:03:17 +01:00
Tim Hunt 9660c98e57 MDL-30760 question engine: question summary can be longer than 64k!
1. So we will truncate the question summary to 65000 chars if necessary.

2. Also, fix one minor error in mutlianswer save_question_options.

question_bank::MAX_SUMMARY_LENGTH is not the most logical class to add
the constant to, but it needs to be accessible during upgrade, so I was
lazy and put it there.
2011-12-16 15:57:49 +00:00
Petr Skoda c34b325447 MDL-30761 improve get_user_access_sitewide() performance 2011-12-16 16:27:18 +01:00
Petr Skoda 35cd08c96e MDL-30761 fix simpletest regression caused by rubrics 2011-12-16 14:26:12 +01:00
Dan Marsden e5baaad498 MDL-28728 SCORM Add missing string 2011-12-16 11:39:12 +08:00
Rajesh Taneja 8e8a8810de MDL-29067 Admin: Added spam checking on comments, messages and forum posts 2011-12-16 11:34:43 +08:00
adrian@moodle.com 177bc9c8b9 MDL-28948 - lib - removed the hard coded key for the rc4encryt function. 2011-12-16 09:14:53 +08:00
AMOS bot 33b8721c71 Automatically generated installer lang files 2011-12-16 00:31:19 +00:00
David Mudrak 6cf3a65082 MDL-30170 MNet peers administration - various usability improvements
While fixing MDL-30170, the following tiny usability details were
improved along the way:

* the maximum length of the peer site title and the hostname is now
  validated (this was actually a real bug as the default value is pre-loaded
  from the peer) so the admin gets a nice validation error instead of
  the database write exception when trying to register a host with a
  longer site title.
* hard-coded English string 'All Hosts' is now localized
* the hostname link in the list of MNet peers leads to the peer itself
2011-12-15 21:26:45 +01:00
David Mudrak 841b2a44ef MDL-30170 MNet peers administration - highlight the undelete widget
The patch highlights the undelete radio selector at the host edit form.
It moves it to the end of the form (near the submit button) and displays
an explanation above the radio selector.

Also, the list of deleted hosts is now displayed below the table of
active peers at the Manage peers page.

The data returned by mnet_get_hosts() function now contain the deleted
status, too. It is possible to obtain deleted hosts from that function
now.
2011-12-15 21:15:56 +01:00
Tim Hunt 98402da094 MDL-29176 quiz editing: can't move questions onto a new page. 2011-12-15 19:33:01 +00:00
Tim Hunt 76ffac7f93 MDL-30646 default qbank sort should only use visible columns. 2011-12-15 18:40:32 +00:00
sam marshall 782b21dc0f MDL-30764 Activity settings: do not disable grouping dropdown if it is already set 2011-12-15 16:47:08 +00:00
Justin Filip e0b587be49 MDL-30741 Adding a new test to check for incorrect parsing of complicate HTML with a PRE tag. 2011-12-15 11:10:32 -05:00
Justin Filip e60d8e5a42 MDL-30741 Fix the handling of PRE tags with the latest code from upstream: http://trac.roundcube.net/browser/trunk/roundcubemail/program/lib/html2text.php?rev=5497 2011-12-15 11:10:20 -05:00
Tim Hunt 67cb80dc09 MDL-30758 quiz_statistics report fails if all 1st attempts require grading 2011-12-15 12:52:10 +00:00
Tim Hunt abe73c6d99 MDL-30739 qtype numerical: upgrade script uses SQL that is not cross-DB. 2011-12-15 12:22:27 +00:00
Tim Hunt f455e4e9bd MDL-30744 question editing permissions. Update to new accessslib.php code.
I don't believe this will actually fix the reported problem, which I
cannot reproduce, but it should give us much better error messages, at
which point we can fix it.
2011-12-15 11:56:21 +00:00
Tim Hunt 6d3ac4035b MDL-30592 / MDL-27183 quiz statistics: fix merge problem.
These two fixes changes the same file in different ways, causing breakage.
2011-12-15 11:22:33 +00:00
Aparup Banerjee b057855440 MDL-28126 webservice : string fixed. 2011-12-15 18:05:13 +08:00
Marina Glancy 92ec74a9a7 MDL-30733: synchronizing view_feedback with parent function to work with advanced grading
assignment_upload::view_feedback was overriden. It is altered the same way as parent function was to work with advanced grading and so it is displayed correctly in user complete report
2011-12-15 16:47:18 +08:00
Jamie Pratt 9abb69aacb MDL-30749 fixing typo referring to question instead of answer object 2011-12-15 14:47:15 +07:00
Aparup Banerjee cb8e878573 Revert "MDL-30482 create new capability for viewing glossary entries" (test failed)
This reverts commit 03adb289ec.
2011-12-15 15:46:22 +08:00
Aparup Banerjee ba0c76e7a9 Revert "MDL-30482 - Glossary - Adding capability to other areas using glossary" (testing failed)
This reverts commit b2b9890d08.
2011-12-15 15:29:36 +08:00
Eloy Lafuente (stronk7) 40ab5a4010 MDL-30592 moodlelib: minor phpdocs/debug tweaks 2011-12-14 22:44:47 +01:00
Eloy Lafuente (stronk7) a30e3c5a1a Merge branch 'MDL-30592_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-14 22:44:33 +01:00
Tim Lock cb140ca0d6 MDL-30419: IMS package content missing when using Blackboard packages 2011-12-14 21:36:04 +01:00
Darko Miletic 4026898f5c MDL-30738: Fix for 2.2 stable 2011-12-14 15:06:31 -03:00
Tim Hunt 51d861632b MDL-30742 restoring 1.9 backups with missing question data should be robust 2011-12-14 17:18:04 +00:00
Jerome Mouneyrac 72306a6ff4 MDL-28126 webservices : should not able to create token if user is deleted,unconfirmed,suspended or guest. 2011-12-15 00:52:16 +08:00
Tim Hunt 9831354928 MDL-30734 question engine: sum_usage_marks_subquery edge-case.
When all qas in a useage are 'gaveup' state, it gives NULL, not 0.0, for the total.
2011-12-14 14:30:25 +00:00
Andrew Davis 925d068de1 MDL-13572 message: added validation of the email address in the messaging preferences 2011-12-14 17:48:36 +08:00
Andrew Davis 1a35796fba MDL-25561 grade: made the student names clickable on the user report 2011-12-14 15:33:10 +08:00
Jason Fowler b2b9890d08 MDL-30482 - Glossary - Adding capability to other areas using glossary 2011-12-14 15:02:51 +08:00
Aparup Banerjee 4f7dc83fe8 Revert "MDL-30482 - Glossary - Adding capability to other areas using glossary"
This reverts commit b23dd6ee72.
2011-12-14 15:02:37 +08:00
Dan Marsden 7c183f44d4 MDL-28728 SCORM - only show delete button if data exists for this user in this scorm 2011-12-14 13:42:14 +08:00
Dan Marsden 7d919d8f27 MDL-28728 SCORM - add capability to allow users to delete own attempts - given to no-one by default. 2011-12-14 13:42:06 +08:00
Aparup Banerjee 324ea4d7de MDL-29325 fixed typo - camelcasing. 2011-12-14 13:14:28 +08:00
Mayank Gupa 9ff12f3dae MDL-30576, Fixing cmi.completion_threshold and default value of minProgressMeasure to be saved correctly in the database. 2011-12-14 17:22:45 +13:00
Sam Hemelryk 83688ab542 Merge branch 'MDL-27183_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-14 17:17:29 +13:00
Eloy Lafuente (stronk7) 2b6d08a333 Merge branch 'wip-MDL-27767-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2011-12-14 03:16:31 +01:00
Mark Nielsen e2acc0a010 MDL-29048 Glossary Force glossary type to secondary while trying to duplicate a mail glossary 2011-12-14 07:28:28 +05:30
Eloy Lafuente (stronk7) c5b8cda403 Merge branch 'w51_MDL-30605_m22_env23' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-14 02:39:11 +01:00
Sam Hemelryk d4b584c5f6 Merge branch 'MDL-30463_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2011-12-14 14:25:17 +13:00
Sam Hemelryk 2f24a39b5b Merge branch 'MDL-30140-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2011-12-14 14:08:21 +13:00
AMOS bot de1b85d795 Automatically generated installer lang files 2011-12-14 00:31:23 +00:00
Tim Hunt d6b040af81 MDL-30683 don't show overall feedback in the quiz grades report.
The grades are small, while the feedback can be big, which breaks the table layout.
2011-12-13 16:51:35 +00:00
Aparup Banerjee a23463acec Merge branch 'MDL-29772-22' of git://github.com/bostelm/moodle into MOODLE_22_STABLE 2011-12-13 17:05:07 +08:00
Aparup Banerjee 3b89933d9f MDL-29325 Enrol : reduced isset calls and improved readability 2011-12-13 16:36:49 +08:00
Dan Marsden 903ab24de4 MDL-29325 imsenterprise enrolment - allow more flexible naming of courses - thanks to Adam Barbary for patch 2011-12-13 16:27:37 +08:00
Mayank Gupa 5c8e2b97d3 MDL-30577, fixing cmi.credit, cmi.mode are not evaluated correctly 2011-12-13 14:49:47 +08:00
Aparup Banerjee 9dfd9a124d Merge branch 'MDL-30472-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-13 14:36:02 +08:00
Andrew Robert Nicols db5602f751 MDL-30362 Change icon class for editsection icons in course formats 2011-12-13 14:30:21 +08:00
Aparup Banerjee a3bb5afdd0 Merge branch 'MDL-30562_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 14:01:57 +08:00
Alexnader Bias 423dc3b17e MDL-30472 Course Making user lists sortable when lastacess field is hidden 2011-12-13 10:53:52 +05:30
Aparup Banerjee 3a353b12ba Merge branch 'MDL-30655-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2011-12-13 13:21:05 +08:00
Tim Hunt 26ebc41703 MDL-30559 conditional availability: missing validation of grade rules. 2011-12-13 12:07:47 +08:00
Jason Fowler b23dd6ee72 MDL-30482 - Glossary - Adding capability to other areas using glossary 2011-12-13 11:51:40 +08:00
Charles Fulton 03adb289ec MDL-30482 create new capability for viewing glossary entries 2011-12-13 11:51:33 +08:00
Petr Skoda 1a52d9e2cc MDL-30575 more mail header cleanup 2011-12-13 10:23:56 +08:00
Mayank Gupa 1daa8c0821 MDL-30645, Fixing evaluation of default value of CMI elements. 2011-12-13 10:16:09 +08:00
Andrew Robert Nicols 51a2716e6b MDL-30653 Remove duplicate Participants link from navbar 2011-12-13 12:09:02 +13:00
Sam Hemelryk b3463f416c Merge branch 'MDL-30677_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 11:20:04 +13:00
Sam Hemelryk fc97bb9863 Merge branch 'MDL-30532_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 11:15:08 +13:00
Sam Hemelryk 8c495ea4ee Merge branch 'MDL-30498a_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 11:11:21 +13:00
Sam Hemelryk bb0ece5a0c Merge branch 'MDL-27143_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 10:26:31 +13:00
Sam Hemelryk e79c09855c Merge branch 'w51_MDL-30621_m22_protectdir' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-13 10:17:56 +13:00
Henning Bostelmann 1f00dc45d4 MDL-29772 Adaptive question behaviour: improve penalty information
also fixes MDL-29780: suppress penalty information if question penalty is 0
2011-12-12 15:38:16 +00:00
Petr Skoda f9c5bd9234 MDL-30621 more dataroot protection 2011-12-12 15:07:25 +01:00
Rossiani Wijaya f6b9be73f5 MDL-30463 lesson module: add space between yes and no options on start last attempt page 2011-12-12 17:13:45 +08:00
Rossiani Wijaya f08f05610b MDL-29239 fixed edit course setting for moodle/course:changesummary permission is set to prevent. 2011-12-12 15:53:54 +08:00
Aparup Banerjee b750cfde81 Merge branch 'w51_MDL-30613_m22_FULLME' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 15:05:37 +08:00
Aparup Banerjee 7210cb5d19 MDL-30603 synced and renamed incorrect ZF 1.10.6 file and name 2011-12-12 14:08:00 +08:00
Sam Hemelryk 860f7f9195 Merge branch 'w51_MDL-29117_m22_enrolnewcourse' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:59:24 +13:00
Sam Hemelryk a3a3186770 Merge branch 'w51_MDL-30292_m22_health' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:41:00 +13:00
Sam Hemelryk 424f91c056 Merge branch 'w51_MDL-30364_m22_report' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:37:39 +13:00
Petr Skoda 56b77440ad MDL-30415 prevent yui2 rollups in debug mode 2011-12-12 17:33:22 +13:00
Petr Skoda 92bf70765a MDL-30502 remove bogus role name param
Credit goes to Michael J Litzkow.
2011-12-12 17:24:43 +13:00
Sam Hemelryk 653599b3a4 Merge branch 'w51_MDL-30588_m22_switchrole' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:14:58 +13:00
Sam Hemelryk ba9489ce91 Merge branch 'w51_MDL-30659_m22_yuidebug' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 16:37:03 +13:00
Sam Hemelryk 6aabb69f9e Merge branch 'w51_MDL-30687_m22_ldapnewcourse' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 16:10:19 +13:00
Sam Hemelryk 02af5654f2 Merge branch 'MDL-29942-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2011-12-12 15:13:01 +13:00
Sam Hemelryk 4e8da675ac Merge branch 'MDL-28180_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2011-12-12 14:56:40 +13:00
Sam Hemelryk d3054582d5 Merge branch 'MDL-30198-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-12 13:57:40 +13:00
Andrew Robert Nicols c3c2a213a2 MDL-29195 Remove duplicate Participants -> Notes from navbar 2011-12-12 13:51:07 +13:00
Eloy Lafuente (stronk7) ed9c60fed7 MDL-28180 backup - on restore always prevent completion_aggr_methd dupes
This covers the last case where dupes could be happening in the
completion_aggr_methd table: Restoring one complete course into
an existing one, adding information. Now we always check if the
aggr_method exists before inserting it.
2011-12-11 23:03:51 +01:00
Eloy Lafuente (stronk7) 9de951556f MDL-28180 backup - take rid of dupes in course_completion_aggr_methd 2011-12-11 22:14:02 +01:00
Eloy Lafuente (stronk7) ff4a2ddef7 MDL-28180 backup - set excluded activities for any non-course operation 2011-12-11 21:37:33 +01:00
Petr Skoda 8d7ec82427 MDL-30687 use course defaults when template not set in ldap enrol 2011-12-11 11:07:00 +01:00
Petr Skoda c4437be63b MDL-29117 use default course settings when template not set in db enrol 2011-12-11 10:58:37 +01:00
Petr Skoda 7f467e69c0 MDL-30292 rework trailing whitespace test
Now compatible with zlib compression.
2011-12-10 20:34:20 +01:00
Petr Skoda d59ef547c9 MDL-30364 fix user report regressions 2011-12-10 20:19:07 +01:00
Petr Skoda abf82af8f7 MDL-30621 prevent warnings when creating temp and cache dirs 2011-12-10 17:35:56 +01:00
Petr Skoda 5cb418e9f8 MDL-30659 fix use of yui filters 2011-12-10 13:52:41 +01:00
Petr Skoda 7109330e9a MDL-30659 fix phpdocs problems 2011-12-10 13:52:40 +01:00
Petr Skoda e467ed219f DML-30588 do not require enrollment after switching of roles 2011-12-10 12:45:06 +01:00
AMOS bot f0c8bb711f Automatically generated installer lang files 2011-12-10 00:31:25 +00:00
Petr Skoda cfef4e754a MDL-30610 new environment requirements for 2.3 2011-12-09 21:55:23 +01:00
Petr Skoda cbd8609407 MDL-30613 use standard https checks 2011-12-09 21:27:10 +01:00
Tim Hunt 2a1733aafc MDL-30592 question_bank: make files in qtext work in the question list. 2011-12-09 19:24:20 +00:00
Tim Hunt 1357ab1d5b MDL-30592 quiz statistics, ensure images in the question text appear. 2011-12-09 19:24:13 +00:00
Tim Hunt 001f78b41f MDL-30592 moodlelib: new helper component_callback
I chose to be slighly inconsistent with plugin_callback in order to make a nicer API.
2011-12-09 19:23:54 +00:00
Tim Hunt 853f2e8eea MDL-30677 quiz: fix attempt counts when a student is in several groups. 2011-12-09 17:59:29 +00:00
Valeriy Streltsov 00c7590c95 MDL-30562 qtypes: extra_answer_fields & questionid_column_name public
Will let us make more of qtype backup and restore work automatically.
2011-12-09 17:58:31 +00:00
Tim Hunt 24e5fcbe26 MDL-30532 qeupgradehelper has broken links to quizzes. 2011-12-09 17:57:35 +00:00
Tim Hunt 4d8a37a0db MDL-30498 user name can overlap user report icon. 2011-12-09 17:57:06 +00:00
Tim Hunt 3cba5809ae MDL-27183 quiz reports: don't show data to users not in any group
if the quiz is set to separate groups, and the user does not have access all groups.
2011-12-09 17:56:35 +00:00
Tim Hunt d7320fc84a MDL-27143 question bank: questions not saved when deleting a category.
Based on a fix by Nikhil Gupta.
2011-12-09 17:56:05 +00:00
sam marshall cff596e51b MDL-30655 Blocks: Moving block to top of list can cause (harmless) PHP warnings 2011-12-09 17:45:57 +00:00
Eloy Lafuente (stronk7) acb3bf8ac1 weekly release 2.2+ 2011-12-09 16:27:08 +01:00
Eloy Lafuente (stronk7) ebd748fd71 Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2011-12-09 16:09:25 +01:00
Tim Hunt 653e811ec0 MDL-30660 javascript-static: another yui3/ticket/2531561 work-around. 2011-12-09 12:41:36 +01:00
Petr Skoda 81dda1da15 MDL-30625 fail gracefully when admins not defined 2011-12-09 10:57:42 +01:00
Aparup Banerjee 9cd8fdda3c MDL-30542 minor string change 2011-12-09 17:10:12 +08:00
Jerome Mouneyrac c532957be2 MDL-30140 alternative way to select user when adding a token. When more than 500 users we display a text box instead of a select box 2011-12-09 14:51:31 +08:00
Mitsuhiro ad86ee91e9 MDL-30198 Glossary Changing string during imports 2011-12-09 10:10:38 +05:30
Petr Skoda 11892d8fdf MDL-27364 use https for recaptcha when site runs via https
Based on solution by Rajesh Taneja.
2011-12-09 11:10:13 +08:00
Tim Hunt 00aa596e8e MDL-30558 question bank, missing string with obscure permissions.
AMOS BEGIN
 MOV [selectcategoryabove,mod_quiz],[selectcategoryabove,question]
AMOS END
2011-12-09 10:47:19 +08:00
Dan Marsden 7b80d3c65a MDL-26974 - add extra logging information all the time - not just when debugging is on. 2011-12-09 10:21:08 +08:00
Mayank Gupa 7da6c0f82d MDL-30579, fixing Data Model Elements are being initialized with an empty string 2011-12-09 10:16:06 +08:00
Tim Hunt a6395af1b9 MDL-27314 quiz reports: fix JS confirmation before deleting attempts. 2011-12-09 02:35:38 +01:00
Eloy Lafuente (stronk7) 4dbdc834ff MDL-30604 Added 2 missing messages andd deleting an incorrect one 2011-12-09 02:10:18 +01:00
Aparup Banerjee bc3801cb9c MDL-30604 Added upgrade lines to upgrade.php(s) 2011-12-09 02:03:58 +01:00
AMOS bot 4e7a371b2e Automatically generated installer lang files 2011-12-09 00:31:16 +00:00
Petr Skoda db48cf080d MDL-30625 full support for main admin 2011-12-09 00:13:05 +01:00
Sam Hemelryk e0745be16b Merge branch 'MDL-30660' of git://github.com/timhunt/moodle 2011-12-09 11:48:01 +13:00
Tim Hunt 9671325a35 MDL-29579 quiz statistics, include qtext in full XHTML export. 2011-12-08 23:37:19 +01:00
Tim Hunt 1e92c729ba MDL-30660 javascript-static: M.util.show_confirm_dialog fixes 2011-12-08 17:51:45 +00:00
Dan Marsden 347f822856 MDL-30028 - use page pref correctly when pagination or re-ordering 2011-12-08 17:07:32 +08:00
Aparup Banerjee 0f69a9eaaf Merge branch 'wip-MDL-30336-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2011-12-08 16:19:02 +08:00
Aparup Banerjee cdbd44f00e Merge branch 'wip-mdl-30560-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2011-12-08 15:54:55 +08:00
Jerome Mouneyrac 6ae2048c1f MDL-29942 trigger user events in web service calls 2011-12-08 15:19:45 +08:00
Andrew Robert Nicols 02ed16902b MDL-30350 Highlight late submissions in the submission overview page 2011-12-08 14:27:22 +08:00
Aparup Banerjee 30e1b79889 Merge branch 'MDL-27432_gd_error_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 14:04:46 +08:00
Aparup Banerjee d30043c852 Merge branch 'MDL-28710_rating_classes_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 13:48:27 +08:00
Aparup Banerjee add75e9682 Merge branch 'MDL-30607_override_email_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 13:39:49 +08:00
Sam Hemelryk 78baf38ea4 Merge branch 'MDL-30518' of git://github.com/mackensen/moodle into MOODLE_22_STABLE 2011-12-08 16:05:08 +13:00
Petr Skoda cad8d5ccb0 MDL-30528 stop recreating role_assignments on every login attempt for each user
Credit goes to Luis Gustavo Mueller de Alcantara.
2011-12-08 15:51:08 +13:00
adrian@moodle.com a52422abcb MDL-30336 - login - Added a setting in security that allows auto complete to be set to off in password fields. 2011-12-08 09:08:38 +08:00
Sam Hemelryk a33d85b374 Merge branch 'w50_MDL-30623_m22_guest' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-08 13:50:03 +13:00
Eloy Lafuente (stronk7) da3494a8c4 Merge branch 'wip-MDL-30582-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2011-12-08 01:37:03 +01:00
AMOS bot ae7aad593c Automatically generated installer lang files 2011-12-08 00:31:19 +00:00
Eloy Lafuente (stronk7) cf2d7311ab Merge branch 'MDL-26522_user_report_menu_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 01:02:01 +01:00
Igor Sazonov 8f64668af2 MDL-27314 quiz attempts cannot be deleted in separate groups mode. 2011-12-08 00:46:49 +01:00
Jerome Mouneyrac 2af51a1dc3 MDL-29712 REST-XML server was translating too many HTML characters. use htmlspecialchars instead of htmlentities. Translated characters by htmlspecialchars are compatible with XML validation, and so XML parsers for javascript, java... 2011-12-08 12:42:44 +13:00
Eloy Lafuente (stronk7) 17e0ed7919 Merge branch 'wip-MDL-30222-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2011-12-08 00:39:53 +01:00
Dan Marsden 7e4c833c5a MDL-30211 imsenterprise enrolment - set up default enrolment methods in new courses 2011-12-08 10:49:58 +13:00
Dan Marsden 264ca6c58d MDL-30536 Choice - remove setType so that validation works when JS is disabled 2011-12-08 10:36:48 +13:00
Sam Hemelryk b1d4c42ad6 Merge branch 'MDL-28282-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-08 10:22:58 +13:00
Sam Hemelryk 7f96df6222 Merge branch 'MDL-28588-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-08 10:19:22 +13:00
Petr Skoda 73553ddbaa MDL-30623 fix password upgrade path from 1.9 2011-12-07 09:15:37 +01:00
Petr Skoda a6adddfb7d MDL-30623 fix null guest passwords in existing 2.2 sites 2011-12-07 09:15:37 +01:00
Petr Skoda f10ad2d4eb MDL-30623 make sure guest password field is not null 2011-12-07 09:15:36 +01:00
Rajesh Taneja e61eecacc8 MDL-30560 Forms Lib: 'type' key for repeat_elements is restored 2011-12-07 12:04:54 +08:00
Andrew Davis 924deffba6 MDL-30607 message: removed an if condition that prevented you from clearing an overrident email address 2011-12-07 12:04:47 +08:00
Andrew Davis de276c9216 MDL-28710 rating: added some more classes to the html for entering ratings 2011-12-07 11:54:10 +08:00
Andrew Davis aed70c6d40 MDL-27432 mod_data: improved handling of the absence of the GD php extension 2011-12-07 11:48:49 +08:00
Andrew Davis b11d6236df MDL-26522 grade: made the user selection drop down on the user report behave more sensibly 2011-12-07 11:42:44 +08:00
Charles Fulton 4921fb4c9f MDL-19147 - forum - Removed single discussions from the pull down menu for moving posts to different forums. 2011-12-07 14:21:21 +13:00
AMOS bot 6a8a17eb28 Automatically generated installer lang files 2011-12-07 00:31:18 +00:00
Charles Fulton c114ff92bb MDL-19147 - forum - Removed single discussions from the pull down menu for moving posts to different forums. 2011-12-07 12:39:56 +13:00
Ankit Kumar Agarwal a77b489d67 MDL-28588 Removing IN from SQL statments 2011-12-06 11:06:23 +05:30
Ankit Kumar Agarwal 9d7ce57ae3 MDL-28282 Scorm Restorting Groups support in Scorm reports 2011-12-06 09:59:26 +05:30
Sam Hemelryk 28a6552570 MDL-30582 navigation: Fixed regression in generation of front page modules 2011-12-06 13:34:27 +13:00
Sam Hemelryk 6f2d62d022 MDL-27767 install: Shows notifications rather than throwing exceptions when installation encounters unexpected id for guest or admin 2011-12-06 12:22:17 +13:00
Sam Hemelryk a9cc3954b9 MDL-30222 Fixed home page redirection madness. Thank you Julien Boulen for providing the solution 2011-12-06 12:08:32 +13:00
AMOS bot 2324ddd3d5 Automatically generated installer lang files 2011-12-05 18:36:41 +01:00
31874 changed files with 1492501 additions and 4515341 deletions
-249
View File
@@ -1,249 +0,0 @@
{
'plugins': [
'@babel',
'promise',
'jsdoc'
],
'extends': [
'eslint:recommended',
'plugin:promise/recommended'
],
'env': {
'browser': true,
// Enable ES6+ features by default.
// See http://eslint.org/docs/user-guide/configuring#specifying-environments
// Note: The YUI override must exactly match this when disabling the ES6+ version because those features are not supported by Shifter.
'es2020': true,
'amd': true
},
'globals': {
'M': true,
'Y': true
},
// Warn about unused eslint-disable statements.
'reportUnusedDisableDirectives': true,
'rules': {
// See http://eslint.org/docs/rules/ for all rules and explanations of all
// rules.
// === Possible Errors ===
'comma-dangle': 'off',
'no-console': 'error',
'no-empty': 'warn',
'no-extra-parens': 'off',
'no-prototype-builtins': 'off',
'no-unreachable': 'warn',
// === Best Practices ===
// (these mostly match our jshint config)
'array-callback-return': 'warn',
'block-scoped-var': 'warn',
'complexity': 'warn',
'consistent-return': 'warn',
'curly': 'error',
'dot-notation': 'warn',
'no-alert': 'warn',
'no-caller': 'error',
'no-div-regex': 'error',
'no-empty-function': 'warn',
'no-eq-null': 'error',
'no-eval': 'error',
'no-extend-native': 'error',
'no-extra-bind': 'warn',
'no-floating-decimal': 'warn',
'no-global-assign': 'warn',
'no-implied-eval': 'error',
'no-invalid-this': 'error',
'no-iterator': 'error',
'no-labels': 'error',
'no-loop-func': 'error',
'no-multi-spaces': 'warn',
'no-multi-str': 'error',
'no-new-func': 'error',
'no-new-wrappers': 'error',
'no-octal-escape': 'error',
'no-proto': 'error',
'no-redeclare': 'warn',
'no-restricted-globals': ['error', { 'name': 'Notification' }],
'no-return-assign': 'error',
'no-script-url': 'error',
'no-self-compare': 'error',
'no-sequences': 'warn',
'no-throw-literal': 'warn',
'no-unmodified-loop-condition': 'error',
'no-unused-expressions': 'error',
'no-useless-call': 'warn',
'no-useless-escape': 'warn',
'wrap-iife': ['error', 'any'],
// === Variables ===
'no-undef-init': 'error',
'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
// === Stylistic Issues ===
'array-bracket-spacing': 'warn',
'block-spacing': 'warn',
'brace-style': ['warn', '1tbs'],
'camelcase': 'warn',
'capitalized-comments': ['warn', 'always', { 'ignoreConsecutiveComments': true }],
'comma-spacing': ['warn', { 'before': false, 'after': true }],
'comma-style': ['warn', 'last'],
'computed-property-spacing': 'error',
'consistent-this': 'off',
'eol-last': 'off',
'func-call-spacing': ['warn', 'never'],
'func-names': 'off',
'func-style': 'off',
// indent currently not doing well with our wrapping style, so disabled.
'indent': ['off', 4, { 'SwitchCase': 1 }],
'key-spacing': ['warn', { 'beforeColon': false, 'afterColon': true, 'mode': minimum }],
'keyword-spacing': 'warn',
'linebreak-style': ['error', 'unix'],
'lines-around-comment': 'off',
'max-len': ['error', 132],
'max-lines': 'off',
'max-depth': 'warn',
'max-nested-callbacks': ['warn', 5],
'max-params': 'off',
'max-statements': 'off',
'max-statements-per-line': ['warn', { max: 2 }],
'new-cap': ['warn', { 'properties': false }],
'new-parens': 'warn',
'newline-per-chained-call': 'off',
'no-array-constructor': 'off',
'no-bitwise': 'error',
'no-continue': 'off',
'no-inline-comments': 'off',
'no-lonely-if': 'off',
'no-mixed-operators': 'off',
'no-multiple-empty-lines': 'warn',
'no-negated-condition': 'off',
'no-nested-ternary': 'warn',
'no-new-object': 'off',
'no-plusplus': 'off',
'no-tabs': 'error',
'no-ternary': 'off',
'no-trailing-spaces': 'error',
'no-underscore-dangle': 'off',
'no-unneeded-ternary': 'off',
'no-whitespace-before-property': 'warn',
'object-curly-newline': 'off',
'object-curly-spacing': 'warn',
'object-property-newline': 'off',
'one-var': 'off',
'one-var-declaration-per-line': ['warn', 'initializations'],
'operator-assignment': 'off',
'operator-linebreak': 'off',
'padded-blocks': 'off',
'quote-props': ['warn', 'as-needed', {'unnecessary': false, 'keywords': true, 'numbers': true}],
'quotes': 'off',
'semi': 'error',
'semi-spacing': ['warn', {'before': false, 'after': true}],
'sort-vars': 'off',
'space-before-blocks': 'warn',
'space-before-function-paren': ['warn', 'never'],
'space-in-parens': 'warn',
'space-infix-ops': 'warn',
'space-unary-ops': 'warn',
'spaced-comment': 'warn',
'unicode-bom': 'error',
'wrap-regex': 'off',
// === Promises (override plugin:promise/recommended) ===
'promise/always-return': 'warn',
'promise/no-return-wrap': 'warn',
'promise/param-names': 'warn',
'promise/catch-or-return': ['warn', {terminationMethod: ['catch', 'fail', 'always'], allowFinally: true}],
'promise/no-native': 'warn',
'promise/avoid-new': 'warn',
// === Deprecations ===
"no-restricted-properties": ['warn', {
'object': 'M',
'property': 'str',
'message': 'Use "core/str" module or M.util.get_string()'
}],
},
overrides: [
{
files: ["**/yui/src/**/*.js"],
'env': {
// Disable ES6+ for YUI files.
'es2020': false,
},
// Disable some rules which we can't safely define for YUI rollups.
rules: {
'no-undef': 'off',
'no-unused-vars': 'off',
'no-unused-expressions': 'off',
// === JSDocs ===
"jsdoc/check-access": 'off',
"jsdoc/check-alignment": 'off',
"jsdoc/check-param-names": 'off',
"jsdoc/check-property-names": 'off',
"jsdoc/empty-tags": 'off',
"jsdoc/implements-on-classes": 'off',
"jsdoc/multiline-blocks": 'off',
"jsdoc/require-jsdoc": 'off',
"jsdoc/require-param": 'off',
"jsdoc/require-param-name": 'off',
"jsdoc/require-param-type": 'off',
"jsdoc/require-property": 'off',
"jsdoc/require-property-name": 'off',
"jsdoc/require-property-type": 'off',
}
},
{
files: ["**/amd/src/*.js", "**/amd/src/**/*.js", "Gruntfile.js", ".grunt/*.js", ".grunt/tasks/*.js", "jsdoc.conf.js"],
// We're using babel transpiling so use their parser
// for linting.
parser: '@babel/eslint-parser',
// Check AMD with some slightly stricter rules.
rules: {
'no-implicit-globals': 'error',
// Disable all of the rules that have babel versions.
'new-cap': 'off',
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
'no-invalid-this': 'off',
'object-curly-spacing': 'off',
'quotes': 'off',
'semi': 'off',
'no-unused-expressions': 'off',
// Enable all of the babel version of these rules.
'@babel/new-cap': ['warn', { 'properties': false }],
// Not using this rule for the time being because it isn't
// compatible with jQuery and ES6.
'@babel/no-invalid-this': 'off',
'@babel/object-curly-spacing': 'warn',
'@babel/semi': 'error',
'@babel/no-unused-expressions': 'error',
// === Promises ===
// We have Promise now that we're using ES6.
'promise/no-native': 'off',
'promise/avoid-new': 'off',
// === JSDocs ===
'jsdoc/check-access': 'error',
'jsdoc/check-alignment': 1, // Recommended.
'jsdoc/check-param-names': 'error',
'jsdoc/check-property-names': 'error',
'jsdoc/empty-tags': 'error',
'jsdoc/implements-on-classes': 'error',
'jsdoc/multiline-blocks': 'error',
'jsdoc/require-jsdoc': 'error',
'jsdoc/require-param': 'error',
'jsdoc/require-param-name': 'error',
'jsdoc/require-param-type': 'error',
'jsdoc/require-property': 'error',
'jsdoc/require-property-name': 'error',
'jsdoc/require-property-type': 'error'
},
parserOptions: {
'sourceType': 'module',
'requireConfigFile': false
}
}
]
}
-24
View File
@@ -1,24 +0,0 @@
{
"indentation": ["on",{
"Feature": 0,
"Background": 2,
"Scenario": 2,
"Examples": 4,
"example": 6,
"Step": 4,
"given": 4,
"and": 4
}],
"no-dupe-feature-names": "on",
"no-dupe-scenario-names": "off",
"no-empty-file": "on",
"no-files-without-scenarios": "on",
"no-multiple-empty-lines": "on",
"no-partially-commented-tag-lines": "on",
"no-trailing-spaces": "on",
"no-unnamed-features": "on",
"no-unnamed-scenarios": "on",
"no-scenario-outlines-without-examples": "on",
"no-examples-in-scenarios": "on",
"new-line-at-eof": ["on", "yes"]
}
-3
View File
@@ -1,3 +0,0 @@
**/yui/build/** -diff
**/amd/build/** -diff
lib/dml/oci_native_moodle_package.sql text eol=lf
-2
View File
@@ -1,2 +0,0 @@
# Primary donations pages.
custom: ["https://moodle.com/donations/", moodle.org]
-7
View File
@@ -1,7 +0,0 @@
*** PLEASE DO NOT OPEN PULL REQUESTS VIA GITHUB ***
The moodle.git repository at Github is just a mirror of the official repository. We do not accept pull requests at Github.
See CONTRIBUTING.md guidelines for how to contribute patches for Moodle. Thank you.
--
-6
View File
@@ -1,6 +0,0 @@
> [!IMPORTANT]
> PLEASE DO NOT PUBLISH SECURITY FINDINGS PUBLICLY.
If you discover a potential security issue, please report it via our [Security Submission Form](https://moodle.org/security/report).
For more information about our security processes and responsible disclosure policy, see the [Security Procedures documentation](https://moodledev.io/general/development/process/security).
-1
View File
@@ -1 +0,0 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1231.24 314.44" preserveAspectRatio="xMinYMid meet"><defs><style>.cls-1{fill:#f48020;}.cls-2,.cls-3{fill:#383738;stroke:#4a4a4c;}.cls-2{stroke-width:2.37px;}.cls-3{stroke-width:2.38px;}.cls-4{fill:#585858;}</style></defs><title>Moodle_Logo_UseonBlack_RGB</title><path class="cls-1" d="M1086.3,235.34a53.42,53.42,0,0,0,16.71,29q13.26,12.27,29.48,12.27,11.29,0,24.56-5.89,16.23-6.88,16.22-16.22l58-.49q-12.29,29-41.76,45.2-27.52,15.23-60.43,15.24-42.25,0-70-26.29t-27.75-68.54q0-43.73,27.75-69.51t72-25.8q48.15,0,75.17,31.94,25.07,29.47,25.06,79.1Zm89.91-33.91q-3.43-17.69-14.73-29-12.8-12.28-29.49-12.29-17.21,0-28.74,11.79t-15.47,29.48Z"/><path class="cls-1" d="M965.45,308.54V0h55V308.54Z"/><path class="cls-1" d="M892.69,308.54V290.36q-7.38,9.83-25.06,15.72a92.31,92.31,0,0,1-30,5.41q-39.31,0-63.13-27T750.7,217.65q0-39.3,23.34-65.84t62.15-26.53q43.71,0,56.5,23.58V0h53.55V308.54Zm0-102.68q0-14.75-14-28.26t-28.74-13.51q-21.12,0-33.41,17.2-10.8,15.24-10.8,37.33,0,21.63,10.8,36.85,12.29,17.71,33.41,17.69,12.78,0,27.76-12t15-24.81Z"/><path class="cls-1" d="M647,313.45q-41.77,0-69-26.53t-27.27-68.3q0-41.73,27.27-68.28t69-26.53q41.75,0,69.27,26.53t27.52,68.28q0,41.79-27.52,68.3T647,313.45ZM647,168q-19.89,0-30.58,15.07t-10.68,35.79q0,20.73,9.94,35.05,11.43,16.31,31.32,16.28t31.32-16.28q10.44-14.31,10.44-35.05t-9.94-35Q667.42,168,647,168Z"/><path class="cls-1" d="M448.07,313.45q-41.76,0-69-26.53t-27.27-68.3q0-41.73,27.27-68.28t69-26.53q41.74,0,69.28,26.53t27.5,68.28q0,41.79-27.5,68.3T448.07,313.45Zm0-145.43q-19.89,0-30.59,15.07t-10.69,35.79q0,20.73,9.94,35.05,11.43,16.31,31.34,16.28t31.32-16.28q10.42-14.31,10.44-35.05t-9.94-35Q468.45,168,448.07,168Z"/><path class="cls-1" d="M288.89,309.11V201q0-33.9-28-33.9t-28,33.9V309.11h-55V201q0-33.9-27.52-33.9-28,0-28,33.9V309.11h-55V194.65q0-35.37,24.56-53.54,21.61-16.22,58.46-16.22,37.35,0,55,19.16,15.23-19.16,55.51-19.16,36.86,0,58.45,16.22,24.57,18.16,24.57,53.54V309.11Z"/><path class="cls-2" d="M.76,145.76"/><path class="cls-3" d="M1.73,145.32"/><path class="cls-4" d="M173.86,116.85l55.08-40.1-.7-2.44C135,83.92,80.42,96.44,0,144.13l.73,2.38,21-.67c15.17.52,30.85,1.26,46,1.32-1,24.09.83,32.65.83,32.65,51.92,17.58,101.22,1.53,127.14-43.9A248.72,248.72,0,0,0,173.86,116.85Z"/><path class="cls-4" d="M113.78,110c-.3-1.08-2.23-1.48-4.28-.9a4.73,4.73,0,0,0-3.14,2.19c-18.53,5-49.16,13.72-70.73,21l-1.33.45c-16.68,5.61-24.73,8.49-25.22,12.55-2.29,18.44-.87,42.18-.86,42.48l.19,6.4c-9.74,27.56.06,49.6,8.38,69.77.06-24.92,1.07-45.22-6-71-.2-3.82-1.49-30.36.61-47.34.34-2.75,11.65-6.56,23.63-10.59l1.33-.44c22-7.42,53.57-16.39,71.9-21.29a6.75,6.75,0,0,0,2.29-.25C112.64,112.43,114.08,111.09,113.78,110Z"/></svg>

Before

Width:  |  Height:  |  Size: 2.7 KiB

-31
View File
@@ -1,31 +0,0 @@
name: 'Close Pull Requests'
on:
pull_request_target:
types: opened
workflow_dispatch:
jobs:
close:
# Avoid forks to run this job
if: github.repository_owner == 'moodle'
name: Close Pull Requests
runs-on: ubuntu-latest
steps:
- uses: dessant/repo-lockdown@v4
with:
process-only: prs
close-pr: true
skip-closed-pr-comment: true
pr-comment: >
**Please, don't open pull requests via GitHub.**
This repository (moodle.git) at GitHub is just a mirror of the official Moodle repository.
For how to contribute patches for Moodle see
[CONTRIBUTING.md](https://github.com/moodle/moodle/blob/main/CONTRIBUTING.md).
Closing this pull request.
-71
View File
@@ -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/>.
/**
* Template configuraton file for github actions CI/CD.
*
* @package core
* @copyright 2020 onwards Eloy Lafuente (stronk7) {@link https://stronk7.com}
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// This cannot be used out from a github actions workflow, so just exit.
getenv('GITHUB_WORKFLOW') || die; // phpcs:ignore moodle.Files.MoodleInternal.MoodleInternalGlobalState
unset($CFG);
global $CFG;
$CFG = new stdClass();
$CFG->dbtype = getenv('dbtype');
$CFG->dblibrary = 'native';
$CFG->dbhost = '127.0.0.1';
$CFG->dbname = 'test';
$CFG->dbuser = 'test';
$CFG->dbpass = 'test';
$CFG->prefix = 'm_';
$CFG->dboptions = ['dbcollation' => 'utf8mb4_bin'];
$host = 'localhost';
$CFG->wwwroot = "http://{$host}";
$CFG->dataroot = realpath(dirname(__DIR__)) . '/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
// Debug options - possible to be controlled by flag in future.
$CFG->debug = (E_ALL | E_STRICT); // DEBUG_DEVELOPER.
$CFG->debugdisplay = 1;
$CFG->debugstringids = 1; // Add strings=1 to url to get string ids.
$CFG->perfdebug = 15;
$CFG->debugpageinfo = 1;
$CFG->allowthemechangeonurl = 1;
$CFG->passwordpolicy = 0;
$CFG->cronclionly = 0;
$CFG->pathtophp = getenv('pathtophp');
$CFG->phpunit_dataroot = realpath(dirname(__DIR__)) . '/phpunitdata';
$CFG->phpunit_prefix = 't_';
define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://localhost:8080');
define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://localhost:8080');
define('TEST_SESSION_REDIS_HOST', 'localhost');
define('TEST_CACHESTORE_REDIS_TESTSERVERS', 'localhost');
// TODO: add others (solr, mongodb, memcached, ldap...).
// Too much for now: define('PHPUNIT_LONGTEST', true); // Only leaves a few tests out and they are run later by CI.
require_once(__DIR__ . '/lib/setup.php');
-143
View File
@@ -1,143 +0,0 @@
name: One by One Testing
# Run all the individual unit tests one by one, with
# fully independent PHPUnit executions. Useful to
# detect issues with some tests that are using stuff
# that has been made available by others, but is not
# available when running individually.
#
# Note that we aren't using PHPUnit's own isolation
# here but completely separated runs, one for each
# test.
#
# The workflow will fail reporting all the tests
# that have failed (and will pass if no failure is
# detected, of course).
#
# It's only executed via workflow dispatch (automated
# or manual), not by push/tag. And acceptd configuration
# of phpunit, specially useful to run it with PHPUnit's
# own isolation or any other option.
on:
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
chunks: 7
jobs:
collect:
name: Collect individual unit tests
runs-on: ubuntu-latest
outputs:
matrix: ${{steps.individual-tests.outputs.matrix }}
steps:
- name: Checking out code
uses: actions/checkout@v4
- name: Looking for all individual tests
id: individual-tests
run: |
count=0 # Number of individual tests found.
while read -r testfile; do # For each test file.
while read -r testname; do # For each unit test in a file.
count=$((count + 1))
# Sent it to the correct chunk file.
chunk=$(((($count % $chunks)) + 1))
echo "$testname $testfile" >> ./chunk_$chunk.txt
done < <(grep "function test_" "${testfile}" | sed -r "s/^.*function (test_[a-zA-Z0-9_]+).*/\1/")
done < <(find . -name "*_test.php")
# Generate the matrix to run tests.
echo "matrix=$(ls -1 chunk_*.txt | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
echo "$count individual tests collected in $chunks files"
- name: Upload individual tests files
uses: actions/upload-artifact@v4
with:
name: individual_tests
path: chunk_*.txt
retention-days: 1
test:
name: Run tests
needs: collect
runs-on: ubuntu-latest
services:
exttests:
image: moodlehq/moodle-exttests
ports:
- 8080:80
redis:
image: redis
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
file: ${{ fromJson(needs.collect.outputs.matrix) }}
steps:
- name: Setting up DB pgsql
uses: m4nu56/postgresql-action@v1
with:
postgresql version: 13
postgresql db: test
postgresql user: test
postgresql password: test
- name: Setting up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
ini-values: max_input_vars=5000
coverage: none
- name: Checking out code
uses: actions/checkout@v4
- name: Download individual test files
uses: actions/download-artifact@v4
with:
name: individual_tests # Make all the chunk files available for the next steps.
- name: Setting up PHPUnit
env:
dbtype: pgsql
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV
cp .github/workflows/config-template.php config.php
mkdir ../moodledata
sudo locale-gen en_AU.UTF-8
php admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Run PHPUnit test (one by one)
env:
dbtype: pgsql
run: |
status=0
count=0
while read -r line; do # For each line in the chunk file
count=$((count + 1))
filter="${line% *}"
file="${line#* }"
# Run the individual unit test and report problems if needed to.
if ! php vendor/bin/phpunit \
--fail-on-empty-test-suite \
--fail-on-warning \
--fail-on-risky \
--filter "$filter" ${{ inputs.phpunit_extra_options }} \
"$file" >/dev/null 2>&1; then
if [ $status -eq 0 ]; then
echo "Problems found, list of PHPUnit commands failing:"
fi
echo "vendor/bin/phpunit --filter '${filter}' ${{ inputs.phpunit_extra_options }} $file"
status=$((status + 1))
fi
done < ${{ matrix.file }}
echo "Finished: $count individual tests executed, $status tests failed"
exit $status
-124
View File
@@ -1,124 +0,0 @@
name: Core
on:
push:
branches-ignore:
- main
- MOODLE_[0-9]+_STABLE
tags-ignore:
- v[0-9]+.[0-9]+.[0-9]+*
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
php: 8.3
jobs:
Grunt:
runs-on: ubuntu-22.04
steps:
- name: Checking out code
uses: actions/checkout@v4
- name: Configuring node & npm
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Installing node stuff
run: npm install
- name: Running grunt
run: npx grunt
- name: Looking for uncommitted changes
# Add all files to the git index and then run diff --cached to see all changes.
# This ensures that we get the status of all files, including new files.
# We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
run: |
git add .
git reset -- npm-shrinkwrap.json
git diff --cached --exit-code
PHPUnit:
runs-on: ${{ matrix.os }}
services:
exttests:
image: moodlehq/moodle-exttests
ports:
- 8080:80
redis:
image: redis
ports:
- 6379:6379
strategy:
fail-fast: false
matrix:
include:
# MySQL builds always run with the lowest PHP supported version.
- os: ubuntu-22.04
php: 8.1
extensions:
db: mysqli
# PostgreSQL builds always run with the highest PHP supported version.
- os: ubuntu-22.04
php: 8.3
db: pgsql
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: moodlehq/mysql-action@v1
with:
collation server: utf8mb4_bin
mysql version: 8.0
mysql database: test
mysql user: test
mysql password: test
use tmpfs: true
tmpfs size: '1024M'
extra conf: --skip-log-bin
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
uses: m4nu56/postgresql-action@v1
with:
postgresql version: 13
postgresql db: test
postgresql user: test
postgresql password: test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v4
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v4
- name: Setting up PHPUnit
env:
dbtype: ${{ matrix.db }}
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
cp .github/workflows/config-template.php config.php
mkdir ../moodledata
sudo locale-gen en_AU.UTF-8
php admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
phpunit_options: ${{ secrets.phpunit_options }}
run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
-23
View File
@@ -1,23 +0,0 @@
name: Web Installer Testing
on:
workflow_dispatch:
jobs:
InstallationTest:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
php: [8.1, 8.3]
steps:
- name: Construct repository URL
run: echo "REPOSITORY_URL=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" >> $GITHUB_ENV
shell: bash
- uses: moodlehq/moodle-webinstaller-test@main
with:
repository: ${{ env.REPOSITORY_URL }}
branch: ${{ github.ref_name }}
php: ${{ matrix.php }}
-149
View File
@@ -1,149 +0,0 @@
name: Windows Testing
on:
workflow_dispatch:
inputs:
phpunit_extra_options:
description: Additional options to apply to PHPUnit
required: false
default: ''
env:
php: 8.3
jobs:
Grunt:
runs-on: windows-latest
steps:
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checking out code
uses: actions/checkout@v4
- name: Configuring node & npm
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Installing node stuff
run: npm ci
- name: Running grunt
run: npx grunt
- name: Looking for uncommitted changes
# Add all files to the git index and then run diff --cached to see all changes.
# This ensures that we get the status of all files, including new files.
# We ignore npm-shrinkwrap.json to make the tasks immune to npm changes.
run: |
git add .
git reset -- npm-shrinkwrap.json
git diff --cached --exit-code
PHPUnit:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
php: 8.3
# Ideally we should use mysql/mariadb, but they are 4x slower without tweaks and configuration
# so let's run only postgres (1.5h vs 6h) only, If some day we want to improve the mysql runs,
# this is the place to enable them.
# db: mysqli
db: pgsql
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium, zip
- os: windows-latest
php: 8.1
db: pgsql
extensions: exif, fileinfo, gd, intl, pgsql, mysql, redis, soap, sodium
steps:
- name: Setting up DB mysql
if: ${{ matrix.db == 'mysqli' }}
uses: shogo82148/actions-setup-mysql@v1
with:
mysql-version: 8.0
user: test
password: test
- name: Creating DB mysql
if: ${{ matrix.db == 'mysqli' }}
run: mysql --host 127.0.0.1 -utest -ptest -e 'CREATE DATABASE IF NOT EXISTS test COLLATE = utf8mb4_bin;';
- name: Setting up DB pgsql
if: ${{ matrix.db == 'pgsql' }}
run: |
# TODO: Remove these conf. modifications when php74 or php80 are lowest.
# Change to old md5 auth, because php73 does not support it.
# #password_encryption = scram-sha-256
(Get-Content "$env:PGDATA\postgresql.conf"). `
replace('#password_encryption = scram-sha-256', 'password_encryption = md5') | `
Set-Content "$env:PGDATA\postgresql.conf"
(Get-Content "$env:PGDATA\pg_hba.conf"). `
replace('scram-sha-256', 'md5') | `
Set-Content "$env:PGDATA\pg_hba.conf"
$pgService = Get-Service -Name postgresql*
Set-Service -InputObject $pgService -Status running -StartupType automatic
Start-Process -FilePath "$env:PGBIN\pg_isready" -Wait -PassThru
& $env:PGBIN\psql --command="CREATE USER test PASSWORD 'test'" --command="\du"
- name: Creating DB pgsql
if: ${{ matrix.db == 'pgsql' }}
run: |
& $env:PGBIN\createdb --owner=test test
$env:PGPASSWORD = 'test'
& $env:PGBIN\psql --username=test --host=localhost --list test
- name: Configuring git vars
uses: rlespinasse/github-slug-action@v4
- name: Setting up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: ${{ matrix.extensions }}
ini-values: max_input_vars=5000
coverage: none
- name: Set git to use LF
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- name: Checking out code from ${{ env.GITHUB_REF_SLUG }}
uses: actions/checkout@v4
# Needs to be done after php is available, git configured and Moodle checkout has happened.
- name: Setting up moodle-exttests service
run: |
git clone https://github.com/moodlehq/moodle-exttests.git
nssm install php-built-in C:\tools\php\php.exe -S localhost:8080 -t D:\a\moodle\moodle\moodle-exttests
nssm start php-built-in
- name: Setting up redis service
run: |
choco install redis-64 --version 3.0.503 --no-progress
nssm install redis redis-server
nssm start redis
- name: Setting up PHPUnit
env:
dbtype: ${{ matrix.db }}
shell: bash
run: |
echo "pathtophp=$(which php)" >> $GITHUB_ENV # Inject installed pathtophp to env. The template config needs it.
cp .github/workflows/config-template.php config.php
mkdir ../moodledata
php admin/tool/phpunit/cli/init.php --no-composer-self-update
- name: Running PHPUnit tests
env:
dbtype: ${{ matrix.db }}
phpunit_options: ${{ secrets.phpunit_options }}
run: vendor/bin/phpunit $phpunit_options ${{ inputs.phpunit_extra_options }}
+3 -36
View File
@@ -9,26 +9,15 @@
#
# See gitignore(5) man page for more details
#
# Swap files (vim)
[._]*.s[a-v][a-z]
[._]*.sw[a-p]
[._]s[a-rt-v][a-z]
[._]ss[a-gi-z]
[._]sw[a-p]
# Temporary files including undo
*~
#
/config.php
/lib/editor/tinymce/extra/tools/temp/
*~
*.swp
/tags
/TAGS
/cscope.*
/.patches/
/.idea/
.phpstorm.*
!/.phpstorm.meta.php/
/.phpstorm.meta.php/*
!/.phpstorm.meta.php/di.php
/nbproject/
CVS
.DS_Store
@@ -36,25 +25,3 @@ CVS
/.project
/.buildpath
/.cache
.phpunit.result.cache
phpunit.xml
# Composer support. Do not ignore composer.json, or composer.lock. These should be shipped by us.
composer.phar
/vendor/
/behat.yml
*/yui/build/*/*-coverage.js
/lib/yuilib/*/build/*/*-coverage.js
# lib/yuilib/version/module/module-coverage.js
/lib/yuilib/*/*/*-coverage.js
atlassian-ide-plugin.xml
/node_modules/
/.vscode/
moodle-plugin-ci.phar
.eslintignore
.stylelintignore
/jsdoc
/admin/tool/componentlibrary/docs
/admin/tool/componentlibrary/hugo/site/data/my-index.json
.hugo_build.lock
phpcs.xml
jsconfig.json
-169
View File
@@ -1,169 +0,0 @@
// 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 is a babel plugin to add the Moodle module names to the AMD modules
* as part of the transpiling process.
*
* In addition it will also add a return statement for the default export if the
* module is using default exports. This is a highly specific Moodle thing because
* we're transpiling to AMD and none of the existing Babel 7 plugins work correctly.
*
* This will fix the issue where an ES6 module using "export default Foo" will be
* transpiled into an AMD module that returns {default: Foo}; Instead it will now
* just simply return Foo.
*
* Note: This means all other named exports in that module are ignored and won't be
* exported.
*
* @copyright 2018 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
module.exports = ({template, types}) => {
const fs = require('fs');
const path = require('path');
const cwd = process.cwd();
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
/**
* Search the list of components that match the given file name
* and return the Moodle component for that file, if found.
*
* Throw an exception if no matching component is found.
*
* @throws {Error}
* @param {string} searchFileName The file name to look for.
* @return {string} Moodle component
*/
function getModuleNameFromFileName(searchFileName) {
searchFileName = fs.realpathSync(searchFileName);
const relativeFileName = searchFileName.replace(`${cwd}${path.sep}`, '').replace(/\\/g, '/');
const [componentPath, file] = relativeFileName.split('/amd/src/');
const fileName = file.replace('.js', '');
// Check subsystems first which require an exact match.
const componentName = ComponentList.getComponentFromPath(componentPath);
if (componentName) {
return `${componentName}/${fileName}`;
}
// This matches the previous PHP behaviour that would throw an exception
// if it couldn't parse an AMD file.
throw new Error(`Unable to find module name for ${searchFileName} (${componentPath}::${file}}`);
}
/**
* This is heavily inspired by the babel-plugin-add-module-exports plugin.
* See: https://github.com/59naga/babel-plugin-add-module-exports
*
* This is used when we detect a module using "export default Foo;" to make
* sure the transpiled code just returns Foo directly rather than an object
* with the default property (i.e. {default: Foo}).
*
* Note: This means that we can't support modules that combine named exports
* with a default export.
*
* @param {String} path
* @param {String} exportObjectName
*/
function addModuleExportsDefaults(path, exportObjectName) {
const rootPath = path.findParent(path => {
return path.key === 'body' || !path.parentPath;
});
// HACK: `path.node.body.push` instead of path.pushContainer(due doesn't work in Plugin.post).
// This is hardcoded to work specifically with AMD.
rootPath.node.body.push(template(`return ${exportObjectName}.default`)());
}
return {
pre() {
this.seenDefine = false;
this.addedReturnForDefaultExport = false;
},
visitor: {
// Plugin ordering is only respected if we visit the "Program" node.
// See: https://babeljs.io/docs/en/plugins.html#plugin-preset-ordering
//
// We require this to run after the other AMD module transformation so
// let's visit the "Program" node.
Program: {
exit(path) {
path.traverse({
CallExpression(path) {
// If we find a "define" function call.
if (!this.seenDefine && path.get('callee').isIdentifier({name: 'define'})) {
// We only want to modify the first instance of define that we find.
this.seenDefine = true;
// Get the Moodle component for the file being processed.
var moduleName = getModuleNameFromFileName(this.file.opts.filename);
// The function signature of `define()` is:
// define = function (name, deps, callback) {...}
// Ensure that if the moduel supplied its own name that it is replaced.
if (path.node.arguments.length > 0) {
// Ensure that there is only one name.
if (path.node.arguments[0].type === 'StringLiteral') {
// eslint-disable-next-line
console.log(`Replacing module name '${path.node.arguments[0].extra.rawValue}' with ${moduleName}`);
path.node.arguments.shift();
}
}
// Add the module name as the first argument to the define function.
path.node.arguments.unshift(types.stringLiteral(moduleName));
// Add a space after the define function in the built file so that previous versions
// of Moodle will not try to add the module name to the file when it's being served
// by PHP. This forces the regex in PHP to not match for this file.
path.node.callee.name = 'define ';
}
// Check for any Object.defineProperty('exports', 'default') calls.
if (!this.addedReturnForDefaultExport && path.get('callee').matchesPattern('Object.defineProperty')) {
const [identifier, prop] = path.get('arguments');
const objectName = identifier.get('name').node;
const propertyName = prop.get('value').node;
if ((objectName === 'exports' || objectName === '_exports') && propertyName === 'default') {
addModuleExportsDefaults(path, objectName);
this.addedReturnForDefaultExport = true;
}
}
},
AssignmentExpression(path) {
// Check for an exports.default assignments.
if (
!this.addedReturnForDefaultExport &&
(
path.get('left').matchesPattern('exports.default') ||
path.get('left').matchesPattern('_exports.default')
)
) {
const objectName = path.get('left.object.name').node;
addModuleExportsDefaults(path, objectName);
this.addedReturnForDefaultExport = true;
}
}
}, this);
}
}
}
};
};
-394
View File
@@ -1,394 +0,0 @@
// 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/>.
/**
* Helper functions for working with Moodle component names, directories, and sources.
*
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
/** @var {Object} A list of subsystems in Moodle */
const componentData = {};
/**
* Load details of all moodle modules.
*
* @returns {object}
*/
const fetchComponentData = () => {
const fs = require('fs');
const path = require('path');
const glob = require('glob');
const gruntFilePath = process.cwd();
if (!Object.entries(componentData).length) {
componentData.subsystems = {};
componentData.pathList = [];
// Fetch the component definiitions from the distributed JSON file.
const components = JSON.parse(fs.readFileSync(`${gruntFilePath}/lib/components.json`));
// Build the list of moodle subsystems.
componentData.subsystems.lib = 'core';
componentData.pathList.push(process.cwd() + path.sep + 'lib');
for (const [component, thisPath] of Object.entries(components.subsystems)) {
if (thisPath) {
// Prefix "core_" to the front of the subsystems.
componentData.subsystems[thisPath] = `core_${component}`;
componentData.pathList.push(process.cwd() + path.sep + thisPath);
}
}
// The list of components incldues the list of subsystems.
componentData.components = componentData.subsystems;
// Go through each of the plugintypes.
Object.entries(components.plugintypes).forEach(([pluginType, pluginTypePath]) => {
// We don't allow any code in this place..?
glob.sync(`${pluginTypePath}/*/version.php`).forEach(versionPath => {
const componentPath = fs.realpathSync(path.dirname(versionPath));
const componentName = path.basename(componentPath);
const frankenstyleName = `${pluginType}_${componentName}`;
componentData.components[`${pluginTypePath}/${componentName}`] = frankenstyleName;
componentData.pathList.push(componentPath);
// Look for any subplugins.
const subPluginConfigurationFile = `${componentPath}/db/subplugins.json`;
if (fs.existsSync(subPluginConfigurationFile)) {
const subpluginList = JSON.parse(fs.readFileSync(fs.realpathSync(subPluginConfigurationFile)));
Object.entries(subpluginList.plugintypes).forEach(([subpluginType, subpluginTypePath]) => {
glob.sync(`${subpluginTypePath}/*/version.php`).forEach(versionPath => {
const componentPath = fs.realpathSync(path.dirname(versionPath));
const componentName = path.basename(componentPath);
const frankenstyleName = `${subpluginType}_${componentName}`;
componentData.components[`${subpluginTypePath}/${componentName}`] = frankenstyleName;
componentData.pathList.push(componentPath);
});
});
}
});
});
}
return componentData;
};
/**
* Get the list of component paths.
*
* @param {string} relativeTo
* @returns {array}
*/
const getComponentPaths = (relativeTo = '') => fetchComponentData().pathList.map(componentPath => {
return componentPath.replace(relativeTo, '');
});
/**
* Get the list of paths to build AMD sources.
*
* @returns {Array}
*/
const getAmdSrcGlobList = () => {
const globList = [];
fetchComponentData().pathList.forEach(componentPath => {
globList.push(`${componentPath}/amd/src/*.js`);
globList.push(`${componentPath}/amd/src/**/*.js`);
});
return globList;
};
/**
* Get the list of paths to build YUI sources.
*
* @param {String} relativeTo
* @returns {Array}
*/
const getYuiSrcGlobList = relativeTo => {
const globList = [];
fetchComponentData().pathList.forEach(componentPath => {
const relativeComponentPath = componentPath.replace(relativeTo, '');
globList.push(`${relativeComponentPath}/yui/src/**/*.js`);
});
return globList;
};
/**
* Get the list of paths to thirdpartylibs.xml.
*
* @param {String} relativeTo
* @returns {Array}
*/
const getThirdPartyLibsList = relativeTo => {
const fs = require('fs');
const path = require('path');
return fetchComponentData().pathList
.map(componentPath => path.relative(relativeTo, componentPath) + '/thirdpartylibs.xml')
.map(componentPath => componentPath.replace(/\\/g, '/'))
.filter(path => fs.existsSync(path))
.sort();
};
/**
* Get the list of thirdparty library paths.
*
* @returns {array}
*/
const getThirdPartyPaths = () => {
const DOMParser = require('@xmldom/xmldom').DOMParser;
const fs = require('fs');
const path = require('path');
const xpath = require('xpath');
const thirdpartyfiles = getThirdPartyLibsList(fs.realpathSync('./'));
const libs = ['node_modules/', 'vendor/'];
const addLibToList = lib => {
if (!lib.match('\\*') && fs.statSync(lib).isDirectory()) {
// Ensure trailing slash on dirs.
lib = lib.replace(/\/?$/, '/');
}
// Look for duplicate paths before adding to array.
if (libs.indexOf(lib) === -1) {
libs.push(lib);
}
};
thirdpartyfiles.forEach(function(file) {
const dirname = path.dirname(file);
const xmlContent = fs.readFileSync(file, 'utf8');
const doc = new DOMParser().parseFromString(xmlContent);
const nodes = xpath.select("/libraries/library/location/text()", doc);
nodes.forEach(function(node) {
let lib = path.posix.join(dirname, node.toString());
addLibToList(lib);
});
});
return libs;
};
/**
* Find the name of the component matching the specified path.
*
* @param {String} path
* @returns {String|null} Name of matching component.
*/
const getComponentFromPath = path => {
const componentList = fetchComponentData().components;
if (componentList.hasOwnProperty(path)) {
return componentList[path];
}
return null;
};
/**
* Check whether the supplied path, relative to the Gruntfile.js, is in a known component.
*
* @param {String} checkPath The path to check. This can be with either Windows, or Linux directory separators.
* @returns {String|null}
*/
const getOwningComponentDirectory = checkPath => {
const path = require('path');
// Fetch all components into a reverse sorted array.
// This ensures that components which are within the directory of another component match first.
const pathList = Object.keys(fetchComponentData().components).sort().reverse();
for (const componentPath of pathList) {
// If the componentPath is the directory being checked, it will be empty.
// If the componentPath is a parent of the directory being checked, the relative directory will not start with ..
if (!path.relative(componentPath, checkPath).startsWith('..')) {
return componentPath;
}
}
return null;
};
/**
* Get the latest tag in a remote GitHub repository.
*
* @param {string} url The remote repository.
* @returns {Array}
*/
const getRepositoryTags = async(url) => {
const gtr = require('git-tags-remote');
try {
const tags = await gtr.get(url);
if (tags !== undefined) {
return tags;
}
} catch (error) {
return [];
}
return [];
};
/**
* Get the list of thirdparty libraries that could be upgraded.
*
* @returns {Array}
*/
const getThirdPartyLibsUpgradable = async() => {
const libraries = getThirdPartyLibsData().filter((library) => !!library.repository);
const upgradableLibraries = [];
const versionCompare = (a, b) => {
if (a === b) {
return 0;
}
const aParts = a.split('.');
const bParts = b.split('.');
for (let i = 0; i < Math.min(aParts.length, bParts.length); i++) {
const aPart = parseInt(aParts[i], 10);
const bPart = parseInt(bParts[i], 10);
if (aPart > bPart) {
// 1.1.0 > 1.0.9
return 1;
} else if (aPart < bPart) {
// 1.0.9 < 1.1.0
return -1;
} else {
// Same version.
continue;
}
}
if (aParts.length > bParts.length) {
// 1.0.1 > 1.0
return 1;
}
// 1.0 < 1.0.1
return -1;
};
for (let library of libraries) {
upgradableLibraries.push(
getRepositoryTags(library.repository).then((tagMap) => {
library.version = library.version.replace(/^v/, '');
const currentVersion = library.version.replace(/moodle-/, '');
const currentMajorVersion = library.version.split('.')[0];
const tags = [...tagMap]
.map((tagData) => tagData[0])
.filter((tag) => !tag.match(/(alpha|beta|rc)/))
.map((tag) => tag.replace(/^v/, ''))
.sort((a, b) => versionCompare(b, a));
if (!tags.length) {
library.warning = "Unable to find any comparable tags.";
return library;
}
library.latestVersion = tags[0];
tags.some((tag) => {
if (!tag) {
return false;
}
// See if the version part matches.
const majorVersion = tag.split('.')[0];
if (majorVersion === currentMajorVersion) {
library.latestSameMajorVersion = tag;
return true;
}
return false;
});
if (versionCompare(currentVersion, library.latestVersion) > 0) {
// Moodle somehow has a newer version than the latest version.
library.warning = `Newer version found: ${currentVersion} > ${library.latestVersion} for ${library.name}`;
return library;
}
if (library.version !== library.latestVersion) {
// Delete version and add it again at the end of the array. That way, current and new will stay closer.
delete library.version;
library.version = currentVersion;
return library;
}
return null;
})
);
}
return (await Promise.all(upgradableLibraries)).filter((library) => !!library);
};
/**
* Get the list of thirdparty libraries.
*
* @returns {Array}
*/
const getThirdPartyLibsData = () => {
const DOMParser = require('@xmldom/xmldom').DOMParser;
const fs = require('fs');
const xpath = require('xpath');
const path = require('path');
const libraryList = [];
const libraryFields = [
'location',
'name',
'version',
'repository',
];
const thirdpartyfiles = getThirdPartyLibsList(fs.realpathSync('./'));
thirdpartyfiles.forEach(function(libraryPath) {
const xmlContent = fs.readFileSync(libraryPath, 'utf8');
const doc = new DOMParser().parseFromString(xmlContent);
const libraries = xpath.select("/libraries/library", doc);
for (const library of libraries) {
const libraryData = [];
for (const field of libraryFields) {
libraryData[field] = xpath.select(`${field}/text()`, library)?.toString();
}
libraryData.location = path.join(path.dirname(libraryPath), libraryData.location);
libraryList.push(libraryData);
}
});
return libraryList.sort((a, b) => a.location.localeCompare(b.location));
};
module.exports = {
fetchComponentData,
getAmdSrcGlobList,
getComponentFromPath,
getComponentPaths,
getOwningComponentDirectory,
getYuiSrcGlobList,
getThirdPartyLibsList,
getThirdPartyPaths,
getThirdPartyLibsUpgradable,
};
-19
View File
@@ -1,19 +0,0 @@
# Moodle JavaScript Documentation
```
.-..-.
_____ | || |
/____/-.---_ .---. .---. .-.| || | .---.
| | _ _ |/ _ \/ _ \/ _ || |/ __ \
* | | | | | || |_| || |_| || |_| || || |___/
|_| |_| |_|\_____/\_____/\_____||_|\_____)
Moodle - the world's open source learning platform
```
## About
This generated documentation includes API documentation for JavaScript written in the AMD and ES2015 module formats within Moodle.
## Related information
See [https://moodledev.io](https://moodledev.io) for other related Developer Documentation.
-131
View File
@@ -1,131 +0,0 @@
// 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/>.
/**
* Helper functions for working with Moodle component names, directories, and sources.
*
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
"use strict";
/* eslint-env node */
// Do not include any plugins as stanard.
const plugins = [];
plugins.push('plugins/markdown');
/**
* Get the source configuration.
*
* @return {Object}
*/
const getSource = () => {
const glob = require('glob');
const path = require('path');
const ComponentList = require(path.resolve('.grunt/components.js'));
const thirdPartyPaths = ComponentList.getThirdPartyPaths();
const source = {
include: [],
includePattern: ".+\\.js$",
};
let includeList = [];
ComponentList.getAmdSrcGlobList().forEach(async pattern => {
includeList.push(...glob.sync(pattern));
});
const cwdLength = process.cwd().length + 1;
includeList.forEach(path => {
if (source.include.indexOf(path) !== -1) {
// Ensure no duplicates.
return;
}
const relPath = path.substring(cwdLength);
if (thirdPartyPaths.indexOf(relPath) !== -1) {
return;
}
source.include.push(path);
});
source.include.push('.grunt/jsdoc/README.md');
return source;
};
const tags = {
// Allow the use of unknown tags.
// We have a lot of legacy uses of these.
allowUnknownTags: true,
// We make use of jsdoc and closure dictionaries as standard.
dictionaries: [
'jsdoc',
'closure',
],
};
// Template configuraiton.
const templates = {
cleverLinks: false,
monospaceLinks: false,
};
module.exports = {
opts: {
destination: "./jsdoc/",
template: "node_modules/docdash",
},
plugins,
recurseDepth: 10,
source: getSource(),
sourceType: 'module',
tags,
templates,
docdash: {
collapse: true,
search: true,
sort: true,
sectionOrder: [
"Namespaces",
"Modules",
"Events",
"Classes",
"Externals",
"Mixins",
"Tutorials",
"Interfaces"
],
"menu": {
"Developer Docs": {
href: "https://moodledev.io",
target: "_blank",
"class": "menu-item",
id: "devdocs"
},
"MDN Docs": {
href: "https://developer.mozilla.org/en-US/docs/Web/JavaScript",
target: "_blank",
"class": "menu-item",
id: "mdndocs",
},
},
typedefs: true,
},
};
-142
View File
@@ -1,142 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* Component Library build tasks.
*
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Get a child path of the component library.
*
* @param {string} path
* @returns {string}
*/
const getCLPath = path => `admin/tool/componentlibrary/${path}`;
/**
* Get a spawn handler.
*
* This is a generic function to write the spawn output, and then to exit if required and mark the async task as
* complete.
*
* @param {Promise} done
* @returns {function}
*/
const getSpawnHandler = done => (error, result, code) => {
grunt.log.write(result);
if (error) {
grunt.log.error(result.stdout);
process.exit(code);
}
done();
};
/**
* Spawn a function against Node with the provided args.
*
* @param {array} args
* @returns {object}
*/
const spawnNodeCall = (args) => grunt.util.spawn({
cmd: 'node',
args,
}, getSpawnHandler(grunt.task.current.async()));
/**
* Build the docs using Hugo.
*
* @returns {Object} Reference to the spawned task
*/
const docsBuild = () => spawnNodeCall([
'node_modules/hugo-bin/cli.js',
'--config', getCLPath('config.yml'),
'--cleanDestinationDir',
]);
/**
* Build the docs index using the hugo-lunr-indexer.
*
* @returns {Object} Reference to the spawned task
*/
const indexBuild = () => spawnNodeCall([
'node_modules/hugo-lunr-indexer/bin/hli.js',
'-i', getCLPath('content/**'),
'-o', getCLPath('hugo/site/data/my-index.json'),
'-l', 'yaml',
'-d', '---',
]);
/**
* Build the hugo CSS.
*
* @returns {Object} Reference to the spawned task
*/
const cssBuild = () => spawnNodeCall([
'node_modules/sass/sass.js',
'--style', 'expanded',
'--source-map',
'--embed-sources',
'--precision', 6,
'--load-path', process.cwd(),
getCLPath('hugo/scss/docs.scss'),
getCLPath('hugo/dist/css/docs.css'),
]);
// Register the various component library tasks.
grunt.registerTask('componentlibrary:docsBuild', 'Build the component library', docsBuild);
grunt.registerTask('componentlibrary:cssBuild', 'Build the component library', cssBuild);
grunt.registerTask('componentlibrary:indexBuild', 'Build the component library', indexBuild);
grunt.registerTask('componentlibrary', 'Build the component library', [
'componentlibrary:docsBuild',
'componentlibrary:cssBuild',
'componentlibrary:indexBuild',
]);
grunt.config.merge({
watch: {
componentLibraryDocs: {
files: [
getCLPath('content/**/*.md'),
getCLPath('hugo'),
],
tasks: ['componentlibrary:docsBuild', 'componentlibrary:indexBuild'],
},
componentLibraryCSS: {
files: [
getCLPath('hugo/scss/**/*.scss'),
'hugo',
],
tasks: ['componentlibrary:cssBuild'],
},
},
});
// Add the 'componentlibrary' task as a startup task.
grunt.moodleEnv.startupTasks.push('componentlibrary');
return {
docsBuild,
cssBuild,
indexBuild,
};
};
-64
View File
@@ -1,64 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
const files = grunt.moodleEnv.files;
// Project configuration.
grunt.config.merge({
eslint: {
// Even though warnings dont stop the build we don't display warnings by default because
// at this moment we've got too many core warnings.
// To display warnings call: grunt eslint --show-lint-warnings
// To fail on warnings call: grunt eslint --max-lint-warnings=0
// Also --max-lint-warnings=-1 can be used to display warnings but not fail.
options: {
quiet: (!grunt.option('show-lint-warnings')) && (typeof grunt.option('max-lint-warnings') === 'undefined'),
maxWarnings: ((typeof grunt.option('max-lint-warnings') !== 'undefined') ? grunt.option('max-lint-warnings') : -1)
},
// Check AMD src files.
amd: {src: files ? files : grunt.moodleEnv.amdSrc},
// Check YUI module source files.
yui: {src: files ? files : grunt.moodleEnv.yuiSrc},
},
});
grunt.loadNpmTasks('grunt-eslint');
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('eslint.amd.src', files);
grunt.config('eslint.yui.src', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', (action, filepath) => {
changedFiles[filepath] = action;
onChange();
});
};
-92
View File
@@ -1,92 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Get the list of feature files to pass to the gherkin linter.
*
* @returns {Array}
*/
const getGherkinLintTargets = () => {
if (grunt.moodleEnv.files) {
// Specific files were requested. Only check these.
return grunt.moodleEnv.files;
}
if (grunt.moodleEnv.inComponent) {
return [`${grunt.moodleEnv.runDir}/tests/behat/*.feature`];
}
return ['**/tests/behat/*.feature'];
};
const handler = function() {
const done = this.async();
const options = grunt.config('gherkinlint.options');
// Grab the gherkin-lint linter and required scaffolding.
const linter = require('gherkin-lint/dist/linter.js');
const featureFinder = require('gherkin-lint/dist/feature-finder.js');
const configParser = require('gherkin-lint/dist/config-parser.js');
const formatter = require('gherkin-lint/dist/formatters/stylish.js');
// Run the linter.
return linter.lint(
featureFinder.getFeatureFiles(grunt.file.expand(options.files)),
configParser.getConfiguration(configParser.defaultConfigFileName)
)
.then(results => {
// Print the results out uncondtionally.
formatter.printResults(results);
return results;
})
.then(results => {
// Report on the results.
// The done function takes a bool whereby a falsey statement causes the task to fail.
return results.every(result => result.errors.length === 0);
})
.then(done); // eslint-disable-line promise/no-callback-in-promise
};
grunt.registerTask('gherkinlint', 'Run gherkinlint against the current directory', handler);
grunt.config.set('gherkinlint', {
options: {
files: getGherkinLintTargets(),
}
});
grunt.config.merge({
watch: {
gherkinlint: {
files: [grunt.moodleEnv.inComponent ? 'tests/behat/*.feature' : '**/tests/behat/*.feature'],
tasks: ['gherkinlint'],
},
},
});
// Add the 'gherkinlint' task as a startup task.
grunt.moodleEnv.startupTasks.push('gherkinlint');
return handler;
};
-100
View File
@@ -1,100 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate the PHPCS configuration.
*
* @param {Object} thirdPartyPaths
*/
const phpcsIgnore = (thirdPartyPaths) => {
const {toXML} = require('jstoxml');
const config = {
_name: 'ruleset',
_attrs: {
name: "MoodleCore",
},
_content: [
{
rule: {
_attrs: {
ref: './phpcs.xml.dist',
},
},
},
],
};
thirdPartyPaths.forEach(library => {
config._content.push({
'exclude-pattern': library,
});
});
grunt.file.write('phpcs.xml', toXML(config, {
header: true,
indent: ' ',
}) + "\n");
};
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
const handler = function() {
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// An array of paths to third party directories.
const thirdPartyPaths = ComponentList.getThirdPartyPaths();
// Generate .eslintignore.
const eslintIgnores = [
'# Generated by "grunt ignorefiles"',
// Do not ignore the .grunt directory.
'!/.grunt',
// Ignore all yui/src meta directories and build directories.
'*/**/yui/src/*/meta/',
'*/**/build/',
].concat(thirdPartyPaths);
grunt.file.write('.eslintignore', eslintIgnores.join('\n') + '\n');
// Generate .stylelintignore.
const stylelintIgnores = [
'# Generated by "grunt ignorefiles"',
'**/yui/build/*',
'theme/boost/style/moodle.css',
'theme/classic/style/moodle.css',
'jsdoc/styles/*.css',
'admin/tool/componentlibrary/hugo/dist/css/docs.css',
].concat(thirdPartyPaths);
grunt.file.write('.stylelintignore', stylelintIgnores.join('\n') + '\n');
phpcsIgnore(thirdPartyPaths);
};
grunt.registerTask('ignorefiles', 'Generate ignore files for linters', handler);
return handler;
};
-215
View File
@@ -1,215 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Function to generate the destination for the minification task
* (e.g. build/file.min.js). This function will be passed to
* the rename property of files array when building dynamically:
* http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
*
* @param {String} destPath the current destination
* @param {String} srcPath the matched src path
* @return {String} The rewritten destination path.
*/
const babelRename = function(destPath, srcPath) {
destPath = srcPath.replace(`amd/src`, `amd/build`);
destPath = destPath.replace(/\.js$/, '.min.js');
return destPath;
};
module.exports = grunt => {
// Load the Ignorefiles tasks.
require('./ignorefiles')(grunt);
// Load the Shifter tasks.
require('./shifter')(grunt);
// Load ESLint.
require('./eslint')(grunt);
// Load jsconfig.
require('./jsconfig')(grunt);
// Load JSDoc.
require('./jsdoc')(grunt);
const path = require('path');
// Register JS tasks.
grunt.registerTask('yui', ['eslint:yui', 'shifter']);
grunt.registerTask('amd', ['ignorefiles', 'eslint:amd', 'rollup']);
grunt.registerTask('js', ['amd', 'yui']);
// Register NPM tasks.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-rollup');
const babelTransform = require('@babel/core').transform;
const babel = (options = {}) => {
return {
name: 'babel',
transform: (code, id) => {
grunt.log.debug(`Transforming ${id}`);
options.filename = id;
const transformed = babelTransform(code, options);
return {
code: transformed.code,
map: transformed.map
};
}
};
};
// Note: We have to use a rate limit plugin here because rollup runs all tasks asynchronously and in parallel.
// When we kick off a full run, if we kick off a rollup of every file this will fork-bomb the machine.
// To work around this we use a concurrent Promise queue based on the number of available processors.
const rateLimit = () => {
const queue = [];
let queueRunner;
const startQueue = () => {
if (queueRunner) {
return;
}
queueRunner = setTimeout(() => {
const limit = Math.max(1, require('os').cpus().length / 2);
grunt.log.debug(`Starting rollup with queue size of ${limit}`);
runQueue(limit);
}, 100);
};
// The queue runner will run the next `size` items in the queue.
const runQueue = (size = 1) => {
queue.splice(0, size).forEach(resolve => {
grunt.log.debug(`Item resolved. Kicking off next one.`);
resolve();
});
};
return {
name: 'ratelimit',
// The options hook is run in parallel.
// We can return an unresolved Promise which is queued for later resolution.
options: async(options) => {
return new Promise(resolve => {
queue.push(resolve);
startQueue();
return options;
});
},
// When an item in the queue completes, start the next item in the queue.
generateBundle: (options, bundle) => {
grunt.log.debug(`Finished output phase for ${Object.keys(bundle).join(', ')}`);
runQueue();
},
};
};
const terser = require('rollup-plugin-terser').terser;
grunt.config.merge({
rollup: {
options: {
format: 'esm',
dir: 'output',
sourcemap: true,
treeshake: false,
context: 'window',
plugins: [
rateLimit(),
babel({
sourceMaps: true,
comments: false,
compact: false,
plugins: [
'transform-es2015-modules-amd-lazy',
'system-import-transformer',
// This plugin modifies the Babel transpiling for "export default"
// so that if it's used then only the exported value is returned
// by the generated AMD module.
//
// It also adds the Moodle plugin name to the AMD module definition
// so that it can be imported as expected in other modules.
path.resolve('.grunt/babel-plugin-add-module-to-define.js')
],
presets: [
['@babel/preset-env', {
modules: false,
useBuiltIns: false
}]
]
}),
terser({
// Do not mangle variables.
// Makes debugging easier.
mangle: false,
}),
],
},
dist: {
files: [{
expand: true,
src: grunt.moodleEnv.files ? grunt.moodleEnv.files : grunt.moodleEnv.amdSrc,
rename: babelRename
}],
},
},
});
grunt.config.merge({
watch: {
amd: {
files: grunt.moodleEnv.inComponent
? ['amd/src/*.js', 'amd/src/**/*.js']
: ['**/amd/src/**/*.js'],
tasks: ['amd']
},
},
});
// Add the 'js' task as a startup task.
grunt.moodleEnv.startupTasks.push('js');
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('rollup.dist.files', [{expand: true, src: files, rename: babelRename}]);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', function(action, filepath) {
changedFiles[filepath] = action;
onChange();
});
return {
babelRename,
};
};
-53
View File
@@ -1,53 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2022 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
const configuration = {
compilerOptions: {
baseUrl: ".",
paths: {
},
target: "es2015",
allowSyntheticDefaultImports: false,
},
exclude: [
"node_modules",
],
include: [],
};
module.exports = (grunt) => {
const handler = () => {
const jsconfigData = Object.assign({}, configuration);
const path = require('path');
const {fetchComponentData} = require(path.join(process.cwd(), '.grunt', 'components.js'));
const componentData = fetchComponentData().components;
for (const [thisPath, component] of Object.entries(componentData)) {
jsconfigData.compilerOptions.paths[`${component}/*`] = [`${thisPath}/amd/src/*`];
jsconfigData.include.push(`${thisPath}/amd/src/**/*`);
}
grunt.file.write('jsconfig.json', JSON.stringify(jsconfigData, null, " ") + "\n");
};
grunt.registerTask('jsconfig', 'Generate a jsconfig configuration compatible with the LSP', handler);
};
-52
View File
@@ -1,52 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = (grunt) => {
const path = require('path');
grunt.registerTask('jsdoc', 'Generate JavaScript documentation using jsdoc', function() {
const done = this.async();
const configuration = path.resolve('.grunt/jsdoc/jsdoc.conf.js');
grunt.util.spawn({
cmd: 'jsdoc',
args: [
'--configure',
configuration,
]
}, function(error, result, code) {
if (result.stdout) {
grunt.log.write(result.stdout);
}
if (result.stderr) {
grunt.log.error(result.stderr);
}
if (error) {
grunt.fail.fatal(`JSDoc failed with error code ${code}`);
} else {
grunt.log.write('JSDoc completed successfully'.green);
}
done();
});
});
};
-40
View File
@@ -1,40 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
grunt.loadNpmTasks('grunt-sass');
grunt.config.merge({
sass: {
dist: {
files: {
"theme/boost/style/moodle.css": "theme/boost/scss/preset/default.scss",
"theme/classic/style/moodle.css": "theme/classic/scss/classicgrunt.scss"
}
},
options: {
implementation: require('sass'),
includePaths: ["theme/boost/scss/", "theme/classic/scss/"]
}
},
});
};
-155
View File
@@ -1,155 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/* eslint-env node */
module.exports = grunt => {
/**
* Shifter task. Is configured with a path to a specific file or a directory,
* in the case of a specific file it will work out the right module to be built.
*
* Note that this task runs the invidiaul shifter jobs async (becase it spawns
* so be careful to to call done().
*/
const handler = function() {
const done = this.async();
const options = grunt.config('shifter.options');
const async = require('async');
const path = require('path');
// Run the shifter processes one at a time to avoid confusing output.
async.eachSeries(options.paths, function(src, filedone) {
var args = [];
args.push(path.normalize(process.cwd() + '/node_modules/shifter/bin/shifter'));
// Always ignore the node_modules directory.
args.push('--excludes', 'node_modules');
// Determine the most appropriate options to run with based upon the current location.
if (grunt.file.isMatch('**/yui/**/*.js', src)) {
// When passed a JS file, build our containing module (this happen with
// watch).
grunt.log.debug('Shifter passed a specific JS file');
src = path.dirname(path.dirname(src));
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src', src)) {
// When in a src directory --walk all modules.
grunt.log.debug('In a src directory');
args.push('--walk');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*', src)) {
// When in module, only build our module.
grunt.log.debug('In a module directory');
options.recursive = false;
} else if (grunt.file.isMatch('**/yui/src/*/js', src)) {
// When in module src, only build our module.
grunt.log.debug('In a source directory');
src = path.dirname(src);
options.recursive = false;
}
if (grunt.option('watch')) {
grunt.fail.fatal('The --watch option has been removed, please use `grunt watch` instead');
}
// Add the stderr option if appropriate
if (grunt.option('verbose')) {
args.push('--lint-stderr');
}
if (grunt.option('no-color')) {
args.push('--color=false');
}
var execShifter = function() {
grunt.log.ok("Running shifter on " + src);
grunt.util.spawn({
cmd: "node",
args: args,
opts: {cwd: src, stdio: 'inherit', env: process.env}
}, function(error, result, code) {
if (code) {
grunt.fail.fatal('Shifter failed with code: ' + code);
} else {
grunt.log.ok('Shifter build complete.');
filedone();
}
});
};
// Actually run shifter.
if (!options.recursive) {
execShifter();
} else {
// Check that there are yui modules otherwise shifter ends with exit code 1.
if (grunt.file.expand({cwd: src}, '**/yui/src/**/*.js').length > 0) {
args.push('--recursive');
execShifter();
} else {
grunt.log.ok('No YUI modules to build.');
filedone();
}
}
}, done);
};
// Register the shifter task.
grunt.registerTask('shifter', 'Run Shifter against the current directory', handler);
// Configure it.
grunt.config.set('shifter', {
options: {
recursive: true,
// Shifter takes a relative path.
paths: grunt.moodleEnv.files ? grunt.moodleEnv.files : [grunt.moodleEnv.runDir]
}
});
grunt.config.merge({
watch: {
yui: {
files: grunt.moodleEnv.inComponent
? ['yui/src/*.json', 'yui/src/**/*.js']
: ['**/yui/src/**/*.js'],
tasks: ['yui']
},
},
});
// On watch, we dynamically modify config to build only affected files. This
// method is slightly complicated to deal with multiple changed files at once (copied
// from the grunt-contrib-watch readme).
let changedFiles = Object.create(null);
const onChange = grunt.util._.debounce(function() {
const files = Object.keys(changedFiles);
grunt.config('shifter.options.paths', files);
changedFiles = Object.create(null);
}, 200);
grunt.event.on('watch', (action, filepath) => {
changedFiles[filepath] = action;
onChange();
});
return handler;
};
-46
View File
@@ -1,46 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate ignore files (utilising thirdpartylibs.xml data)
*/
const handler = function() {
const path = require('path');
// Are we in a YUI directory?
if (path.basename(path.resolve(grunt.moodleEnv.cwd, '../../')) == 'yui') {
grunt.task.run('yui');
// Are we in an AMD directory?
} else if (grunt.moodleEnv.inAMD) {
grunt.task.run('amd');
} else {
// Run all of the requested startup tasks.
grunt.moodleEnv.startupTasks.forEach(taskName => grunt.task.run(taskName));
}
};
// Register the startup task.
grunt.registerTask('startup', 'Run the correct tasks for the current directory', handler);
return handler;
};
-35
View File
@@ -1,35 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
// Load the ignorefiles tasks.
require('./ignorefiles')(grunt);
// Load the Style Lint tasks.
require('./stylelint')(grunt);
// Load the SASS tasks.
require('./sass')(grunt);
// Add the 'css' task as a startup task.
grunt.moodleEnv.startupTasks.push('css');
};
-187
View File
@@ -1,187 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2021 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
const getCssConfigForFiles = files => {
return {
stylelint: {
css: {
// Use a fully-qualified path.
src: files,
options: {
quietDeprecationWarnings: true,
configOverrides: {
rules: {
// These rules have to be disabled in .stylelintrc for scss compat.
"at-rule-no-unknown": true,
}
}
}
},
},
};
};
const getScssConfigForFiles = files => {
return {
stylelint: {
scss: {
options: {
quietDeprecationWarnings: true,
customSyntax: 'postcss-scss',
},
src: files,
},
},
};
};
/**
* Register any stylelint tasks.
*
* @param {Object} grunt
* @param {Array} files
* @param {String} fullRunDir
*/
const registerStyleLintTasks = () => {
const glob = require('glob');
// The stylelinters do not handle the case where a configuration was provided but no files were included.
// Keep track of whether any files were found.
let hasCss = false;
let hasScss = false;
// The stylelint processors do not take a path argument. They always check all provided values.
// As a result we must check through each glob and determine if any files match the current directory.
const scssFiles = [];
const cssFiles = [];
const requestedFiles = grunt.moodleEnv.files;
if (requestedFiles) {
// Grunt was called with a files argument.
// Check whether each of the requested files matches either the CSS or SCSS source file list.
requestedFiles.forEach(changedFilePath => {
let matchesGlob;
// Check whether this watched path matches any watched SCSS file.
matchesGlob = grunt.moodleEnv.scssSrc.some(watchedPathGlob => {
return glob.sync(watchedPathGlob).indexOf(changedFilePath) !== -1;
});
if (matchesGlob) {
scssFiles.push(changedFilePath);
hasScss = true;
}
// Check whether this watched path matches any watched CSS file.
matchesGlob = grunt.moodleEnv.cssSrc.some(watchedPathGlob => {
return glob.sync(watchedPathGlob).indexOf(changedFilePath) !== -1;
});
if (matchesGlob) {
cssFiles.push(changedFilePath);
hasCss = true;
}
});
} else {
// Grunt was called without a list of files.
// The start directory (runDir) may be a child dir of the project.
// Check each scssSrc file to see if it's in the start directory.
// This means that we can lint just mod/*/styles.css if started in the mod directory.
grunt.moodleEnv.scssSrc.forEach(path => {
if (path.startsWith(grunt.moodleEnv.runDir)) {
scssFiles.push(path);
hasScss = true;
}
});
grunt.moodleEnv.cssSrc.forEach(path => {
if (path.startsWith(grunt.moodleEnv.runDir)) {
cssFiles.push(path);
hasCss = true;
}
});
}
// Register the tasks.
const scssTasks = ['sass'];
if (hasScss) {
grunt.config.merge(getScssConfigForFiles(scssFiles));
scssTasks.unshift('stylelint:scss');
}
scssTasks.unshift('ignorefiles');
const cssTasks = ['ignorefiles'];
if (hasCss) {
grunt.config.merge(getCssConfigForFiles(cssFiles));
cssTasks.push('stylelint:css');
}
// The tasks must be registered, even if empty to ensure a consistent command list.
// They jsut won't run anything.
grunt.registerTask('scss', scssTasks);
grunt.registerTask('rawcss', cssTasks);
};
// Register CSS tasks.
grunt.loadNpmTasks('grunt-stylelint');
// Register the style lint tasks.
registerStyleLintTasks();
grunt.registerTask('css', ['scss', 'rawcss']);
const getCoreThemeMatches = () => {
const scssMatch = 'scss/**/*.scss';
if (grunt.moodleEnv.inTheme) {
return [scssMatch];
}
if (grunt.moodleEnv.runDir.startsWith('theme')) {
return [`*/${scssMatch}`];
}
return [`theme/*/${scssMatch}`];
};
// Add the watch configuration for rawcss, and scss.
grunt.config.merge({
watch: {
rawcss: {
files: [
'**/*.css',
],
excludes: [
'**/moodle.css',
'**/editor.css',
'jsdoc/styles/*.css',
],
tasks: ['rawcss']
},
scss: {
files: getCoreThemeMatches(),
tasks: ['scss']
},
},
});
};
-42
View File
@@ -1,42 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* @copyright 2023 Sara Arjona <sara@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
module.exports = grunt => {
/**
* Generate upgradable third-party libraries (utilising thirdpartylibs.xml data)
*/
grunt.registerTask('upgradablelibs', 'Generate upgradable third-party libraries', async function() {
const done = this.async();
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// An array of third party libraries that have a newer version in their repositories.
const thirdPartyLibs = await ComponentList.getThirdPartyLibsUpgradable({progress: true});
for (let library of thirdPartyLibs) {
grunt.log.ok(JSON.stringify(Object.assign({}, library), null, 4));
}
done();
});
};
-272
View File
@@ -1,272 +0,0 @@
/**
* This is a wrapper task to handle the grunt watch command. It attempts to use
* Watchman to monitor for file changes, if it's installed, because it's much faster.
*
* If Watchman isn't installed then it falls back to the grunt-contrib-watch file
* watcher for backwards compatibility.
*/
/* eslint-env node */
module.exports = grunt => {
/**
* This is a wrapper task to handle the grunt watch command. It attempts to use
* Watchman to monitor for file changes, if it's installed, because it's much faster.
*
* If Watchman isn't installed then it falls back to the grunt-contrib-watch file
* watcher for backwards compatibility.
*/
const watchHandler = function() {
const async = require('async');
const watchTaskDone = this.async();
let watchInitialised = false;
let watchTaskQueue = {};
let processingQueue = false;
const watchman = require('fb-watchman');
const watchmanClient = new watchman.Client();
// Grab the tasks and files that have been queued up and execute them.
var processWatchTaskQueue = function() {
if (!Object.keys(watchTaskQueue).length || processingQueue) {
// If there is nothing in the queue or we're already processing then wait.
return;
}
processingQueue = true;
// Grab all tasks currently in the queue.
var queueToProcess = watchTaskQueue;
// Reset the queue.
watchTaskQueue = {};
async.forEachSeries(
Object.keys(queueToProcess),
function(task, next) {
var files = queueToProcess[task];
var filesOption = '--files=' + files.join(',');
grunt.log.ok('Running task ' + task + ' for files ' + filesOption);
// Spawn the task in a child process so that it doesn't kill this one
// if it failed.
grunt.util.spawn(
{
// Spawn with the grunt bin.
grunt: true,
// Run from current working dir and inherit stdio from process.
opts: {
cwd: grunt.moodleEnv.fullRunDir,
stdio: 'inherit'
},
args: [task, filesOption]
},
function(err, res, code) {
if (code !== 0) {
// The grunt task failed.
grunt.log.error(err);
}
// Move on to the next task.
next();
}
);
},
function() {
// No longer processing.
processingQueue = false;
// Once all of the tasks are done then recurse just in case more tasks
// were queued while we were processing.
processWatchTaskQueue();
}
);
};
const originalWatchConfig = grunt.config.get(['watch']);
const watchConfig = Object.keys(originalWatchConfig).reduce(function(carry, key) {
if (key == 'options') {
return carry;
}
const value = originalWatchConfig[key];
const taskNames = value.tasks;
const files = value.files;
let excludes = [];
if (value.excludes) {
excludes = value.excludes;
}
taskNames.forEach(function(taskName) {
carry[taskName] = {
files,
excludes,
};
});
return carry;
}, {});
watchmanClient.on('error', function(error) {
// We have to add an error handler here and parse the error string because the
// example way from the docs to check if Watchman is installed doesn't actually work!!
// See: https://github.com/facebook/watchman/issues/509
if (error.message.match('Watchman was not found')) {
// If watchman isn't installed then we should fallback to the other watch task.
grunt.log.ok('It is recommended that you install Watchman for better performance using the "watch" command.');
// Fallback to the old grunt-contrib-watch task.
grunt.renameTask('watch-grunt', 'watch');
grunt.task.run(['watch']);
// This task is finished.
watchTaskDone(0);
} else {
grunt.log.error(error);
// Fatal error.
watchTaskDone(1);
}
});
watchmanClient.on('subscription', function(resp) {
if (resp.subscription !== 'grunt-watch') {
return;
}
resp.files.forEach(function(file) {
grunt.log.ok('File changed: ' + file.name);
var fullPath = grunt.moodleEnv.fullRunDir + '/' + file.name;
Object.keys(watchConfig).forEach(function(task) {
const fileGlobs = watchConfig[task].files;
var match = fileGlobs.some(function(fileGlob) {
return grunt.file.isMatch(`**/${fileGlob}`, fullPath);
});
if (match) {
// If we are watching a subdirectory then the file.name will be relative
// to that directory. However the grunt tasks expect the file paths to be
// relative to the Gruntfile.js location so let's normalise them before
// adding them to the queue.
var relativePath = fullPath.replace(grunt.moodleEnv.gruntFilePath + '/', '');
if (task in watchTaskQueue) {
if (!watchTaskQueue[task].includes(relativePath)) {
watchTaskQueue[task] = watchTaskQueue[task].concat(relativePath);
}
} else {
watchTaskQueue[task] = [relativePath];
}
}
});
});
processWatchTaskQueue();
});
process.on('SIGINT', function() {
// Let the user know that they may need to manually stop the Watchman daemon if they
// no longer want it running.
if (watchInitialised) {
grunt.log.ok('The Watchman daemon may still be running and may need to be stopped manually.');
}
process.exit();
});
// Initiate the watch on the current directory.
watchmanClient.command(['watch-project', grunt.moodleEnv.fullRunDir], function(watchError, watchResponse) {
if (watchError) {
grunt.log.error('Error initiating watch:', watchError);
watchTaskDone(1);
return;
}
if ('warning' in watchResponse) {
grunt.log.error('warning: ', watchResponse.warning);
}
var watch = watchResponse.watch;
var relativePath = watchResponse.relative_path;
watchInitialised = true;
watchmanClient.command(['clock', watch], function(clockError, clockResponse) {
if (clockError) {
grunt.log.error('Failed to query clock:', clockError);
watchTaskDone(1);
return;
}
// Generate the expression query used by watchman.
// Documentation is limited, but see https://facebook.github.io/watchman/docs/expr/allof.html for examples.
// We generate an expression to match any value in the files list of all of our tasks, but excluding
// all value in the excludes list of that task.
//
// [anyof, [
// [allof, [
// [anyof, [
// ['match', validPath, 'wholename'],
// ['match', validPath, 'wholename'],
// ],
// [not,
// [anyof, [
// ['match', invalidPath, 'wholename'],
// ['match', invalidPath, 'wholename'],
// ],
// ],
// ],
var matchWholeName = fileGlob => ['match', fileGlob, 'wholename'];
var matches = Object.keys(watchConfig).map(function(task) {
const matchAll = [];
matchAll.push(['anyof'].concat(watchConfig[task].files.map(matchWholeName)));
if (watchConfig[task].excludes.length) {
matchAll.push(['not', ['anyof'].concat(watchConfig[task].excludes.map(matchWholeName))]);
}
return ['allof'].concat(matchAll);
});
matches = ['anyof'].concat(matches);
var sub = {
expression: matches,
// Which fields we're interested in.
fields: ["name", "size", "type"],
// Add our time constraint.
since: clockResponse.clock
};
if (relativePath) {
/* eslint-disable camelcase */
sub.relative_root = relativePath;
}
watchmanClient.command(['subscribe', watch, 'grunt-watch', sub], function(subscribeError) {
if (subscribeError) {
// Probably an error in the subscription criteria.
grunt.log.error('failed to subscribe: ', subscribeError);
watchTaskDone(1);
return;
}
grunt.log.ok('Listening for changes to files in ' + grunt.moodleEnv.fullRunDir);
});
});
});
};
// Rename the grunt-contrib-watch "watch" task because we're going to wrap it.
grunt.renameTask('watch', 'watch-grunt');
// Register the new watch handler.
grunt.registerTask('watch', 'Run tasks on file changes', watchHandler);
grunt.config.merge({
watch: {
options: {
nospawn: true // We need not to spawn so config can be changed dynamically.
},
},
});
return watchHandler;
};
-2
View File
@@ -1,2 +0,0 @@
**/amd/**
/*.js
-58
View File
@@ -1,58 +0,0 @@
// NOTE: We use eslint now. This file is used only by shifter. We keep the configuration
// here because shifter uses jshint after modules have been concating. Eslint can't
// currently do this.
{
"asi": false,
"bitwise": true,
"boss": false,
"browser": true,
"curly": true,
"debug": false,
"eqeqeq": false,
"eqnull": false,
"es5": false,
"esnext": false,
"evil": false,
"expr": false,
"forin": false,
"funcscope": false,
"globalstrict": false,
"immed": true,
"indent": 4,
"iterator": false,
"lastsemic": false,
"latedef": true,
"laxbreak": true,
"laxcomma": false,
"loopfunc": false,
"maxerr": 500,
"maxlen": 132,
"multistr": false,
"newcap": true,
"noarg": true,
"noempty": true,
"nomen": false,
"onecase": false,
"onevar": false,
"passfail": false,
"plusplus": false,
"predef": [
"M",
"define",
"require"
],
"proto": false,
"regexdash": false,
"regexp": false,
"scripturl": false,
"shadow": false,
"smarttabs": false,
"strict": false,
"sub": false,
"supernew": false,
"trailing": true,
"undef": true,
"unused": true,
"white": false,
"yui": true
}
-1
View File
@@ -1 +0,0 @@
lts/iron
-40
View File
@@ -1,40 +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/>.
/**
* Helper file for PhpStorm, and other IDEs, to provide better code completion.
*
* @package core
* @copyright 2024 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace PHPSTORM_META;
// Assume that anything returned by \core\di::get('...') is an instance of the first argument.
override(\core\di::get(0), map([
'' => '@',
]));
// Assume that anything returned by \Psr\Container\ContainerInterface::get('...') is an instance of the first argument.
override(\Psr\Container\ContainerInterface::get(0), map([
'' => '@',
]));
// Assume that anything returned by \DI\Container::get('...') is an instance of the first argument.
override(\DI\Container::get(0), map([
'' => '@',
]));
-5
View File
@@ -1,5 +0,0 @@
{
"coverage": false,
"lint": "config",
"clean": true
}
-107
View File
@@ -1,107 +0,0 @@
{
"customSyntax": "postcss-scss",
"plugins": [
"stylelint-csstree-validator"
],
"rules": {
"csstree/validator": {
"syntaxExtensions": [
"sass"
]
},
"at-rule-empty-line-before": [ "always",
{"except": [ "blockless-after-blockless"], ignore: ["after-comment", "inside-block"]}
],
"at-rule-name-case": "lower",
"at-rule-name-space-after": "always-single-line",
"at-rule-no-unknown": null, # Enabled for non-scss in grunt.
"at-rule-semicolon-newline-after": "always",
"at-rule-semicolon-space-before": "never",
"block-closing-brace-newline-after": "always",
"block-closing-brace-newline-before": "always",
"block-closing-brace-space-before": "always-single-line",
"block-no-empty": true,
"block-opening-brace-newline-after": "always",
"block-opening-brace-space-after": "always-single-line",
"block-opening-brace-space-before": "always",
"color-hex-case": ["lower", { "severity": "warning" }],
"color-hex-length": ["short", { "severity": "warning" }],
"color-no-invalid-hex": true,
"declaration-bang-space-after": "never",
"declaration-bang-space-before": "always",
"declaration-block-no-duplicate-properties": true,
"declaration-block-no-shorthand-property-overrides": true,
"declaration-block-semicolon-newline-after": "always-multi-line",
"declaration-block-semicolon-space-after": "always-single-line",
"declaration-block-semicolon-space-before": "never",
"declaration-block-single-line-max-declarations": 1,
"declaration-block-trailing-semicolon": "always",
"declaration-colon-newline-after": "always-multi-line",
"declaration-colon-space-after": "always-single-line",
"declaration-colon-space-before": "never",
"declaration-no-important": true,
"font-family-no-duplicate-names": true,
"function-calc-no-unspaced-operator": true,
"function-comma-newline-after": "always-multi-line",
"function-comma-space-after": "always-single-line",
"function-comma-space-before": "never",
"function-linear-gradient-no-nonstandard-direction": true,
"function-max-empty-lines": 0,
"function-name-case": "lower",
"function-parentheses-newline-inside": "always-multi-line",
"function-parentheses-space-inside": "never-single-line",
"function-url-scheme-disallowed-list": ["data"],
"function-whitespace-after": "always",
"indentation": 4,
"keyframe-declaration-no-important": true,
"length-zero-no-unit": [true, { "severity": "warning" }],
"max-empty-lines": 2,
"max-line-length": [132, { "severity": "warning" }],
"media-feature-colon-space-after": "always",
"media-feature-colon-space-before": "never",
"media-feature-parentheses-space-inside": "never",
"media-feature-range-operator-space-after": "always",
"media-feature-range-operator-space-before": "always",
"media-query-list-comma-newline-after": "always-multi-line",
"media-query-list-comma-space-after": "always-single-line",
"media-query-list-comma-space-before": "never",
"no-empty-source": true,
"no-eol-whitespace": true,
"no-extra-semicolons": [true, { "severity": "warning" }],
"no-invalid-double-slash-comments": true,
"no-unknown-animations": true,
"property-case": "lower",
"property-no-unknown": true,
"selector-attribute-brackets-space-inside": "never",
"selector-attribute-operator-space-after": "never",
"selector-attribute-operator-space-before": "never",
"selector-combinator-space-after": "always",
"selector-combinator-space-before": "always",
"selector-list-comma-newline-after": "always",
"selector-list-comma-space-before": "never",
"selector-max-empty-lines": 0,
"selector-pseudo-class-case": "lower",
"selector-pseudo-class-no-unknown": true,
"selector-pseudo-class-parentheses-space-inside": "never",
"selector-pseudo-element-case": "lower",
"selector-pseudo-element-no-unknown": true,
"selector-type-case": "lower",
"selector-type-no-unknown": true,
"string-no-newline": true,
"time-min-milliseconds": 100,
"unit-disallowed-list": ["pt"],
"unit-case": "lower",
"unit-no-unknown": true,
"value-keyword-case": ["lower", {"ignoreKeywords": ["/(@|$)/"]}],
"value-list-comma-newline-after": "always-multi-line",
"value-list-comma-space-after": "always-single-line",
"value-list-comma-space-before": "never",
},
"overrides": [
{
"files": ["**/yui/**/*.css"],
"rules": {
}
}
]
}
-52
View File
@@ -1,52 +0,0 @@
# Contributing to Moodle
[Moodle][1] is made by people like you. We are members of a big worldwide community of developers, designers, teachers, testers, translators and many more. We work in universities, schools, companies and other places. You are very welcome to join us and contribute to the project.
There are many ways that you can contribute to Moodle, not just through development. See our [community contribution guide][2] for some of the many ways that you can help.
## Github
> [!NOTE]
> Please do not open pull requests via Github.
All issues should be reported via, and patched provided to the [Moodle Tracker][3].
The Moodle [Github][4] repository is a clone of the official Moodle repository, whcih can be found at https://git.moodle.org.
## Moodle core bug fixes and new features
Over the years, Moodle has developed a mature process for reporting, reviewing, and accepting patches. This is fully documented in our [documentation on development processes][6], but in summary:
- Every bug fix or new feature must have a tracker issue.
- You publish the branch implementing the fix or new feature in your public clone of the moodle.git repository (typically on Github).
- Your patch is peer-reviewed, discussed, integrated, tested and then released as a part of one of our weekly releases.
- New features are developed on the `main` branch. Bug fixes are also backported to currently supported maintenance (stable) branches.
> [!IMPORTANT]
> Please do not publish security issues, or patches releating to them publicly.
> See our [Responsible Disclosure Policy][5] for more information.
## Moodle plugins
Moodle has a framework for additional plugins to extend its functionality. We
have a Moodle plugins directory <https://moodle.org/plugins/> where you can
register and maintain your plugin. Plugins hosted in the plugins directory can
be easily installed and updated via the Moodle administration interface.
* You are expected to have a public source code repository with your plugin
code.
* After registering your plugin in the plugins directory it is reviewed before
being published.
* You are expected to continuously release updated versions of the plugin via
the plugins directory. We do not pull from your code repository; you must do
it explicitly.
For further details, see <https://moodledev.io/general/community/plugincontribution>.
[1]: https://moodle.org
[2]: https://moodledev.io/general/community/contribute
[3]: https://tracker.moodle.org
[4]: https://github.com/moodle/moodle
[5]: https://moodledev.io/general/development/process/security
[6]: https://moodledev.io/general/development/process
-267
View File
@@ -1,267 +0,0 @@
// 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/>.
/* jshint node: true, browser: false */
/* eslint-env node */
/**
* Grunt configuration for Moodle.
*
* @copyright 2014 Andrew Nicols
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Setup the Grunt Moodle environment.
*
* @param {Grunt} grunt
* @returns {Object}
*/
const setupMoodleEnvironment = grunt => {
const fs = require('fs');
const path = require('path');
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
const getAmdConfiguration = () => {
// If the cwd is the amd directory in the current component then it will be empty.
// If the cwd is a child of the component's AMD directory, the relative directory will not start with ..
let inAMD = !path.relative(`${componentDirectory}/amd`, cwd).startsWith('..');
// Globbing pattern for matching all AMD JS source files.
let amdSrc = [];
if (inComponent) {
amdSrc.push(
componentDirectory + "/amd/src/*.js",
componentDirectory + "/amd/src/**/*.js"
);
} else {
amdSrc = ComponentList.getAmdSrcGlobList();
}
return {
inAMD,
amdSrc,
};
};
const getYuiConfiguration = () => {
let yuiSrc = [];
if (inComponent) {
yuiSrc.push(componentDirectory + "/yui/src/**/*.js");
} else {
yuiSrc = ComponentList.getYuiSrcGlobList(gruntFilePath + '/');
}
return {
yuiSrc,
};
};
const getStyleConfiguration = () => {
const ComponentList = require(path.join(process.cwd(), '.grunt', 'components.js'));
// Build the cssSrc and scssSrc.
// Valid paths are:
// [component]/styles.css; and either
// [theme/[themename]]/scss/**/*.scss; or
// [theme/[themename]]/style/*.css.
//
// If a theme has scss, then it is assumed that the style directory contains generated content.
let cssSrc = [];
let scssSrc = [];
const checkComponentDirectory = componentDirectory => {
const isTheme = componentDirectory.startsWith('theme/');
if (isTheme) {
const scssDirectory = `${componentDirectory}/scss`;
if (fs.existsSync(scssDirectory)) {
// This theme has an SCSS directory.
// Include all scss files within it recursively, but do not check for css files.
scssSrc.push(`${scssDirectory}/*.scss`);
scssSrc.push(`${scssDirectory}/**/*.scss`);
} else {
// This theme has no SCSS directory.
// Only hte CSS files in the top-level directory are checked.
cssSrc.push(`${componentDirectory}/style/*.css`);
}
} else {
// This is not a theme.
// All other plugin types are restricted to a single styles.css in their top level.
cssSrc.push(`${componentDirectory}/styles.css`);
}
};
if (inComponent) {
checkComponentDirectory(componentDirectory);
} else {
ComponentList.getComponentPaths(`${gruntFilePath}/`).forEach(componentPath => {
checkComponentDirectory(componentPath);
});
}
return {
cssSrc,
scssSrc,
};
};
/**
* Calculate the cwd, taking into consideration the `root` option (for Windows).
*
* @param {Object} grunt
* @returns {String} The current directory as best we can determine
*/
const getCwd = grunt => {
let cwd = fs.realpathSync(process.env.PWD || process.cwd());
// Windows users can't run grunt in a subdirectory, so allow them to set
// the root by passing --root=path/to/dir.
if (grunt.option('root')) {
const root = grunt.option('root');
if (grunt.file.exists(__dirname, root)) {
cwd = fs.realpathSync(path.join(__dirname, root));
grunt.log.ok('Setting root to ' + cwd);
} else {
grunt.fail.fatal('Setting root to ' + root + ' failed - path does not exist');
}
}
return cwd;
};
// Detect directories:
// * gruntFilePath The real path on disk to this Gruntfile.js
// * cwd The current working directory, which can be overridden by the `root` option
// * relativeCwd The cwd, relative to the Gruntfile.js
// * componentDirectory The root directory of the component if the cwd is in a valid component
// * inComponent Whether the cwd is in a valid component
// * runDir The componentDirectory or cwd if not in a component, relative to Gruntfile.js
// * fullRunDir The full path to the runDir
const gruntFilePath = fs.realpathSync(process.cwd());
const cwd = getCwd(grunt);
const relativeCwd = path.relative(gruntFilePath, cwd);
const componentDirectory = ComponentList.getOwningComponentDirectory(relativeCwd);
const inComponent = !!componentDirectory;
const inTheme = !!componentDirectory && componentDirectory.startsWith('theme/');
const runDir = inComponent ? componentDirectory : relativeCwd;
const fullRunDir = fs.realpathSync(gruntFilePath + path.sep + runDir);
const {inAMD, amdSrc} = getAmdConfiguration();
const {yuiSrc} = getYuiConfiguration();
const {cssSrc, scssSrc} = getStyleConfiguration();
let files = null;
if (grunt.option('files')) {
// Accept a comma separated list of files to process.
files = grunt.option('files').split(',');
}
grunt.log.debug('============================================================================');
grunt.log.debug(`= Node version: ${process.versions.node}`);
grunt.log.debug(`= grunt version: ${grunt.package.version}`);
grunt.log.debug(`= process.cwd: '` + process.cwd() + `'`);
grunt.log.debug(`= process.env.PWD: '${process.env.PWD}'`);
grunt.log.debug(`= path.sep '${path.sep}'`);
grunt.log.debug('============================================================================');
grunt.log.debug(`= gruntFilePath: '${gruntFilePath}'`);
grunt.log.debug(`= relativeCwd: '${relativeCwd}'`);
grunt.log.debug(`= componentDirectory: '${componentDirectory}'`);
grunt.log.debug(`= inComponent: '${inComponent}'`);
grunt.log.debug(`= runDir: '${runDir}'`);
grunt.log.debug(`= fullRunDir: '${fullRunDir}'`);
grunt.log.debug('============================================================================');
if (inComponent) {
grunt.log.ok(`Running tasks for component directory ${componentDirectory}`);
}
return {
amdSrc,
componentDirectory,
cwd,
cssSrc,
files,
fullRunDir,
gruntFilePath,
inAMD,
inComponent,
inTheme,
relativeCwd,
runDir,
scssSrc,
yuiSrc,
};
};
/**
* Verify tha tthe current NodeJS version matches the required version in package.json.
*
* @param {Grunt} grunt
*/
const verifyNodeVersion = grunt => {
const semver = require('semver');
// Verify the node version is new enough.
var expected = semver.validRange(grunt.file.readJSON('package.json').engines.node);
var actual = semver.valid(process.version);
if (!semver.satisfies(actual, expected)) {
grunt.fail.fatal('Node version not satisfied. Require ' + expected + ', version installed: ' + actual);
}
};
/**
* Grunt configuration.
*
* @param {Grunt} grunt
*/
module.exports = function(grunt) {
// Verify that the Node version meets our requirements.
verifyNodeVersion(grunt);
// Setup the Moodle environemnt within the Grunt object.
grunt.moodleEnv = setupMoodleEnvironment(grunt);
/**
* Add the named task.
*
* @param {string} name
* @param {Grunt} grunt
*/
const addTask = (name, grunt) => {
const path = require('path');
const taskPath = path.resolve(`./.grunt/tasks/${name}.js`);
grunt.log.debug(`Including tasks for ${name} from ${taskPath}`);
require(path.resolve(`./.grunt/tasks/${name}.js`))(grunt);
};
// Startup tasks.
grunt.moodleEnv.startupTasks = [];
// Add Moodle task configuration.
addTask('gherkinlint', grunt);
addTask('ignorefiles', grunt);
addTask('javascript', grunt);
addTask('style', grunt);
addTask('componentlibrary', grunt);
addTask('watch', grunt);
addTask('startup', grunt);
addTask('upgradablelibs', grunt);
// Register the default task.
grunt.registerTask('default', ['startup']);
};
-20
View File
@@ -1,20 +0,0 @@
MOODLE INSTALLATION
===================
Here is a short summary of the installation process (which can take just a few
minutes):
1. Move the Moodle files into your web directory.
2. Create a single database for Moodle to store all its tables in (or choose an
existing database).
3. Visit your Moodle site with a browser. You should be taken to the
install.php script, which will lead you through creating a config.php file
and then setting up Moodle, creating an admin account etc.
4. Set up a cron task to call the file admin/cron.php every minute.
For more information, see <https://docs.moodle.org/en/Installing_Moodle>.
Good luck and have fun!
-48
View File
@@ -1,48 +0,0 @@
# Moodle
<p align="center"><a href="https://moodle.org" target="_blank" title="Moodle Website">
<img src="https://raw.githubusercontent.com/moodle/moodle/main/.github/moodlelogo.svg" alt="The Moodle Logo">
</a></p>
[Moodle][1] is the World's Open Source Learning Platform, widely used around the world by countless universities, schools, companies, and all manner of organisations and individuals.
Moodle is designed to allow educators, administrators and learners to create personalised learning environments with a single robust, secure and integrated system.
## Documentation
- Read our [User documentation][3]
- Discover our [developer documentation][5]
- Take a look at our [demo site][4]
## Community
[moodle.org][1] is the central hub for the Moodle Community, with spaces for educators, administrators and developers to meet and work together.
You may also be interested in:
- attending a [Moodle Moot][6]
- our regular series of [developer meetings][7]
- the [Moodle User Association][8]
## Installation and hosting
Moodle is Free, and Open Source software. You can easily [download Moodle][9] and run it on your own web server, however you may prefer to work with one of our experienced [Moodle Partners][10].
Moodle also offers hosting through both [MoodleCloud][11], and our [partner network][10].
## License
Moodle is provided freely as open source software, under version 3 of the GNU General Public License. For more information on our license see
[1]: https://moodle.org
[2]: https://moodle.com
[3]: https://docs.moodle.org/
[4]: https://sandbox.moodledemo.net/
[5]: https://moodledev.io
[6]: https://moodle.com/events/mootglobal/
[7]: https://moodledev.io/general/community/meetings
[8]: https://moodleassociation.org/
[9]: https://download.moodle.org
[10]: https://moodle.com/partners
[11]: https://moodle.com/cloud
[12]: https://moodledev.io/general/license
+29
View File
@@ -0,0 +1,29 @@
QUICK INSTALL
=============
For the impatient, here is a basic outline of the
installation process, which normally takes me only
a few minutes:
1) Move the Moodle files into your web directory.
2) Create a single database for Moodle to store all
it's tables in (or choose an existing database).
3) Visit your Moodle site with a browser, you should
be taken to the install.php script, which will lead
you through creating a config.php file and then
setting up Moodle, creating an admin account etc.
4) Set up a cron task to call the file admin/cron.php
every five minutes or so.
For more information, see the INSTALL DOCUMENTATION:
http://docs.moodle.org/en/Installing_Moodle
Good luck and have fun!
Martin Dougiamas, Lead Developer
+28 -60
View File
@@ -1,66 +1,34 @@
MOODLE TRADEMARKS POLICY
========================
The Moodle Trademark
--------------------
The brand and word "Moodle" has trade mark protection in many countries around
the world. Various Moodle™ trade marks are owned by either Moodle Pty Ltd or
one of its associated entities. The law obligates trade mark owners to police
their trade marks and prevent the use of confusingly similar names by
third parties.
We have created a more concise and thorough set of Trademark Guidelines
(https://moodle.com/wp-content/uploads/2023/02/Moodle-Trademark-Guidelines-2023-4.pdf)
to help you understand how to comply with Moodle's trade mark requirements.
The Trademark Guidelines will also assist our Moodle Certified Partners and the
community to understand some of the principles that inform Moodle's stance
whenever potential infringement has been detected by us or our community.
We need to be clear about use of the word "Moodle" and how we restrict its use
when promoting commercial Moodle™ branded services. The proper use of
trade marks reliably assures consumers about the quality of the associated
products or services and where they have been derived from. Because the
Moodle LMS is made available under the open source GNU General Public License'
that permits you to modify the copyrighted software, the distribution of such
modified software in combination with Moodle trade marks can potentially
mislead others in the community. To be clear, the GNU GPL does not include an
implied right or licence to use Moodle's trade marks.
We do all this to protect the very business model that allows us to continue
developing various Moodle software solutions for you.
Allowed uses of "Moodle"
------------------------
Moodle Trademark License
------------------------
The following uses don't require any permission at all:
The name Moodle™ is a registered trademark of the Moodle Trust.
* Referring to the software or the Moodle project as the "Moodle™ software"
or the "Moodle™ project"
* Describing your own implementation of the Moodle™ software platform
(including within corporate settings).
* Describing a Moodle-based community hub.
* Describing certain software you've made that integrates with Moodle™
branded software (e.g. a Moodle™ integration feature on another system).
A key part of the business model that allows us to produce and
distribute Moodle as completely Free open source software is that
we restrict the commercial use of the Moodle trademark to those
who have contracted to support Moodle development (Moodle Partners).
Restricted uses of "Moodle"
---------------------------
If you are intending to use the name (and/or logo) to advertise
generic Moodle™ services (eg Moodle Hosting, Moodle Support,
Moodle Certification, Moodle Training, Moodle Consulting,
Moodle Customisation, Moodle Courseware Development, Moodle
Theme design, Moodle Integrations, Moodle Installations, etc)
or as the name of a software package, then you must seek
direct permission in writing from the Moodle Trust via the
moodle.com helpdesk, in accordance with normal trademark
restrictions.
The following uses are generally prohibited without explicit and direct
permission being granted to you by Moodle Pty Ltd. We do this to protect the
Moodle™ project from software and sites which could confuse people. If in
doubt, reach out for clarification at <trademarks@moodle.com>
There are no restrictions on how you use the name in other
contexts (for example, if you use Moodle just to provide
courses then you can use the name freely to refer to it.)
* You can't use the word "Moodle" or any Moodle logos for commercial purposes
without prior written permission from Moodle HQ.
* You can't use "Moodle" in the name of your software (including Mobile apps).
* You can't use "Moodle" in your company name.
* You can't use "Moodle" in your domain name.
* You can't use "Moodle" in advertising-related keywords (such as Adsense).
* You can't use "Moodle" to describe services around Moodle
(such as hosting, training, support, consulting, course creation services,
theme development, customisation, installation, integration, analytics
and certification) that cause consumers to be confused that you are
associated with Moodle HQ if you are not.
This applies even if you do not charge for the services.
Note that usually only Moodle Partners have this permission.
If you aren't sure of a particular case, please ask us via
http://moodle.com/helpdesk: we'll be happy to either provide
you with official permission in writing or help you fix
your wording.
Martin Dougiamas
Executive Director
Moodle Trust
http://moodle.com
-3
View File
@@ -1,3 +0,0 @@
define("core_admin/block_management_table",["exports","./plugin_management_table","core_table/dynamic","core/ajax","core/pending","core/notification"],(function(_exports,_plugin_management_table,_dynamic,_ajax,_pending,_notification){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,_plugin_management_table=_interopRequireDefault(_plugin_management_table),_pending=_interopRequireDefault(_pending);class _default extends _plugin_management_table.default{constructor(){super(),this.addClickHandler(this.handleBlockProtectToggle)}setBlockProtectState(plugin,state){return(0,_ajax.call)([{methodname:"core_admin_set_block_protection",args:{plugin:plugin,state:state}}])[0]}async handleBlockProtectToggle(tableRoot,e){const stateToggle=e.target.closest('[data-action="toggleprotectstate"]');if(stateToggle){e.preventDefault();const pendingPromise=new _pending.default("core_table/dynamic:processAction");await this.setBlockProtectState(stateToggle.dataset.plugin,"1"===stateToggle.dataset.targetState?1:0);const[updatedRoot]=await Promise.all([(0,_dynamic.refreshTableContent)(tableRoot),(0,_notification.fetchNotifications)()]);updatedRoot.querySelector('[data-action="toggleprotectstate"][data-plugin="'.concat(stateToggle.dataset.plugin,'"]')).focus(),pendingPromise.resolve()}}}return _exports.default=_default,_exports.default}));
//# sourceMappingURL=block_management_table.min.js.map
@@ -1 +0,0 @@
{"version":3,"file":"block_management_table.min.js","sources":["../src/block_management_table.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\nimport PluginManagementTable from './plugin_management_table';\nimport {refreshTableContent} from 'core_table/dynamic';\nimport {call as fetchMany} from 'core/ajax';\nimport Pending from 'core/pending';\nimport {fetchNotifications} from 'core/notification';\n\nexport default class extends PluginManagementTable {\n constructor() {\n super();\n this.addClickHandler(this.handleBlockProtectToggle);\n }\n\n /**\n * Set the block protection state.\n *\n * @param {string} plugin\n * @param {number} state\n * @returns {Promise}\n */\n setBlockProtectState(plugin, state) {\n return fetchMany([{\n methodname: 'core_admin_set_block_protection',\n args: {\n plugin,\n state,\n },\n }])[0];\n }\n\n /**\n * Handle toggling of block protection.\n *\n * @param {HTMLElement} tableRoot\n * @param {Event} e\n */\n async handleBlockProtectToggle(tableRoot, e) {\n const stateToggle = e.target.closest('[data-action=\"toggleprotectstate\"]');\n if (stateToggle) {\n e.preventDefault();\n const pendingPromise = new Pending('core_table/dynamic:processAction');\n\n await this.setBlockProtectState(\n stateToggle.dataset.plugin,\n stateToggle.dataset.targetState === '1' ? 1 : 0\n );\n\n const [updatedRoot] = await Promise.all([\n refreshTableContent(tableRoot),\n fetchNotifications(),\n ]);\n\n // Refocus on the link that as pressed in the first place.\n updatedRoot.querySelector(`[data-action=\"toggleprotectstate\"][data-plugin=\"${stateToggle.dataset.plugin}\"]`).focus();\n pendingPromise.resolve();\n }\n }\n}\n"],"names":["PluginManagementTable","constructor","addClickHandler","this","handleBlockProtectToggle","setBlockProtectState","plugin","state","methodname","args","tableRoot","e","stateToggle","target","closest","preventDefault","pendingPromise","Pending","dataset","targetState","updatedRoot","Promise","all","querySelector","focus","resolve"],"mappings":"uhBAqB6BA,iCACzBC,2BAESC,gBAAgBC,KAAKC,0BAU9BC,qBAAqBC,OAAQC,cAClB,cAAU,CAAC,CACdC,WAAY,kCACZC,KAAM,CACFH,OAAAA,OACAC,MAAAA,UAEJ,kCASuBG,UAAWC,SAChCC,YAAcD,EAAEE,OAAOC,QAAQ,yCACjCF,YAAa,CACbD,EAAEI,uBACIC,eAAiB,IAAIC,iBAAQ,0CAE7Bd,KAAKE,qBACPO,YAAYM,QAAQZ,OACgB,MAApCM,YAAYM,QAAQC,YAAsB,EAAI,SAG3CC,mBAAqBC,QAAQC,IAAI,EACpC,gCAAoBZ,YACpB,wCAIJU,YAAYG,wEAAiEX,YAAYM,QAAQZ,cAAYkB,QAC7GR,eAAeS"}
-10
View File
@@ -1,10 +0,0 @@
define("core_admin/bulk_user_actions",["exports","core_reportbuilder/local/selectors","core_table/local/dynamic/events","core_form/changechecker","core/custom_interaction_events","jquery"],(function(_exports,reportSelectors,tableEvents,FormChangeChecker,CustomEvents,_jquery){var obj;function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}function _interopRequireWildcard(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}return newObj.default=obj,cache&&cache.set(obj,newObj),newObj}
/**
* Add bulk actions to the users list report
*
* @module core_admin/bulk_user_actions
* @copyright 2024 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,reportSelectors=_interopRequireWildcard(reportSelectors),tableEvents=_interopRequireWildcard(tableEvents),FormChangeChecker=_interopRequireWildcard(FormChangeChecker),CustomEvents=_interopRequireWildcard(CustomEvents),_jquery=(obj=_jquery)&&obj.__esModule?obj:{default:obj};const Selectors_bulkActionsForm="form#user-bulk-action-form",Selectors_userReportWrapper='[data-region="report-user-list-wrapper"]',Selectors_checkbox='input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="slave"]',Selectors_masterCheckbox='input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="master"]',Selectors_checkedRows='[data-togglegroup="report-select-all"][data-toggle="slave"]:checked';_exports.init=()=>{var _userBulkForm$closest;const userBulkForm=document.querySelector(Selectors_bulkActionsForm),userReport=null==userBulkForm||null===(_userBulkForm$closest=userBulkForm.closest(Selectors_userReportWrapper))||void 0===_userBulkForm$closest?void 0:_userBulkForm$closest.querySelector(reportSelectors.regions.report);if(!userBulkForm||!userReport)return;const actionSelect=userBulkForm.querySelector("select");CustomEvents.define(actionSelect,[CustomEvents.events.accessibleChange]),(0,_jquery.default)(actionSelect).on(CustomEvents.events.accessibleChange,(event=>{if(event.target.value&&"0"!=="".concat(event.target.value)){const e=new Event("submit",{cancelable:!0});userBulkForm.dispatchEvent(e),e.defaultPrevented||(FormChangeChecker.markFormSubmitted(userBulkForm),userBulkForm.submit())}}));const updateUserIds=()=>{const selectedUsers=[...userReport.querySelectorAll(Selectors_checkedRows)],selectedUserIds=selectedUsers.map((check=>parseInt(check.value)));userBulkForm.querySelector('[name="userids"]').value=selectedUserIds.join(","),actionSelect.disabled=0===selectedUsers.length,actionSelect.disabled&&(actionSelect.value="0");const selectedUsersNames=selectedUsers.map((check=>document.querySelector('label[for="'.concat(check.id,'"]')).textContent));userBulkForm.data={userids:selectedUserIds,usernames:selectedUsersNames}};updateUserIds(),document.addEventListener("change",(event=>{(event.target.matches(Selectors_checkbox)||event.target.matches(Selectors_masterCheckbox))&&userReport.contains(event.target)&&updateUserIds()})),document.addEventListener(tableEvents.tableContentRefreshed,(event=>{userReport.contains(event.target)&&updateUserIds()}))}}));
//# sourceMappingURL=bulk_user_actions.min.js.map
File diff suppressed because one or more lines are too long
-3
View File
@@ -1,3 +0,0 @@
define("core_admin/plugin_management_table",["exports","core_table/dynamic","core_table/local/dynamic/selectors","core/ajax","core/pending","core/notification"],(function(_exports,_dynamic,Selectors,_ajax,_pending,_notification){var obj;function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.default=void 0,Selectors=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}(Selectors),_pending=(obj=_pending)&&obj.__esModule?obj:{default:obj};let watching=!1;return _exports.default=class{constructor(){!function(obj,key,value){key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value}(this,"clickHandlers",[]),this.addClickHandler(this.handleStateToggle),this.addClickHandler(this.handleMoveUpDown),this.registerEventListeners()}static init(){watching||(watching=!0,new this)}addClickHandler(handler){this.clickHandlers.push(handler.bind(this))}registerEventListeners(){document.addEventListener("click",function(e){const tableRoot=this.getTableRoot(e);tableRoot&&this.clickHandlers.forEach((handler=>handler(tableRoot,e)))}.bind(this))}getTableRoot(e){const tableRoot=e.target.closest(Selectors.main.region);return tableRoot||!1}setPluginState(methodname,plugin,state){return(0,_ajax.call)([{methodname:methodname,args:{plugin:plugin,state:state}}])[0]}setPluginOrder(methodname,plugin,direction){return(0,_ajax.call)([{methodname:methodname,args:{plugin:plugin,direction:direction}}])[0]}async handleStateToggle(tableRoot,e){const stateToggle=e.target.closest('[data-action="togglestate"][data-toggle-method]');if(stateToggle){e.preventDefault();const pendingPromise=new _pending.default("core_table/dynamic:togglestate");await this.setPluginState(stateToggle.dataset.toggleMethod,stateToggle.dataset.plugin,"1"===stateToggle.dataset.state?0:1);const[updatedRoot]=await Promise.all([(0,_dynamic.refreshTableContent)(tableRoot),(0,_notification.fetchNotifications)()]);updatedRoot.querySelector('[data-action="togglestate"][data-plugin="'.concat(stateToggle.dataset.plugin,'"]')).focus(),pendingPromise.resolve()}}async handleMoveUpDown(tableRoot,e){const actionLink=e.target.closest('[data-action="move"][data-method][data-direction]');if(!actionLink)return;e.preventDefault();const pendingPromise=new _pending.default("core_table/dynamic:processAction");await this.setPluginOrder(actionLink.dataset.method,actionLink.dataset.plugin,"up"===actionLink.dataset.direction?-1:1);const[updatedRoot]=await Promise.all([(0,_dynamic.refreshTableContent)(tableRoot),(0,_notification.fetchNotifications)()]),exactMatch=updatedRoot.querySelector('[data-action="move"][data-plugin="'.concat(actionLink.dataset.plugin,'"][data-direction="').concat(actionLink.dataset.direction,'"]'));var _updatedRoot$querySel;exactMatch?exactMatch.focus():null===(_updatedRoot$querySel=updatedRoot.querySelector('[data-action="move"][data-plugin="'.concat(actionLink.dataset.plugin,'"]')))||void 0===_updatedRoot$querySel||_updatedRoot$querySel.focus();pendingPromise.resolve()}},_exports.default}));
//# sourceMappingURL=plugin_management_table.min.js.map
File diff suppressed because one or more lines are too long
-10
View File
@@ -1,10 +0,0 @@
define("core_admin/themeselector/preview_modal",["exports","core/modal_events","core/modal_cancel","core/modal_save_cancel","core/notification","core/templates","core/str"],(function(_exports,_modal_events,_modal_cancel,_modal_save_cancel,_notification,_templates,_str){function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}
/**
* Modal for theme previews.
*
* @module core_admin/themeselector/preview_modal
* @copyright 2023 David Woloszyn <david.woloszyn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,_modal_events=_interopRequireDefault(_modal_events),_modal_cancel=_interopRequireDefault(_modal_cancel),_modal_save_cancel=_interopRequireDefault(_modal_save_cancel),_notification=_interopRequireDefault(_notification),_templates=_interopRequireDefault(_templates);const SELECTORS_THEMES_CONTAINER="themelist",SELECTORS_PREVIEW='[data-action="preview"]';_exports.init=()=>{registerListenerEvents()};const registerListenerEvents=()=>{document.addEventListener("click",(e=>{const preview=e.target.closest(SELECTORS_PREVIEW);preview&&buildModal(preview).catch(_notification.default.exception)}))},buildModal=async element=>{let description=await(0,_str.getString)("choosereadme","theme_"+element.getAttribute("data-choose"));const themesContainer=document.getElementById(SELECTORS_THEMES_CONTAINER),definedInConfig=parseInt(themesContainer.dataset.definedinconfig),data={name:element.getAttribute("data-name"),image:element.getAttribute("data-image"),description:description.replace(/<[^>]+>/g," "),current:element.getAttribute("data-current"),actionurl:element.getAttribute("data-actionurl"),choose:element.getAttribute("data-choose"),sesskey:element.getAttribute("data-sesskey"),definedinconfig:definedInConfig};let modalTemplate=_modal_save_cancel.default;(data.current||data.definedinconfig)&&(modalTemplate=_modal_cancel.default);const modal=await modalTemplate.create({title:data.name,body:_templates.default.render("core_admin/themeselector/theme_preview_modal",data),large:!0,buttons:{save:(0,_str.getString)("selecttheme","moodle"),cancel:(0,_str.getString)("closebuttontitle","moodle")},show:!0});modal.getRoot().on(_modal_events.default.save,(()=>{modal.getRoot().find("form").submit()}))}}));
//# sourceMappingURL=preview_modal.min.js.map
@@ -1 +0,0 @@
{"version":3,"file":"preview_modal.min.js","sources":["../../src/themeselector/preview_modal.js"],"sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Modal for theme previews.\n *\n * @module core_admin/themeselector/preview_modal\n * @copyright 2023 David Woloszyn <david.woloszyn@moodle.com>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport ModalEvents from 'core/modal_events';\nimport ModalCancel from 'core/modal_cancel';\nimport ModalSaveCancel from 'core/modal_save_cancel';\nimport Notification from 'core/notification';\nimport Templates from 'core/templates';\nimport {getString} from 'core/str';\n\nconst SELECTORS = {\n THEMES_CONTAINER: 'themelist',\n PREVIEW: '[data-action=\"preview\"]',\n};\n\n/**\n * Entrypoint of the js.\n *\n * @method init\n */\nexport const init = () => {\n registerListenerEvents();\n};\n\n/**\n * Register theme related event listeners.\n *\n * @method registerListenerEvents\n */\nconst registerListenerEvents = () => {\n document.addEventListener('click', (e) => {\n const preview = e.target.closest(SELECTORS.PREVIEW);\n if (preview) {\n buildModal(preview).catch(Notification.exception);\n }\n });\n};\n\n/**\n * Build the modal with the provided data.\n *\n * @method buildModal\n * @param {object} element\n */\nconst buildModal = async(element) => {\n\n // This string can be long. We will fetch it with JS as opposed to passing it as an attribute.\n let description = await getString('choosereadme', 'theme_' + element.getAttribute('data-choose'));\n\n const themesContainer = document.getElementById(SELECTORS.THEMES_CONTAINER);\n const definedInConfig = parseInt(themesContainer.dataset.definedinconfig);\n // Prepare data for modal.\n const data = {\n name: element.getAttribute('data-name'),\n image: element.getAttribute('data-image'),\n description: description.replace(/<[^>]+>/g, ' '), // Strip out HTML tags.\n current: element.getAttribute('data-current'),\n actionurl: element.getAttribute('data-actionurl'),\n choose: element.getAttribute('data-choose'),\n sesskey: element.getAttribute('data-sesskey'),\n definedinconfig: definedInConfig,\n };\n\n // Determine which modal template we should use.\n let modalTemplate = ModalSaveCancel;\n if (data.current || data.definedinconfig) {\n modalTemplate = ModalCancel;\n }\n\n const modal = await modalTemplate.create({\n title: data.name,\n body: Templates.render('core_admin/themeselector/theme_preview_modal', data),\n large: true,\n buttons: {\n 'save': getString('selecttheme', 'moodle'),\n 'cancel': getString('closebuttontitle', 'moodle'),\n },\n show: true,\n });\n\n modal.getRoot().on(ModalEvents.save, () => {\n modal.getRoot().find('form').submit();\n });\n};\n"],"names":["SELECTORS","registerListenerEvents","document","addEventListener","e","preview","target","closest","buildModal","catch","Notification","exception","async","description","element","getAttribute","themesContainer","getElementById","definedInConfig","parseInt","dataset","definedinconfig","data","name","image","replace","current","actionurl","choose","sesskey","modalTemplate","ModalSaveCancel","ModalCancel","modal","create","title","body","Templates","render","large","buttons","show","getRoot","on","ModalEvents","save","find","submit"],"mappings":";;;;;;;gWA8BMA,2BACgB,YADhBA,kBAEO,wCAQO,KAChBC,gCAQEA,uBAAyB,KAC3BC,SAASC,iBAAiB,SAAUC,UAC1BC,QAAUD,EAAEE,OAAOC,QAAQP,mBAC7BK,SACAG,WAAWH,SAASI,MAAMC,sBAAaC,eAW7CH,WAAaI,MAAAA,cAGXC,kBAAoB,kBAAU,eAAgB,SAAWC,QAAQC,aAAa,sBAE5EC,gBAAkBd,SAASe,eAAejB,4BAC1CkB,gBAAkBC,SAASH,gBAAgBI,QAAQC,iBAEnDC,KAAO,CACTC,KAAMT,QAAQC,aAAa,aAC3BS,MAAOV,QAAQC,aAAa,cAC5BF,YAAaA,YAAYY,QAAQ,WAAY,KAC7CC,QAASZ,QAAQC,aAAa,gBAC9BY,UAAWb,QAAQC,aAAa,kBAChCa,OAAQd,QAAQC,aAAa,eAC7Bc,QAASf,QAAQC,aAAa,gBAC9BM,gBAAiBH,qBAIjBY,cAAgBC,4BAChBT,KAAKI,SAAWJ,KAAKD,mBACrBS,cAAgBE,6BAGdC,YAAcH,cAAcI,OAAO,CACrCC,MAAOb,KAAKC,KACZa,KAAMC,mBAAUC,OAAO,+CAAgDhB,MACvEiB,OAAO,EACPC,QAAS,OACG,kBAAU,cAAe,kBACvB,kBAAU,mBAAoB,WAE5CC,MAAM,IAGVR,MAAMS,UAAUC,GAAGC,sBAAYC,MAAM,KACjCZ,MAAMS,UAAUI,KAAK,QAAQC"}
-72
View File
@@ -1,72 +0,0 @@
// 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/>.
import PluginManagementTable from './plugin_management_table';
import {refreshTableContent} from 'core_table/dynamic';
import {call as fetchMany} from 'core/ajax';
import Pending from 'core/pending';
import {fetchNotifications} from 'core/notification';
export default class extends PluginManagementTable {
constructor() {
super();
this.addClickHandler(this.handleBlockProtectToggle);
}
/**
* Set the block protection state.
*
* @param {string} plugin
* @param {number} state
* @returns {Promise}
*/
setBlockProtectState(plugin, state) {
return fetchMany([{
methodname: 'core_admin_set_block_protection',
args: {
plugin,
state,
},
}])[0];
}
/**
* Handle toggling of block protection.
*
* @param {HTMLElement} tableRoot
* @param {Event} e
*/
async handleBlockProtectToggle(tableRoot, e) {
const stateToggle = e.target.closest('[data-action="toggleprotectstate"]');
if (stateToggle) {
e.preventDefault();
const pendingPromise = new Pending('core_table/dynamic:processAction');
await this.setBlockProtectState(
stateToggle.dataset.plugin,
stateToggle.dataset.targetState === '1' ? 1 : 0
);
const [updatedRoot] = await Promise.all([
refreshTableContent(tableRoot),
fetchNotifications(),
]);
// Refocus on the link that as pressed in the first place.
updatedRoot.querySelector(`[data-action="toggleprotectstate"][data-plugin="${stateToggle.dataset.plugin}"]`).focus();
pendingPromise.resolve();
}
}
}
-97
View File
@@ -1,97 +0,0 @@
// 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/>.
/**
* Add bulk actions to the users list report
*
* @module core_admin/bulk_user_actions
* @copyright 2024 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import * as reportSelectors from 'core_reportbuilder/local/selectors';
import * as tableEvents from 'core_table/local/dynamic/events';
import * as FormChangeChecker from 'core_form/changechecker';
import * as CustomEvents from 'core/custom_interaction_events';
import jQuery from 'jquery';
const Selectors = {
bulkActionsForm: 'form#user-bulk-action-form',
userReportWrapper: '[data-region="report-user-list-wrapper"]',
checkbox: 'input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="slave"]',
masterCheckbox: 'input[type="checkbox"][data-togglegroup="report-select-all"][data-toggle="master"]',
checkedRows: '[data-togglegroup="report-select-all"][data-toggle="slave"]:checked',
};
/**
* Initialise module
*/
export const init = () => {
const userBulkForm = document.querySelector(Selectors.bulkActionsForm);
const userReport = userBulkForm?.closest(Selectors.userReportWrapper)?.querySelector(reportSelectors.regions.report);
if (!userBulkForm || !userReport) {
return;
}
const actionSelect = userBulkForm.querySelector('select');
CustomEvents.define(actionSelect, [CustomEvents.events.accessibleChange]);
jQuery(actionSelect).on(CustomEvents.events.accessibleChange, event => {
if (event.target.value && `${event.target.value}` !== "0") {
const e = new Event('submit', {cancelable: true});
userBulkForm.dispatchEvent(e);
if (!e.defaultPrevented) {
FormChangeChecker.markFormSubmitted(userBulkForm);
userBulkForm.submit();
}
}
});
// Every time the checkboxes in the report are changed, update the list of users in the form values
// and enable/disable the action select.
const updateUserIds = () => {
const selectedUsers = [...userReport.querySelectorAll(Selectors.checkedRows)];
const selectedUserIds = selectedUsers.map(check => parseInt(check.value));
userBulkForm.querySelector('[name="userids"]').value = selectedUserIds.join(',');
// Disable the action selector if nothing selected, and reset the current selection.
actionSelect.disabled = selectedUsers.length === 0;
if (actionSelect.disabled) {
actionSelect.value = "0";
}
const selectedUsersNames = selectedUsers.map(check => document.querySelector(`label[for="${check.id}"]`).textContent);
// Add the user ids and names to the form data attributes so they can be available from the
// other JS modules that listen to the form submit event.
userBulkForm.data = {userids: selectedUserIds, usernames: selectedUsersNames};
};
updateUserIds();
document.addEventListener('change', event => {
// When checkboxes are checked next to individual users or the master toggle (Select all/none).
if ((event.target.matches(Selectors.checkbox) || event.target.matches(Selectors.masterCheckbox))
&& userReport.contains(event.target)) {
updateUserIds();
}
});
document.addEventListener(tableEvents.tableContentRefreshed, event => {
// When the report contents is updated (i.e. page is changed, filters applied, etc).
if (userReport.contains(event.target)) {
updateUserIds();
}
});
};
-179
View File
@@ -1,179 +0,0 @@
// 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/>.
import {refreshTableContent} from 'core_table/dynamic';
import * as Selectors from 'core_table/local/dynamic/selectors';
import {call as fetchMany} from 'core/ajax';
import Pending from 'core/pending';
import {fetchNotifications} from 'core/notification';
let watching = false;
export default class {
/**
* @property {function[]} clickHandlers a list of handlers to call on click.
*/
clickHandlers = [];
constructor() {
this.addClickHandler(this.handleStateToggle);
this.addClickHandler(this.handleMoveUpDown);
this.registerEventListeners();
}
/**
* Initialise an instance of the class.
*
* This is just a way of making it easier to initialise an instance of the class from PHP.
*/
static init() {
if (watching) {
return;
}
watching = true;
new this();
}
/**
* Add a click handler to the list of handlers.
*
* @param {Function} handler A handler to call on a click event
*/
addClickHandler(handler) {
this.clickHandlers.push(handler.bind(this));
}
/**
* Register the event listeners for this instance.
*/
registerEventListeners() {
document.addEventListener('click', function(e) {
const tableRoot = this.getTableRoot(e);
if (!tableRoot) {
return;
}
this.clickHandlers.forEach((handler) => handler(tableRoot, e));
}.bind(this));
}
/**
* Get the table root from an event.
*
* @param {Event} e
* @returns {HTMLElement|bool}
*/
getTableRoot(e) {
const tableRoot = e.target.closest(Selectors.main.region);
if (!tableRoot) {
return false;
}
return tableRoot;
}
/**
* Set the plugin state (enabled or disabled)
*
* @param {string} methodname The web service to call
* @param {string} plugin The name of the plugin to set the state for
* @param {number} state The state to set
* @returns {Promise}
*/
setPluginState(methodname, plugin, state) {
return fetchMany([{
methodname,
args: {
plugin,
state,
},
}])[0];
}
setPluginOrder(methodname, plugin, direction) {
return fetchMany([{
methodname,
args: {
plugin,
direction,
},
}])[0];
}
/**
* Handle state toggling.
*
* @param {HTMLElement} tableRoot
* @param {Event} e
*/
async handleStateToggle(tableRoot, e) {
const stateToggle = e.target.closest('[data-action="togglestate"][data-toggle-method]');
if (stateToggle) {
e.preventDefault();
const pendingPromise = new Pending('core_table/dynamic:togglestate');
await this.setPluginState(
stateToggle.dataset.toggleMethod,
stateToggle.dataset.plugin,
stateToggle.dataset.state === '1' ? 0 : 1
);
const [updatedRoot] = await Promise.all([
refreshTableContent(tableRoot),
fetchNotifications(),
]);
// Refocus on the link that as pressed in the first place.
updatedRoot.querySelector(`[data-action="togglestate"][data-plugin="${stateToggle.dataset.plugin}"]`).focus();
pendingPromise.resolve();
}
}
async handleMoveUpDown(tableRoot, e) {
const actionLink = e.target.closest('[data-action="move"][data-method][data-direction]');
if (!actionLink) {
return;
}
e.preventDefault();
const pendingPromise = new Pending('core_table/dynamic:processAction');
await this.setPluginOrder(
actionLink.dataset.method,
actionLink.dataset.plugin,
actionLink.dataset.direction === 'up' ? -1 : 1,
);
const [updatedRoot] = await Promise.all([
refreshTableContent(tableRoot),
fetchNotifications(),
]);
// Refocus on the link that as pressed in the first place.
const exactMatch = updatedRoot.querySelector(
`[data-action="move"][data-plugin="${actionLink.dataset.plugin}"][data-direction="${actionLink.dataset.direction}"]`
);
if (exactMatch) {
exactMatch.focus();
} else {
// The move link is not present anymore, so we need to focus on the other one.
updatedRoot.querySelector(`[data-action="move"][data-plugin="${actionLink.dataset.plugin}"]`)?.focus();
}
pendingPromise.resolve();
}
}
@@ -1,104 +0,0 @@
// 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/>.
/**
* Modal for theme previews.
*
* @module core_admin/themeselector/preview_modal
* @copyright 2023 David Woloszyn <david.woloszyn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import ModalEvents from 'core/modal_events';
import ModalCancel from 'core/modal_cancel';
import ModalSaveCancel from 'core/modal_save_cancel';
import Notification from 'core/notification';
import Templates from 'core/templates';
import {getString} from 'core/str';
const SELECTORS = {
THEMES_CONTAINER: 'themelist',
PREVIEW: '[data-action="preview"]',
};
/**
* Entrypoint of the js.
*
* @method init
*/
export const init = () => {
registerListenerEvents();
};
/**
* Register theme related event listeners.
*
* @method registerListenerEvents
*/
const registerListenerEvents = () => {
document.addEventListener('click', (e) => {
const preview = e.target.closest(SELECTORS.PREVIEW);
if (preview) {
buildModal(preview).catch(Notification.exception);
}
});
};
/**
* Build the modal with the provided data.
*
* @method buildModal
* @param {object} element
*/
const buildModal = async(element) => {
// This string can be long. We will fetch it with JS as opposed to passing it as an attribute.
let description = await getString('choosereadme', 'theme_' + element.getAttribute('data-choose'));
const themesContainer = document.getElementById(SELECTORS.THEMES_CONTAINER);
const definedInConfig = parseInt(themesContainer.dataset.definedinconfig);
// Prepare data for modal.
const data = {
name: element.getAttribute('data-name'),
image: element.getAttribute('data-image'),
description: description.replace(/<[^>]+>/g, ' '), // Strip out HTML tags.
current: element.getAttribute('data-current'),
actionurl: element.getAttribute('data-actionurl'),
choose: element.getAttribute('data-choose'),
sesskey: element.getAttribute('data-sesskey'),
definedinconfig: definedInConfig,
};
// Determine which modal template we should use.
let modalTemplate = ModalSaveCancel;
if (data.current || data.definedinconfig) {
modalTemplate = ModalCancel;
}
const modal = await modalTemplate.create({
title: data.name,
body: Templates.render('core_admin/themeselector/theme_preview_modal', data),
large: true,
buttons: {
'save': getString('selecttheme', 'moodle'),
'cancel': getString('closebuttontitle', 'moodle'),
},
show: true,
});
modal.getRoot().on(ModalEvents.save, () => {
modal.getRoot().find('form').submit();
});
};
-113
View File
@@ -1,113 +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/>.
/**
* Allows admin to configure antiviruses.
*
* @package core_antivirus
* @copyright 2015 Ruslan Kabalin, Lancaster University.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
$action = required_param('action', PARAM_ALPHANUMEXT);
$antivirus = required_param('antivirus', PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/admin/antiviruses.php', array('action' => $action, 'antivirus' => $antivirus));
$PAGE->set_context(context_system::instance());
require_admin();
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageantiviruses";
// Get currently installed and enabled antivirus plugins.
$availableantiviruses = \core\antivirus\manager::get_available();
if (!empty($antivirus) and empty($availableantiviruses[$antivirus])) {
redirect ($returnurl);
}
$activeantiviruses = explode(',', $CFG->antiviruses);
foreach ($activeantiviruses as $key => $active) {
if (empty($availableantiviruses[$active])) {
unset($activeantiviruses[$key]);
}
}
if (!confirm_sesskey()) {
redirect($returnurl);
}
$needsupdate = false;
switch ($action) {
case 'disable':
// Remove from enabled list.
$class = \core_plugin_manager::resolve_plugininfo_class('antivirus');
$class::enable_plugin($antivirus, false);
break;
case 'enable':
// Add to enabled list.
if (!in_array($antivirus, $activeantiviruses)) {
$class = \core_plugin_manager::resolve_plugininfo_class('antivirus');
$class::enable_plugin($antivirus, true);
}
break;
case 'down':
$key = array_search($antivirus, $activeantiviruses);
// Check auth plugin is valid.
if ($key !== false) {
// Move down the list.
if ($key < (count($activeantiviruses) - 1)) {
$fsave = $activeantiviruses[$key];
$activeantiviruses[$key] = $activeantiviruses[$key + 1];
$activeantiviruses[$key + 1] = $fsave;
$needsupdate = true;
}
}
break;
case 'up':
$key = array_search($antivirus, $activeantiviruses);
// Check auth is valid.
if ($key !== false) {
// Move up the list.
if ($key >= 1) {
$fsave = $activeantiviruses[$key];
$activeantiviruses[$key] = $activeantiviruses[$key - 1];
$activeantiviruses[$key - 1] = $fsave;
$needsupdate = true;
}
}
break;
default:
break;
}
if ($needsupdate) {
$new = implode(',', $activeantiviruses);
add_to_config_log('antiviruses', $CFG->antiviruses, $new, 'core');
set_config('antiviruses', $new);
core_plugin_manager::reset_caches();
}
redirect ($returnurl);
+28 -17
View File
@@ -11,13 +11,14 @@ require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
require_admin();
require_login();
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
$returnurl = new moodle_url('/admin/settings.php', array('section'=>'manageauths'));
$PAGE->set_url($returnurl);
$action = optional_param('action', '', PARAM_ALPHANUMEXT);
$action = optional_param('action', '', PARAM_ACTION);
$auth = optional_param('auth', '', PARAM_PLUGIN);
get_enabled_auth_plugins(true); // fix the list of enabled auths
@@ -28,7 +29,7 @@ if (empty($CFG->auth)) {
}
if (!empty($auth) and !exists_auth_plugin($auth)) {
throw new \moodle_exception('pluginnotinstalled', 'auth', $returnurl, $auth);
print_error('pluginnotinstalled', 'auth', $returnurl, $auth);
}
////////////////////////////////////////////////////////////////////////////////
@@ -40,31 +41,41 @@ if (!confirm_sesskey()) {
switch ($action) {
case 'disable':
// Remove from enabled list.
$class = \core_plugin_manager::resolve_plugininfo_class('auth');
$class::enable_plugin($auth, false);
// remove from enabled list
$key = array_search($auth, $authsenabled);
if ($key !== false) {
unset($authsenabled[$key]);
set_config('auth', implode(',', $authsenabled));
}
if ($auth == $CFG->registerauth) {
set_config('registerauth', '');
}
session_gc(); // remove stale sessions
break;
case 'enable':
// Add to enabled list.
$class = \core_plugin_manager::resolve_plugininfo_class('auth');
$class::enable_plugin($auth, true);
// add to enabled list
if (!in_array($auth, $authsenabled)) {
$authsenabled[] = $auth;
$authsenabled = array_unique($authsenabled);
set_config('auth', implode(',', $authsenabled));
}
session_gc(); // remove stale sessions
break;
case 'down':
$key = array_search($auth, $authsenabled);
// check auth plugin is valid
if ($key === false) {
throw new \moodle_exception('pluginnotenabled', 'auth', $returnurl, $auth);
print_error('pluginnotenabled', 'auth', $returnurl, $auth);
}
// move down the list
if ($key < (count($authsenabled) - 1)) {
$fsave = $authsenabled[$key];
$authsenabled[$key] = $authsenabled[$key + 1];
$authsenabled[$key + 1] = $fsave;
$value = implode(',', $authsenabled);
add_to_config_log('auth', $CFG->auth, $value, 'core');
set_config('auth', $value);
set_config('auth', implode(',', $authsenabled));
}
break;
@@ -72,16 +83,14 @@ switch ($action) {
$key = array_search($auth, $authsenabled);
// check auth is valid
if ($key === false) {
throw new \moodle_exception('pluginnotenabled', 'auth', $returnurl, $auth);
print_error('pluginnotenabled', 'auth', $returnurl, $auth);
}
// move up the list
if ($key >= 1) {
$fsave = $authsenabled[$key];
$authsenabled[$key] = $authsenabled[$key - 1];
$authsenabled[$key - 1] = $fsave;
$value = implode(',', $authsenabled);
add_to_config_log('auth', $CFG->auth, $value, 'core');
set_config('auth', $value);
set_config('auth', implode(',', $authsenabled));
}
break;
@@ -90,3 +99,5 @@ switch ($action) {
}
redirect($returnurl);
+179
View File
@@ -0,0 +1,179 @@
<?php
/**
* Edit configuration for an individual auth plugin
*/
require_once '../config.php';
require_once $CFG->libdir.'/adminlib.php';
$auth = required_param('auth', PARAM_PLUGIN);
$PAGE->set_pagetype('admin-auth-' . $auth);
admin_externalpage_setup('authsetting'.$auth);
$authplugin = get_auth_plugin($auth);
$err = array();
$returnurl = "$CFG->wwwroot/$CFG->admin/settings.php?section=manageauths";
// save configuration changes
if ($frm = data_submitted() and confirm_sesskey()) {
$authplugin->validate_form($frm, $err);
if (count($err) == 0) {
// save plugin config
if ($authplugin->process_config($frm)) {
// save field lock configuration
foreach ($frm as $name => $value) {
if (preg_match('/^lockconfig_(.+?)$/', $name, $matches)) {
$plugin = "auth/$auth";
$name = $matches[1];
set_config($name, $value, $plugin);
}
}
redirect($returnurl);
exit;
}
} else {
foreach ($err as $key => $value) {
$focus = "form.$key";
}
}
} else {
$frmlegacystyle = get_config('auth/'.$auth);
$frmnewstyle = get_config('auth_'.$auth);
$frm = (object)array_merge((array)$frmlegacystyle, (array)$frmnewstyle);
}
$user_fields = $authplugin->userfields;
//$user_fields = array("firstname", "lastname", "email", "phone1", "phone2", "institution", "department", "address", "city", "country", "description", "idnumber", "lang");
/// Get the auth title (from core or own auth lang files)
$authtitle = $authplugin->get_title();
/// Get the auth descriptions (from core or own auth lang files)
$authdescription = $authplugin->get_description();
// output configuration form
echo $OUTPUT->header();
// choose an authentication method
echo "<form id=\"authmenu\" method=\"post\" action=\"auth_config.php\">\n";
echo "<div>\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"".sesskey()."\" />\n";
echo "<input type=\"hidden\" name=\"auth\" value=\"".$auth."\" />\n";
// auth plugin description
echo $OUTPUT->box_start();
echo $OUTPUT->heading($authtitle);
echo $OUTPUT->box_start('informationbox');
echo $authdescription;
echo $OUTPUT->box_end();
echo "<hr />\n";
$authplugin->config_form($frm, $err, $user_fields);
echo $OUTPUT->box_end();
echo '<p style="text-align: center"><input type="submit" value="' . get_string("savechanges") . "\" /></p>\n";
echo "</div>\n";
echo "</form>\n";
echo $OUTPUT->footer();
exit;
/// Functions /////////////////////////////////////////////////////////////////
// Good enough for most auth plugins
// but some may want a custom one if they are offering
// other options
// Note: lockconfig_ fields have special handling.
function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, $updateopts) {
global $OUTPUT;
echo '<tr><td colspan="3">';
if ($retrieveopts) {
echo $OUTPUT->heading(get_string('auth_data_mapping', 'auth'));
} else {
echo $OUTPUT->heading(get_string('auth_fieldlocks', 'auth'));
}
echo '</td></tr>';
$lockoptions = array ('unlocked' => get_string('unlocked', 'auth'),
'unlockedifempty' => get_string('unlockedifempty', 'auth'),
'locked' => get_string('locked', 'auth'));
$updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'),
'onlogin' => get_string('update_onlogin', 'auth'));
$updateextoptions = array('0' => get_string('update_never', 'auth'),
'1' => get_string('update_onupdate', 'auth'));
$pluginconfig = get_config("auth/$auth");
// helptext is on a field with rowspan
if (empty($helptext)) {
$helptext = '&nbsp;';
}
foreach ($user_fields as $field) {
// Define some vars we'll work with
if (!isset($pluginconfig->{"field_map_$field"})) {
$pluginconfig->{"field_map_$field"} = '';
}
if (!isset($pluginconfig->{"field_updatelocal_$field"})) {
$pluginconfig->{"field_updatelocal_$field"} = '';
}
if (!isset($pluginconfig->{"field_updateremote_$field"})) {
$pluginconfig->{"field_updateremote_$field"} = '';
}
if (!isset($pluginconfig->{"field_lock_$field"})) {
$pluginconfig->{"field_lock_$field"} = '';
}
// define the fieldname we display to the user
$fieldname = $field;
if ($fieldname === 'lang') {
$fieldname = get_string('language');
} elseif (preg_match('/^(.+?)(\d+)$/', $fieldname, $matches)) {
$fieldname = get_string($matches[1]) . ' ' . $matches[2];
} elseif ($fieldname == 'url') {
$fieldname = get_string('webpage');
} else {
$fieldname = get_string($fieldname);
}
if ($retrieveopts) {
$varname = 'field_map_' . $field;
echo '<tr valign="top"><td align="right">';
echo '<label for="lockconfig_'.$varname.'">'.$fieldname.'</label>';
echo '</td><td>';
echo "<input id=\"lockconfig_{$varname}\" name=\"lockconfig_{$varname}\" type=\"text\" size=\"30\" value=\"{$pluginconfig->$varname}\" />";
echo '<div style="text-align: right">';
echo '<label for="menulockconfig_field_updatelocal_'.$field.'">'.get_string('auth_updatelocal', 'auth') . '</label>&nbsp;';
echo html_writer::select($updatelocaloptions, "lockconfig_field_updatelocal_{$field}", $pluginconfig->{"field_updatelocal_$field"}, false);
echo '<br />';
if ($updateopts) {
echo '<label for="menulockconfig_field_updateremote_'.$field.'">'.get_string('auth_updateremote', 'auth') . '</label>&nbsp;';
echo html_writer::select($updateextoptions, "lockconfig_field_updateremote_{$field}", $pluginconfig->{"field_updateremote_$field"}, false);
echo '<br />';
}
echo '<label for="menulockconfig_field_lock_'.$field.'">'.get_string('auth_fieldlock', 'auth') . '</label>&nbsp;';
echo html_writer::select($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false);
echo '</div>';
} else {
echo '<tr valign="top"><td align="right">';
echo '<label for="menulockconfig_field_lock_'.$field.'">'.$fieldname.'</label>';
echo '</td><td>';
echo html_writer::select($lockoptions, "lockconfig_field_lock_{$field}", $pluginconfig->{"field_lock_$field"}, false);
}
echo '</td>';
if (!empty($helptext)) {
echo '<td rowspan="' . count($user_fields) . '">' . $helptext . '</td>';
$helptext = '';
}
echo '</tr>';
}
}
+76
View File
@@ -0,0 +1,76 @@
<?php
// block.php - allows admin to edit all local configuration variables for a block
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$blockid = required_param('block', PARAM_INT);
if(!$blockrecord = blocks_get_record($blockid)) {
print_error('blockdoesnotexist', 'error');
}
admin_externalpage_setup('blocksetting'.$blockrecord->name);
$block = block_instance($blockrecord->name);
if($block === false) {
print_error('blockcannotinistantiate', 'error');
}
// Define the data we're going to silently include in the instance config form here,
// so we can strip them from the submitted data BEFORE handling it.
$hiddendata = array(
'block' => $blockid,
'sesskey' => sesskey()
);
/// If data submitted, then process and store.
if ($config = data_submitted()) {
if (!confirm_sesskey()) {
print_error('confirmsesskeybad', 'error');
}
if(!$block->has_config()) {
print_error('blockcannotconfig', 'error');
}
$remove = array_keys($hiddendata);
foreach($remove as $item) {
unset($config->$item);
}
$block->config_save($config);
redirect("$CFG->wwwroot/$CFG->admin/blocks.php", get_string("changessaved"), 1);
exit;
}
/// Otherwise print the form.
$strmanageblocks = get_string('manageblocks');
$strblockname = $block->get_title();
echo $OUTPUT->header();
echo $OUTPUT->heading($strblockname);
echo $OUTPUT->notification('This block still uses an old-style config_global.html file. ' .
'It must be updated by a developer to use a settings.php file.');
echo $OUTPUT->box(get_string('configwarning', 'admin'), 'generalbox boxwidthnormal boxaligncenter');
echo '<br />';
echo '<form method="post" action="block.php">';
echo '<p>';
foreach($hiddendata as $name => $val) {
echo '<input type="hidden" name="'. $name .'" value="'. $val .'" />';
}
echo '</p>';
echo $OUTPUT->box_start();
include($CFG->dirroot.'/blocks/'. $block->name() .'/config_global.html');
echo $OUTPUT->box_end();
echo '</form>';
echo $OUTPUT->footer();
+244 -79
View File
@@ -1,94 +1,259 @@
<?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/>.
/**
* Allows the admin to configure blocks (hide/show, uninstall and configure)
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// Allows the admin to configure blocks (hide/show, delete and configure)
require_once('../config.php');
require_once("{$CFG->libdir}/adminlib.php");
require_once("{$CFG->libdir}/blocklib.php");
require_once("{$CFG->libdir}/tablelib.php");
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('manageblocks');
admin_externalpage_setup('manageblocks');
$plugin = optional_param('plugin', '', PARAM_PLUGIN);
$action = optional_param('action', '', PARAM_ALPHA);
$unprotect = optional_param('unprotect', 0, PARAM_PLUGIN);
$protect = optional_param('protect', 0, PARAM_PLUGIN);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_INT);
$unprotect = optional_param('unprotect', 0, PARAM_INT);
$protect = optional_param('protect', 0, PARAM_INT);
$strmanageblocks = get_string('manageblocks');
/// Print headings
// If data submitted, then process and store.
if (!empty($plugin) && !empty($action) && confirm_sesskey()) {
$manager = \core_plugin_manager::resolve_plugininfo_class('block');
$pluginname = get_string('pluginname', "block_{$plugin}");
$strmanageblocks = get_string('manageblocks');
$strdelete = get_string('delete');
$strversion = get_string('version');
$strhide = get_string('hide');
$strshow = get_string('show');
$strsettings = get_string('settings');
$strcourses = get_string('blockinstances', 'admin');
$strname = get_string('name');
$strshowblockcourse = get_string('showblockcourse');
$strprotecthdr = get_string('blockprotect', 'admin'). $OUTPUT->help_icon('blockprotect','admin');
$strprotect = get_string('blockprotect', 'admin');
$strunprotect = get_string('blockunprotect', 'admin');
if ($action === 'disable' && $manager::enable_plugin($plugin, 0)) {
\core\notification::add(
get_string('plugin_disabled', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
// Settings not required - only pages.
admin_get_root(true, false);
} else if ($action === 'enable' && $manager::enable_plugin($plugin, 1)) {
\core\notification::add(
get_string('plugin_enabled', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
/// If data submitted, then process and store.
// Settings not required - only pages.
admin_get_root(true, false);
if (!empty($hide) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$hide))) {
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '0', array('id'=>$block->id)); // Hide block
admin_get_root(true, false); // settings not required - only pages
}
// Redirect back to the page with out any params.
redirect(new moodle_url('/admin/blocks.php'));
}
if (!empty($show) && confirm_sesskey() ) {
if (!$block = $DB->get_record('block', array('id'=>$show))) {
print_error('blockdoesnotexist', 'error');
}
$DB->set_field('block', 'visible', '1', array('id'=>$block->id)); // Show block
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($protect) && confirm_sesskey()) {
block_manager::protect_block($protect);
$pluginname = get_string('pluginname', "block_{$protect}");
\core\notification::add(
get_string('blockprotected', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
// Settings not required - only pages.
admin_get_root(true, false);
}
if (!isset($CFG->undeletableblocktypes) || (!is_array($CFG->undeletableblocktypes) && !is_string($CFG->undeletableblocktypes))) {
$undeletableblocktypes = array('navigation', 'settings');
} else if (is_string($CFG->undeletableblocktypes)) {
$undeletableblocktypes = explode(',', $CFG->undeletableblocktypes);
} else {
$undeletableblocktypes = $CFG->undeletableblocktypes;
}
if (!empty($unprotect) && confirm_sesskey()) {
block_manager::unprotect_block($unprotect);
$pluginname = get_string('pluginname', "block_{$unprotect}");
\core\notification::add(
get_string('blockunprotected', 'core_admin', $pluginname),
\core\notification::SUCCESS
);
// Settings not required - only pages.
admin_get_root(true, false);
}
if (!empty($protect) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$protect))) {
print_error('blockdoesnotexist', 'error');
}
if (!in_array($block->name, $undeletableblocktypes)) {
$undeletableblocktypes[] = $block->name;
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
}
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($unprotect) && confirm_sesskey()) {
if (!$block = $DB->get_record('block', array('id'=>$unprotect))) {
print_error('blockdoesnotexist', 'error');
}
if (in_array($block->name, $undeletableblocktypes)) {
$undeletableblocktypes = array_diff($undeletableblocktypes, array($block->name));
set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
}
admin_get_root(true, false); // settings not required - only pages
}
if (!empty($delete) && confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
if (!$block = blocks_get_record($delete)) {
print_error('blockdoesnotexist', 'error');
}
if (get_string_manager()->string_exists('pluginname', "block_$block->name")) {
$strblockname = get_string('pluginname', "block_$block->name");
} else {
$strblockname = $block->name;
}
if (!$confirm) {
echo $OUTPUT->confirm(get_string('blockdeleteconfirm', '', $strblockname), 'blocks.php?delete='.$block->id.'&confirm=1', 'blocks.php');
echo $OUTPUT->footer();
exit;
} else {
uninstall_plugin('block', $block->name);
$a = new stdClass();
$a->block = $strblockname;
$a->directory = $CFG->dirroot.'/blocks/'.$block->name;
notice(get_string('blockdeletefiles', '', $a), 'blocks.php');
}
}
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
/// Main display starts here
/// Get and sort the existing blocks
if (!$blocks = $DB->get_records('block', array(), 'name ASC')) {
print_error('noblocks', 'error'); // Should never happen
}
$incompatible = array();
/// Print the table of all blocks
$table = new flexible_table('admin-blocks-compatible');
$table->define_columns(array('name', 'instances', 'version', 'hideshow', 'undeletable', 'delete', 'settings'));
$table->define_headers(array($strname, $strcourses, $strversion, $strhide.'/'.$strshow, $strprotecthdr, $strdelete, $strsettings));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'compatibleblockstable blockstable generaltable');
$table->setup();
$tablerows = array();
foreach ($blocks as $blockid=>$block) {
$blockname = $block->name;
if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) {
$blockobject = false;
$strblockname = '<span class="notifyproblem">'.$blockname.' ('.get_string('missingfromdisk').')</span>';
$plugin = new stdClass();
$plugin->version = $block->version;
} else {
$plugin = new stdClass();
$plugin->version = '???';
if (file_exists("$CFG->dirroot/blocks/$blockname/version.php")) {
include("$CFG->dirroot/blocks/$blockname/version.php");
}
if (!$blockobject = block_instance($block->name)) {
$incompatible[] = $block;
continue;
}
$strblockname = get_string('pluginname', 'block_'.$blockname);
}
$delete = '<a href="blocks.php?delete='.$blockid.'&amp;sesskey='.sesskey().'">'.$strdelete.'</a>';
$settings = ''; // By default, no configuration
if ($blockobject and $blockobject->has_config()) {
$blocksettings = admin_get_root()->locate('blocksetting' . $block->name);
if ($blocksettings instanceof admin_externalpage) {
$settings = '<a href="' . $blocksettings->url . '">' . get_string('settings') . '</a>';
} else if ($blocksettings instanceof admin_settingpage) {
$settings = '<a href="'.$CFG->wwwroot.'/'.$CFG->admin.'/settings.php?section=blocksetting'.$block->name.'">'.$strsettings.'</a>';
} else {
$settings = '<a href="block.php?block='.$blockid.'">'.$strsettings.'</a>';
}
}
// MDL-11167, blocks can be placed on mymoodle, or the blogs page
// and it should not show up on course search page
$totalcount = $DB->count_records('block_instances', array('blockname'=>$blockname));
$count = $DB->count_records('block_instances', array('blockname'=>$blockname, 'pagetypepattern'=>'course-view-*'));
if ($count>0) {
$blocklist = "<a href=\"{$CFG->wwwroot}/course/search.php?blocklist=$blockid&amp;sesskey=".sesskey()."\" ";
$blocklist .= "title=\"$strshowblockcourse\" >$totalcount</a>";
}
else {
$blocklist = "$totalcount";
}
$class = ''; // Nothing fancy, by default
if (!$blockobject) {
// ignore
$visible = '';
} else if ($blocks[$blockid]->visible) {
$visible = '<a href="blocks.php?hide='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strhide.'">'.
'<img src="'.$OUTPUT->pix_url('i/hide') . '" class="icon" alt="'.$strhide.'" /></a>';
} else {
$visible = '<a href="blocks.php?show='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strshow.'">'.
'<img src="'.$OUTPUT->pix_url('i/show') . '" class="icon" alt="'.$strshow.'" /></a>';
$class = ' class="dimmed_text"'; // Leading space required!
}
if ($block->version == $plugin->version) {
$version = $block->version;
} else {
$version = "$block->version ($plugin->version)";
}
if (!$blockobject) {
// ignore
$undeletable = '';
} else if (in_array($blockname, $undeletableblocktypes)) {
$undeletable = '<a href="blocks.php?unprotect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strunprotect.'">'.
'<img src="'.$OUTPUT->pix_url('t/unlock') . '" class="icon" alt="'.$strunprotect.'" /></a>';
} else {
$undeletable = '<a href="blocks.php?protect='.$blockid.'&amp;sesskey='.sesskey().'" title="'.$strprotect.'">'.
'<img src="'.$OUTPUT->pix_url('t/unlock_gray') . '" class="icon" alt="'.$strprotect.'" /></a>';
}
$row = array(
'<span'.$class.'>'.$strblockname.'</span>',
$blocklist,
'<span'.$class.'>'.$version.'</span>',
$visible,
$undeletable,
$delete,
$settings
);
$tablerows[] = array(strip_tags($strblockname), $row); // first element will be used for sorting
}
collatorlib::asort($tablerows);
foreach ($tablerows as $row) {
$table->add_data($row[1]);
}
$table->print_html();
if (!empty($incompatible)) {
echo $OUTPUT->heading(get_string('incompatibleblocks', 'blockstable', 'admin'));
$table = new flexible_table('admin-blocks-incompatible');
$table->define_columns(array('block', 'delete'));
$table->define_headers(array($strname, $strdelete));
$table->define_baseurl($CFG->wwwroot.'/'.$CFG->admin.'/blocks.php');
$table->set_attribute('class', 'incompatibleblockstable generaltable');
$table->setup();
foreach ($incompatible as $block) {
$table->add_data(array(
$block->name,
'<a href="blocks.php?delete='.$block->id.'&amp;sesskey='.sesskey().'">'.$strdelete.'</a>',
));
}
$table->print_html();
}
echo $OUTPUT->footer();
echo $OUTPUT->header();
echo $OUTPUT->heading($strmanageblocks);
echo $OUTPUT->notification(get_string('noteunneededblocks', 'admin'), 'info', false);
// Print the table of all blocks.
$table = new \core_admin\table\block_management_table();
$table->out();
echo $OUTPUT->footer();
-163
View File
@@ -1,163 +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 is used to display a categories sub categories, external pages, and settings.
*
* @since Moodle 2.3
* @package admin
* @copyright 2011 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once('../config.php');
require_once($CFG->libdir.'/adminlib.php');
$category = required_param('category', PARAM_SAFEDIR);
$return = optional_param('return','', PARAM_ALPHA);
$adminediting = optional_param('adminedit', -1, PARAM_BOOL);
require_login(0, false);
$PAGE->set_context(context_system::instance());
$PAGE->set_url('/admin/category.php', array('category' => $category));
$PAGE->set_pagetype('admin-setting-' . $category);
$PAGE->set_pagelayout('admin');
$PAGE->navigation->clear_cache();
$adminroot = admin_get_root(); // need all settings
$settingspage = $adminroot->locate($category, true);
if (empty($settingspage) or !($settingspage instanceof admin_category)) {
throw new \moodle_exception('categoryerror', 'error', "$CFG->wwwroot/$CFG->admin/");
}
if (!($settingspage->check_access())) {
throw new \moodle_exception('accessdenied', 'admin');
}
$hassiteconfig = has_capability('moodle/site:config', $PAGE->context);
if ($hassiteconfig) {
$PAGE->add_header_action($OUTPUT->render_from_template('core_admin/header_search_input', [
'action' => new moodle_url('/admin/search.php'),
]));
}
$statusmsg = '';
$errormsg = '';
if ($data = data_submitted() and confirm_sesskey()) {
$count = admin_write_settings($data);
if (empty($adminroot->errors)) {
// No errors. Did we change any setting? If so, then indicate success.
if ($count) {
$statusmsg = get_string('changessaved');
} else {
switch ($return) {
case 'site': redirect("$CFG->wwwroot/");
case 'admin': redirect("$CFG->wwwroot/$CFG->admin/");
}
}
} else {
$errormsg = get_string('errorwithsettings', 'admin');
$firsterror = reset($adminroot->errors);
}
$settingspage = $adminroot->locate($category, true);
}
if ($PAGE->user_allowed_editing() && $adminediting != -1) {
$USER->editing = $adminediting;
}
$buttons = null;
if ($PAGE->user_allowed_editing() && !$PAGE->theme->haseditswitch) {
$url = clone($PAGE->url);
if ($PAGE->user_is_editing()) {
$caption = get_string('blockseditoff');
$url->param('adminedit', 'off');
} else {
$caption = get_string('blocksediton');
$url->param('adminedit', 'on');
}
$buttons = $OUTPUT->single_button($url, $caption, 'get');
}
$savebutton = false;
$outputhtml = '';
foreach ($settingspage->children as $childpage) {
if ($childpage->is_hidden() || !$childpage->check_access()) {
continue;
}
if ($childpage instanceof admin_externalpage) {
$outputhtml .= $OUTPUT->heading(html_writer::link($childpage->url, $childpage->visiblename), 3);
} else if ($childpage instanceof admin_settingpage) {
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/settings.php', array('section' => $childpage->name)), $childpage->visiblename), 3);
// If its a settings page and has settings lets display them.
if (!empty($childpage->settings)) {
$outputhtml .= html_writer::start_tag('fieldset', array('class' => 'adminsettings'));
foreach ($childpage->settings as $setting) {
if (empty($setting->nosave)) {
$savebutton = true;
}
$fullname = $setting->get_full_name();
if (array_key_exists($fullname, $adminroot->errors)) {
$data = $adminroot->errors[$fullname]->data;
} else {
$data = $setting->get_setting();
}
$outputhtml .= html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
$outputhtml .= $setting->output_html($data);
}
$outputhtml .= html_writer::end_tag('fieldset');
}
} else if ($childpage instanceof admin_category) {
$outputhtml .= $OUTPUT->heading(html_writer::link(new moodle_url('/'.$CFG->admin.'/category.php', array('category' => $childpage->name)), get_string('admincategory', 'admin', $childpage->visiblename)), 3);
}
}
if ($savebutton) {
$outputhtml .= html_writer::start_tag('div', array('class' => 'form-buttons'));
$outputhtml .= html_writer::empty_tag('input', array('class' => 'btn btn-primary form-submit', 'type' => 'submit', 'value' => get_string('savechanges','admin')));
$outputhtml .= html_writer::end_tag('div');
}
$PAGE->set_title(implode(moodle_page::TITLE_SEPARATOR, $settingspage->visiblepath));
$PAGE->set_heading($SITE->fullname);
if ($buttons) {
$PAGE->set_button($buttons);
}
echo $OUTPUT->header();
if ($errormsg !== '') {
echo $OUTPUT->notification($errormsg);
} else if ($statusmsg !== '') {
echo $OUTPUT->notification($statusmsg, 'notifysuccess');
}
echo $OUTPUT->heading(get_string('admincategory', 'admin', $settingspage->visiblename), 2);
echo html_writer::start_tag('form', array('action' => '', 'method' => 'post', 'id' => 'adminsettings'));
echo html_writer::start_tag('div');
echo html_writer::input_hidden_params(new moodle_url($PAGE->url, array('sesskey' => sesskey(), 'return' => $return)));
echo html_writer::end_tag('div');
echo html_writer::start_tag('fieldset');
echo html_writer::tag('div', '<!-- -->', array('class' => 'clearer'));
echo $outputhtml;
echo html_writer::end_tag('fieldset');
echo html_writer::end_tag('form');
// Add the form change checker.
$PAGE->requires->js_call_amd('core_form/changechecker', 'watchFormById', ['adminsettings']);
echo $OUTPUT->footer();
@@ -1,127 +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/>.
namespace core_admin\admin;
use admin_setting;
use core_plugin_manager;
use core_text;
/**
* Admin setting plugin manager.
*
* @package core_admin
* @subpackage admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_plugin_manager extends admin_setting {
/** @var core_plugin_manager The plugin manager instance */
protected core_plugin_manager $pluginmanager;
/** @var string The plugintype that this manager covers */
protected string $plugintype;
/** @var string The class of the management table to use */
protected string $tableclass;
public function __construct(
string $plugintype,
string $tableclass,
string $name,
string $visiblename,
string $description = '',
string $defaultsetting = '',
) {
$this->nosave = true;
$this->pluginmanager = core_plugin_manager::instance();
$this->plugintype = $plugintype;
$this->tableclass = $tableclass;
parent::__construct($name, $visiblename, $description, $defaultsetting);
}
/**
* Always returns true, does nothing
*
* @return true
*/
public function get_setting(): bool {
return true;
}
/**
* Always returns true, does nothing
*
* @return true
*/
public function get_defaultsetting(): bool {
return true;
}
/**
* Always returns '', does not write anything
*
* @return string Always returns ''
*/
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
public function write_setting($data): string {
// Do not write any setting.
return '';
}
/**
* Checks if $query is one of the available editors
*
* @param string $query The string to search for
* @return bool Returns true if found, false if not
*/
public function is_related($query) {
if (parent::is_related($query)) {
return true;
}
$plugins = $this->pluginmanager->get_installed_plugins($this->plugintype);
foreach (array_keys($plugins) as $plugin) {
$plugin = "{$this->plugintype}_{$plugin}";
if (str_contains($plugin, $query)) {
return true;
}
$pluginname = get_string('pluginname', $plugin);
if (strpos(core_text::strtolower($pluginname), $query) !== false) {
return true;
}
}
return false;
}
/**
* Builds the XHTML to display the control
*
* @param string $data Unused
* @param string $query
* @return string
*/
public function output_html($data, $query = ''): string {
$table = new $this->tableclass();
if (!($table instanceof \core_admin\table\plugin_management_table)) {
throw new \coding_exception("{$this->tableclass} must be an instance of \\core_admin\\table\\plugin_management_table");
}
return highlight($query, $table->get_content());
}
}
-97
View File
@@ -1,97 +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/>.
namespace core_admin\external;
use block_manager;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_single_structure;
use core_external\external_value;
/**
* Web Service to control the state of a plugin.
*
* @package core_admin
* @category external
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class set_block_protection extends external_api {
/**
* Returns description of method parameters
*
* @return external_function_parameters
*/
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters([
'plugin' => new external_value(PARAM_PLUGIN, 'The name of the plugin', VALUE_REQUIRED),
'state' => new external_value(PARAM_INT, 'The target state', VALUE_REQUIRED),
]);
}
/**
* Set the block protection state.
*
* @param string $plugin The name of the plugin
* @param int $state The target state
* @return null
*/
public static function execute(
string $plugin,
int $state,
): array {
[
'plugin' => $plugin,
'state' => $state,
] = self::validate_parameters(self::execute_parameters(), [
'plugin' => $plugin,
'state' => $state,
]);
$context = \context_system::instance();
self::validate_context($context);
require_capability('moodle/site:config', $context);
[, $pluginname] = explode('_', \core_component::normalize_componentname($plugin), 2);
$displayname = get_string('pluginname', $plugin);
if ($state) {
block_manager::protect_block($pluginname);
\core\notification::add(
get_string('blockprotected', 'core_admin', $displayname),
\core\notification::SUCCESS
);
} else {
block_manager::unprotect_block($pluginname);
\core\notification::add(
get_string('blockunprotected', 'core_admin', $displayname),
\core\notification::SUCCESS
);
}
return [];
}
/**
* Describe the return structure of the external service.
*
* @return external_single_structure
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([]);
}
}
-84
View File
@@ -1,84 +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/>.
namespace core_admin\external;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_single_structure;
use core_external\external_value;
/**
* Web Service to control the order of a plugin.
*
* @package core_admin
* @category external
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class set_plugin_order extends external_api {
/**
* Returns description of method parameters
*
* @return external_function_parameters
*/
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters([
'plugin' => new external_value(PARAM_PLUGIN, 'The name of the plugin', VALUE_REQUIRED),
'direction' => new external_value(PARAM_INT, 'The direction to move', VALUE_REQUIRED),
]);
}
/**
* Set the plugin state.
*
* @param string $plugin The name of the plugin
* @param int $direction The direction to move the plugin
* @return array
*/
public static function execute(
string $plugin,
int $direction,
): array {
[
'plugin' => $plugin,
'direction' => $direction,
] = self::validate_parameters(self::execute_parameters(), [
'plugin' => $plugin,
'direction' => $direction,
]);
$context = \context_system::instance();
self::validate_context($context);
require_capability('moodle/site:config', $context);
[$plugintype, $pluginname] = explode('_', \core_component::normalize_componentname($plugin), 2);
$manager = \core_plugin_manager::resolve_plugininfo_class($plugintype);
$manager::change_plugin_order($pluginname, $direction);
return [];
}
/**
* Describe the return structure of the external service.
*
* @return external_single_structure
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([]);
}
}
-98
View File
@@ -1,98 +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/>.
namespace core_admin\external;
use core_external\external_api;
use core_external\external_function_parameters;
use core_external\external_single_structure;
use core_external\external_value;
/**
* Web Service to control the state of a plugin.
*
* @package core_admin
* @category external
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class set_plugin_state extends external_api {
/**
* Returns description of method parameters
*
* @return external_function_parameters
*/
public static function execute_parameters(): external_function_parameters {
return new external_function_parameters([
'plugin' => new external_value(PARAM_PLUGIN, 'The name of the plugin', VALUE_REQUIRED),
'state' => new external_value(PARAM_INT, 'The target state', VALUE_REQUIRED),
]);
}
/**
* Set the plugin state.
*
* @param string $plugin The name of the plugin
* @param int $state The target state
* @return null
*/
public static function execute(
string $plugin,
int $state,
): array {
[
'plugin' => $plugin,
'state' => $state,
] = self::validate_parameters(self::execute_parameters(), [
'plugin' => $plugin,
'state' => $state,
]);
$context = \context_system::instance();
self::validate_context($context);
require_capability('moodle/site:config', $context);
[$plugintype, $pluginname] = explode('_', \core_component::normalize_componentname($plugin), 2);
$manager = \core_plugin_manager::resolve_plugininfo_class($plugintype);
$displayname = get_string('pluginname', $plugin);
if ($manager::enable_plugin($pluginname, $state)) {
if (!empty($state)) {
\core\notification::add(
get_string('plugin_enabled', 'core_admin', $displayname),
\core\notification::SUCCESS
);
} else {
\core\notification::add(
get_string('plugin_disabled', 'core_admin', $displayname),
\core\notification::SUCCESS
);
}
}
return [];
}
/**
* Describe the return structure of the external service.
*
* @return external_single_structure
*/
public static function execute_returns(): external_single_structure {
return new external_single_structure([]);
}
}
-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/>.
/**
* Form for selective purging of caches.
*
* @package core
* @copyright 2018 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\form;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Form for selecting which caches to purge on admin/purgecaches.php
*
* @package core
* @copyright 2018 The Open University
* @author Mark Johnson <mark.johnson@open.ac.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class purge_caches extends \moodleform {
/**
* Define a "Purge all caches" button, and a fieldset with checkboxes for selectively purging separate caches.
*/
public function definition() {
$mform = $this->_form;
$mform->addElement('hidden', 'returnurl', $this->_customdata['returnurl']);
$mform->setType('returnurl', PARAM_LOCALURL);
$mform->addElement('submit', 'all', get_string('purgecaches', 'admin'));
$mform->addElement('header', 'purgecacheheader', get_string('purgeselectedcaches', 'admin'));
$checkboxes = [
$mform->createElement('advcheckbox', 'theme', '', get_string('purgethemecache', 'admin')),
$mform->createElement('advcheckbox', 'lang', '', get_string('purgelangcache', 'admin')),
$mform->createElement('advcheckbox', 'js', '', get_string('purgejscache', 'admin')),
$mform->createElement('advcheckbox', 'template', '', get_string('purgetemplates', 'admin')),
$mform->createElement('advcheckbox', 'filter', '', get_string('purgefiltercache', 'admin')),
$mform->createElement('advcheckbox', 'muc', '', get_string('purgemuc', 'admin')),
$mform->createElement('advcheckbox', 'other', '', get_string('purgeothercaches', 'admin'))
];
$mform->addGroup($checkboxes, 'purgeselectedoptions');
$mform->addElement('submit', 'purgeselectedcaches', get_string('purgeselectedcaches', 'admin'));
}
/**
* If the "Purge selected caches" button was pressed, ensure at least one cache was selected.
*
* @param array $data
* @param array $files
* @return array Error messages
*/
public function validation($data, $files) {
$errors = [];
if (isset($data['purgeselectedcaches']) && empty(array_filter($data['purgeselectedoptions']))) {
$errors['purgeselectedoptions'] = get_string('purgecachesnoneselected', 'admin');
}
return $errors;
}
}
@@ -1,92 +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/>.
/**
* Testing outgoing mail configuration form
*
* @package core
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\form;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/formslib.php');
/**
* Test mail form
*
* @package core
* @copyright 2019 Victor Deniz <victor@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class testoutgoingmailconf_form extends \moodleform {
/**
* Add elements to form
*/
public function definition() {
$mform = $this->_form;
// Recipient.
$options = ['maxlength' => '100', 'size' => '25', 'autocomplete' => 'email'];
$mform->addElement('text', 'recipient', get_string('testoutgoingmailconf_toemail', 'admin'), $options);
$mform->setType('recipient', PARAM_EMAIL);
$mform->addRule('recipient', get_string('required'), 'required');
// From user.
$options = ['maxlength' => '100', 'size' => '25'];
$mform->addElement('text', 'from', get_string('testoutgoingmailconf_fromemail', 'admin'), $options);
$mform->setType('from', PARAM_TEXT);
$mform->addHelpButton('from', 'testoutgoingmailconf_fromemail', 'admin');
// Additional subject text.
$options = ['size' => '25'];
$mform->addElement('text', 'additionalsubject', get_string('testoutgoingmailconf_subjectadditional', 'admin'), $options);
$mform->setType('additionalsubject', PARAM_TEXT);
$buttonarray = array();
$buttonarray[] = $mform->createElement('submit', 'send', get_string('testoutgoingmailconf_sendtest', 'admin'));
$buttonarray[] = $mform->createElement('cancel');
$mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
$mform->closeHeaderBefore('buttonar');
}
/**
* Validate Form field, should be a valid email format or a username that matches with a Moodle user.
*
* @param array $data
* @param array $files
* @return array
* @throws \dml_exception|\coding_exception
*/
public function validation($data, $files): array {
$errors = parent::validation($data, $files);
if (isset($data['from']) && $data['from']) {
$userfrom = \core_user::get_user_by_username($data['from']);
if (!$userfrom && !validate_email($data['from'])) {
$errors['from'] = get_string('testoutgoingmailconf_fromemail_invalid', 'admin');
}
}
return $errors;
}
}
@@ -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/>.
/**
* External admin page class that allows a callback to be provided to determine whether page can be accessed
*
* @package core_admin
* @copyright 2019 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\externalpage;
use admin_externalpage;
defined('MOODLE_INTERNAL') || die();
require_once("{$CFG->libdir}/adminlib.php");
/**
* Admin externalpage class
*
* @package core_admin
* @copyright 2019 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class accesscallback extends admin_externalpage {
/** @var callable $accesscheckcallback */
protected $accesscheckcallback;
/**
* Class constructor
*
* @param string $name
* @param string $visiblename
* @param string $url
* @param callable $accesscheckcallback The callback method that will be executed to check whether user has access to
* this page. The setting instance ($this) is passed as an argument to the callback. Should return boolean value
* @param bool $hidden
*/
public function __construct(string $name, string $visiblename, string $url, callable $accesscheckcallback,
bool $hidden = false) {
$this->accesscheckcallback = $accesscheckcallback;
parent::__construct($name, $visiblename, $url, [], $hidden);
}
/**
* Determines if the current user has access to this external page based on access callback
*
* @return bool
*/
public function check_access() {
return ($this->accesscheckcallback)($this);
}
}
@@ -1,206 +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/>.
/**
* Auto complete admin setting.
*
* @package core_admin
* @copyright 2020 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/adminlib.php');
/**
* Auto complete setting class.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright 2020 The Open University
*/
class autocomplete extends \admin_setting_configmultiselect {
/** @var boolean Should we allow typing new entries to the field? */
protected $tags = false;
/** @var string Name of an AMD module to send/process ajax requests. */
protected $ajax = '';
/** @var string Placeholder text for an empty list. */
protected $placeholder = '';
/** @var bool Whether the search has to be case-sensitive. */
protected $casesensitive = false;
/** @var bool Show suggestions by default - but this can be turned off. */
protected $showsuggestions = true;
/** @var string String that is shown when there are no selections. */
protected $noselectionstring = '';
/** @var string Delimiter to store values in database. */
protected $delimiter = ',';
/** @var string Should be multiple choices? */
protected $multiple = true;
/** @var string The link to manage choices. */
protected $manageurl = true;
/** @var string The text to display in manage link. */
protected $managetext = true;
/**
* Constructor
*
* @param string $name unique ascii name, either 'mysetting' for settings that in config, or 'myplugin/mysetting'
* for ones in config_plugins.
* @param string $visiblename localised
* @param string $description long localised info
* @param array $defaultsetting array of selected items
* @param array $choices options for autocomplete field
* @param array $attributes settings for autocomplete field
*/
public function __construct($name, $visiblename, $description, $defaultsetting, $choices, $attributes = null) {
if ($attributes === null) {
$attributes = [];
}
$this->placeholder = get_string('search');
$this->noselectionstring = get_string('noselection', 'form');
$defaultattributes = [
'tags',
'showsuggestions',
'placeholder',
'noselectionstring',
'ajax',
'casesensitive',
'delimiter',
'multiple',
'manageurl',
'managetext'
];
foreach ($defaultattributes as $attributename) {
if (isset($attributes[$attributename])) {
$this->$attributename = $attributes[$attributename];
}
}
parent::__construct($name, $visiblename, $description, $defaultsetting, $choices);
}
/**
* Returns the select setting(s)
*
* @return mixed null or array. Null if no settings else array of setting(s)
*/
public function get_setting() {
$result = $this->config_read($this->name);
if (is_null($result)) {
return null;
}
if ($result === '') {
return [];
}
return explode($this->delimiter, $result);
}
/**
* Saves setting(s) provided through $data
*
* @param array $data
*/
public function write_setting($data) {
if (!is_array($data)) {
return ''; // Ignore it.
}
if (!$this->load_choices() || empty($this->choices)) {
return '';
}
unset($data['xxxxx']);
$save = [];
foreach ($data as $value) {
if (!array_key_exists($value, $this->choices)) {
continue; // Ignore it.
}
$save[] = $value;
}
return ($this->config_write($this->name, implode($this->delimiter, $save)) ? '' : get_string('errorsetting', 'admin'));
}
/**
* Returns XHTML autocomplete field
*
* @param array $data Array of values to select by default
* @param string $query
* @return string XHTML autocomplete field
*/
public function output_html($data, $query = '') {
global $OUTPUT;
if (!$this->load_choices() or empty($this->choices)) {
return '';
}
$default = $this->get_defaultsetting();
if (empty($default)) {
$default = [];
}
if (is_null($data)) {
$data = [];
}
$context = [
'id' => $this->get_id(),
'name' => $this->get_full_name()
];
$defaults = [];
$options = [];
$template = 'core_admin/local/settings/autocomplete';
foreach ($this->choices as $value => $name) {
if (in_array($value, $default)) {
$defaults[] = $name;
}
$options[] = [
'value' => $value,
'text' => $name,
'selected' => in_array($value, $data),
'disabled' => false
];
}
$context['options'] = $options;
$context['tags'] = $this->tags;
$context['placeholder'] = $this->placeholder;
$context['casesensitive'] = $this->casesensitive;
$context['multiple'] = $this->multiple;
$context['showsuggestions'] = $this->showsuggestions;
$context['manageurl'] = $this->manageurl;
$context['managetext'] = $this->managetext;
if (is_null($default)) {
$defaultinfo = null;
} if (!empty($defaults)) {
$defaultinfo = implode(', ', $defaults);
} else {
$defaultinfo = get_string('none');
}
$element = $OUTPUT->render_from_template($template, $context);
return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '', $defaultinfo, $query);
}
}
-197
View File
@@ -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/>.
/**
* File size admin setting.
*
* @package core_admin
* @copyright 2019 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir . '/adminlib.php');
/**
* An admin setting to support entering and displaying of file sizes in Bytes, KB, MB or GB.
*
* @copyright 2019 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class filesize extends \admin_setting {
/** @var int The byte unit. Number of bytes in a byte */
const UNIT_B = 1;
/** @var int The kilobyte unit (number of bytes in a kilobyte) */
const UNIT_KB = 1024;
/** @var int The megabyte unit (number of bytes in a megabyte) */
const UNIT_MB = 1048576;
/** @var int The gigabyte unit (number of bytes in a gigabyte) */
const UNIT_GB = 1073741824;
/** @var int default size unit */
protected $defaultunit;
/**
* Constructor
*
* @param string $name unique ascii name, either 'mysetting' for settings that in config,
* or 'myplugin/mysetting' for ones in config_plugins.
* @param string $visiblename localised name
* @param string $description localised long description
* @param int|null $defaultvalue Value of the settings in bytes
* @param int|null $defaultunit GB, MB, etc. (in bytes)
*/
public function __construct(string $name, string $visiblename, string $description,
int $defaultvalue = null, int $defaultunit = null) {
$defaultsetting = self::parse_bytes($defaultvalue);
if ($defaultunit && array_key_exists($defaultunit, self::get_units())) {
$this->defaultunit = $defaultunit;
} else {
$this->defaultunit = self::UNIT_MB;
}
parent::__construct($name, $visiblename, $description, $defaultsetting);
}
/**
* Returns selectable units.
*
* @return array
*/
protected static function get_units(): array {
return [
self::UNIT_GB => get_string('sizegb'),
self::UNIT_MB => get_string('sizemb'),
self::UNIT_KB => get_string('sizekb'),
self::UNIT_B => get_string('sizeb'),
];
}
/**
* Converts bytes to some more user friendly string.
*
* @param int $bytes The number of bytes we want to convert from
* @return string
*/
protected static function get_size_text(int $bytes): string {
if (empty($bytes)) {
return get_string('none');
}
return display_size($bytes, 0);
}
/**
* Finds suitable units for given file size.
*
* @param int $bytes The number of bytes
* @return array Parsed file size in the format of ['v' => value, 'u' => unit]
*/
protected static function parse_bytes(int $bytes): array {
foreach (self::get_units() as $unit => $unused) {
if ($bytes % $unit === 0) {
return ['v' => (int)($bytes / $unit), 'u' => $unit];
}
}
return ['v' => (int)$bytes, 'u' => self::UNIT_B];
}
/**
* Get the selected file size as array.
*
* @return array|null An array containing 'v' => xx, 'u' => xx, or null if not set
*/
public function get_setting(): ?array {
$bytes = $this->config_read($this->name);
if (is_null($bytes)) {
return null;
}
$bytes = intval($bytes);
return self::parse_bytes($bytes);
}
/**
* Store the file size as bytes.
*
* @param array $data Must be form 'h' => xx, 'm' => xx
* @return string The error string if any
*/
public function write_setting($data): string {
if (!is_array($data)) {
return '';
}
if (!is_numeric($data['v']) || $data['v'] < 0) {
return get_string('errorsetting', 'admin');
}
// Calculate size in bytes, ensuring we don't overflow PHP_INT_MAX.
$bytes = $data['v'] * $data['u'];
$result = (is_int($bytes) && $this->config_write($this->name, $bytes));
return ($result ? '' : get_string('errorsetting', 'admin'));
}
/**
* Returns file size text+select fields.
*
* @param array $data The current setting value. Must be form 'v' => xx, 'u' => xx.
* @param string $query Admin search query to be highlighted.
* @return string File size text+select fields and wrapping div(s).
*/
public function output_html($data, $query = ''): string {
global $OUTPUT;
$default = $this->get_defaultsetting();
if (is_number($default)) {
$defaultinfo = self::get_size_text($default);
} else if (is_array($default)) {
$defaultinfo = self::get_size_text($default['v'] * $default['u']);
} else {
$defaultinfo = null;
}
$inputid = $this->get_id() . 'v';
$units = self::get_units();
$defaultunit = $this->defaultunit;
$context = (object) [
'id' => $this->get_id(),
'name' => $this->get_full_name(),
'value' => $data['v'],
'readonly' => $this->is_readonly(),
'options' => array_map(function($unit, $title) use ($data, $defaultunit) {
return [
'value' => $unit,
'name' => $title,
'selected' => ($data['v'] == 0 && $unit == $defaultunit) || $unit == $data['u']
];
}, array_keys($units), $units)
];
$element = $OUTPUT->render_from_template('core_admin/setting_configfilesize', $context);
return format_admin_setting($this, $this->visiblename, $element, $this->description, $inputid, '', $defaultinfo, $query);
}
}
@@ -1,37 +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 settings page which can be viewed with a link directly.
*
* @package core_admin
* @copyright 2021 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
use moodle_url;
interface linkable_settings_page {
/**
* Get the URL to view this settings page.
*
* @return moodle_url
*/
public function get_settings_page_url(): moodle_url;
}
@@ -1,74 +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/>.
/**
* Payment gateway admin setting.
*
* @package core_admin
* @copyright 2020 Shamim Rezaie <shamim@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
/**
* Generic class for managing plugins in a table that allows re-ordering and enable/disable of each plugin.
*/
class manage_payment_gateway_plugins extends \admin_setting_manage_plugins {
/**
* Get the admin settings section title (use get_string).
*
* @return string
*/
public function get_section_title() {
return get_string('type_paygw_plural', 'plugin');
}
/**
* Get the type of plugin to manage.
*
* @return string
*/
public function get_plugin_type() {
return 'paygw';
}
/**
* Get the name of the second column.
*
* @return string
*/
public function get_info_column_name() {
return get_string('supportedcurrencies', 'core_payment');
}
/**
* Get the type of plugin to manage.
*
* @param plugininfo The plugin info class.
* @return string
*/
public function get_info_column($plugininfo) {
$codes = $plugininfo->get_supported_currencies();
$currencies = [];
foreach ($codes as $c) {
$currencies[$c] = new \lang_string($c, 'core_currencies');
}
return implode(get_string('listsep', 'langconfig') . ' ', $currencies);
}
}
@@ -1,121 +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/>.
/**
* Admin setting to show current scheduled task's status.
*
* @package core
* @copyright 2021 Universitat Rovira i Virgili
* @author Jordi Pujol-Ahulló <jpahullo@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\local\settings;
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->libdir . '/adminlib.php');
require_once($CFG->libdir . '/moodlelib.php');
use admin_setting_description;
use core\task\manager;
use core\task\scheduled_task;
use html_writer;
use lang_string;
use moodle_url;
use stdClass;
/**
* This admin setting tells whether a given scheduled task is enabled, providing a link to its configuration page.
*
* The goal of this setting is to help contextualizing the configuration settings with related scheduled task status,
* providing the big picture of that part of the system.
*
* @package core
* @copyright 2021 Universitat Rovira i Virgili
* @author Jordi Pujol-Ahulló <jpahullo@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class setting_scheduled_task_status extends admin_setting_description {
/**
* @var string fully qualified class name of a scheduled task.
*/
private $classname;
/**
* @var string additional text to append to the description.
*/
private $extradescription;
/**
* setting_scheduled_task_status constructor.
* @param string $name unique setting name.
* @param string $scheduledtaskclassname full classpath class name of the scheduled task.
* @param string $extradescription extra detail to append to the scheduled task status to add context in the setting
* page.
*/
public function __construct(string $name, string $scheduledtaskclassname, string $extradescription = '') {
$visiblename = new lang_string('task_status', 'admin');
$this->classname = $scheduledtaskclassname;
$this->extradescription = $extradescription;
parent::__construct($name, $visiblename, '');
}
/**
* Calculates lazily the content of the description.
* @param mixed $data nothing expected in this case.
* @param string $query nothing expected in this case.
* @return string the HTML content to print for this setting.
*/
public function output_html($data, $query = ''): string {
if (empty($this->description)) {
$this->description = $this->get_task_description();
}
return parent::output_html($data, $query);
}
/**
* Returns the HTML to print as the description.
* @return string description to be printed.
*/
private function get_task_description(): string {
$task = manager::get_scheduled_task($this->classname);
if ($task->is_enabled()) {
$taskenabled = get_string('enabled', 'admin');
} else {
$taskenabled = get_string('disabled', 'admin');
}
$taskenabled = strtolower($taskenabled);
$gotourl = new moodle_url(
'/admin/tool/task/scheduledtasks.php',
[],
scheduled_task::get_html_id($this->classname)
);
if (!empty($this->extradescription)) {
$this->extradescription = '<br />' . $this->extradescription;
}
$taskdetail = new stdClass();
$taskdetail->class = $this->classname;
$taskdetail->name = $task->get_name();
$taskdetail->status = $taskenabled;
$taskdetail->gotourl = $gotourl->out(false);
$taskdetail->extradescription = $this->extradescription;
return html_writer::tag('p', get_string('task_status_desc', 'admin', $taskdetail));
}
}
-71
View File
@@ -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/>.
namespace core_admin\output;
use moodle_url;
use renderable;
use renderer_base;
use stdClass;
use templatable;
/**
* Theme selector renderable.
*
* @package core_admin
* @copyright 2023 David Woloszyn <david.woloszyn@moodle.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class theme_selector implements renderable, templatable {
/** @var array $themedata Theme data to pass to the template. */
private $themedata = null;
/** @var bool Whether $CFG->theme is defined in config.php. */
private $definedinconfig;
/**
* Constructor.
*
* @param array $themedata Theme data used for template.
* @param bool $definedinconfig Whether $CFG->theme is defined in config.php.
*/
public function __construct(array $themedata, bool $definedinconfig = false) {
$this->themedata = $themedata;
$this->definedinconfig = $definedinconfig;
}
/**
* Export this data so it can be used as the context for a mustache template.
*
* @param renderer_base $output Renderer base.
* @return stdClass
*/
public function export_for_template(renderer_base $output): stdClass {
$data = new stdClass();
// Theme data used to populate cards and modal.
$data->themes = $this->themedata;
// Reset theme caches button.
$reseturl = new moodle_url('/admin/themeselector.php', ['sesskey' => sesskey(), 'reset' => 1]);
$resetbutton = new \single_button($reseturl, get_string('themeresetcaches', 'admin'), 'post',
\single_button::BUTTON_SECONDARY);
$data->resetbutton = $resetbutton->export_for_template($output);
$data->definedinconfig = $this->definedinconfig;
return $data;
}
}
-41
View File
@@ -1,41 +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/>.
/**
* Privacy Subsystem implementation for core_admin.
*
* @package core_admin
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace core_admin\privacy;
defined('MOODLE_INTERNAL') || die();
/**
* Privacy Subsystem for core_admin implementing null_provider.
*
* @copyright 2018 Carlos Escobedo <carlos@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class provider implements \core_privacy\local\metadata\null_provider {
/**
* Get the language string identifier with the component's language
* file to explain why this plugin stores no data.
*
* @return string
*/
public static function get_reason(): string {
return 'privacy:metadata';
}
}
@@ -1,128 +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/>.
declare(strict_types=1);
namespace core_admin\reportbuilder\datasource;
use core_admin\reportbuilder\local\entities\task_log;
use core_reportbuilder\datasource;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\filters\select;
/**
* Task logs datasource
*
* @package core_admin
* @copyright 2022 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_logs extends datasource {
/**
* Return user friendly name of the report source
*
* @return string
*/
public static function get_name(): string {
return get_string('tasklogs', 'core_admin');
}
/**
* Initialise report
*/
protected function initialise(): void {
$tasklogentity = new task_log();
$tasklogalias = $tasklogentity->get_table_alias('task_log');
$this->set_main_table('task_log', $tasklogalias);
$this->add_entity($tasklogentity);
// Join the user entity to represent the associated user.
$userentity = new user();
$useralias = $userentity->get_table_alias('user');
$this->add_entity($userentity->add_join("
LEFT JOIN {user} {$useralias}
ON {$useralias}.id = {$tasklogalias}.userid")
);
// Add report elements from each of the entities we added to the report.
$this->add_all_from_entities();
}
/**
* Return the columns that will be added to the report upon creation
*
* @return string[]
*/
public function get_default_columns(): array {
return [
'task_log:name',
'task_log:starttime',
'task_log:duration',
'task_log:result',
];
}
/**
* Return the column sorting that will be added to the report upon creation
*
* @return int[]
*/
public function get_default_column_sorting(): array {
return [
'task_log:starttime' => SORT_DESC,
];
}
/**
* Return the filters that will be added to the report upon creation
*
* @return string[]
*/
public function get_default_filters(): array {
return [
'task_log:timestart',
'task_log:result',
];
}
/**
* Return the conditions that will be added to the report upon creation
*
* @return string[]
*/
public function get_default_conditions(): array {
return [
'task_log:type',
'task_log:timestart',
'task_log:result',
];
}
/**
* Return the condition values that will be set for the report upon creation
*
* @return array
*/
public function get_default_condition_values(): array {
return [
'task_log:type_operator' => select::EQUAL_TO,
'task_log:type_value' => \core\task\database_logger::TYPE_SCHEDULED,
];
}
}
@@ -1,429 +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/>.
namespace core_admin\reportbuilder\local\entities;
use core_reportbuilder\local\filters\date;
use core_reportbuilder\local\filters\duration;
use core_reportbuilder\local\filters\number;
use core_reportbuilder\local\filters\select;
use core_reportbuilder\local\filters\text;
use core_reportbuilder\local\filters\autocomplete;
use core_reportbuilder\local\helpers\format;
use lang_string;
use core_reportbuilder\local\entities\base;
use core_reportbuilder\local\report\column;
use core_reportbuilder\local\report\filter;
use stdClass;
use core_collator;
/**
* Task log entity class implementation
*
* @package core_admin
* @copyright 2021 David Matamoros <davidmc@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_log extends base {
/** @var int Result success */
protected const SUCCESS = 0;
/** @var int Result failed */
protected const FAILED = 1;
/**
* Database tables that this entity uses
*
* @return string[]
*/
protected function get_default_tables(): array {
return [
'task_log',
];
}
/**
* The default title for this entity in the list of columns/conditions/filters in the report builder
*
* @return lang_string
*/
protected function get_default_entity_title(): lang_string {
return new lang_string('entitytasklog', 'admin');
}
/**
* Initialise the entity
*
* @return base
*/
public function initialise(): base {
$columns = $this->get_all_columns();
foreach ($columns as $column) {
$this->add_column($column);
}
// All the filters defined by the entity can also be used as conditions.
$filters = $this->get_all_filters();
foreach ($filters as $filter) {
$this
->add_filter($filter)
->add_condition($filter);
}
return $this;
}
/**
* Returns list of all available columns
*
* @return column[]
*/
protected function get_all_columns(): array {
global $DB;
$tablealias = $this->get_table_alias('task_log');
// Name column.
$columns[] = (new column(
'name',
new lang_string('name'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("$tablealias.classname")
->set_is_sortable(true)
->add_callback(static function(string $classname): string {
$output = '';
if (class_exists($classname)) {
$task = new $classname;
if ($task instanceof \core\task\task_base) {
$output = $task->get_name();
}
}
$output .= \html_writer::tag('div', "\\{$classname}", [
'class' => 'small text-muted',
]);
return $output;
});
// Component column.
$columns[] = (new column(
'component',
new lang_string('plugin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("{$tablealias}.component")
->set_is_sortable(true);
// Type column.
$columns[] = (new column(
'type',
new lang_string('tasktype', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("{$tablealias}.type")
->set_is_sortable(true)
->add_callback(static function($value): string {
if (\core\task\database_logger::TYPE_SCHEDULED === (int) $value) {
return get_string('task_type:scheduled', 'admin');
}
return get_string('task_type:adhoc', 'admin');
});
// Start time column.
$columns[] = (new column(
'starttime',
new lang_string('task_starttime', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TIMESTAMP)
->add_field("{$tablealias}.timestart")
->set_is_sortable(true)
->add_callback([format::class, 'userdate'], get_string('strftimedatetimeshortaccurate', 'core_langconfig'));
// End time column.
$columns[] = (new column(
'endtime',
new lang_string('task_endtime', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TIMESTAMP)
->add_field("{$tablealias}.timeend")
->set_is_sortable(true)
->add_callback([format::class, 'userdate'], get_string('strftimedatetimeshortaccurate', 'core_langconfig'));
// Duration column.
$columns[] = (new column(
'duration',
new lang_string('task_duration', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_FLOAT)
->add_field("{$tablealias}.timeend - {$tablealias}.timestart", 'duration')
->set_is_sortable(true)
->add_callback(static function(float $value): string {
$duration = round($value, 2);
if (empty($duration)) {
// The format_time function returns 'now' when the difference is exactly 0.
// Note: format_time performs concatenation in exactly this fashion so we should do this for consistency.
return '0 ' . get_string('secs', 'moodle');
}
return format_time($duration);
});
// Hostname column.
$columns[] = (new column(
'hostname',
new lang_string('hostname', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_TEXT)
->add_field("$tablealias.hostname")
->set_is_sortable(true);
// PID column.
$columns[] = (new column(
'pid',
new lang_string('pid', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_field("{$tablealias}.pid")
->set_is_sortable(true)
// Although this is an integer column, it doesn't make sense to perform numeric aggregation on it.
->set_disabled_aggregation(['avg', 'count', 'countdistinct', 'max', 'min', 'sum']);
// Database column.
$columns[] = (new column(
'database',
new lang_string('task_dbstats', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_fields("{$tablealias}.dbreads, {$tablealias}.dbwrites")
->set_is_sortable(true, ["{$tablealias}.dbreads", "{$tablealias}.dbwrites"])
->add_callback(static function(int $value, stdClass $row): string {
$output = '';
$output .= \html_writer::div(get_string('task_stats:dbreads', 'admin', $row->dbreads));
$output .= \html_writer::div(get_string('task_stats:dbwrites', 'admin', $row->dbwrites));
return $output;
})
// Although this is an integer column, it doesn't make sense to perform numeric aggregation on it.
->set_disabled_aggregation(['avg', 'count', 'countdistinct', 'max', 'min', 'sum']);
// Database reads column.
$columns[] = (new column(
'dbreads',
new lang_string('task_dbreads', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_fields("{$tablealias}.dbreads")
->set_is_sortable(true);
// Database writes column.
$columns[] = (new column(
'dbwrites',
new lang_string('task_dbwrites', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_INTEGER)
->add_fields("{$tablealias}.dbwrites")
->set_is_sortable(true);
// Result column.
$columns[] = (new column(
'result',
new lang_string('task_result', 'admin'),
$this->get_entity_name()
))
->add_joins($this->get_joins())
->set_type(column::TYPE_BOOLEAN)
// For accurate aggregation, we need to return boolean success = true by xor'ing the field value.
->add_field($DB->sql_bitxor("{$tablealias}.result", 1), 'success')
->set_is_sortable(true)
->add_callback(static function(bool $success): string {
if (!$success) {
return get_string('task_result:failed', 'admin');
}
return get_string('success');
});
return $columns;
}
/**
* Return list of all available filters
*
* @return filter[]
*/
protected function get_all_filters(): array {
global $DB;
$tablealias = $this->get_table_alias('task_log');
// Name filter (Filter by classname).
$filters[] = (new filter(
autocomplete::class,
'name',
new lang_string('classname', 'tool_task'),
$this->get_entity_name(),
"{$tablealias}.classname"
))
->add_joins($this->get_joins())
->set_options_callback(static function(): array {
global $DB;
$classnames = $DB->get_fieldset_sql('SELECT DISTINCT classname FROM {task_log} ORDER BY classname ASC');
$options = [];
foreach ($classnames as $classname) {
if (class_exists($classname)) {
$task = new $classname;
$options[$classname] = $task->get_name();
}
}
core_collator::asort($options);
return $options;
});
// Component filter.
$filters[] = (new filter(
text::class,
'component',
new lang_string('plugin'),
$this->get_entity_name(),
"{$tablealias}.component"
))
->add_joins($this->get_joins());
// Type filter.
$filters[] = (new filter(
select::class,
'type',
new lang_string('tasktype', 'admin'),
$this->get_entity_name(),
"{$tablealias}.type"
))
->add_joins($this->get_joins())
->set_options([
\core\task\database_logger::TYPE_ADHOC => new lang_string('task_type:adhoc', 'admin'),
\core\task\database_logger::TYPE_SCHEDULED => new lang_string('task_type:scheduled', 'admin'),
]);
// Output filter (Filter by task output).
$filters[] = (new filter(
text::class,
'output',
new lang_string('task_logoutput', 'admin'),
$this->get_entity_name(),
$DB->sql_cast_to_char("{$tablealias}.output")
))
->add_joins($this->get_joins());
// Start time filter.
$filters[] = (new filter(
date::class,
'timestart',
new lang_string('task_starttime', 'admin'),
$this->get_entity_name(),
"{$tablealias}.timestart"
))
->add_joins($this->get_joins())
->set_limited_operators([
date::DATE_ANY,
date::DATE_RANGE,
date::DATE_PREVIOUS,
date::DATE_CURRENT,
]);
// End time.
$filters[] = (new filter(
date::class,
'timeend',
new lang_string('task_endtime', 'admin'),
$this->get_entity_name(),
"{$tablealias}.timeend"
))
->add_joins($this->get_joins())
->set_limited_operators([
date::DATE_ANY,
date::DATE_RANGE,
date::DATE_PREVIOUS,
date::DATE_CURRENT,
]);
// Duration filter.
$filters[] = (new filter(
duration::class,
'duration',
new lang_string('task_duration', 'admin'),
$this->get_entity_name(),
"{$tablealias}.timeend - {$tablealias}.timestart"
))
->add_joins($this->get_joins());
// Database reads.
$filters[] = (new filter(
number::class,
'dbreads',
new lang_string('task_dbreads', 'admin'),
$this->get_entity_name(),
"{$tablealias}.dbreads"
))
->add_joins($this->get_joins());
// Database writes.
$filters[] = (new filter(
number::class,
'dbwrites',
new lang_string('task_dbwrites', 'admin'),
$this->get_entity_name(),
"{$tablealias}.dbwrites"
))
->add_joins($this->get_joins());
// Result filter.
$filters[] = (new filter(
select::class,
'result',
new lang_string('task_result', 'admin'),
$this->get_entity_name(),
"{$tablealias}.result"
))
->add_joins($this->get_joins())
->set_options([
self::SUCCESS => get_string('success'),
self::FAILED => get_string('task_result:failed', 'admin'),
]);
return $filters;
}
}
@@ -1,108 +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/>.
declare(strict_types=1);
namespace core_admin\reportbuilder\local\filters;
use core\context\system;
use core_course_category;
use MoodleQuickForm;
use core_reportbuilder\local\filters\base;
use core_reportbuilder\local\helpers\database;
/**
* Course role report filter (by role, category, course)
*
* The provided filter field SQL must refer/return an expression for the user ID (e.g. "{$user}.id")
*
* @package core_admin
* @copyright 2023 Paul Holden <paulh@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class courserole extends base {
/**
* Setup form
*
* @param MoodleQuickForm $mform
*/
public function setup_form(MoodleQuickForm $mform): void {
$elements = [];
// Role.
$elements['role'] = $mform->createElement('select', "{$this->name}_role", get_string('rolefullname', 'core_role'),
[0 => get_string('anyrole', 'core_filters')] + get_default_enrol_roles(system::instance()));
// Category.
$elements['category'] = $mform->createElement('select', "{$this->name}_category", get_string('category'),
[0 => get_string('anycategory', 'core_filters')] + core_course_category::make_categories_list());
// Course.
$elements['course'] = $mform->createElement('text', "{$this->name}_course", get_string('shortnamecourse'));
$mform->setType("{$this->name}_course", PARAM_RAW_TRIMMED);
$mform->addGroup($elements, "{$this->name}_group", $this->get_header(), '', false)
->setHiddenLabel(true);
}
/**
* Return filter SQL
*
* @param array $values
* @return array
*/
public function get_sql_filter(array $values): array {
[$fieldsql, $params] = $this->filter->get_field_sql_and_params();
[$contextalias, $rolealias, $coursealias] = database::generate_aliases(3);
[$roleparam, $categoryparam, $courseparam] = database::generate_param_names(3);
// Role.
$role = (int) ($values["{$this->name}_role"] ?? 0);
if ($role > 0) {
$selects[] = "{$rolealias}.roleid = :{$roleparam}";
$params[$roleparam] = $role;
}
// Category.
$category = (int) ($values["{$this->name}_category"] ?? 0);
if ($category > 0) {
$selects[] = "{$coursealias}.category = :{$categoryparam}";
$params[$categoryparam] = $category;
}
// Course.
$course = trim($values["{$this->name}_course"] ?? '');
if ($course !== '') {
$selects[] = "{$coursealias}.shortname = :{$courseparam}";
$params[$courseparam] = $course;
}
// Filter values are not set.
if (empty($selects)) {
return ['', []];
}
return ["{$fieldsql} IN (
SELECT {$rolealias}.userid
FROM {role_assignments} {$rolealias}
JOIN {context} {$contextalias} ON {$contextalias}.id = {$rolealias}.contextid AND {$contextalias}.contextlevel = 50
JOIN {course} {$coursealias} ON {$coursealias}.id = {$contextalias}.instanceid
WHERE " . implode(' AND ', $selects) . "
)", $params];
}
}
@@ -1,159 +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/>.
namespace core_admin\reportbuilder\local\systemreports;
use context_system;
use core_admin\reportbuilder\local\entities\task_log;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\report\action;
use lang_string;
use moodle_url;
use pix_icon;
use core_reportbuilder\system_report;
/**
* Task logs system report class implementation
*
* @package core_admin
* @copyright 2021 David Matamoros <davidmc@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class task_logs extends system_report {
/**
* Initialise report, we need to set the main table, load our entities and set columns/filters
*/
protected function initialise(): void {
// Our main entity, it contains all of the column definitions that we need.
$entitymain = new task_log();
$entitymainalias = $entitymain->get_table_alias('task_log');
$this->set_main_table('task_log', $entitymainalias);
$this->add_entity($entitymain);
// Any columns required by actions should be defined here to ensure they're always available.
$this->add_base_fields("{$entitymainalias}.id");
// We can join the "user" entity to our "main" entity and use the fullname column from the user entity.
$entityuser = new user();
$entituseralias = $entityuser->get_table_alias('user');
$this->add_entity($entityuser->add_join(
"LEFT JOIN {user} {$entituseralias} ON {$entituseralias}.id = {$entitymainalias}.userid"
));
// Now we can call our helper methods to add the content we want to include in the report.
$this->add_columns();
$this->add_filters();
$this->add_actions();
// Set if report can be downloaded.
$this->set_downloadable(true, get_string('tasklogs', 'admin'));
}
/**
* Validates access to view this report
*
* @return bool
*/
protected function can_view(): bool {
return has_capability('moodle/site:config', context_system::instance());
}
/**
* Get the visible name of the report
*
* @return string
*/
public static function get_name(): string {
return get_string('entitytasklog', 'admin');
}
/**
* Adds the columns we want to display in the report
*
* They are all provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier
*/
public function add_columns(): void {
$columns = [
'task_log:name',
'task_log:type',
'user:fullname',
'task_log:starttime',
'task_log:duration',
'task_log:hostname',
'task_log:pid',
'task_log:database',
'task_log:result',
];
$this->add_columns_from_entities($columns);
// It's possible to override the display name of a column, if you don't want to use the value provided by the entity.
if ($column = $this->get_column('user:fullname')) {
$column->set_title(new lang_string('user', 'admin'));
}
// It's possible to set a default initial sort direction for one column.
$this->set_initial_sort_column('task_log:starttime', SORT_DESC);
}
/**
* Adds the filters we want to display in the report
*
* They are all provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier
*/
protected function add_filters(): void {
$filters = [
'task_log:name',
'task_log:type',
'task_log:output',
'task_log:result',
'task_log:timestart',
'task_log:duration',
];
$this->add_filters_from_entities($filters);
}
/**
* Add the system report actions. An extra column will be appended to each row, containing all actions added here
*
* Note the use of ":id" placeholder which will be substituted according to actual values in the row
*/
protected function add_actions(): void {
// Action to view individual task log on a popup window.
$this->add_action((new action(
new moodle_url('/admin/tasklogs.php', ['logid' => ':id']),
new pix_icon('e/search', ''),
[],
true,
new lang_string('view'),
)));
// Action to download individual task log.
$this->add_action((new action(
new moodle_url('/admin/tasklogs.php', ['logid' => ':id', 'download' => true]),
new pix_icon('t/download', ''),
[],
false,
new lang_string('download'),
)));
}
}
@@ -1,417 +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/>.
namespace core_admin\reportbuilder\local\systemreports;
use core_admin\reportbuilder\local\filters\courserole;
use core\context\system;
use core_cohort\reportbuilder\local\entities\cohort;
use core_cohort\reportbuilder\local\entities\cohort_member;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\filters\boolean_select;
use core_reportbuilder\local\helpers\database;
use core_reportbuilder\local\helpers\user_profile_fields;
use core_reportbuilder\local\report\action;
use core_reportbuilder\local\report\filter;
use core_reportbuilder\system_report;
use core_role\reportbuilder\local\entities\role;
use core_user\fields;
use lang_string;
use moodle_url;
use pix_icon;
defined('MOODLE_INTERNAL') || die();
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/authlib.php');
require_once($CFG->libdir.'/enrollib.php');
require_once($CFG->dirroot.'/user/lib.php');
/**
* Browse users system report class implementation
*
* @package core_admin
* @copyright 2023 David Carrillo <davidmc@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class users extends system_report {
/**
* Initialise report, we need to set the main table, load our entities and set columns/filters
*/
protected function initialise(): void {
global $CFG;
// Our main entity, it contains all of the column definitions that we need.
$entityuser = new user();
$entityuseralias = $entityuser->get_table_alias('user');
$this->set_main_table('user', $entityuseralias);
$this->add_entity($entityuser);
// Any columns required by actions should be defined here to ensure they're always available.
$fullnamefields = array_map(fn($field) => "{$entityuseralias}.{$field}", fields::get_name_fields());
$this->add_base_fields("{$entityuseralias}.id, {$entityuseralias}.confirmed, {$entityuseralias}.mnethostid,
{$entityuseralias}.suspended, {$entityuseralias}.username, " . implode(', ', $fullnamefields));
if ($this->get_parameter('withcheckboxes', false, PARAM_BOOL)) {
$canviewfullnames = has_capability('moodle/site:viewfullnames', \context_system::instance());
$this->set_checkbox_toggleall(static function(\stdClass $row) use ($canviewfullnames): array {
return [$row->id, fullname($row, $canviewfullnames)];
});
}
$paramguest = database::generate_param_name();
$this->add_base_condition_sql("{$entityuseralias}.deleted <> 1 AND {$entityuseralias}.id <> :{$paramguest}",
[$paramguest => $CFG->siteguest]);
$entitycohortmember = new cohort_member();
$entitycohortmemberalias = $entitycohortmember->get_table_alias('cohort_members');
$this->add_entity($entitycohortmember
->add_joins($entitycohortmember->get_joins())
->add_join("LEFT JOIN {cohort_members} {$entitycohortmemberalias}
ON {$entityuseralias}.id = {$entitycohortmemberalias}.userid")
);
$entitycohort = new cohort();
$entitycohortalias = $entitycohort->get_table_alias('cohort');
$this->add_entity($entitycohort
->add_joins($entitycohort->get_joins())
->add_joins($entitycohortmember->get_joins())
->add_join("LEFT JOIN {cohort} {$entitycohortalias}
ON {$entitycohortalias}.id = {$entitycohortmemberalias}.cohortid")
);
// Join the role entity (Needed for the system role filter).
$roleentity = new role();
$role = $roleentity->get_table_alias('role');
$this->add_entity($roleentity
->add_join("LEFT JOIN (
SELECT DISTINCT r0.id, ras.userid
FROM {role} r0
JOIN {role_assignments} ras ON ras.roleid = r0.id
WHERE ras.contextid = ".SYSCONTEXTID."
) {$role} ON {$role}.userid = {$entityuseralias}.id")
);
// Now we can call our helper methods to add the content we want to include in the report.
$this->add_columns();
$this->add_filters();
$this->add_actions();
// Set if report can be downloaded.
$this->set_downloadable(true);
}
/**
* Validates access to view this report
*
* @return bool
*/
protected function can_view(): bool {
return has_any_capability(['moodle/user:update', 'moodle/user:delete'], system::instance());
}
/**
* Adds the columns we want to display in the report
*
* They are all provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier
*/
public function add_columns(): void {
$entityuser = $this->get_entity('user');
$entityuseralias = $entityuser->get_table_alias('user');
$this->add_column($entityuser->get_column('fullnamewithpicturelink'));
// Include identity field columns.
$identitycolumns = $entityuser->get_identity_columns($this->get_context());
foreach ($identitycolumns as $identitycolumn) {
$this->add_column($identitycolumn);
}
// Add "Last access" column.
$this->add_column(($entityuser->get_column('lastaccess'))
->set_callback(static function ($value, \stdClass $row): string {
if ($row->lastaccess) {
return format_time(time() - $row->lastaccess);
}
return get_string('never');
})
);
if ($column = $this->get_column('user:fullnamewithpicturelink')) {
$column
->add_fields("{$entityuseralias}.suspended, {$entityuseralias}.confirmed")
->add_callback(static function(string $fullname, \stdClass $row): string {
if ($row->suspended) {
$fullname .= ' ' . \html_writer::tag('span', get_string('suspended', 'moodle'),
['class' => 'badge badge-secondary ml-1']);
}
if (!$row->confirmed) {
$fullname .= ' ' . \html_writer::tag('span', get_string('confirmationpending', 'admin'),
['class' => 'badge badge-danger ml-1']);
}
return $fullname;
});
}
$this->set_initial_sort_column('user:fullnamewithpicturelink', SORT_ASC);
$this->set_default_no_results_notice(new lang_string('nousersfound', 'moodle'));
}
/**
* Adds the filters we want to display in the report
*
* They are all provided by the entities we previously added in the {@see initialise} method, referencing each by their
* unique identifier
*/
protected function add_filters(): void {
$entityuser = $this->get_entity('user');
$entityuseralias = $entityuser->get_table_alias('user');
$filters = [
'user:fullname',
'user:firstname',
'user:lastname',
'user:username',
'user:idnumber',
'user:email',
'user:department',
'user:institution',
'user:city',
'user:country',
'user:confirmed',
'user:suspended',
'user:timecreated',
'user:lastaccess',
'user:timemodified',
'user:auth',
'user:lastip',
'cohort:idnumber',
'role:name',
];
$this->add_filters_from_entities($filters);
// Enrolled in any course filter.
$ue = database::generate_alias();
[$now1, $now2] = database::generate_param_names(2);
$now = time();
$sql = "CASE WHEN ({$entityuseralias}.id IN (
SELECT userid FROM {user_enrolments} {$ue}
WHERE {$ue}.status = " . ENROL_USER_ACTIVE . "
AND ({$ue}.timestart = 0 OR {$ue}.timestart < :{$now1})
AND ({$ue}.timeend = 0 OR {$ue}.timeend > :{$now2})
)) THEN 1 ELSE 0 END";
$this->add_filter((new filter(
boolean_select::class,
'enrolledinanycourse',
new lang_string('anycourses', 'filters'),
$this->get_entity('user')->get_entity_name(),
))
->set_field_sql($sql, [
$now1 => $now,
$now2 => $now,
])
);
// Course role filter.
$this->add_filter((new filter(
courserole::class,
'courserole',
new lang_string('courserole', 'filters'),
$this->get_entity('user')->get_entity_name(),
))
->set_field_sql("{$entityuseralias}.id")
);
// Add user profile fields filters.
$userprofilefields = new user_profile_fields($entityuseralias . '.id', $entityuser->get_entity_name());
foreach ($userprofilefields->get_filters() as $filter) {
$this->add_filter($filter);
}
// Set options for system role filter.
if ($filter = $this->get_filter('role:name')) {
$filter
->set_header(new lang_string('globalrole', 'role'))
->set_options(get_assignable_roles(system::instance()));
}
}
/**
* Add the system report actions. An extra column will be appended to each row, containing all actions added here
*
* Note the use of ":id" placeholder which will be substituted according to actual values in the row
*/
protected function add_actions(): void {
global $DB, $USER;
$contextsystem = system::instance();
// Action to edit users.
$this->add_action((new action(
new moodle_url('/user/editadvanced.php', ['id' => ':id', 'course' => get_site()->id]),
new pix_icon('t/edit', ''),
[],
false,
new lang_string('edit', 'moodle'),
))->add_callback(static function(\stdclass $row) use ($USER, $contextsystem): bool {
return has_capability('moodle/user:update', $contextsystem) && (is_siteadmin($USER) || !is_siteadmin($row));
}));
// Action to suspend users (non mnet remote users).
$this->add_action((new action(
new moodle_url('/admin/user.php', ['suspend' => ':id', 'sesskey' => sesskey()]),
new pix_icon('t/show', ''),
[],
false,
new lang_string('suspenduser', 'admin'),
))->add_callback(static function(\stdclass $row) use ($USER, $contextsystem): bool {
return has_capability('moodle/user:update', $contextsystem) && !$row->suspended && !is_mnet_remote_user($row) &&
!($row->id == $USER->id || is_siteadmin($row));
}));
// Action to unsuspend users (non mnet remote users).
$this->add_action((new action(
new moodle_url('/admin/user.php', ['unsuspend' => ':id', 'sesskey' => sesskey()]),
new pix_icon('t/hide', ''),
[],
false,
new lang_string('unsuspenduser', 'admin'),
))->add_callback(static function(\stdclass $row) use ($USER, $contextsystem): bool {
return has_capability('moodle/user:update', $contextsystem) && $row->suspended && !is_mnet_remote_user($row) &&
!($row->id == $USER->id || is_siteadmin($row));
}));
// Action to unlock users (non mnet remote users).
$this->add_action((new action(
new moodle_url('/admin/user.php', ['unlock' => ':id', 'sesskey' => sesskey()]),
new pix_icon('t/unlock', ''),
[],
false,
new lang_string('unlockaccount', 'admin'),
))->add_callback(static function(\stdclass $row) use ($contextsystem): bool {
return has_capability('moodle/user:update', $contextsystem) && !is_mnet_remote_user($row) &&
login_is_lockedout($row);
}));
// Action to suspend users (mnet remote users).
$this->add_action((new action(
new moodle_url('/admin/user.php', ['acl' => ':id', 'sesskey' => sesskey(), 'accessctrl' => 'deny']),
new pix_icon('t/show', ''),
[],
false,
new lang_string('denyaccess', 'mnet'),
))->add_callback(static function(\stdclass $row) use ($DB, $contextsystem): bool {
if (!$accessctrl = $DB->get_field(table: 'mnet_sso_access_control', return: 'accessctrl',
conditions: ['username' => $row->username, 'mnet_host_id' => $row->mnethostid]
)) {
$accessctrl = 'allow';
}
return has_capability('moodle/user:update', $contextsystem) && !$row->suspended &&
is_mnet_remote_user($row) && $accessctrl == 'allow';
}));
// Action to unsuspend users (mnet remote users).
$this->add_action((new action(
new moodle_url('/admin/user.php', ['acl' => ':id', 'sesskey' => sesskey(), 'accessctrl' => 'allow']),
new pix_icon('t/hide', ''),
[],
false,
new lang_string('allowaccess', 'mnet'),
))->add_callback(static function(\stdclass $row) use ($DB, $contextsystem): bool {
if (!$accessctrl = $DB->get_field(table: 'mnet_sso_access_control', return: 'accessctrl',
conditions: ['username' => $row->username, 'mnet_host_id' => $row->mnethostid]
)) {
$accessctrl = 'allow';
}
return has_capability('moodle/user:update', $contextsystem) && !$row->suspended &&
is_mnet_remote_user($row) && $accessctrl == 'deny';
}));
// Action to delete users.
$this->add_action((new action(
new moodle_url('/admin/user.php', ['delete' => ':id', 'sesskey' => sesskey()]),
new pix_icon('t/delete', ''),
[
'class' => 'text-danger',
'data-modal' => 'confirmation',
'data-modal-title-str' => json_encode(['deleteuser', 'admin']),
'data-modal-content-str' => ':deletestr',
'data-modal-yes-button-str' => json_encode(['delete', 'core']),
'data-modal-destination' => ':deleteurl',
],
false,
new lang_string('delete', 'moodle'),
))->add_callback(static function(\stdclass $row) use ($USER, $contextsystem): bool {
// Populate deletion modal attributes.
$row->deletestr = json_encode([
'deletecheckfull',
'moodle',
fullname($row, true),
]);
$row->deleteurl = (new moodle_url('/admin/user.php', [
'delete' => $row->id,
'confirm' => md5($row->id),
'sesskey' => sesskey(),
]))->out(false);
return has_capability('moodle/user:delete', $contextsystem) &&
!is_mnet_remote_user($row) && $row->id != $USER->id && !is_siteadmin($row);
}));
$this->add_action_divider();
// Action to confirm users.
$this->add_action((new action(
new moodle_url('/admin/user.php', ['confirmuser' => ':id', 'sesskey' => sesskey()]),
new pix_icon('t/check', ''),
[],
false,
new lang_string('confirmaccount', 'moodle'),
))->add_callback(static function(\stdclass $row) use ($contextsystem): bool {
return has_capability('moodle/user:update', $contextsystem) && !$row->confirmed;
}));
// Action to resend email.
$this->add_action((new action(
new moodle_url('/admin/user.php', ['resendemail' => ':id', 'sesskey' => sesskey()]),
new pix_icon('t/email', ''),
[],
false,
new lang_string('resendemail', 'moodle'),
))->add_callback(static function(\stdclass $row): bool {
return !$row->confirmed && !is_mnet_remote_user($row);
}));
}
/**
* Row class
*
* @param \stdClass $row
* @return string
*/
public function get_row_class(\stdClass $row): string {
return $row->suspended ? 'text-muted' : '';
}
}
@@ -1,118 +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/>.
namespace core_admin\table;
use core_plugin_manager;
use dml_exception;
use html_writer;
use moodle_url;
use stdClass;
/**
* Activity Module admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class activity_management_table extends plugin_management_table {
public function setup() {
$this->set_attribute('id', 'modules');
$this->set_attribute('class', 'admintable generaltable');
parent::setup();
}
protected function get_table_id(): string {
return 'module-administration-table';
}
protected function get_plugintype(): string {
return 'mod';
}
public function guess_base_url(): void {
$this->define_baseurl(
new moodle_url('/admin/modules.php')
);
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/modules.php', $params);
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
return array_merge(
array_slice($columns, 0, 1, true),
['activities' => get_string('activities')],
array_slice($columns, 1, null, true),
);
}
protected function col_name(stdClass $row): string {
global $OUTPUT;
$status = $row->plugininfo->get_status();
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
return html_writer::span(
get_string('pluginmissingfromdisk', 'core', $row->plugininfo),
'notifyproblem'
);
}
return html_writer::span(
html_writer::img(
$OUTPUT->image_url('monologo', $row->plugininfo->name),
'',
[
'class' => 'icon',
],
) . get_string('modulename', $row->plugininfo->name)
);
}
/**
* Show the number of activities present, with a link to courses containing activity if relevant.
*
* @param mixed $row
* @return string
*/
protected function col_activities(stdClass $row): string {
global $DB, $OUTPUT;
try {
$count = $DB->count_records_select($row->plugininfo->name, "course <> 0");
} catch (dml_exception $e) {
$count = -1;
}
if ($count > 0) {
return $OUTPUT->action_link(
new moodle_url('/course/search.php', [
'modulelist' => $row->plugininfo->name,
]),
$count,
null,
['title' => get_string('showmodulecourse')]
);
} else if ($count < 0) {
return get_string('error');
} else {
return $count;
}
}
}
@@ -1,153 +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/>.
namespace core_admin\table;
use html_writer;
use moodle_url;
use stdClass;
/**
* Tiny admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_management_table extends \core_admin\table\plugin_management_table {
/** @var plugininfo[] A list of blocks which cannot be deleted */
protected array $undeletableblocktypes;
/** @var stdClass[] A list of basic block data */
protected array $blockdata;
/** @var array<string,int> A list of course counts */
protected array $courseblocks;
public function __construct() {
global $DB;
parent::__construct();
$this->undeletableblocktypes = \block_manager::get_undeletable_block_types();
$sql = 'SELECT b.name,
b.id,
COUNT(DISTINCT binst.id) as totalcount
FROM {block} b
LEFT JOIN {block_instances} binst ON binst.blockname = b.name
GROUP BY b.id,
b.name
ORDER BY b.name ASC';
$this->blockdata = $DB->get_records_sql($sql);
$sql = "SELECT blockname
FROM {block_instances}
WHERE pagetypepattern = 'course-view-*'
GROUP BY blockname";
$this->courseblocks = $DB->get_records_sql($sql);
}
protected function get_plugintype(): string {
return 'block';
}
public function guess_base_url(): void {
$this->define_baseurl(
new moodle_url('/admin/blocks.php')
);
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/blocks.php', $params);
}
protected function get_table_js_module(): string {
return 'core_admin/block_management_table';
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
return array_merge(
array_slice($columns, 0, 1, true),
['instances' => get_string('blockinstances', 'admin')],
array_slice($columns, 1, 2, true),
['protect' => get_string('blockprotect', 'admin')],
array_slice($columns, 3, null, true),
);
}
protected function get_columns_with_help(): array {
return [
'protect' => new \help_icon('blockprotect', 'admin'),
];
}
/**
* Render the instances column
* @param stdClass $row
* @return string
*/
protected function col_instances(stdClass $row): string {
$blockdata = $this->blockdata[$row->plugininfo->name];
if (array_key_exists($blockdata->name, $this->courseblocks)) {
return html_writer::link(
new moodle_url('/course/search.php', [
'blocklist' => $blockdata->id,
]),
$blockdata->totalcount,
);
}
return $blockdata->totalcount;
}
/**
* Render the protect column.
*
* @param stdClass $row
* @return string
*/
protected function col_protect(stdClass $row): string {
global $OUTPUT;
$params = [
'sesskey' => sesskey(),
];
$protected = in_array($row->plugininfo->name, $this->undeletableblocktypes);
$pluginname = $row->plugininfo->displayname;
if ($protected) {
$params['unprotect'] = $row->plugininfo->name;
$icon = $OUTPUT->pix_icon('t/unlock', get_string('blockunprotectblock', 'admin', $pluginname));
} else {
$params['protect'] = $row->plugininfo->name;
$icon = $OUTPUT->pix_icon('t/lock', get_string('blockprotectblock', 'admin', $pluginname));
}
return html_writer::link(
$this->get_action_url($params),
$icon,
[
'data-action' => 'toggleprotectstate',
'data-plugin' => $row->plugin,
'data-target-state' => $protected ? 0 : 1,
],
);
return '';
}
}
@@ -1,63 +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/>.
namespace core_admin\table;
use moodle_url;
/**
* Tiny admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class editor_management_table extends \core_admin\table\plugin_management_table {
protected function get_plugintype(): string {
return 'editor';
}
public function guess_base_url(): void {
$this->define_baseurl(
new moodle_url('/admin/settings.php', ['section' => 'manageeditors'])
);
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/editors.php', $params);
}
protected function order_plugins(array $plugins): array {
global $CFG;
// The Editor list is stored in an ordered string.
$activeeditors = explode(',', $CFG->texteditors);
$sortedplugins = [];
foreach ($activeeditors as $editor) {
if (isset($plugins[$editor])) {
$sortedplugins[$editor] = $plugins[$editor];
unset($plugins[$editor]);
}
}
$otherplugins = parent::order_plugins($plugins);
return array_merge(
$sortedplugins,
$otherplugins
);
}
}
-281
View File
@@ -1,281 +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/>.
namespace core_admin\table;
use core_plugin_manager;
use flexible_table;
use html_writer;
use stdClass;
defined('MOODLE_INTERNAL') || die();
require_once("{$CFG->libdir}/tablelib.php");
/**
* Plugin Management table.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class hook_list_table extends flexible_table {
/** @var \core\plugininfo\base[] The plugin list */
protected array $plugins = [];
/** @var int The number of enabled plugins of this type */
protected int $enabledplugincount = 0;
/** @var core_plugin_manager */
protected core_plugin_manager $pluginmanager;
/** @var string The plugininfo class for this plugintype */
protected string $plugininfoclass;
/** @var stdClass[] The list of emitted hooks with metadata */
protected array $emitters;
public function __construct() {
global $CFG;
$this->define_baseurl('/admin/hooks.php');
parent::__construct('core_admin-hook_list_table');
// Add emitted hooks.
$this->emitters = \core\hook\manager::discover_known_hooks();
$this->setup_column_configuration();
$this->setup();
}
/**
* Set up the column configuration for this table.
*/
protected function setup_column_configuration(): void {
$columnlist = [
'details' => get_string('hookname', 'core_admin'),
'callbacks' => get_string('hookcallbacks', 'core_admin'),
'deprecates' => get_string('hookdeprecates', 'core_admin'),
];
$this->define_columns(array_keys($columnlist));
$this->define_headers(array_values($columnlist));
$columnswithhelp = [
'callbacks' => new \help_icon('hookcallbacks', 'admin'),
];
$columnhelp = array_map(function (string $column) use ($columnswithhelp): ?\renderable {
if (array_key_exists($column, $columnswithhelp)) {
return $columnswithhelp[$column];
}
return null;
}, array_keys($columnlist));
$this->define_help_for_headers($columnhelp);
}
/**
* Print the table.
*/
public function out(): void {
// All hook consumers referenced from the db/hooks.php files.
$hookmanager = \core\di::get(\core\hook\manager::class);
$allhooks = (array)$hookmanager->get_all_callbacks();
// Add any unused hooks.
foreach (array_keys($this->emitters) as $classname) {
if (isset($allhooks[$classname])) {
continue;
}
$allhooks[$classname] = [];
}
// Order rows by hook name, putting core first.
\core_collator::ksort($allhooks);
$corehooks = [];
foreach ($allhooks as $classname => $consumers) {
if (str_starts_with($classname, 'core\\')) {
$corehooks[$classname] = $consumers;
unset($allhooks[$classname]);
}
}
$allhooks = array_merge($corehooks, $allhooks);
foreach ($allhooks as $classname => $consumers) {
$this->add_data_keyed(
$this->format_row((object) [
'classname' => $classname,
'callbacks' => $consumers,
]),
$this->get_row_class($classname),
);
}
$this->finish_output(false);
}
protected function col_details(stdClass $row): string {
return $row->classname .
$this->get_description($row) .
html_writer::div($this->get_tags_for_row($row));
}
/**
* Show the name column content.
*
* @param stdClass $row
* @return string
*/
protected function get_description(stdClass $row): string {
if (!array_key_exists($row->classname, $this->emitters)) {
return '';
}
return html_writer::tag(
'small',
clean_text(markdown_to_html($this->emitters[$row->classname]['description']), FORMAT_HTML),
);
}
protected function col_deprecates(stdClass $row): string {
if (!class_exists($row->classname)) {
return '';
}
$deprecates = \core\hook\manager::get_replaced_callbacks($row->classname);
if (count($deprecates) === 0) {
return '';
}
$content = html_writer::start_tag('ul');
foreach ($deprecates as $deprecatedmethod) {
$content .= html_writer::tag('li', $deprecatedmethod);
}
$content .= html_writer::end_tag('ul');
return $content;
}
protected function col_callbacks(stdClass $row): string {
global $CFG;
$hookclass = $row->classname;
$cbinfo = [];
foreach ($row->callbacks as $definition) {
$iscallable = is_callable($definition['callback'], false, $callbackname);
$isoverridden = isset($CFG->hooks_callback_overrides[$hookclass][$definition['callback']]);
$info = "{$callbackname}&nbsp;({$definition['priority']})";
if (!$iscallable) {
$info .= '&nbsp;';
$info .= $this->get_tag(
get_string('error'),
'danger',
get_string('hookcallbacknotcallable', 'core_admin', $callbackname),
);
}
if ($isoverridden) {
// The lang string meaning should be close enough here.
$info .= $this->get_tag(
get_string('hookconfigoverride', 'core_admin'),
'warning',
get_string('hookconfigoverride_help', 'core_admin'),
);
}
$cbinfo[] = $info;
}
if ($cbinfo) {
$output = html_writer::start_tag('ol');
foreach ($cbinfo as $callback) {
$class = '';
if ($definition['disabled']) {
$class = 'dimmed_text';
}
$output .= html_writer::tag('li', $callback, ['class' => $class]);
}
$output .= html_writer::end_tag('ol');
return $output;
} else {
return '';
}
}
/**
* Get the HTML to display the badge with tooltip.
*
* @param string $tag The main text to display
* @param null|string $type The pill type
* @param null|string $tooltip The content of the tooltip
* @return string
*/
protected function get_tag(
string $tag,
?string $type = null,
?string $tooltip = null,
): string {
$attributes = [];
if ($type === null) {
$type = 'info';
}
if ($tooltip) {
$attributes['data-toggle'] = 'tooltip';
$attributes['title'] = $tooltip;
}
return html_writer::span($tag, "badge badge-{$type}", $attributes);
}
/**
* Get the code to display a set of tags for this table row.
*
* @param stdClass $row
* @return string
*/
protected function get_tags_for_row(stdClass $row): string {
if (!array_key_exists($row->classname, $this->emitters)) {
// This hook has been defined in the db/hooks.php file
// but does not refer to a hook in this version of Moodle.
return $this->get_tag(
get_string('hookunknown', 'core_admin'),
'warning',
get_string('hookunknown_desc', 'core_admin'),
);
}
if (!class_exists($row->classname)) {
// This hook has been defined in a hook discovery agent, but the class it refers to could not be found.
return $this->get_tag(
get_string('hookclassmissing', 'core_admin'),
'warning',
get_string('hookclassmissing_desc', 'core_admin'),
);
}
$tags = $this->emitters[$row->classname]['tags'] ?? [];
$taglist = array_map(function($tag): string {
if (is_array($tag)) {
return $this->get_tag(...$tag);
}
return $this->get_tag($tag, 'badge bg-info text-white');
}, $tags);
return implode("\n", $taglist);
}
protected function get_row_class(string $classname): string {
return '';
}
}
@@ -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/>.
namespace core_admin\table;
use moodle_url;
use stdClass;
/**
* Media plugin admin settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class media_management_table extends \core_admin\table\plugin_management_table {
/** @var array The list of used extensions */
protected array $usedextensions = [];
protected function get_plugintype(): string {
return 'media';
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/media.php', $params);
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
return array_merge(
array_slice($columns, 0, 1, true),
['supports' => get_string('supports', 'core_media')],
array_slice($columns, 1, null, true),
);
}
protected function col_name(stdClass $row): string {
global $OUTPUT, $PAGE;
$name = $row->plugininfo->name;
if ($PAGE->theme->resolve_image_location('icon', 'media_' . $name, false)) {
$icon = $OUTPUT->pix_icon('icon', '', "media_{$name}", ['class' => 'icon pluginicon']);
} else {
$icon = $OUTPUT->pix_icon('spacer', '', 'moodle', ['class' => 'icon pluginicon noicon']);
}
$help = '';
if (get_string_manager()->string_exists('pluginname_help', 'media_' . $name)) {
$help = '&nbsp;' . $OUTPUT->help_icon('pluginname', 'media_' . $name);
}
return $icon . $row->plugininfo->displayname . $help;
}
protected function col_supports(stdClass $row): string {
return $row->plugininfo->supports($this->usedextensions);
}
}
@@ -1,514 +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/>.
namespace core_admin\table;
use context_system;
use core_plugin_manager;
use core_table\dynamic as dynamic_table;
use flexible_table;
use html_writer;
use moodle_url;
use stdClass;
defined('MOODLE_INTERNAL') || die();
require_once("{$CFG->libdir}/tablelib.php");
/**
* Plugin Management table.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
abstract class plugin_management_table extends flexible_table implements dynamic_table {
/** @var \core\plugininfo\base[] The plugin list */
protected array $plugins = [];
/** @var int The number of enabled plugins of this type */
protected int $enabledplugincount = 0;
/** @var core_plugin_manager */
protected core_plugin_manager $pluginmanager;
/** @var string The plugininfo class for this plugintype */
protected string $plugininfoclass;
public function __construct() {
global $CFG;
parent::__construct($this->get_table_id());
require_once($CFG->libdir . '/adminlib.php');
// Fetch the plugininfo class.
$this->pluginmanager = core_plugin_manager::instance();
$this->plugininfoclass = $this->pluginmanager::resolve_plugininfo_class($this->get_plugintype());
$this->guess_base_url();
$this->plugins = $this->get_sorted_plugins();
$this->enabledplugincount = count(array_filter($this->plugins, function ($plugin) {
return $plugin->is_enabled();
}));
$this->setup_column_configuration();
$this->set_filterset(new plugin_management_table_filterset());
$this->setup();
}
/**
* Get the list of sorted plugins.
*
* @return \core\plugininfo\base[]
*/
protected function get_sorted_plugins(): array {
if ($this->plugininfoclass::plugintype_supports_ordering()) {
return $this->plugininfoclass::get_sorted_plugins();
} else {
$plugins = $this->pluginmanager->get_plugins_of_type($this->get_plugintype());
return self::sort_plugins($plugins);
}
}
/**
* Sort the plugins list.
*
* Note: This only applies to plugins which do not support ordering.
*
* @param \core\plugininfo\base[] $plugins
* @return \core\plugininfo\base[]
*/
protected function sort_plugins(array $plugins): array {
// The asort functions work by reference.
\core_collator::asort_objects_by_property($plugins, 'displayname');
return $plugins;
}
/**
* Set up the column configuration for this table.
*/
protected function setup_column_configuration(): void {
$columnlist = $this->get_column_list();
$this->define_columns(array_keys($columnlist));
$this->define_headers(array_values($columnlist));
$columnswithhelp = $this->get_columns_with_help();
$columnhelp = array_map(function (string $column) use ($columnswithhelp): ?\renderable {
if (array_key_exists($column, $columnswithhelp)) {
return $columnswithhelp[$column];
}
return null;
}, array_keys($columnlist));
$this->define_help_for_headers($columnhelp);
}
/**
* Set the standard order of the plugins.
*
* @param array $plugins
* @return array
*/
protected function order_plugins(array $plugins): array {
uasort($plugins, function ($a, $b) {
if ($a->is_enabled() && !$b->is_enabled()) {
return -1;
} else if (!$a->is_enabled() && $b->is_enabled()) {
return 1;
}
return strnatcasecmp($a->name, $b->name);
});
return $plugins;
}
/**
* Get the plugintype for this table.
*
* @return string
*/
abstract protected function get_plugintype(): string;
/**
* Get the action URL for this table.
*
* The action URL is used to perform all actions when JS is not available.
*
* @param array $params
* @return moodle_url
*/
abstract protected function get_action_url(array $params = []): moodle_url;
/**
* Provide a default implementation for guessing the base URL from the action URL.
*/
public function guess_base_url(): void {
$this->define_baseurl($this->get_action_url());
}
/**
* Get the web service method used to toggle state.
*
* @return null|string
*/
protected function get_toggle_service(): ?string {
return 'core_admin_set_plugin_state';
}
/**
* Get the web service method used to order plugins.
*
* @return null|string
*/
protected function get_sortorder_service(): ?string {
return 'core_admin_set_plugin_order';
}
/**
* Get the ID of the table.
*
* @return string
*/
protected function get_table_id(): string {
return 'plugin_management_table-' . $this->get_plugintype();
}
/**
* Get a list of the column titles
* @return string[]
*/
protected function get_column_list(): array {
$columns = [
'name' => get_string('name', 'core'),
'version' => get_string('version', 'core'),
];
if ($this->supports_disabling()) {
$columns['enabled'] = get_string('pluginenabled', 'core_plugin');
}
if ($this->supports_ordering()) {
$columns['order'] = get_string('order', 'core');
}
$columns['settings'] = get_string('settings', 'core');
$columns['uninstall'] = get_string('uninstallplugin', 'core_admin');
return $columns;
}
protected function get_columns_with_help(): array {
return [];
}
/**
* Get the context for this table.
*
* @return context_system
*/
public function get_context(): context_system {
return context_system::instance();
}
/**
* Get the table content.
*/
public function get_content(): string {
ob_start();
$this->out();
$content = ob_get_contents();
ob_end_clean();
return $content;
}
/**
* Print the table.
*/
public function out(): void {
$plugintype = $this->get_plugintype();
foreach ($this->plugins as $plugininfo) {
$plugin = "{$plugintype}_{$plugininfo->name}";
$rowdata = (object) [
'plugin' => $plugin,
'plugininfo' => $plugininfo,
'name' => $plugininfo->displayname,
'version' => $plugininfo->versiondb,
];
$this->add_data_keyed(
$this->format_row($rowdata),
$this->get_row_class($rowdata)
);
}
$this->finish_output(false);
}
/**
* This table is not downloadable.
* @param bool $downloadable
* @return bool
*/
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
public function is_downloadable($downloadable = null): bool {
return false;
}
/**
* Show the name column content.
*
* @param stdClass $row
* @return string
*/
protected function col_name(stdClass $row): string {
$status = $row->plugininfo->get_status();
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
return html_writer::span(
get_string('pluginmissingfromdisk', 'core', $row->plugininfo),
'notifyproblem'
);
}
if ($row->plugininfo->is_installed_and_upgraded()) {
return $row->plugininfo->displayname;
}
return html_writer::span(
$row->plugininfo->displayname,
'notifyproblem'
);
}
/**
* Show the enable/disable column content.
*
* @param stdClass $row
* @return string
*/
protected function col_enabled(stdClass $row): string {
global $OUTPUT;
$enabled = $row->plugininfo->is_enabled();
$params = [
'sesskey' => sesskey(),
'plugin' => $row->plugininfo->name,
'action' => $enabled ? 'disable' : 'enable',
];
if ($enabled) {
$icon = $OUTPUT->pix_icon('t/hide', get_string('disableplugin', 'core_admin', $row->plugininfo->displayname));
} else {
$icon = $OUTPUT->pix_icon('t/show', get_string('enableplugin', 'core_admin', $row->plugininfo->displayname));
}
return html_writer::link(
$this->get_action_url($params),
$icon,
[
'data-toggle-method' => $this->get_toggle_service(),
'data-action' => 'togglestate',
'data-plugin' => $row->plugin,
'data-state' => $enabled ? 1 : 0,
],
);
}
protected function col_order(stdClass $row): string {
global $OUTPUT;
if (!$this->supports_ordering()) {
return '';
}
if (!$row->plugininfo->is_enabled()) {
return '';
}
if ($this->enabledplugincount <= 1) {
// There is only one row.
return '';
}
$hasup = true;
$hasdown = true;
if (empty($this->currentrow)) {
// This is the top row.
$hasup = false;
}
if ($this->currentrow === ($this->enabledplugincount - 1)) {
// This is the last row.
$hasdown = false;
}
if ($this->supports_ordering()) {
$dataattributes = [
'data-method' => $this->get_sortorder_service(),
'data-action' => 'move',
'data-plugin' => $row->plugin,
];
} else {
$dataattributes = [];
}
if ($hasup) {
$upicon = html_writer::link(
$this->get_action_url([
'sesskey' => sesskey(),
'action' => 'up',
'plugin' => $row->plugininfo->name,
]),
$OUTPUT->pix_icon('t/up', get_string('moveup')),
array_merge($dataattributes, ['data-direction' => 'up']),
);
} else {
$upicon = $OUTPUT->spacer();
}
if ($hasdown) {
$downicon = html_writer::link(
$this->get_action_url([
'sesskey' => sesskey(),
'action' => 'down',
'plugin' => $row->plugininfo->name,
]),
$OUTPUT->pix_icon('t/down', get_string('movedown')),
array_merge($dataattributes, ['data-direction' => 'down']),
);
} else {
$downicon = $OUTPUT->spacer();
}
// For now just add the up/down icons.
return html_writer::span($upicon . $downicon);
}
/**
* Show the settings column content.
*
* @param stdClass $row
* @return string
*/
protected function col_settings(stdClass $row): string {
if ($settingsurl = $row->plugininfo->get_settings_url()) {
return html_writer::link($settingsurl, get_string('settings'));
}
return '';
}
/**
* Show the Uninstall column content.
*
* @param stdClass $row
* @return string
*/
protected function col_uninstall(stdClass $row): string {
$status = $row->plugininfo->get_status();
if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
return get_string('status_new', 'core_plugin');
}
if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
$uninstall = get_string('status_missing', 'core_plugin') . '<br/>';
} else {
$uninstall = '';
}
if ($uninstallurl = $this->pluginmanager->get_uninstall_url($row->plugin)) {
$uninstall .= html_writer::link($uninstallurl, get_string('uninstallplugin', 'core_admin'));
}
return $uninstall;
}
/**
* Get the JS module used to manage this table.
*
* This should be a class which extends 'core_admin/plugin_management_table'.
*
* @return string
*/
protected function get_table_js_module(): string {
return 'core_admin/plugin_management_table';
}
/**
* Add JS specific to this implementation.
*
* @return string
*/
protected function get_dynamic_table_html_end(): string {
global $PAGE;
$PAGE->requires->js_call_amd($this->get_table_js_module(), 'init');
return parent::get_dynamic_table_html_end();
}
/**
* Get any class to add to the row.
*
* @param mixed $row
* @return string
*/
protected function get_row_class($row): string {
$plugininfo = $row->plugininfo;
if ($plugininfo->get_status() === core_plugin_manager::PLUGIN_STATUS_MISSING) {
return '';
}
if (!$plugininfo->is_enabled()) {
return 'dimmed_text';
}
return '';
}
public static function get_filterset_class(): string {
return self::class . '_filterset';
}
/**
* Whether this plugin type supports the disabling of plugins.
*
* @return bool
*/
protected function supports_disabling(): bool {
return $this->plugininfoclass::plugintype_supports_disabling();
}
/**
* Whether this table should show ordering fields.
*
* @return bool
*/
protected function supports_ordering(): bool {
return $this->plugininfoclass::plugintype_supports_ordering();
}
/**
* Check if the user has the capability to access this table.
*
* Default implementation for plugin management tables is to require 'moodle/site:config' capability
*
* @return bool Return true if capability check passed.
*/
public function has_capability(): bool {
return has_capability('moodle/site:config', $this->get_context());
}
}
@@ -1,27 +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/>.
namespace core_admin\table;
/**
* This file contains the dynamic interface.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class plugin_management_table_filterset extends \core_table\local\filter\filterset {
}
@@ -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/>.
namespace core_admin\table;
use moodle_url;
/**
* Admin tool settings.
*
* @package core_admin
* @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class tool_plugin_management_table extends \core_admin\table\plugin_management_table {
protected function get_plugintype(): string {
return 'tool';
}
protected function get_column_list(): array {
$columns = parent::get_column_list();
unset($columns['settings']);
return $columns;
}
protected function get_action_url(array $params = []): moodle_url {
return new moodle_url('/admin/settings.php', array_merge(['section' => 'toolsmanagement'], $params));
}
}
-174
View File
@@ -1,174 +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/>.
/**
* Task executor for adhoc tasks.
*
* @package core
* @subpackage cli
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once("{$CFG->libdir}/clilib.php");
list($options, $unrecognized) = cli_get_params(
[
'help' => false,
'showsql' => false,
'showdebugging' => false,
'execute' => false,
'keep-alive' => 0,
'ignorelimits' => false,
'force' => false,
'id' => null,
'classname' => null,
'taskslimit' => null,
'failed' => false,
], [
'h' => 'help',
'e' => 'execute',
'k' => 'keep-alive',
'i' => 'ignorelimits',
'f' => 'force',
'c' => 'classname',
'l' => 'taskslimit',
]
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$help = <<<EOT
Ad hoc cron tasks.
Options:
-h, --help Print out this help
--showsql Show sql queries before they are executed
--showdebugging Show developer level debugging information
-e, --execute Run all queued adhoc tasks
-k, --keep-alive=N Keep this script alive for N seconds and poll for new adhoc tasks
-i --ignorelimits Ignore task_adhoc_concurrency_limit and task_adhoc_max_runtime limits
-f, --force Run even if cron is disabled
--id Run (failed) task with id
-c, --classname Run tasks with a certain classname (FQN)
-l, --taskslimit=N Run at most N tasks
--failed Run only tasks that failed, ie those with a fail delay
Run all queued tasks:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --execute
Run all queued tasks of specific class:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --classname=\\\\core_course\\\\task\\\\course_delete_modules
Double backslash for the shell escape reasons.
Run a specific task:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --id=123456
Run a specific task with debugging:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --id=123456 --showsql --showdebugging
To profile a long running task:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --taskslimit=1 --classname='\\some\\class\\name' --ignorelimits
EOT;
if ($options['help']) {
echo $help;
exit(0);
}
if (CLI_MAINTENANCE) {
echo "CLI maintenance mode active, cron execution suspended.\n";
exit(1);
}
if (moodle_needs_upgrading()) {
echo "Moodle upgrade pending, cron execution suspended.\n";
exit(1);
}
if (!get_config('core', 'cron_enabled') && !$options['force']) {
mtrace('Cron is disabled. Use --force to override.');
exit(1);
}
// Common debugging options.
if ($options['showdebugging']) {
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql']) {
$DB->set_debug(true);
}
if (!empty($CFG->showcronsql)) {
$DB->set_debug(true);
}
if (!empty($CFG->showcrondebugging)) {
set_debugging(DEBUG_DEVELOPER, true);
}
// Process params.
core_php_time_limit::raise();
// Increase memory limit.
raise_memory_limit(MEMORY_EXTRA);
// Emulate normal session - we use admin account by default.
\core\cron::setup_user();
\core\local\cli\shutdown::script_supports_graceful_exit();
$humantimenow = date('r', time());
mtrace("Server Time: {$humantimenow}\n");
$classname = $options['classname'];
// Run a single adhoc task only, if requested.
if (!empty($options['id'])) {
$taskid = (int) $options['id'];
\core\cron::run_adhoc_task($taskid);
exit(0);
}
// Run all failed tasks.
if (!empty($options['failed'])) {
\core\cron::run_failed_adhoc_tasks($classname);
exit(0);
}
// Examine params and determine if we should run.
$execute = (bool) $options['execute'];
$keepalive = empty($options['keep-alive']) ? 0 : (int) $options['keep-alive'];
$taskslimit = empty($options['taskslimit']) ? null : (int) $options['taskslimit'];
$checklimits = empty($options['ignorelimits']);
if ($classname || $keepalive || $taskslimit) {
$execute = true;
}
// Output the help text if no criteria for running the adhoc tasks are given.
if (!$execute) {
echo $help;
exit(0);
}
\core\cron::run_adhoc_tasks(time(), $keepalive, $checklimits, null, $taskslimit, $classname);
-111
View File
@@ -1,111 +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 hack is intended for clustered sites that do not want
* to use shared cachedir for component cache.
*
* This file needs to be called after any change in PHP files in dataroot,
* that is before upgrade and install.
*
* @package core
* @copyright 2013 Petr Skoda (skodak) {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
define('ABORT_AFTER_CONFIG', true); // We need just the values from config.php.
define('CACHE_DISABLE_ALL', true); // This prevents reading of existing caches.
define('IGNORE_COMPONENT_CACHE', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
// Now get cli options.
list($options, $unrecognized) = cli_get_params(
array(
'file' => false,
'rebuild' => false,
'print' => false,
'help' => false
),
array(
'h' => 'help'
)
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
}
if (!$options['rebuild'] and !$options['file'] and !$options['print']) {
$help =
"Create alternative component cache file
Options:
-h, --help Print out this help
--rebuild Rebuild \$CFG->alternative_component_cache file
--file=filepath Save component cache to file
--print Print component cache file content
Example:
\$ php admin/cli/rebuild_alternative_component_cache.php --rebuild
";
echo $help;
exit(0);
}
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);
$content = core_component::get_cache_content();
if ($options['print']) {
echo $content;
exit(0);
}
if ($options['rebuild']) {
if (empty($CFG->alternative_component_cache)) {
fwrite(STDERR, 'config.php does not contain $CFG->alternative_component_cache setting');
fwrite(STDERR, "\n");
exit(2);
}
$target = $CFG->alternative_component_cache;
} else {
$target = $options['file'];
}
if (!$target) {
fwrite(STDERR, "Invalid target file $target");
fwrite(STDERR, "\n");
exit(1);
}
$bytes = file_put_contents($target, $content);
if (!$bytes) {
fwrite(STDERR, "Error writing to $target");
fwrite(STDERR, "\n");
exit(1);
}
// Success.
echo "File $target was updated\n";
exit(0);
+8 -6
View File
@@ -28,8 +28,9 @@
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false),
@@ -74,15 +75,16 @@ if (!empty($CFG->showcronsql)) {
$DB->set_debug(true);
}
if (!empty($CFG->showcrondebugging)) {
set_debugging(DEBUG_DEVELOPER, true);
$CFG->debug = DEBUG_DEVELOPER;
$CFG->debugdisplay = true;
}
$starttime = microtime();
// Emulate normal session.
\core\cron::setup_user();
/// emulate normal session
cron_setup_user();
// Start output log.
/// Start output log
$timenow = time();
mtrace("Server Time: ".date('r',$timenow)."\n\n");
@@ -95,4 +97,4 @@ backup_cron_automated_helper::run_automated_backup(backup_cron_automated_helper:
mtrace("Automated cron backups completed correctly");
$difftime = microtime_diff($starttime, microtime());
mtrace("Execution took ".$difftime." seconds");
mtrace("Execution took ".$difftime." seconds");
-135
View File
@@ -1,135 +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 script allows to do backup.
*
* @package core
* @subpackage cli
* @copyright 2013 Lancaster University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', 1);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
// Now get cli options.
list($options, $unrecognized) = cli_get_params(array(
'courseid' => false,
'courseshortname' => '',
'cmid' => false,
'destination' => '',
'help' => false,
), array('h' => 'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] || !($options['courseid'] || $options['courseshortname'] || $options['cmid'])) {
$help = <<<EOL
Perform backup of the given course or course module.
Options:
--courseid=INTEGER Course ID for backup.
--courseshortname=STRING Course shortname for backup. This option is ignored if courseid is set.
--cmid=INTEGER Course module ID for backup. This option is ignored if courseid or courseshortname is set.
--destination=STRING Path where to store backup file. If not set the backup
will be stored within the course backup file area.
-h, --help Print out this help.
Example:
\$sudo -u www-data /usr/bin/php admin/cli/backup.php --courseid=2 --destination=/moodle/backup/\n
EOL;
echo $help;
die;
}
$admin = get_admin();
if (!$admin) {
mtrace("Error: No admin account was found");
die;
}
// Do we need to store backup somewhere else?
$dir = rtrim($options['destination'], '/');
if (!empty($dir)) {
if (!file_exists($dir) || !is_dir($dir) || !is_writable($dir)) {
mtrace("Destination directory does not exists or not writable.");
die;
}
}
// Check that the course or course module exists.
if ($options['courseid']) {
$course = $DB->get_record('course', array('id' => $options['courseid']), '*', MUST_EXIST);
} else if ($options['courseshortname']) {
$course = $DB->get_record('course', array('shortname' => $options['courseshortname']), '*', MUST_EXIST);
} else if ($options['cmid']) {
$cm = $DB->get_record('course_modules', ['id' => $options['cmid']], '*', MUST_EXIST);
}
cli_heading('Performing backup...');
if (!empty($course)) {
$bc = new backup_controller(backup::TYPE_1COURSE, $course->id, backup::FORMAT_MOODLE,
backup::INTERACTIVE_YES, backup::MODE_GENERAL, $admin->id);
} else if (!empty($cm)) {
$bc = new backup_controller(backup::TYPE_1ACTIVITY, $cm->id, backup::FORMAT_MOODLE,
backup::INTERACTIVE_YES, backup::MODE_GENERAL, $admin->id);
} else {
throw new \moodle_exception('invalidoption');
}
// Set the default filename.
$format = $bc->get_format();
$type = $bc->get_type();
$id = $bc->get_id();
$users = $bc->get_plan()->get_setting('users')->get_value();
$anonymised = $bc->get_plan()->get_setting('anonymize')->get_value();
$filename = backup_plan_dbops::get_default_backup_filename($format, $type, $id, $users, $anonymised);
$bc->get_plan()->get_setting('filename')->set_value($filename);
// Execution.
$bc->finish_ui();
$bc->execute_plan();
$results = $bc->get_results();
$file = $results['backup_destination']; // May be empty if file already moved to target location.
// Do we need to store backup somewhere else?
if (!empty($dir)) {
if ($file) {
mtrace("Writing " . $dir.'/'.$filename);
if ($file->copy_content_to($dir.'/'.$filename)) {
$file->delete();
mtrace("Backup completed.");
} else {
mtrace("Destination directory does not exist or is not writable. Leaving the backup in the course backup file area.");
}
}
} else {
if (!empty($course)) {
mtrace("Backup completed, the new file is listed in the backup area of the given course");
} else {
mtrace("Backup completed, the new file is listed in the backup area of the given module");
}
}
$bc->destroy();
exit(0);
-119
View File
@@ -1,119 +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/>.
/**
* Build and store theme CSS.
*
* @package core
* @subpackage cli
* @copyright 2017 Ryan Wyllie <ryan@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once("$CFG->libdir/clilib.php");
require_once("$CFG->libdir/csslib.php");
require_once("$CFG->libdir/outputlib.php");
$longparams = [
'themes' => null,
'direction' => null,
'help' => false,
'verbose' => false
];
$shortmappings = [
't' => 'themes',
'd' => 'direction',
'h' => 'help',
'v' => 'verbose'
];
// Get CLI params.
list($options, $unrecognized) = cli_get_params($longparams, $shortmappings);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
echo
"Compile the CSS for one or more installed themes.
Existing CSS caches will replaced.
By default all themes will be recompiled unless otherwise specified.
Options:
-t, --themes A comma separated list of themes to be compiled
-d, --direction Only compile a single direction (either ltr or rtl)
-v, --verbose Print info comments to stdout
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/build_theme_css.php --themes=boost --direction=ltr
";
die;
}
if (empty($options['verbose'])) {
$trace = new null_progress_trace();
} else {
$trace = new text_progress_trace();
}
cli_heading('Build theme css');
// Determine which themes we need to build.
$themenames = [];
if (is_null($options['themes'])) {
$trace->output('No themes specified. Finding all installed themes.');
$themenames = array_keys(core_component::get_plugin_list('theme'));
} else {
if (is_string($options['themes'])) {
$themenames = explode(',', $options['themes']);
} else {
cli_error('--themes must be a comma separated list of theme names');
}
}
$trace->output('Checking that each theme is correctly installed...');
$themeconfigs = [];
foreach ($themenames as $themename) {
if (is_null(theme_get_config_file_path($themename))) {
cli_error("Unable to find theme config for {$themename}");
}
// Load the config for the theme.
$themeconfigs[] = theme_config::load($themename);
}
$directions = ['ltr', 'rtl'];
if (!is_null($options['direction'])) {
if (!in_array($options['direction'], $directions)) {
cli_error("--direction must be either ltr or rtl");
}
$directions = [$options['direction']];
}
$trace->output('Building CSS for themes: ' . implode(', ', $themenames));
theme_build_css_for_themes($themeconfigs, $directions);
exit(0);
-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/>.
/**
* CLI script allowing to get and set config values.
*
* This is technically just a thin wrapper for {@link get_config()} and
* {@link set_config()} functions.
*
* @package core
* @subpackage cli
* @copyright 2017 David Mudrák <david@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
$usage = "Displays the current value of the given site setting. Allows to set it to the given value, too.
Usage:
# php cfg.php [--component=<componentname>] [--json] [--shell-arg]
# php cfg.php --name=<configname> [--component=<componentname>] [--shell-arg] [--no-eol]
# php cfg.php --name=<configname> [--component=<componentname>] --set=<value>
# php cfg.php --name=<configname> [--component=<componentname>] --unset
# php cfg.php [--help|-h]
Options:
-h --help Print this help.
--component=<frankenstyle> Name of the component the variable is part of. Defaults to core.
--name=<configname> Name of the configuration variable to get/set. If missing, print all
configuration variables of the given component.
--set=<value> Set the given variable to this value.
--unset Unset the given variable.
--shell-arg Escape output values so that they can be directly used as shell script arguments.
--json Encode output list of values using JSON notation.
--no-eol Do not include the trailing new line character when printing the value.
The list of all variables of the given component can be printed as
tab-separated list (default) or JSON object (--json). Particular values are
printed as raw text values, optionally escaped so that they can be directly
used as shell script arguments (--shell-arg). Single values are displayed with
trailing new line by default, unless explicitly disabled (--no-eol).
In the read mode, the script exits with success status 0 if the requested value
is found. If the requested variable is not set, the script exits with status 3.
When listing all variables of the component, the exit status is always 0 even
if no variables for the given component are found. When setting/unsetting a
value, the exit status is 0. When attempting to set/unset a value that has
already been hard-set in config.php, the script exits with error status 4. In
case of unexpected error, the script exits with error status 1.
Examples:
# php cfg.php
Prints tab-separated list of all core configuration variables and their values.
# php cfg.php --json
Prints list of all core configuration variables and their values as a JSON object.
# php cfg.php --name=release
Prints the given configuration variable - e.g. \$CFG->release in this case.
# php cfg.php --component=tool_recyclebin
# Prints tab-separated list of the plugin's configuration variables.
# export DATAROOT=\$(php cfg.php --name=dataroot --shell-arg --no-eol)
Stores the given configuration variable in the shell variable, escaped
so that it can be safely used as a shell argument.
# php cfg.php --name=theme --set=classic
Sets the given configuration variable to the given value.
# php cfg.php --name=noemailever --unset
Unsets the previously configured variable.
";
list($options, $unrecognised) = cli_get_params([
'help' => false,
'component' => null,
'name' => null,
'set' => null,
'unset' => false,
'shell-arg' => false,
'json' => false,
'no-eol' => false,
], [
'h' => 'help'
]);
if ($unrecognised) {
$unrecognised = implode(PHP_EOL.' ', $unrecognised);
cli_error(get_string('cliunknowoption', 'core_admin', $unrecognised));
}
if ($options['help']) {
cli_writeln($usage);
exit(2);
}
if ($options['unset'] || $options['set'] !== null) {
// Unset the variable or set it to the given value.
if (empty($options['name'])) {
cli_error('Missing configuration variable name', 2);
}
// Check that the variable is not hard-set in the main config.php already.
$component = $options['component'];
if (!empty($component)) {
$componentsettings = $CFG->forced_plugin_settings[$component] ?? [];
$settinginconfig = array_key_exists($options['name'], $componentsettings);
} else {
$settinginconfig = array_key_exists($options['name'], $CFG->config_php_settings);
}
if ($settinginconfig) {
cli_error('The configuration variable is hard-set in the config.php, unable to change.', 4);
}
$new = $options['set'];
$old = get_config($options['component'], $options['name']);
if ($new !== $old) {
set_config($options['name'], $options['set'], $options['component']);
add_to_config_log($options['name'], $old, $new, $options['component']);
}
exit(0);
}
if ($options['name'] === null) {
// List all variables provided by the component (defaults to core).
$got = get_config($options['component']);
if ($options['json']) {
cli_writeln(json_encode($got));
} else {
foreach ($got as $name => $value) {
if ($options['shell-arg']) {
$value = escapeshellarg($value);
}
cli_writeln($name."\t".$value);
}
}
exit(0);
} else {
// Display the value of a single variable.
$got = get_config($options['component'], $options['name']);
if ($got === false) {
cli_error('No such configuration variable found.', 3);
}
if ($options['shell-arg']) {
$got = escapeshellarg($got);
}
if ($options['json']) {
$got = json_encode($got);
}
if ($options['no-eol']) {
cli_write($got);
} else {
cli_writeln($got);
}
exit(0);
}
-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);
-171
View File
@@ -1,171 +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/>.
/**
* CLI tool for system checks
*
* @package core
* @category check
* @copyright 2020 Brendan Heywood (brendan@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir.'/clilib.php');
use core\check\result;
list($options, $unrecognized) = cli_get_params([
'help' => false,
'filter' => '',
'type' => 'status',
'verbose' => false,
], [
'h' => 'help',
'f' => 'filter',
'v' => 'verbose',
't' => 'type',
]);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
$checks = \core\check\manager::get_checks($options['type']);
$types = join(', ', \core\check\manager::TYPES);
$help = "Run Moodle system checks
Options:
-h, --help Print out this help
-f, --filter Filter to a subset of checks
-t, --type Which set of checks? Defaults to 'status'
One of $types
-v, --verbose Show details of all checks, not just failed checks
Example:
sudo -u www-data php admin/cli/checks.php
sudo -u www-data php admin/cli/checks.php -v
sudo -u www-data php admin/cli/checks.php -v --filter=environment
";
if ($options['help']) {
echo $help;
die();
}
$filter = $options['filter'];
if ($filter) {
$checks = array_filter($checks, function($check, $key) use ($filter) {
$ref = $check->get_ref();
return (strpos($ref, $filter) !== false);
}, 1);
}
// These shell exit codes and labels align with the NRPE standard.
$exitcodes = [
result::NA => 0,
result::OK => 0,
result::INFO => 0,
result::UNKNOWN => 3,
result::WARNING => 1,
result::ERROR => 2,
result::CRITICAL => 2,
];
$exitlabel = [
result::NA => 'OK',
result::OK => 'OK',
result::INFO => 'OK',
result::UNKNOWN => 'UNKNOWN',
result::WARNING => 'WARNING',
result::ERROR => 'CRITICAL',
result::CRITICAL => 'CRITICAL',
];
$format = "% 10s| % -60s\n";
$spacer = "----------+--------------------------------------------------------------------\n";
$prefix = ' |';
$output = '';
$header = $exitlabel[result::OK] . ': ' . get_string('checksok', '', $options['type']) . "\n";
$exitcode = $exitcodes[result::OK];
foreach ($checks as $check) {
$ref = $check->get_ref();
$result = $check->get_result();
$status = $result->get_status();
$checkexitcode = $exitcodes[$status];
// Summary is treated as html.
$summary = $result->get_summary();
$summary = html_to_text($summary, 60, false);
if ($checkexitcode > $exitcode) {
$exitcode = $checkexitcode;
$header = $exitlabel[$status] . ': ' . $check->get_name() . " (" . $check->get_ref() . ")\n";
}
if (empty($messages[$status])) {
$messages[$status] = $result;
}
$len = strlen(get_string('status' . $status));
if ($options['verbose'] ||
$status == result::WARNING ||
$status == result::CRITICAL ||
$status == result::ERROR) {
$output .= sprintf(
$format,
$OUTPUT->check_result($result),
sprintf('%s (%s)', $check->get_name(), $ref)
);
$summary = str_replace("\n", "\n" . $prefix . ' ', $summary);
$output .= sprintf( $format, '', ' ' . $summary);
if ($options['verbose']) {
$actionlink = $check->get_action_link();
if ($actionlink) {
$output .= sprintf( $format, '', ' ' . $actionlink->url);
}
$output .= sprintf( $format, '', '');
}
}
}
// Print NRPE header.
print $header;
// Only show the table header if there is anything to show.
if ($output) {
print sprintf($format,
get_string('status'). ' ',
get_string('check')
) . $spacer;
print $output;
}
// NRPE shell exit code.
exit($exitcode);
+10 -135
View File
@@ -1,4 +1,5 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
@@ -29,32 +30,13 @@
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
require(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once($CFG->libdir.'/clilib.php'); // cli only functions
require_once($CFG->libdir.'/cronlib.php');
// Now get cli option.
[$options, $unrecognized] = cli_get_params(
[
'help' => false,
'stop' => false,
'list' => false,
'force' => false,
'enable' => false,
'disable' => false,
'disable-wait' => false,
'keep-alive' => null,
],
[
'h' => 'help',
's' => 'stop',
'l' => 'list',
'f' => 'force',
'e' => 'enable',
'd' => 'disable',
'w' => 'disable-wait',
'k' => 'keep-alive',
]
);
// now get cli options
list($options, $unrecognized) = cli_get_params(array('help'=>false),
array('h'=>'help'));
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
@@ -63,19 +45,10 @@ if ($unrecognized) {
if ($options['help']) {
$help =
"Execute periodic cron actions.
"Execute periodic cron actions.
Options:
-h, --help Print out this help
-s, --stop Notify all other running cron processes to stop after the current task
-l, --list Show the list of currently running tasks and how long they have been running
-f, --force Execute task even if cron is disabled
-e, --enable Enable cron
-d, --disable Disable cron
-w, --disable-wait=600 Disable cron and wait until all tasks finished or fail after N seconds (optional param)
-k, --keep-alive=N Keep this script alive for N seconds and poll for new tasks
The default value can be set by administrators in:
Site administration > Server > Tasks > Task processing > Keep alive time
-h, --help Print out this help
Example:
\$sudo -u www-data /usr/bin/php admin/cli/cron.php
@@ -85,102 +58,4 @@ Example:
die;
}
if ($options['stop']) {
// By clearing the caches this signals to other running processes
// to exit after finishing the current task.
\core\task\manager::clear_static_caches();
die;
}
if ($options['enable']) {
set_config('cron_enabled', 1);
mtrace('Cron has been enabled for the site.');
exit(0);
}
if ($options['disable']) {
set_config('cron_enabled', 0);
\core\task\manager::clear_static_caches();
mtrace('Cron has been disabled for the site.');
exit(0);
}
if ($options['list']) {
$tasks = \core\task\manager::get_running_tasks();
mtrace('The list of currently running tasks:');
$format = "%7s %-12s %-9s %-20s %-52s\n";
printf(
$format,
'PID',
'HOST',
'TYPE',
'TIME',
'CLASSNAME'
);
foreach ($tasks as $task) {
printf(
$format,
$task->pid,
substr($task->hostname, 0, 12),
$task->type,
format_time(time() - $task->timestarted),
substr($task->classname, 0, 52)
);
}
exit(0);
}
if ($wait = $options['disable-wait']) {
$started = time();
if (true === $wait) {
// Default waiting time.
$waitsec = 600;
} else {
$waitsec = $wait;
$wait = true;
}
set_config('cron_enabled', 0);
\core\task\manager::clear_static_caches();
mtrace('Cron has been disabled for the site.');
mtrace('Allocating ' . format_time($waitsec) . ' for the tasks to finish.');
$lastcount = 0;
while ($wait) {
$tasks = \core\task\manager::get_running_tasks();
if (count($tasks) == 0) {
mtrace('');
mtrace('All scheduled and adhoc tasks finished.');
exit(0);
}
if (time() - $started >= $waitsec) {
mtrace('');
mtrace('Wait time (' . format_time($waitsec) . ') elapsed, but ' . count($tasks) . ' task(s) still running.');
mtrace('Exiting with code 1.');
exit(1);
}
if (count($tasks) !== $lastcount) {
mtrace('');
mtrace(count($tasks) . " tasks currently running.", '');
$lastcount = count($tasks);
} else {
mtrace('.', '');
}
sleep(1);
}
}
if (!get_config('core', 'cron_enabled') && !$options['force']) {
mtrace('Cron is disabled. Use --force to override.');
exit(1);
}
\core\local\cli\shutdown::script_supports_graceful_exit();
$keepalive = $options['keep-alive'];
\core\cron::run_main_process($keepalive);
cron_run();
-65
View File
@@ -1,65 +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/>.
/**
* CLI script to reset dashboards.
*
* @package core
* @subpackage cli
* @copyright 2021 Brendan Heywood (brendan@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__.'/../../config.php');
require_once($CFG->libdir.'/clilib.php');
require_once($CFG->dirroot.'/my/lib.php');
list($options, $unrecognized) = cli_get_params([
'help' => false,
'execute' => false,
], [
'h' => 'help',
'e' => 'execute',
]);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized), 2);
}
if (!$options['execute']) {
$help = <<<EOF
Resets Moodle dashboards for all users
Options:
-h, --help Print out this help
-e, --execute Actually run the reset
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/dashboard_reset.php -e
EOF;
echo $help;
exit(0);
}
$progressbar = new progress_bar();
$progressbar->create();
my_reset_page_for_all_users(MY_PAGE_PRIVATE, 'my-index', $progressbar);
-123
View File
@@ -1,123 +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/>.
/**
* CLI script to delete a course.
*
* @package core
* @subpackage cli
* @author Mikhail Golenkov <mikhailgolenkov@catalyst-au.net>
* @copyright 2022 Catalyst IT
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../config.php');
require_once($CFG->libdir . '/clilib.php');
list($options, $unrecognized) = cli_get_params(
[
'courseid' => false,
'help' => false,
'showsql' => false,
'showdebugging' => false,
'disablerecyclebin' => false,
'non-interactive' => false,
], [
'c' => 'courseid',
'h' => 'help',
]
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] || empty($options['courseid'])) {
$help = <<<EOT
CLI script to delete a course.
Options:
-h, --help Print out this help
--showsql Show sql queries before they are executed
--showdebugging Show developer level debugging information
--disablerecyclebin Skip backing up the course
--non-interactive No interactive questions or confirmations
-c, --courseid Course id to be deleted
Example:
\$sudo -u www-data /usr/bin/php admin/cli/delete_course.php --courseid=123456
\$sudo -u www-data /usr/bin/php admin/cli/delete_course.php --courseid=123456 --showdebugging
\$sudo -u www-data /usr/bin/php admin/cli/delete_course.php --courseid=123456 --disablerecyclebin
EOT;
echo $help;
die;
}
$interactive = empty($options['non-interactive']);
if ($options['showdebugging']) {
mtrace('Enabling debugging...');
set_debugging(DEBUG_DEVELOPER, true);
}
if ($options['showsql']) {
mtrace('Enabling SQL debugging...');
$DB->set_debug(true);
}
if (CLI_MAINTENANCE) {
cli_error('CLI maintenance mode active, CLI execution suspended');
}
if (moodle_needs_upgrading()) {
cli_error('Moodle upgrade pending, CLI execution suspended');
}
$course = $DB->get_record('course', array('id' => $options['courseid']));
if (empty($course)) {
cli_error('Course not found');
}
mtrace('Deleting course id ' . $course->id);
mtrace('Course name: ' . $course->fullname);
mtrace('Short name: ' . $course->shortname);
if ($interactive) {
mtrace('');
$input = cli_input('Are you sure you wish to delete this course? (y/N)', 'N', ['y', 'Y', 'n', 'N']);
if (strtolower($input) != 'y') {
exit(0);
}
}
if ($options['disablerecyclebin']) {
mtrace('Disabling recycle bin...');
$overrideconfig = ['tool_recyclebin' => ['coursebinenable' => false, 'categorybinenable' => false]];
$CFG->forced_plugin_settings = array_merge($CFG->forced_plugin_settings, $overrideconfig);
}
core_php_time_limit::raise();
delete_course($course);
mtrace('Updating course count in categories...');
fix_course_sortorder();
mtrace('Done!');

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