Compare commits

...

667 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) 46f6bae002 Moodle release 3.10beta 2020-10-27 23:48:46 +01:00
Eloy Lafuente (stronk7) 8aacc3fa2b NOBUG: Fixed file access permissions 2020-10-27 23:48:45 +01:00
Eloy Lafuente (stronk7) 0715960dd8 NOBUG: Fixed SVG browser compatibility 2020-10-27 23:48:43 +01:00
Sara Arjona 65084e7371 MDL-69166 enrol_fee: fix behat string from fee to enrolment by payment 2020-10-27 15:01:47 +01:00
Sara Arjona da4b94e012 MDL-69166 enrol_fee: define default value to currency setting 2020-10-27 15:01:47 +01:00
Andrew Nicols e243810142 Merge branch 'MDL-69166-310-4' of git://github.com/rezaies/moodle into MOODLE_310_STABLE 2020-10-27 16:35:58 +08:00
Shamim Rezaie f018e92334 MDL-69166 core: Fix missing lang strings 2020-10-27 18:15:09 +11:00
Andrew Nicols 46e3cfa354 Merge branch 'MDL-69166-310-4' of git://github.com/rezaies/moodle into MOODLE_310_STABLE 2020-10-27 12:59:25 +08:00
Shamim Rezaie 25cf4fa5ca MDL-69166 core_payment: Add privacy implementation 2020-10-27 15:45:25 +11:00
Shamim Rezaie 0fb7847e09 MDL-69166 core_payment: Use promises instead of callbacks 2020-10-27 15:45:25 +11:00
Shamim Rezaie b63f17b5f1 MDL-69166 core_payment: Addressing various integration points
- Add help for 'payment account' field in the enrol instance form
- Remove MOODLE_INTERNALs when not necessary
- Add $userid to deliver_order
- Check if provider classes implement the provider interface
- Rename get_cost to get_payable
- get_payable returns payable object
- Improve registerEventListeners and added init
- Rename payment\provider to payment\service_provider
2020-10-27 15:45:25 +11:00
Shamim Rezaie 52305c9a2e MDL-69166 core_payment: Rename componentid to itemid 2020-10-27 15:45:25 +11:00
Shamim Rezaie 6b3d163a56 MDL-69166 core_payment: Renamed plugintype name from pg to paygw 2020-10-27 15:45:23 +11:00
Marina Glancy efc576fc5c MDL-69166 core_payment: addressing integration review 2020-10-27 15:45:00 +11:00
Marina Glancy 90fbc58de6 MDL-69166 core_payment: rename some functions 2020-10-27 15:45:00 +11:00
Shamim Rezaie 087845bb30 MDL-69166 Replace all upgrade steps with just "create_table" steps 2020-10-27 15:45:00 +11:00
Shamim Rezaie 7d10f35278 MDL-69166 core_payment: Add paymentarea to the payment subsystem 2020-10-27 15:45:00 +11:00
Marina Glancy 9476b48942 MDL-69166 core_payment: archiving accounts, triggering events, tests 2020-10-27 15:45:00 +11:00
Shamim Rezaie 7e11261633 MDL-69166 core_payment: Show cost on the modal when no gateway is chosen 2020-10-27 15:45:00 +11:00
Marina Glancy 15a4e4c87c MDL-69166 core_payment: improvements to api, small fixes 2020-10-27 15:45:00 +11:00
Marina Glancy 895f38cc76 MDL-69166 core_payment: add payment accounts 2020-10-27 15:45:00 +11:00
Shamim Rezaie acd1c82403 MDL-69166 enrol_fee: Show a warning when no currency is supported 2020-10-27 15:44:59 +11:00
Shamim Rezaie c9271eba7c MDL-69166 enrol_fee: Prevent adding instance if no currency is supported 2020-10-27 15:44:59 +11:00
Shamim Rezaie 0cf4bb2afc MDL-69166 pg_paypal: only prevent closing during autorisation 2020-10-27 15:44:59 +11:00
Shamim Rezaie 58a89a46e4 MDL-69166 core-payment: Autoselect gateway when there is only one 2020-10-27 15:44:59 +11:00
Shamim Rezaie 1882bb4792 MDL-69166 core_payment: payment gateways can have a surcharge 2020-10-27 15:44:59 +11:00
Shamim Rezaie bb7d679395 MDL-69166 core_payment: show cost on the modal 2020-10-27 15:44:59 +11:00
Shamim Rezaie 048a652106 MDL-69166 pg_paypal: capture payment directly 2020-10-27 15:44:59 +11:00
Shamim Rezaie 23e24a504e MDL-69166 pg_paypal: New helper to get order details from PayPal 2020-10-27 15:44:59 +11:00
Marina Glancy 761898c876 MDL-69166 core_form: allow modals to prevent closing on accidental click 2020-10-27 15:44:59 +11:00
Shamim Rezaie dc976fba1e MDL-69166 core_payment: ES6-ifying modal_gateways 2020-10-27 15:44:59 +11:00
Shamim Rezaie e2faf67247 MDL-69166 core_payment: Use a custom modal type for gateway selector 2020-10-27 15:44:59 +11:00
Shamim Rezaie b97899634c MDL-69166 pg_paypal: Support multiple currencies on the same page 2020-10-27 15:44:59 +11:00
Shamim Rezaie 2427b92114 MDL-69166 enrol_fee: use template for payment btn & properly format cost 2020-10-27 15:44:59 +11:00
Shamim Rezaie 34770016ee MDL-69166 core_payment: es6-ify 2020-10-27 15:44:59 +11:00
Shamim Rezaie d00c00dd4f MDL-69166 core_payment: add a callback for when payment is done 2020-10-27 15:44:59 +11:00
Shamim Rezaie ed1cc02522 MDL-69166 pg_paypal: Display PayPal buttons in a modal 2020-10-27 15:44:59 +11:00
Shamim Rezaie e1151bf6f5 MDL-69166 pg_paypal: handle paypal checkout callbacks 2020-10-27 15:44:59 +11:00
Shamim Rezaie bbb887f6ae MDL-69166 pg_paypal: Ability to connect to sandbox or live environment 2020-10-27 15:44:59 +11:00
Shamim Rezaie 4403b8f60d MDL-69166 pg_paypal: Process after payment 2020-10-27 15:44:59 +11:00
Shamim Rezaie 3c3b43a58c MDL-69166 core_payment: Save general payment information 2020-10-27 15:44:59 +11:00
Shamim Rezaie 04e2dc7c3b MDL-69166 pg_paypal: paypal helper class to work with API 2020-10-27 15:44:59 +11:00
Shamim Rezaie 05574af1a6 MDL-69166 enrol_fee: Implement callback functions for payment subsystem 2020-10-27 15:44:59 +11:00
Shamim Rezaie 5337ca485c MDL-69166 core_payment: helper methods to get cost and to deliver order
Also create the infrastructure to let components know when they have to
deliver what they sold. We are going to use namespace functions instead
of traditional callbacks.
2020-10-27 15:44:59 +11:00
Shamim Rezaie 3b0034cc91 MDL-69166 enrol_fee: set a description for enrolment 2020-10-27 15:44:59 +11:00
Shamim Rezaie ab6ca27571 MDL-69166 core_payment: send a purchase description to payment gateways
We truncate description to 127 chars as per PayPal requirement
2020-10-27 15:44:59 +11:00
Shamim Rezaie 149e530cc1 MDL-69166 pg_paypal: render PayPal buttons and set up transaction
We truncate brand_name to 127 chars as per PayPal requirement.
2020-10-27 15:44:59 +11:00
Shamim Rezaie 9a7aed4a25 MDL-69166 pg_paypal: WS and AMD to return some settings to be used in js 2020-10-27 15:44:59 +11:00
Shamim Rezaie ed04c3824c MDL-69166 core_payment: post to process payment 2020-10-27 15:44:59 +11:00
Shamim Rezaie 97e8cb0de4 MDL-69166 core_payment: display an image for each gateway 2020-10-27 15:44:59 +11:00
Shamim Rezaie a435c63e16 MDL-69166 core_payment: some basic styling 2020-10-27 15:44:59 +11:00
Shamim Rezaie c2321a263b MDL-69166 core_payment: display the gateways modal 2020-10-27 15:44:58 +11:00
Shamim Rezaie f3d7526419 MDL-69166 core_payment: WS to get list of gateways supporting a currency 2020-10-27 15:44:58 +11:00
Shamim Rezaie d3432a883c MDL-69166 enrol_fee: An enrolment plugin that supports payments 2020-10-27 15:44:58 +11:00
Shamim Rezaie e1cab8e18e MDL-69166 pg_paypal: A new payment gateway is born 2020-10-27 15:44:56 +11:00
Shamim Rezaie bc28c05995 MDL-69166 core: list settings page in the admin tree 2020-10-27 15:05:23 +11:00
Shamim Rezaie 4865d2a0ae MDL-69166 core_payment: basic gateway skeleton 2020-10-27 15:05:23 +11:00
Shamim Rezaie 8317134779 MDL-69166 core: define payment as a subsystem and pg as a plugin type 2020-10-27 15:05:23 +11:00
Michael Hawkins fbac2e9296 MDL-69559 course: Fix course download cap checks when creating courses 2020-10-27 12:01:09 +08:00
Michael Hawkins 599eed0f95 MDL-69559 core: Removed stopPropagation from tree click handling
It was preventing JS click event handlers being reached on some
elements, such as course admin items in Classic
(eg download course content for teachers).
2020-10-27 08:02:20 +08:00
Michael Hawkins 7d52d5def6 MDL-69559 course: Fixed behat navigation in download course content 2020-10-27 08:01:48 +08:00
Sara Arjona 0459910b53 MDL-65959 core_badges: fix unique index in upgrade.php
There was an error when creating the unique index. Apart from that,
the code has been reorganised to copy data in the new structure only
if password field hasn't been removed.
2020-10-26 23:56:46 +01:00
Sara Arjona 0dd7bb8374 Merge branch 'MDL-65959-310' of git://github.com/peterRd/moodle into MOODLE_310_STABLE 2020-10-26 22:44:05 +01:00
Peter Dias bcba1347f8 MDL-65959 badges: Allow cross domain/protocol functionality - obv2 2020-10-26 18:36:26 +08:00
Peter Dias b0e1edd427 MDL-65959 badge: Enable OB2.1 *connection* with cross domain ability 2020-10-26 18:36:26 +08:00
Peter Dias b0007a154c MDL-65959 badge: Reset external_identifiers if backpack details modified 2020-10-26 18:36:26 +08:00
Peter Dias 8c9d3695e3 MDL-65959 badge: Confirm assertion data is updated before awarding 2020-10-26 18:36:26 +08:00
Peter Dias 184944ce6a MDL-65959 badges: Unit and Behat tests 2020-10-26 18:36:26 +08:00
Peter Dias ad9f9e54a3 MDL-65959 badges: Do not use badge user preference after verification 2020-10-26 18:36:26 +08:00
Peter Dias 943b261760 MDL-65959 badges: Update the implementation to use admin set backpack 2020-10-26 18:36:25 +08:00
Peter 8dbc7c6532 MDL-65959 core_badges: Allow ability to upload badges cross domain. 2020-10-26 18:35:36 +08:00
Peter 6f7fe5df9c MDL-65959 core_badges: Unrestricted user's badger account
* Restructure the email to be backpack specific
* Amended table defintion and functions
2020-10-26 18:35:35 +08:00
Eloy Lafuente (stronk7) 11b6df58db Merge branch 'MDL-69993-310' of git://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-26 10:42:51 +01:00
Andrew Nicols 36beec930e Merge branch 'MDL-69995-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-10-26 16:00:38 +08:00
Adrian Greeve 750fe24949 MDL-69559 core_course: Fix to bad behat test formatting. 2020-10-26 13:28:10 +08:00
Adrian Greeve cc718b59d0 Merge branch 'MDL-69559-310-7' of git://github.com/mickhawkins/moodle into MOODLE_310_STABLE 2020-10-26 13:05:33 +08:00
Jun Pataleta 4dcc2d37c6 Merge branch 'MDL-67301-dynreg-squashed-310' of https://github.com/cengage/moodle into MOODLE_310_STABLE 2020-10-26 12:40:23 +08:00
Michael Hawkins d358b91e2b MDL-69559 course: Add course setting and cap to control course downloads 2020-10-26 10:25:37 +08:00
Michael Hawkins c053b93f0c MDL-69559 course: Add course content download UI and execution page 2020-10-26 10:19:39 +08:00
Michael Hawkins cdf91cc236 MDL-69559 course: Add capability and access checks for course download 2020-10-26 10:19:33 +08:00
Michael Hawkins fab34222ca MDL-69559 admin: Add course download admin settings and lang strings 2020-10-26 10:19:27 +08:00
Luca Bösch a9f5f8094c MDL-69995 backup: padding before activity icons. 2020-10-25 02:07:26 +02:00
Claude Vervoort 10e16c69c8 MDL-67301 mod_lti: dynamic registration 2020-10-24 09:28:32 -04:00
Eloy Lafuente (stronk7) 6594c54b2e on-demand release 3.10dev+ 2020-10-23 14:41:20 +02:00
Paul Holden 6dc336a5d4 MDL-69993 output: correct navigation node type for user reports. 2020-10-23 08:25:40 +01:00
Adrian Greeve 39128991d7 Merge branch 'MDL-67650-forced-checkbox-textarea-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-23 09:01:59 +08:00
Víctor Déniz e1990f2f33 Merge branch 'MDL-68664-310' of git://github.com/lameze/moodle into MOODLE_310_STABLE 2020-10-22 12:25:51 +01:00
Sara Arjona 1ce223c7e1 Merge branch 'MDL-69553-m310' of https://github.com/NeillM/moodle into MOODLE_310_STABLE 2020-10-22 08:56:05 +02:00
Brendan Heywood 6694715840 MDL-67650 admin: Consistently show forced config settings 2020-10-22 13:17:49 +11:00
Jake Dallimore 0a43a459ba Merge branch 'MDL-68438_310' of https://github.com/t-schroeder/moodle into MOODLE_310_STABLE 2020-10-22 09:30:48 +08:00
Adrian Greeve 7e0bcbfb19 Merge branch 'MDL-69788-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-22 09:07:54 +08:00
Eloy Lafuente (stronk7) eaf89f7754 Merge branch 'MDL-66392-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-21 19:45:26 +02:00
Paul Holden 5bbfcc25c0 MDL-66392 analytics: make model output directory default to empty.
Falling back to path within $CFG->dataroot/models.
2020-10-21 18:04:20 +01:00
Sara Arjona 4a495d66b8 Merge branch 'm310_MDL-68536_Notice_Undefined_Property_CFG_branch' of https://github.com/scara/moodle into MOODLE_310_STABLE 2020-10-21 18:32:47 +02:00
Sara Arjona b13ec3c353 Merge branch 'MDL-67673_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-10-21 17:38:16 +02:00
Víctor Déniz 5903054142 Merge branch 'MDL-69392-310' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-10-21 16:26:44 +01:00
Víctor Déniz 2dd9b53fd6 Merge branch 'MDL-69513-dkim-settings-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-21 11:56:54 +01:00
Eloy Lafuente (stronk7) 7f20e2071c MDL-67673 phpunit: Document all the changes in upgrade.txt
This includes:

- Breaking changes (return void + PHP 7.1 min requirement).
- Deprecations and removals.
- Specifically DbUnit and its replacement.
- Printer showing how to rerun tests removed.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 0ab106f41c MDL-67673 phpunit: Remove the rerun hint on failed test cases
That custom printer was using some hacks to be able to intercept
configuration switches, reflection and other tricks to be able to
print the:

To re-run:
 vendor/bin/phpunit --verbose "core_setuplib_testcase" lib/tests/setuplib_test.php

line on every failed/exceptional/skipped test. After some internal
discussion it was agreed that the normal phpunit output:

1) core_setuplib_testcase::test_localcachedir
Time is lower that allowed start value
Failed asserting that 1601976686 is equal to 1601976687 or is greater than 1601976687.

/var/www/html/lib/phpunit/classes/advanced_testcase.php:446
/var/www/html/lib/tests/setuplib_test.php:170
/var/www/html/lib/phpunit/classes/advanced_testcase.php:80

has already all the information at hand about how to rerun a test:

- vendor/bin/phpunit lib/tests/setuplib_test.php
- vendor/bin/phpunit --filter core_setuplib_testcase::test_localcachedir
- vendor/bin/phpunit --filter ::test_localcachedir
- vendor/bin/phpunit --testsuite componentname_testsuite
- vendor/bin/phpunit --config <<compoenent directory>>
- use --cache-result to get failed tests rerun with ease.
- ...

So better, let's use standard phpunit output and done. Also, note that,
with the upgrade to phpunit 8.5, the printer was not working correctly
any more, causing some switches, like --verbose ... to be ignored. Sure
it could have been fixed but, as commented above, no real need for all
that "parapheranlia" to print the rerun information.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 9f82c9aece MDL-67673 phpunit: deprecate old phpunit/dbunit stuff
Apply the standard deprecation procedure to the old APIs, to
be removed in Moodle 4.2 (MDL-69882). Existing unit tests
cover the deprecation debugging.

Originally MDL-64600
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 1f13dff1a7 MDL-67673 phpunit: Move tests to use new phpunit_dataset
- Make advanced_testcase old methods to use new ones internally.
- Fix advanced_testcase, statslib, mod/quiz and mod/data tests.

Originally MDL-64600
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) be396eddf0 MDL-67673 phpunit: Introduce a new, lightweight phpunit_dataset
In charge of taking over the, now removed/archived, phpunit/dbunit
package. It supports loading of CSV/XML files and strings and
PHP arrays, allowing to send the loaded information to database.

Perform some basic controls about the consistency of information,
surely not super-exhaustive but fair enough.

100% covered with unit test.

Planned like an "interim" replacement for phpunit/dbunit uses in
core that, ideally, should be moved to generators stuff at some
point.

Note, expect a few tests in core to fail with this commit, I've
changed some fixtures around. Next commit will fix existing uses.

Originally MDL-64600
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 4af4d709a4 MDL-67673 phpunit: Disable phpunit results cache by default
It can be enabled if desired from CLI using the --cache-result
option (or modifying the phpunit.xml cacheResult to true).

That will create the .phpunit.result.cache files that,
later, can be used to easily repeat failed (defects) tests or
run the slow ones first and more. See the --order-by option
to know more about all the available criteria. For example:

./vendor/bin/phpunit --order-by=defects --stop-on-defect

(will run all the failed ones first, stopping on problem, useful
for TDD and other scenarios, not so much for complete runs or CI).

Also, added to .gitignore so they won't be committed ever.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 46606b3ddd MDL-67673 phpunit: Remove deprecated assertEquals() params
The optional parameters of assertEquals() and assertNotEquals()
are deprecated in PHPUnit 8 (to be removed in PHPUnit 9):

- delta => use assertEqualsWithDelta()
- canonicalize => use assertEqualsCanonicalizing()
- ignoreCase => use assertEqualsIgnoringCase
- maxDepth => removed without replacement.

More info @ https://github.com/sebastianbergmann/phpunit/issues/3341

Initial search done with:

ag 'assert(Not)?Equals\(.*,.*,' --php

Then, running tests and fixing remaining cases.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 35bc26b516 MDL-67673 phpunit: Remove deprecated assertContains() uses on strings
Both assertContains() and assertNotContains() are deprecated in PHPUnit 8
for operations on strings. Also the optional case parameter is. All uses
must be changed to one of:

- assertStringContainsString()
- assertStringContainsStringIgnoringCase()
- assertStringNotContainsString()
- assertStringNotContainsStringIgnoringCase()

More info: https://github.com/sebastianbergmann/phpunit/issues/3422

Regexp to find all uses:

ag 'assert(Not)?Contains\('
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 106c64ac24 MDL-67673 phpunit: Remove deprecated non-public attribute assertions
With PHPUnit 8 a good number of assertions, all them related with
operations on non-public attributes have been deprecated. And will
be removed with PHPUnit 9.

The main point is that unit tests shouldn't be testing non-public
APIs (good practice) and those assertions were an error originally.

See https://github.com/sebastianbergmann/phpunit/issues/3338 for
the complete list and other details.

When possible (the attributes being checked are public), the change
is simple, just switching to normal assertions.

When the attributes are not public we need to find a workaround
to be able to test the same using public APIs, or use Reflection,
or remove the tests.

For the records, this is the regexp used to find all the cases:

ag '>(assertAttribute|attribute\(|readAttributte|getStaticAttribute| \
    getObjectAttribute)' -G "test.php"
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) ddf72dd60d MDL-67673 phpunit: Remove expectedException annotations
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

The annotations `@expectedException`, `@expectedExceptionCode`,
`@expectedExceptionMessage`, and `@expectedExceptionMessageRegExp`
are now deprecated.
Using these annotations will trigger a deprecation warning
in PHPUnit 8 and in PHPUnit 9 these annotations will be removed.

Also, all uses of expectExceptionMessageRegExp() has been moved
to expectExceptionMessageMatches(). See https://github.com/sebastianbergmann/phpunit/issues/3957

TODO: Various weirdness found while doing the changes with these tests:
- vendor/bin/phpunit lib/tests/exporter_test.php (created MDL-69700)
- vendor/bin/phpunit competency/tests/external_test.php (same issue than prev one)
- vendor/bin/phpunit question/engine/tests/questionengine_test.php (created MDL-69624)
- vendor/bin/phpunit lib/tests/event_test.php (created MDL-69688)
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) 0ae27225f5 MDL-67673 phpunit: Remove deprecated assertArraySubset()
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

assertArraySubset() is deprecated and will be removed in PHPUnit 9.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) a6674bf8a4 MDL-67673 phpunit: Remove deprecated assertInternalType()
While this is not strictly required, because removal will
happen in PHPUnit 9.0, we are already getting rid of all
uses in core.

From release notes:https://phpunit.de/announcements/phpunit-8.html

assertInternalType() is deprecated and will be removed in
PHPUnit 9. Refactor your test to use assertIsArray(), assertIsBool(),
assertIsFloat(), assertIsInt(), assertIsNumeric(), assertIsObject(),
assertIsResource(), assertIsString(), assertIsScalar(),
assertIsCallable(), or assertIsIterable() instead.
2020-10-21 12:46:05 +02:00
Eloy Lafuente (stronk7) dc87fd4b3f MDL-67673 phpunit: phpunit_constraint_object_is_equal_with_exceptions
Constraints are now declared final, so we cannot extend them anymore.

Hence, instead of extending PHPUnit\Framework\Constraint\IsEqual we
are just wrapping it into our constraint.
2020-10-21 12:46:04 +02:00
Eloy Lafuente (stronk7) d81a94807b MDL-67673 phpunit: Fix the return type of template methods
All the setup/teardown/pre/post/conditions template methods
now are required to return void. This was warned with phpunit 7
and now is enforced.

At the same time, fix a few wrong function names,
provider data and param types, return statements...
2020-10-21 12:46:04 +02:00
Eloy Lafuente (stronk7) c611109ed7 MDL-67673 phpunit: Bump to PHPUnit 8.5 and remove DBunit
This makes everything to break, but it's what we'll be fixing
in the next commits, heh. :-)

Generated with php72 (min version supported), following the
instructions @ https://docs.moodle.org/dev/Composer
2020-10-21 12:46:04 +02:00
Paul Holden 74ef7dc5b1 MDL-69788 admin: validate language menu configuration. 2020-10-21 11:24:22 +01:00
Jun Pataleta 8996ed98c7 Merge branch 'MDL-37226-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-10-21 17:46:48 +08:00
Tim Schroeder 3fcba4be5e MDL-68438 message: fixed email format change with messaging disabled 2020-10-21 11:29:15 +02:00
Neill Magill 55d463b9f2 MDL-69553 output: Handle pre-loading multiline string defines
Before this patch strings that were declared over multiple lines in
a template would not be parsed correctly.

{{#str}}value,
mod_forum{{/str}}

would have been been parsed to get_string('value', 'core')

{{#str}}
value, mod_forum
{{/str}}

would have been been parsed to get_string('', 'core')
2020-10-21 10:06:26 +01:00
Neill Magill bbb58b10ad MDL-69553 output: Unit tests for loading multiline string defines 2020-10-21 10:06:25 +01:00
Jun Pataleta f266c852c3 Merge branch 'MDL-69945-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-10-21 16:03:14 +08:00
Jun Pataleta b14daeaa9a MDL-69392 mod_forum: Colour contrast check for locked discussions 2020-10-21 14:54:25 +08:00
Jun Pataleta 8e083da3d5 MDL-69392 block_myoverview: Basic contrast check for the dashboard 2020-10-21 14:54:25 +08:00
Jun Pataleta 8312eeacb0 MDL-69392 question: Fix Try again button styling 2020-10-21 14:54:24 +08:00
Jun Pataleta 0ce40927cf MDL-69392 theme_boost: Improve question colour contrast
* Lighten info container.
* Fix colour contrast for the question container by
  - Lightening the background a bit
  - Darkening the text colour a bit
  - Making sure the link colour has good colour contrast against the
  question text.
* Fix colour contrast for the comments container by
  - Lightening the text colour a bit
  - Darkening the link colour a bit for better colour contrast against
  the feedback text.
2020-10-21 14:54:05 +08:00
Jun Pataleta 0cdfaccd4e MDL-69392 theme_classic: Darken red, blue and green colours
The current red, blue, and green colours achieve the minimum colour
contrast against a white background. However, when they're against
coloured background, text with these colours will easily fail the
4.5:1 contrast ratio requirement for Level AA.
The updated colours now have the following contrast ratio against a
white background:
* Blue  - #0f6fc5 (5.12:1, from 4.58:1)
* Green - #357a32 (5.27:1, from 4.63:1)
* Red   - #ca3120 (5.29:1, from 4.59:1)
2020-10-21 14:54:03 +08:00
Jun Pataleta d386d21360 MDL-69392 theme_boost: Darken red, blue and green colours
The current red, blue, and green colours achieve the minimum colour
contrast against a white background. However, when they're against
coloured background, text with these colours will easily fail the
4.5:1 contrast ratio requirement for Level AA.
The updated colours now have the following contrast ratio against a
white background:
* Blue  - #0f6fc5 (5.12:1, from 4.58:1)
* Green - #357a32 (5.27:1, from 4.63:1)
* Red   - #ca3120 (5.29:1, from 4.59:1)
2020-10-21 14:53:44 +08:00
Adrian Greeve 5429ece3f8 Merge branch 'MDL-69807-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-21 14:18:02 +08:00
Adrian Greeve 32f99bc4d1 Merge branch 'MDL-68766-M310' of https://github.com/michael-milette/moodle into MOODLE_310_STABLE 2020-10-21 12:54:02 +08:00
Jake Dallimore df0df3110d Merge branch 'MDL-68983-recent-session-lock-ro-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-21 12:45:55 +08:00
Jake Dallimore 2ced8c6674 Merge branch 'MDL-69902-310' of https://github.com/marinaglancy/moodle into MOODLE_310_STABLE 2020-10-21 10:57:35 +08:00
Jake Dallimore 17056bf206 Merge branch 'MDL-69751-310' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-10-21 10:02:47 +08:00
Eloy Lafuente (stronk7) 27b09acf75 on-demand release 3.10dev+ 2020-10-21 00:51:10 +02:00
Luca Bösch d159c32b84 MDL-65448 block_site_main_menu: Restyle moving. 2020-10-20 17:26:14 +02:00
Jake Dallimore 221f0e16d0 Merge branch 'MDL-67695-MOODLE_310_STABLE_get_lti_proxies' of https://github.com/andrewmadden/moodle into MOODLE_310_STABLE 2020-10-20 11:08:46 +08:00
Adrian Greeve 55189def65 Merge branch 'MOODLE_310_STABLE-MDL-68284' of https://github.com/yao9394/moodle into MOODLE_310_STABLE 2020-10-20 08:49:06 +08:00
Mihail Geshoski 086a2adc35 MDL-69751 core: Restore deleted guest user and add missing context
This upgrade step fixes the cases where the current guest user is
labelled as 'deleted' and the related user context is missing.
2020-10-20 08:41:35 +08:00
Mihail Geshoski 3c315a874a MDL-69751 course: Handle missing guest user context
Makes sure the guest user context exists when fetching
the recommended modules. If the context does not exist
an exception is being thrown describing the problem.
2020-10-20 08:39:17 +08:00
Simey Lameze b4a8a99898 MDL-68664 theme: remove right margin from form-inline class 2020-10-20 08:32:45 +08:00
Katie Ransom 08e8205d6f MDL-69962 tool_usertours: Fix increase in included files 2020-10-20 01:29:47 +01:00
Andrew Nicols 0a54a501eb Merge branch 'MDL-69687-m310' of https://github.com/sammarshallou/moodle into MOODLE_310_STABLE 2020-10-20 08:02:22 +08:00
Jenkins Automation 213ea00afe MDL-69726 calendar: fix raw event fetcher under postgres
Without this, there's a code path that under the right circumstances is hit and
results in a query with `FROM (mdl_event) ev` in it - which is not valid syntax
under postgres.
2020-10-20 07:46:00 +08:00
Paul Holden 9428e33d55 MDL-69807 blocks: remove redundant sesskey loading edit/delete page. 2020-10-19 22:40:45 +01:00
Eloy Lafuente (stronk7) 31a98b3fb2 Merge branch 'MDL-69906-310-searchsimpledb' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-10-19 22:56:31 +02:00
Eloy Lafuente (stronk7) ae6da7d6a0 Merge branch 'MDL-57756-text-customparams-310' of https://github.com/cengage/moodle into MOODLE_310_STABLE 2020-10-19 22:32:02 +02:00
Andrew Madden 4d5bc273ce MDL-67695 mod_lti: Use correct return structure for get_tool_proxies.
* Deprecated serialise_tool_proxy() as no longer used.
* Use tool_proxy_return_structure for each proxy.
* Added tests for getting all proxies and orphaned proxies.
2020-10-20 04:09:44 +11:00
Sara Arjona 33c7881448 Merge branch 'MDL-69897-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-19 18:14:54 +02:00
Sara Arjona b7146b655a Merge branch 'MDL-69900-310' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-10-19 13:41:59 +02:00
sam marshall 178d5a0e23 MDL-69687 Course: remove_course_contents orphaned completion data
The remove_course_contents function did not delete data from
course_module_completion table in most cases, resulting in large
quantities of orphaned data.
2020-10-19 10:24:44 +01:00
Sara Arjona f576390bd2 Merge branch 'MOODLE_310_MDL-69791' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-10-19 10:07:21 +02:00
Andrew Nicols 7ed7afad98 Merge branch 'MDL-65448-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-10-19 15:54:36 +08:00
Luca Bösch a7e12a77b1 MDL-65448 block_social_activities: Restyle moving. 2020-10-19 09:50:20 +02:00
Luca Bösch 09e02634d4 MDL-65448 core_course: Restyle non-JS activity moving. 2020-10-19 09:50:20 +02:00
Luca Bösch be019636d1 MDL-65448 gradebook: Remove erraneous dev .movehere class left over. 2020-10-19 09:50:19 +02:00
Luca Bösch 7789be4030 MDL-65448 core_course: Restyle non-JS activity moving. 2020-10-19 09:50:19 +02:00
Luca Bösch 91c9ca0f49 MDL-65448 block_site_main_menu: Restyle moving. 2020-10-19 09:50:18 +02:00
Luca Bösch 7c0923a3e4 MDL-65448 block_social_activities: Restyle moving. 2020-10-19 09:50:18 +02:00
Luca Bösch 83cba7b9b0 MDL-65448 gradebook: Restyle moving. 2020-10-19 09:50:18 +02:00
Sara Arjona cb4418bc5b Merge branch 'MDL-69736-310' of git://github.com/ferranrecio/moodle into MOODLE_310_STABLE 2020-10-19 09:03:51 +02:00
Brendan Heywood 4db3403481 MDL-69513 email: Add support for email DKIM signatures 2020-10-19 16:20:42 +11:00
Andrew Nicols 9296086653 Merge branch 'MDL-69687-m310' of https://github.com/sammarshallou/moodle into MOODLE_310_STABLE 2020-10-19 13:19:28 +08:00
Andrew Nicols 38d4a1b75f Merge branch 'MDL-65448-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-10-19 10:07:45 +08:00
Michael Milette 1b4ef7cd88 MDL-68766 auth: Login form: 'Log in using...' should be h3, not h6 2020-10-17 03:59:35 -04:00
sam marshall 3576eb4835 MDL-69687 Course: Improve removal of completion data on MySQL 2020-10-16 18:22:51 +01:00
sam marshall 39eb58c754 MDL-69687 DB: Add API for deleting data based on subquery
The new API works on normal databases (by deleting data based on the
subquery) and also on MySQL (by deleting the data using a weird join
on the subquery).
2020-10-16 18:22:51 +01:00
Luca Bösch c6731f8045 MDL-37226 assign: align select all header checkbox 2020-10-16 16:08:58 +02:00
Paul Holden 252f95e1b7 MDL-69788 lang: fallback to all translations if misconfigured.
If given translation list contains only invalid entries, fallback
to returning the complete list of available language translations.
2020-10-16 14:38:03 +01:00
Luca Bösch c24c9e174b MDL-65448 block_site_main_menu: Restyle moving. 2020-10-16 14:50:11 +02:00
Luca Bösch 199333208d MDL-65448 block_social_activities: Restyle moving. 2020-10-16 14:50:10 +02:00
Luca Bösch 91557080d7 MDL-65448 core_course: Restyle non-JS activity moving. 2020-10-16 14:50:10 +02:00
Luca Bösch 3370b20e3c MDL-65448 gradebook: Restyle moving. 2020-10-16 14:50:10 +02:00
Luca Bösch 2c98bfc4f4 MDL-69945 core_calendar: let circles appear as circles 2020-10-16 14:22:47 +02:00
Sara Arjona 36f0c3d531 on-demand release 3.10dev+ 2020-10-16 13:18:54 +02:00
Sagar Ghimire 1ebbd18b82 MDL-68284 gradebook: Prevent exposing hidden quiz grade item 2020-10-16 15:06:34 +11:00
Jake Dallimore 04a02b5bd9 Merge branch 'MOODLE_310_MDL-47178' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-10-16 11:52:29 +08:00
Jun Pataleta 506df9bdbd Merge branch 'MDL-69266-310' of https://github.com/HuongNV13/moodle into MOODLE_310_STABLE 2020-10-16 10:09:40 +08:00
Huong Nguyen 873b4847f5 MDL-69266 qtype_ddwtos: 'unlimited' options fail in 3.9 2020-10-15 20:05:52 +07:00
Adrian Greeve a2aa548af7 Merge branch 'MDL-69549-310-7' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-10-15 15:11:29 +08:00
Jun Pataleta d0c89df9ee Merge branch 'MDL-69583-310' of git://github.com/ferranrecio/moodle into MOODLE_310_STABLE 2020-10-15 13:56:58 +08:00
Jun Pataleta 30eccfabaa Merge branch 'MDL-69520-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-10-15 13:53:36 +08:00
Simey Lameze 63e2c543ae MDL-69549 mod_resource: content export implementation 2020-10-15 13:46:25 +08:00
Andrew Nicols a69b38d604 MDL-69549 mod_page: Content export implementation 2020-10-15 13:46:25 +08:00
Andrew Nicols 0ea391d1eb MDL-69549 mod_folder: Content export implementation 2020-10-15 13:46:25 +08:00
Andrew Nicols 17d4bc49f6 MDL-69549 core: Add context export API 2020-10-15 13:46:25 +08:00
Katie Ransom 57a13a5971 MDL-69739 tool_usertours: Add tour-level CSS selector 2020-10-15 13:35:32 +08:00
Eloy Lafuente (stronk7) 12fce2a4bd Merge branch 'MDL-69813-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-14 22:47:12 +02:00
Eloy Lafuente (stronk7) b68dd3a121 Merge branch 'MDL-63805-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-10-14 21:22:08 +02:00
Eloy Lafuente (stronk7) eb4c7963c0 MDL-68070 messaging: Ensure that error is shown on first messages
Before there is a conversation, messages between users are sent
using core_message_send_instant_messages instead of
core_message_send_messages_to_conversation.

That method had an undefined $errormessage variable, ultimately
causing the problem detected on message_post_message()/message_send()
to never been returned by the external.

This just adds the same error than already existing conversations do,
but returning it as warning, for BC, JS will show it.
2020-10-14 18:57:29 +02:00
Sara Arjona dde0818f6c MDL-69520 core_h5p: unit tests for covering example and tutorial 2020-10-14 18:35:52 +02:00
Sara Arjona ad28920d0b MDL-69520 core_h5p: add example and tutorial links 2020-10-14 18:35:50 +02:00
Eloy Lafuente (stronk7) a5cde22a26 MDL-68070 messaging: Amend lang string to be clearer for any user.
Credit goes to Helen Foster for the improvement, thanks!
2020-10-14 16:54:26 +02:00
Víctor Déniz 44719d2ad9 Merge branch 'MDL-68900-m310' of https://github.com/sumitnegi933/moodle into MOODLE_310_STABLE 2020-10-14 12:22:22 +01:00
Juan Leyva 784c09c834 MDL-63805 glossary: New WS mod_glossary_prepare_entry_for_edition 2020-10-14 12:57:33 +02:00
Juan Leyva 004be78003 MDL-63805 glossary: New WS mod_glossary_update_entry 2020-10-14 12:56:52 +02:00
Juan Leyva 7fae5f61ef MDL-63805 glossary: Glossary API refactor 2020-10-14 12:56:43 +02:00
Ferran Recio d7cadcc244 MDL-69583 tool_customlang: add CLI import 2020-10-14 11:59:33 +02:00
Jake Dallimore 2cb45addb1 Merge branch 'MOODLE_310_MDL-69848' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-10-14 09:42:43 +08:00
Víctor Déniz 5ea92799c4 Merge branch 'MDL-69779-better-x-redirect-by-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-13 23:41:59 +01:00
Víctor Déniz 55c9482171 Merge branch 'MDL-68440-310' of https://github.com/Peterburnett/moodle into MOODLE_310_STABLE 2020-10-13 23:15:48 +01:00
Simon Mok 1a7928173b MDL-68070 messaging: Fix error when personal notification is disabled 2020-10-13 23:40:46 +02:00
Eloy Lafuente (stronk7) c3299761f7 Merge branch 'MDL-63806-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-10-13 22:26:35 +02:00
Sara Arjona 9aeb59af73 on-demand release 3.10dev+ 2020-10-13 13:25:30 +02:00
Ferran Recio 3759daa952 MDL-69583 tool_customlang: add customization import 2020-10-13 12:33:13 +02:00
Brendan Heywood 15044cea7f MDL-68983 cache: Fix bug with readonly session combined with lock debug 2020-10-13 14:53:26 +11:00
Andrew Nicols 1170a8b694 Merge branch 'MDL-66928-request-dir-purge-bug-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-13 11:49:10 +08:00
Brendan Heywood 69959c371f MDL-66928 core: Move request dirs to system tmp instead of localcache 2020-10-13 14:29:30 +11:00
Andrew Nicols ec46b18e13 Merge branch 'MDL-67654-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-13 07:58:20 +08:00
Paul Holden f1acce7bef MDL-67654 mod_forum: formchangechecker for discussion inline replies. 2020-10-12 23:32:44 +01:00
Adrian Greeve 1c6e578db4 Merge branch 'MOODLE_310_MDL-69818' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-10-12 14:48:48 +08:00
Jake Dallimore a7ea95030c Merge branch 'MDL-68292-admin-sesskey-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-12 14:37:07 +08:00
Brendan Heywood 3f04dbee09 MDL-68292 core: Remove sesskey leakage on module pages 2020-10-12 17:11:59 +11:00
Adrian Greeve 6a91117d4a Merge branch 'MDL-65743-310' of git://github.com/lameze/moodle into MOODLE_310_STABLE 2020-10-12 13:41:44 +08:00
Simey Lameze cfe9f53e91 MDL-65743 lib: update moodle library docs 2020-10-12 13:10:12 +08:00
Simey Lameze decd480c42 MDL-65743 lib: add XMPPHP namespace and update calls 2020-10-12 13:10:12 +08:00
Simey Lameze d947f53d4c MDL-65743 lib: upgrade XMPPHP library to v2.2 2020-10-12 13:10:12 +08:00
Andrew Nicols 00877bf283 Merge branch 'MDL-69776-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-10-12 12:33:51 +08:00
Adrian Greeve 6f86e933ed Merge branch 'MDL-69649-310' of git://github.com/rezaies/moodle into MOODLE_310_STABLE 2020-10-12 10:15:41 +08:00
Jake Dallimore 6d7b36da59 Merge branch 'MDL-69910-calendar-protectusername-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-12 10:05:43 +08:00
Jake Dallimore 7924191691 Merge branch 'MDL-69707-redis-avoid-write-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-12 09:57:46 +08:00
Peter Burnett 0628d11380 MDL-68440 cache: Added counting of default mappings 2020-10-12 11:57:17 +10:00
Jake Dallimore 151a63b4cc Merge branch 'MDL-68406-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-10-12 09:51:51 +08:00
Adrian Greeve 4ebfbfe88c Merge branch 'MDL-69825-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-12 08:09:47 +08:00
Brendan Heywood 93a60507fc MDL-69779 core: Improved the X-Redirect-By header when debugging is on 2020-10-11 09:50:21 +11:00
Brendan Heywood 0a8371c690 MDL-69910 calendar: Fix export exception when both params are sent 2020-10-10 19:28:45 +11:00
Paul Holden 604f19afd6 MDL-69825 admin: externalpage class using a callback for access check.
Co-Authored-By: Marina Glancy <marina@moodle.com>
2020-10-09 15:09:05 +01:00
David Mudrák bda1473afa MDL-69906 admin: Display Setup search engine as link only if it is valid
We use auto-generated admin section name here so we need to check that
the target section actually exists.
2020-10-09 14:16:29 +02:00
Sara Arjona d70cfda576 on-demand release 3.10dev+ 2020-10-09 11:12:48 +02:00
Juan Leyva 3dc820a057 MDL-68406 tool_mobile: Allow users to log-out from the app
In this commit, we also reorganised how the Mobile box is displayed in the user profile.
We are allowing now site admins to see the user last access time.
2020-10-09 09:59:43 +02:00
Juan Leyva 4b64516b0e MDL-63806 glossary: New WS mod_glossary_delete_entry 2020-10-09 09:50:38 +02:00
Juan Leyva e8496407e9 MDL-63806 glossary: Return user permissions for entries in WS 2020-10-09 09:49:59 +02:00
Juan Leyva 0ab3fd7958 MDL-63806 glossary: Move delete code to API function 2020-10-09 09:49:59 +02:00
Marina Glancy d103bdba3d MDL-69902 core_search: fix error in the custom fields indexing 2020-10-09 08:52:47 +02:00
Adrian Greeve cf1d32e9c5 Merge branch 'MDL-68384-fix-spec-violations-310' of https://github.com/cengage/moodle into MOODLE_310_STABLE 2020-10-09 12:05:34 +08:00
Jun Pataleta b5fe033b18 Merge branch 'MDL-69740_310' of https://github.com/timhunt/moodle into MOODLE_310_STABLE 2020-10-09 11:56:44 +08:00
Jun Pataleta 05a3e35677 Merge branch 'MDL-69257-310' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-10-09 11:12:16 +08:00
Mihail Geshoski 03058394f2 MDL-69257 core_h5p: Move $maxsize outside the foreach loop
There is no reason to repeatedly obtain the maximum size for uploading
files as a part of foreach loop.
2020-10-09 10:36:01 +08:00
Martin Gauk 1a80427018 MDL-69257 H5P: Check size of uploaded files and virus scan 2020-10-09 10:36:01 +08:00
Stephen Bourget a2b727d7bc MDL-69900 core_backup: Allow IMSCC v1.0 restore to finish 2020-10-09 09:06:26 +08:00
Eloy Lafuente (stronk7) b2a382016f Merge branch 'MDL-69582-310' of git://github.com/ferranrecio/moodle into MOODLE_310_STABLE 2020-10-08 22:44:29 +02:00
Paul Holden 31efbf2e0e MDL-69897 repository: add heading to delete file modal. 2020-10-08 20:29:48 +01:00
Thomas Wedekind 3540343ceb MDL-69582 tool_customlang: export cli script 2020-10-08 19:30:26 +02:00
Thomas Wedekind 78076a621f MDL-69582 tool_customlang: add export langstring feature 2020-10-08 19:30:26 +02:00
Eloy Lafuente (stronk7) ca80e9a68d Merge branch 'MDL-69810-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-10-08 16:58:34 +02:00
Eloy Lafuente (stronk7) 9b9b38f44e Merge branch 'MDL-69712-310' of git://github.com/aanabit/moodle into MOODLE_310_STABLE 2020-10-08 16:25:35 +02:00
Sara Arjona 8e5b007c3e Merge branch 'MDL-64657-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-10-08 14:15:38 +02:00
Sara Arjona d487ee2240 Merge branch 'MDL-69146_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-10-08 12:43:29 +02:00
Sumit Negi 300e4aef4c MDL-68900 mod_forum: permission check for user who is viewing timed post
Pass current user object to post builder as argument, so that the permission to view timed post
will check with current user, who is viewing the posts instead of user who made that post.
2020-10-08 12:46:17 +05:30
Adrian Greeve eefa5c928f Merge branch 'MDL-69805-310' of https://github.com/dravek/moodle into MOODLE_310_STABLE 2020-10-08 15:00:29 +08:00
Adrian Greeve 407dcd4922 Merge branch 'MDL-69798_310' of https://github.com/timhunt/moodle into MOODLE_310_STABLE 2020-10-08 13:34:30 +08:00
Jake Dallimore 8d9a36fb8a Merge branch 'MDL-69192-310-behat' of https://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-10-08 09:22:40 +08:00
Andrew Nicols b2d43a7db1 MDL-68665 assignfeedback_editpdf: Coding style fixes 2020-10-08 08:24:07 +08:00
Andrew Nicols 876a5c143b Merge branch 'MDL-68665-310-assign-stamp-cache' of https://github.com/jamie-catalyst/moodle into MOODLE_310_STABLE 2020-10-08 08:23:36 +08:00
Andrew Nicols c562848596 MDL-69192 mod_assign: Stop clicking OK on non-existent modal 2020-10-08 08:04:43 +08:00
Eloy Lafuente (stronk7) 74efdb135d Merge branch 'MDL-69760-MOODLE_310_STABLE' of https://github.com/inkjet2000/moodle into MOODLE_310_STABLE 2020-10-08 00:25:14 +02:00
Víctor Déniz 46d1546c6e Merge branch 'MDL-69759-m310' of https://github.com/sammarshallou/moodle into MOODLE_310_STABLE 2020-10-07 22:24:58 +01:00
Jamie Stamp c2ba78902c MDL-68665 assignfeedback_editpdf: Fix systemsstamp URLs 2020-10-07 16:23:18 +01:00
Jamie Stamp 12fb5964f2 MDL-68665 assignfeedback_editpdf: Add filearea to persist stamps 2020-10-07 16:21:18 +01:00
Justin Merrill 52a84caaaa MDL-69760 core: add mdl_event index for assign adhoc tasks 2020-10-07 09:18:24 -04:00
Sara Arjona 524f6a656b Merge branch 'MDL-65451-310' of https://github.com/marinaglancy/moodle into MOODLE_310_STABLE 2020-10-07 09:39:58 +02:00
Andrew Nicols 86e69ea7b2 Merge branch 'MDL-69192-310' of https://github.com/willob99/moodle into MOODLE_310_STABLE 2020-10-07 13:18:41 +08:00
Andrew Nicols 12820e3a56 Merge branch 'MDL-67275-310-post_noun_verb' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-10-07 12:38:02 +08:00
Victor Deniz Falcon 36905f42b8 MDL-52407 travis: use Travis default notifications(email) 2020-10-07 10:45:54 +08:00
Adrian Greeve fd532533dd Merge branch 'MDL-59510-310' of https://github.com/snake/moodle into MOODLE_310_STABLE 2020-10-07 09:58:52 +08:00
Víctor Déniz d6806beb3e Merge branch 'MDL-62678-core-fetch-notifications-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-10-06 22:58:45 +01:00
Eloy Lafuente (stronk7) 9ab387d707 Merge branch 'MDL-69746-MOODLE_310_STABLE' of https://github.com/tuanngocnguyen/moodle into MOODLE_310_STABLE 2020-10-06 23:53:22 +02:00
Marina Glancy 2a4d1c64bf MDL-65451 tool_uploaduser: move code away from index.php, add CLI script 2020-10-06 15:53:13 +02:00
Ferran Recio a0999ab66f MDL-69736 core_h5p: enable player reporting 2020-10-06 13:05:33 +02:00
Paul Holden 7e3f7e3d7c MDL-69813 h5p: fix undefined addon ordering in framework test. 2020-10-06 10:48:06 +01:00
Eloy Lafuente (stronk7) 823bc36276 on-demand release 3.10dev+ 2020-10-06 10:21:14 +02:00
Mikhail Golenkov 1f3aacf8fc MDL-47178 question: Retain question authors when restoring backups. 2020-10-06 09:33:56 +11:00
Eloy Lafuente (stronk7) 38bcf316ee Merge branch 'MDL-69772-310-allcountrycodes' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-10-06 00:04:05 +02:00
Eloy Lafuente (stronk7) f993881244 Merge branch 'MDL-65074-310' of https://github.com/hitteshahuja/moodle into MOODLE_310_STABLE 2020-10-05 23:12:25 +02:00
Víctor Déniz 3277fc9db6 Merge branch 'MDL-69625-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-05 19:21:12 +01:00
Sara Arjona ef3720efbd Merge branch 'MDL-69355-310-filebuffer' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-10-05 18:33:45 +02:00
Jun Pataleta 41bc6b9400 Merge branch 'MDL-69704-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-10-05 23:12:57 +08:00
Paul Holden b9f8e3e114 MDL-69625 course: return raw custom field value in external method.
For clients that wish to consume the original value of the custom
field (e.g. timestamps for date fields), rather than the formatted
version, add a new "valueraw" property to the returned data.
2020-10-05 10:40:33 +01:00
Eloy Lafuente (stronk7) 355d07e0b4 Merge branch 'MOODLE_310-MDL-69752' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-10-05 10:54:56 +02:00
Amaia Anabitarte 5af206ad2a MDL-69712 core_h5p: Remove 'whitelist' key uses 2020-10-05 10:28:07 +02:00
Jun Pataleta 5ec265b48d Merge branch 'MOODLE_310_MDL-53966' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-10-05 13:24:04 +08:00
Mikhail Golenkov 35b29ce7d9 MDL-69791 gradereport: Fix error message when invalid grade is entered 2020-10-05 14:59:41 +11:00
Mikhail Golenkov bec49592ce MDL-69848 upgrade: Delete notifications in chunks 2020-10-05 13:13:51 +11:00
Jake Dallimore 57bb99edd4 MDL-59510 core_oauth2: autorefresh google drive, nextcloud and onedrive
Request additional offline access, allowing the repository to sign in
automatically each time, including across different user sessions, until
either the refresh token is invalidated or the user logs out of the
repository.
2020-10-05 09:17:14 +08:00
Jake Dallimore eb6b828b81 MDL-59510 core: report oauth2_refresh_token table in core provider 2020-10-05 09:17:14 +08:00
Jake Dallimore 8b09853319 MDL-59510 core_oauth2: add autorefresh mode to oauth2\client
Changes:
- The client can now be instantiated with the new mode enabled.
- A user refresh token will be stored if returned as part of the
authorization_code grant but only if the user is authenticated and only
if the mode is enabled.
- If the mode permits it, attempt to exchange a stored refresh token for
a new access token during login checks, allowing access to continue
across sessions without the need to re-grant consent every time.
- Purge all refresh tokens for a given user, issuer and scope on client
log out. This makes sure logout persists across logins.
2020-10-05 09:17:14 +08:00
Jake Dallimore fe1031244b MDL-59510 core_oauth2: add oauth2_refresh_token table 2020-10-05 09:17:14 +08:00
Mikhail Golenkov 03de8ed6d9 MDL-69818 mod_feedback: Fix item dependency during activity restoration 2020-10-04 18:27:32 +11:00
Mikhail Golenkov 6fae5e65e9 MDL-69752 mod_data: Format module intro on Database activities page 2020-10-04 13:46:32 +11:00
Mikhail Golenkov d7157063c3 MDL-53966 lesson: Allow maximum number of attempts to be unlimited 2020-10-04 13:18:45 +11:00
Tim Hunt 477fb6c9d6 MDL-69740 Behat init: more progress info at the end of the install 2020-10-02 23:16:23 +01:00
Juan Leyva c50b024463 MDL-69810 tool_mobile: Return support contact information via WS 2020-10-02 21:02:37 +02:00
Eloy Lafuente (stronk7) fadd2915eb MDL-69146 composer: bump to moodle-behat-extension 3.310.0
Generated following the instructions @:

https://docs.moodle.org/dev/Composer#How_to_prepare_and_submit_composer_changes

(using php72)

Note that here we are jumping to 3-digit branches (for all branches > 39),
exactly how we have done for moodle.git branches (310, 311, 400, 401...)
2020-10-02 15:07:01 +02:00
Sara Arjona c71355941b on-demand release 3.10dev+ 2020-10-02 13:44:05 +02:00
Nathan Nguyen 18871c74e2 MDL-69746 tool_replace: additional skip tables 2020-10-02 15:00:18 +10:00
Víctor Déniz 5cffc7f78b Merge branch 'MDL-69087-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-10-01 23:42:20 +01:00
Nathan Nguyen 946159a554 MDL-69572 mod_book : add bookid index to book_chapters 2020-10-01 23:28:21 +01:00
Eloy Lafuente (stronk7) 8d371859dc Merge branch 'MDL-69758-m310' of https://github.com/sammarshallou/moodle into MOODLE_310_STABLE 2020-10-01 23:44:15 +02:00
Claude Vervoort aad6afe979 MDL-57756 mod_lti: params change to text type 2020-10-01 17:32:44 -04:00
Sara Arjona d12c1406df MDL-69704 course: catch exception when calling get_course_content_items
When plugins are removed from disk, an exception is thrown when
calling component_callback_exists.
This exception should be catched here in order to load properly
the activity chooser (otherwise, the exception will be displayed
and no activity will appear).
2020-10-01 19:56:34 +02:00
Víctor Déniz 5130127a3e Merge branch 'MDL-69613-MOODLE_310_STABLE' of https://github.com/tuanngocnguyen/moodle into MOODLE_310_STABLE 2020-10-01 17:39:51 +01:00
Tim Hunt 651dbb729c MDL-69798 XML question export: excape special chars in idnumbers 2020-10-01 17:10:28 +01:00
Jamie Stamp 2c8db06e7a MDL-68665 assignfeedback_editpdf: Improve caching on stamps 2020-10-01 16:52:48 +01:00
Eloy Lafuente (stronk7) e98d18241f Merge branch 'MDL-69672-310' of git://github.com/aanabit/moodle into MOODLE_310_STABLE 2020-10-01 17:49:15 +02:00
Eloy Lafuente (stronk7) 3e460f45ac Merge branch 'MDL-69586-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-10-01 17:12:43 +02:00
Sara Arjona d5e30e0108 Merge branch 'MDL-69638_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-10-01 15:01:56 +02:00
Sara Arjona 7db1a61a72 Merge branch 'MDL-69050-310-allowlist' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-10-01 14:51:12 +02:00
David Mudrák d335530a28 MDL-69772 admin: Better validation for the allcountrycodes setting
The patch introduces a new admin_setting fiela type that can be used for
specifying comma separated list of countries. The field has inbuilt
validation so that only valid country codes can be inserted.
2020-10-01 13:38:48 +02:00
Sara Arjona 6fe5bb1b96 MDL-69050 lang: Fix few remaining places spotted during integration 2020-10-01 13:01:58 +02:00
Sara Arjona e2a73965ca Merge branch 'MDL-68098-310' of git://github.com/dpalou/moodle into MOODLE_310_STABLE 2020-10-01 12:56:23 +02:00
Ferran Recio ccd0b96591 MDL-69582 tool_customlang: fix options layout 2020-10-01 11:04:10 +02:00
Ferran Recio 851f0d3354 MDL-69582 tool_customlang: add label to textarea 2020-10-01 11:04:10 +02:00
Sara Arjona 5576a97713 Merge branch 'MDL-67473-multipledeeplinking-squashed-310' of https://github.com/cengage/moodle into MOODLE_310_STABLE 2020-10-01 10:28:12 +02:00
Jake Dallimore b235c3a5a7 Merge branch 'MDL-69573-MOODLE_310_STABLE' of https://github.com/tuanngocnguyen/moodle into MOODLE_310_STABLE 2020-10-01 12:20:29 +08:00
Adrian Greeve c00b8b7cab Merge branch 'MDL-54956-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-10-01 11:17:44 +08:00
willob99 b19f178e0d MDL-69192 mod_assign: replace grading confirmation popup 2020-09-30 11:08:11 -07:00
David Matamoros 56b28e8e0b MDL-69805 mod_data: Freeze comment field if comments disabled 2020-09-30 15:51:02 +02:00
Matteo Scaramuccia 6658d9fba1 MDL-68536 core: Fix notice about undefined prop 'branch' in $CFG 2020-09-30 14:43:42 +02:00
Claude Vervoort 09dabe003a MDL-67473 mod_lti: deeplinking multiple support
AMOS BEGIN
 CPY [contentitem_help,mod_lti],[contentitem_deeplinking_help,mod_lti]
AMOS END
2020-09-30 08:04:53 -04:00
Nathan Nguyen 85f136094b MDL-69573 core_course: Make MAX_COURSES_IN_CATEGORY configurable 2020-09-30 16:04:55 +10:00
Adrian Greeve 1c55d84794 Merge branch 'MDL-37802-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-30 13:51:31 +08:00
Brendan Heywood 3ac504fd3d MDL-62678 core: Improve efficiency of notifications and avoid ajax call 2020-09-30 13:56:29 +10:00
Jake Dallimore 1f25df48b1 Merge branch 'MDL-68845-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-09-30 11:45:43 +08:00
Adrian Greeve 64ba1753a8 Merge branch 'MDL-68562_310' of https://github.com/mkassaei/moodle into MOODLE_310_STABLE 2020-09-30 11:12:34 +08:00
Eloy Lafuente (stronk7) 0e8d14f4e9 MDL-69638 install: update the list of stale files for 3.10 2020-09-29 22:37:56 +02:00
Víctor Déniz 9c28e07d31 Merge branch 'MDL-67841-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-09-29 18:33:48 +01:00
Sara Arjona 4ea44f96e5 Merge branch 'MDL-69342-310_profile_picture_deletion' of https://github.com/vtos/moodle into MOODLE_310_STABLE 2020-09-29 19:01:05 +02:00
Amaia Anabitarte c5c1b8b121 MDL-69672 core_contentbank: is_context_allowed unit tests 2020-09-29 17:47:37 +02:00
Amaia Anabitarte 3490f29ad9 MDL-69672 core_contentbank: Check used context level 2020-09-29 17:47:36 +02:00
Jun Pataleta 3b03a3da47 Merge branch 'MDL-69600-divertemails-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-09-29 20:27:36 +08:00
Sara Arjona a6aefe15f0 Merge branch 'MDL-65976-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-09-29 14:09:26 +02:00
Juan Leyva b294665c21 MDL-65976 completion: New course completion message provider 2020-09-29 13:41:49 +02:00
Brendan Heywood 2b50abffa2 MDL-69707 session: Avoid redis writes if the session is unchanged 2020-09-29 20:46:25 +10:00
Brendan Heywood acb848cdce MDL-69600 core: Expose divertallemails config in UI 2020-09-29 20:30:09 +10:00
Jun Pataleta 7cd362b873 Merge branch 'MDL-41492-310' of https://github.com/peterburnett/moodle into MOODLE_310_STABLE 2020-09-29 18:07:18 +08:00
Juan Leyva cc16de4ccc MDL-68845 calendar: New WS get_calendar_export_token 2020-09-29 10:56:29 +02:00
Juan Leyva c0af823086 MDL-68845 calendar: Move duplicated code to function 2020-09-29 10:54:05 +02:00
Eloy Lafuente (stronk7) 8b026809c5 on-demand release 3.10dev+ 2020-09-29 10:48:59 +02:00
Jun Pataleta 2dbc9a5005 Merge branch 'MDL-69283-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-09-29 13:53:53 +08:00
Claude Vervoort d224506353 MDL-68384 mod_lti: fix spec violations bo claim name and dl value type 2020-09-28 17:02:40 -04:00
Juan Leyva 0d1187b052 MDL-67841 tool_mobile: Inform about last access with the app 2020-09-28 21:40:54 +02:00
Víctor Déniz a2e3aa6806 Merge branch 'MDL-69644-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-28 20:34:01 +01:00
Shamim Rezaie adac2a9e55 MDL-69649 form: Fix labels for defaultcustom form elements 2020-09-28 23:43:01 +10:00
Shamim Rezaie 2fca843e49 MDL-69649 backup: Fix missing labels
- The backup details page uses a table to show a sumary of the backup
  content. Used role attribute to denote the tabular format of the
  summary.
- The backup details page displays activity name next to each activity
  icon. Therefore the icons are only decorative and do not need to have
  any title or even alt text.
- Form labels should be associated with form controls.  A div element is
  not a form control.
- The from attribute of the form labels should be equal to the id
  attribute of an element. Therefore, we first create a label and an
  input elements and associate them to each other, and then pass them to
  backup_detail_pair() when a label is needed.
2020-09-28 23:43:01 +10:00
Sara Arjona 157a497a3e Merge branch 'MDL-69695-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-28 13:03:21 +02:00
sam marshall 4f0fc4f45b MDL-69759 Web services: app checks to token.php cause log errors 2020-09-28 11:55:14 +01:00
Sara Arjona 27b1425eb2 Merge branch 'MDL-68935-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-09-28 11:41:01 +02:00
Peter Burnett 40e41c1997 MDL-41492 cache: Added ability for alternate cache config 2020-09-28 15:14:30 +10:00
Nathan Nguyen 89ce0b387e MDL-69613 gradereport: confirm message if override none is selected 2020-09-28 10:40:06 +10:00
Juan Leyva 9b64c178dd MDL-69283 webservice: New external setting for forcing timezone 2020-09-25 19:09:50 +02:00
Hittesh Ahuja 69cc1d1dd5 MDL-65074 mod_quiz: Quiz navigation buttons shouldnt use btn-secondary
Removing .btn-secondary as plain.scss and default.scss in bootstrap hide the button from view.
2020-09-25 15:14:06 +01:00
Juan Leyva 39c8e99e67 MDL-69776 files: New WS core_files_delete_draft_files 2020-09-25 10:38:25 +02:00
Paul Holden 833ab0ea9f MDL-37802 repository: return error if unzipping files fails.
For instance, when a user tried to unzip a password protected zip
archive using the file manager.
2020-09-25 09:33:54 +01:00
Paul Holden 2b87250347 MDL-69586 tool_usertours: use specified user in privacy prefs export. 2020-09-25 09:13:28 +01:00
Mahmoud Kassaei 95d1f1f18d MDL-68562 Qtype_essay: Adding file-size limit to the attachment files 2020-09-25 08:52:59 +01:00
Sara Arjona d23f05828f MDL-69087 core_h5p: add renderer to let personalize styles
Existing mod_hvp pluging has a renderer to let Moodle instances
alter styles, Javascript, semantics (fields in the editor) and
content: https://github.com/h5p/moodle-mod_hvp/blob/stable/renderer.php

The approach for core_h5p is exactly the same, to let people
to reuse their existing code.
2020-09-24 19:56:42 +02:00
David Mudrák 972340b678 MDL-69050 lang: Stop using the term blacklist in mustache output engine 2020-09-24 19:39:36 +02:00
David Mudrák 3971892bd3 MDL-69050 lang: Fix the variable name in the admin/cli/svgtool.php 2020-09-24 19:33:36 +02:00
David Mudrák b18b714165 MDL-69050 lang: Fix variable name and comment in core-notification YUI 2020-09-24 19:33:36 +02:00
David Mudrák 781545d34d MDL-69050 lang: Rename and deprecate filetypes_util methods 2020-09-24 19:33:32 +02:00
David Mudrák 19fe7f27a8 MDL-69050 lang: Improve the wording of the comments
Stop using the terms whitelist/blacklist when used to allow/deny things.
2020-09-24 19:32:40 +02:00
David Mudrák bd686af064 MDL-69050 lang: Fix the variable name in the Essay question type 2020-09-24 19:32:40 +02:00
David Mudrák fd18dc14ff MDL-69050 lang: Rename the filetypesnotwhitelisted string
Rename the string identifier to filetypesnotallowed, copy all the
existing translations in AMOS and deprecate the original string to be
eventually removed.

AMOS BEGIN
 CPY [filetypesnotwhitelisted,core_form],[filetypesnotallowed,core_form]
AMOS END
2020-09-24 19:32:40 +02:00
David Mudrák e840b14f4c MDL-69050 lang: Fix the variable name in the TeX filter library 2020-09-24 19:32:39 +02:00
David Mudrák 730aa1dcb0 MDL-69050 lang: Rename the whitelist variable in the Workshop locallib 2020-09-24 19:32:39 +02:00
David Mudrák 9ef6492e5d MDL-69050 lang: Fix variables and methods names in curl_security_helper
The code has been using terms that were found exclusive and potentially
derogatory. Fixing the terms and making the variables and methods
consistent with the related admin settings.
2020-09-24 19:32:39 +02:00
David Mudrák 41ad54e182 MDL-69050 lang: Fix placeholder in the err_wrongfileextension string
The name of the placeholder has been found exclusive and potentially
derogatory. Also the name of variable that was used to populate the
placeholder value. That was not the intention.
2020-09-24 19:32:39 +02:00
David Mudrák 2a1fb5b5e7 MDL-69772 admin: Fix legacy coding style on Location settings admin page
No actual change here. Just polishing the coding style and adding
fulltree check.
2020-09-24 18:14:29 +02:00
David Mudrák 56adf1f3d8 MDL-69772 lang: Ignore misconfigured allcountrycodes filter
If the allcountrycodes filter contains only invalid values, ignore the
whole filter setting and make get_list_of_countries() return the full
list of all known countries, rather than empty list.
2020-09-24 18:14:29 +02:00
Víctor Déniz a36870c175 weekly release 3.10dev 2020-09-24 16:27:15 +01:00
Eloy Lafuente (stronk7) a0f377cf2b Merge branch 'MDL-69698-310-licensecache' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-09-24 16:50:39 +02:00
Eloy Lafuente (stronk7) 7905d70497 Merge branch 'MDL-69718-display-size-MOODLE_310_STABLE' of https://github.com/brendanheywood/moodle into MOODLE_310_STABLE 2020-09-24 16:39:26 +02:00
Paul Holden d0a55062f9 MDL-69644 tool_dataprivacy: fix focus outline of contact DPO link.
The link class attribute is a leftover from 7258bf0b, which was mostly
removed in 3b2f691f. It no longer serves a purpose and interferes with
the element focus outline.
2020-09-24 11:53:29 +01:00
Vitaly 7f177d440c MDL-69342 core_user: fixed user picture updating
When editing a user and checking the 'Delete picture' checkbox to delete
the old picture and uploading a new one at a time, the new one didn't appear
in the user profile. This happened due to the 'if/else' statement
in the 'core_user::update_picture()' method which allowed either to delete
the old picture or to upload a new one.
The fix removes the 'else' part of the 'if/else' statement to force
checking for a new uploaded picture no matter if a user checked
the 'Delete picture' checkbox or not.
2020-09-24 10:29:31 +03:00
Bas Brands 8730ffcbe1 MDL-66587 mod_quiz: visible quiz timer 2020-09-24 11:32:18 +08:00
Bas Brands 486aa319c2 MDL-69454 core_search: consistent backup search 2020-09-23 17:36:15 +02:00
Bas Brands 6fa8e1c86f MDL-69454 core_search: consistent cohort search 2020-09-23 17:36:15 +02:00
Bas Brands dcfb713ca6 MDL-69454 core_search: consistent content bank search 2020-09-23 17:36:15 +02:00
Bas Brands 9d82cdb62e MDL-69454 core_search: consistent activity chooser search 2020-09-23 17:36:15 +02:00
Bas Brands a88f50d1b2 MDL-69454 core_search: consistent template library search 2020-09-23 17:36:15 +02:00
Bas Brands 94adb3429b MDL-69454 core_search: consistent capability search 2020-09-23 17:36:15 +02:00
Bas Brands bd516bf05c MDL-69454 core_search: consistent tag search 2020-09-23 17:36:15 +02:00
Bas Brands 02829c03c1 MDL-69454 core_search: message search 2020-09-23 17:36:14 +02:00
Bas Brands e9435e8f6d MDL-69454 core_search: consistent mod searches 2020-09-23 17:36:14 +02:00
Bas Brands 6a750d283d MDL-69454 core_search: consistent block searches 2020-09-23 17:36:14 +02:00
Bas Brands b5e39191fc MDL-69454 core_search: consistent course management search 2020-09-23 17:36:14 +02:00
Bas Brands 42c1cf3b03 MDL-69454 core_search: consistent frontpage course search 2020-09-23 17:36:14 +02:00
Bas Brands a5cd815635 MDL-69454 core_search: consistent admin search 2020-09-23 17:36:14 +02:00
Bas Brands 1fdb4fda4a MDL-69454 core_search: consistent navbar search 2020-09-23 17:36:14 +02:00
Juan Leyva 61772eb89b MDL-54956 quiz: Fix WS to support files submission 2020-09-23 12:52:45 +02:00
Juan Leyva e49ccc92c4 MDL-54956 quiz: Return response files in attempts 2020-09-23 12:52:45 +02:00
Dani Palou f9f289f69d MDL-68098 tests: Reset FILTERLIB_PRIVATE after tests 2020-09-23 12:09:08 +02:00
Dani Palou e16b858ff9 MDL-68098 ws: Add unit tests to test mathjax in WS 2020-09-23 12:08:52 +02:00
Dani Palou f4bdb898c7 MDL-68098 ws: Fix WebServices broken by filters HTML 2020-09-23 12:08:40 +02:00
Eloy Lafuente (stronk7) 2d502fd749 Merge branch 'MDL-68229-310' of git://github.com/jleyva/moodle into MOODLE_310_STABLE 2020-09-23 11:51:16 +02:00
Eloy Lafuente (stronk7) b552d604ff Merge branch 'MDL-69014-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-22 23:04:57 +02:00
Eloy Lafuente (stronk7) 6d73afb2bf Merge branch 'MDL-66934-coursehistory-310' of https://github.com/cengage/moodle into MOODLE_310_STABLE 2020-09-22 14:40:12 +02:00
Juan Leyva 0ad2d843d7 MDL-64657 course: Return hidden section names when configured 2020-09-22 11:53:04 +02:00
Eloy Lafuente (stronk7) 82a1e8fae7 Merge branch 'MDL-66648-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-21 23:36:22 +02:00
Eloy Lafuente (stronk7) a2c1a20055 Merge branch 'MDL-69667-MOODLE_310_STABLE' of https://github.com/comete-upn/moodle into MOODLE_310_STABLE 2020-09-21 23:20:05 +02:00
David Mudrák 76c3dc5f6b MDL-67275 forum: Fix language and accessibility issues with buttons
There were inconsistencies with the text shown on the submit button,
depending on the where the button was shown.

* Inline reply forum displayed general "Submit".
* Experimental nested discussion view reply form displayed "Post"
  (post/core string) which acts as a noun in other contexts and cannot
  be used as such in many non-English languages.
* Advanced reply form displayed "Post to forum".

The patch fixes this and starts to show "Post to forum" in all three
places consistently.

While working on this, two more issues were noticed and fixed:

* Inline reply textarea's title was hard-coded English "post" text.
  Changed to "Message" to provide advisory information related to the
  element.
* Buttons contained title attribute with the same value as the explicit
  button text. This goes against accessibility guidelines.
2020-09-21 22:50:43 +02:00
sam marshall 62ea8b1cae MDL-69758 Web services: core_get_course_contents PHP warnings
Calls to core_get_course_contents can cause PHP warnings in the server
log if there are any URL instances in the course with sketchy URLs.
This is because url_export_contents incorrectly returns null instead
of an empty array if there is an error.
2020-09-21 15:28:11 +01:00
Brendan Heywood c36d5093e3 MDL-69718 core: Added support for TB and PT to display_size 2020-09-21 12:55:44 +10:00
Claude Vervoort fae57261e7 MDL-66934 mod_lti: support context history param 2020-09-18 14:06:58 -04:00
Juan Leyva 11a49b08e7 MDL-68229 tool_mobile: Add missing option to disable tags in the app 2020-09-18 15:31:03 +02:00
Sara Arjona a730c334c7 MDL-69548 grunt: build ignorefiles 2020-09-18 09:56:22 +02:00
Sara Arjona fb5e3957be Merge branch 'MDL-69548-310' of git://github.com/mickhawkins/moodle into MOODLE_310_STABLE 2020-09-18 09:41:10 +02:00
Michael Hawkins 54524f1ff0 MDL-69548 core: Adding the http-message library
This is a dependency of ZipStream
2020-09-18 10:03:22 +08:00
Michael Hawkins bbfbe8e260 MDL-69548 core: Adding the php-enum library
This is a dependency of ZipStream
2020-09-18 10:03:22 +08:00
Michael Hawkins cfe02e4d3e MDL-69548 core: Adding the ZipStream library
This allows downloading of zip files as a stream, and will be used by
the Download course content project (MDL-69540).
2020-09-18 10:03:22 +08:00
Eloy Lafuente (stronk7) 611399214b weekly release 3.10dev 2020-09-17 19:04:13 +02:00
David Mudrák 321de29e93 MDL-69355 file: Do not attempt to set headers after output started
It was found out that in certain situations there may be some content
in to output handlers buffers. Let's allow that to happen given that:

* default handler's buffer is not sent as a part of the file and an
  error is reported into the server log.
* other handlers' buffer is sent with the assumption that it is required
  for the correct serving of the file.
2020-09-17 17:37:28 +02:00
Eloy Lafuente (stronk7) f200ba55f8 Merge branch 'MDL-69395_310' of github.com:stronk7/moodle into MOODLE_310_STABLE 2020-09-17 17:02:08 +02:00
Eloy Lafuente (stronk7) 8d791e12ba MDL-69395 theme_classic: remove superfluous selector already in boost 2020-09-17 13:05:40 +02:00
Jun Pataleta 8923308d47 Merge branch 'MDL-69630-310' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-09-17 09:17:23 +02:00
Eloy Lafuente (stronk7) 0e97e40e5a Merge branch 'MDL-62387-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-17 09:17:23 +02:00
Eloy Lafuente (stronk7) 7254648363 Merge branch 'MDL-68909-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE
Bump version to 2020091000.02 (01 was already current)
2020-09-17 09:17:20 +02:00
Eloy Lafuente (stronk7) c3176af430 Merge branch 'MDL-69664-310' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-09-17 09:16:52 +02:00
Eloy Lafuente (stronk7) cb82c4d901 Merge branch 'MDL-69395-310' of git://github.com/bmbrands/moodle into MOODLE_310_STABLE 2020-09-17 09:16:52 +02:00
Sara Arjona bf127517b3 Merge branch 'MDL-68688-310' of git://github.com/aanabit/moodle into MOODLE_310_STABLE 2020-09-17 09:16:52 +02:00
Jun Pataleta 29e56fef72 Merge branch 'MDL-69663-m310' of https://github.com/sammarshallou/moodle into MOODLE_310_STABLE 2020-09-17 09:16:52 +02:00
Sara Arjona b249ab9df4 Merge branch 'MDL-68564_before_footer' of git://github.com/davosmith/moodle into MOODLE_310_STABLE 2020-09-17 09:16:52 +02:00
Sara Arjona 7805d0bb44 MDL-68909 h5p: move temporary editor files to draft area 2020-09-17 09:16:51 +02:00
Sara Arjona 6fcc509ed1 MDL-68909 h5p: upgrade step to remove files in editor filearea
As temporary editor files have been moved from core_h5p/editor to
user/draft, they can be removed (to clean unused DB entries).
2020-09-17 09:16:49 +02:00
Mihail Geshoski ebd136ca12 MDL-69630 format_social: Fix behat tests 2020-09-17 12:24:39 +08:00
Stephen Bourget c96a155937 MDL-69630 format_social: Add ajax support 2020-09-17 12:24:39 +08:00
Juan Leyva fdb7f85140 MDL-68935 course: Return context data in get_content WS 2020-09-16 12:43:53 +02:00
David Mudrák fbae45d7c9 MDL-69698 licenses: Improve the performance of the licenses cache
The cache uses a single simple key and there is no need to hash it.
2020-09-15 10:35:34 +02:00
David Mudrák a398a60092 MDL-69698 licenses: Do not cache the localised licenses fullnames
The localisation must happen only after loading the list of licenses
from cache so that the name is displayed in the current user's preferred
language, not in the language of the user who initiated the cache
rebuild.
2020-09-15 10:35:34 +02:00
Paul Holden de0e594a10 MDL-62387 tool_lp: switch to core 'cohort' form element.
The autocomplete AJAX is identical to the version in tool_lp, but also
includes support for excluding suggestions (i.e. cohorts already
synced with the current learning plan).
2020-09-15 08:08:11 +01:00
comete-upn 93097192e6 MDL-69667 competencies: fix competencies count always 0 in frameworks. 2020-09-15 08:37:53 +02:00
Jun Pataleta 1427573cde Merge branch 'MDL-68702-MOODLE_310_STABLE' of https://github.com/tuanngocnguyen/moodle into MOODLE_310_STABLE 2020-09-15 11:56:28 +08:00
Jun Pataleta 28790a42ad Merge branch 'MDL-42012-310-alt' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-09-15 11:52:56 +08:00
Andrew Nicols e5f0085cdb MDL-42012 cache: Fix missing return value 2020-09-15 11:46:31 +08:00
Eloy Lafuente (stronk7) 682593054d Merge branch 'MDL-42012-310-alt' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-09-14 23:28:54 +02:00
Eloy Lafuente (stronk7) 8fba6189fe Merge branch 'MDL-69658-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-14 22:56:42 +02:00
Paul Holden 31188e93d6 MDL-69695 mod_folder: use forcedownload setting during inline display. 2020-09-14 21:40:38 +01:00
Paul Holden 9bc368f71c MDL-69014 tool_usertours: clean up user preferences of deleted tours. 2020-09-14 20:36:28 +01:00
Paul Holden 1aa7c68c6f MDL-66648 user: consistent checks for linking to full profile.
The access checks for displaying a link to a users' full profile
now match the checks performed on the full profile page itself.
2020-09-14 20:22:05 +01:00
Davo Smith 23efc7337a MDL-68564 outputrenderers: extend before_footer hook to allow output 2020-09-14 11:00:36 +01:00
Nathan Nguyen cf4b6c8c94 MDL-68702 core_backup: exclude legacy course files 2020-09-11 10:59:28 +10:00
Amaia Anabitarte abb2037b0f MDL-68688 core_contentbank: Empty content bank notification 2020-09-10 11:58:53 +02:00
sam marshall c94b6b2ab7 MDL-69663 Web services: override_webservice_execution not honoured
If two different plugin types (e.g. theme, local) implement
override_webservice_execution callbacks, then all of them except
the 'last' plugin type do not work correctly.
2020-09-10 09:50:50 +01:00
Sara Arjona ab5d361c80 weekly release 3.10dev 2020-09-10 08:52:01 +02:00
Jun Pataleta 334333b6c7 MDL-69664 mod_lti: Apply correct badge class to tool card 2020-09-09 23:34:39 +08:00
Bas Brands 3d08cd2272 MDL-69395 theme_boost: improve colour contrast for form input fields
- for this issue the atto styles.css was moved into theme boost so
we can use our preset variable for $gray-500
2020-09-09 13:41:32 +02:00
Sara Arjona 83a5ed90ce Merge branch 'MDL-69466-3.10' of https://github.com/JBThong/moodle into MOODLE_310_STABLE 2020-09-09 11:39:16 +02:00
Sara Arjona d945333b47 Merge branch 'MDL-69645-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-09-09 11:00:49 +02:00
Jun Pataleta da84b731c7 Merge branch 'MDL-57682-310-fix' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-09-09 16:06:02 +08:00
Andrew Nicols 36f3b1e418 MDL-57682 mediaplayer_videojs: Improve in-page caching of lang strings 2020-09-09 15:37:54 +08:00
Andrew Nicols a3cc6898e9 MDL-57682 mediaplayer_videojs: Login not required for lang fetch 2020-09-09 15:37:52 +08:00
Thong Bui fcbca18c7b MDL-69466 Autocomplete widget: Improve keyboard accessibility 2020-09-09 13:44:23 +07:00
Tien Nguyen c0280f4405 MDL-68797 Administration: Add auto complete setting 2020-09-09 14:37:34 +08:00
Sara Arjona c83543095a Merge branch 'MDL-69521_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-09-09 08:08:29 +02:00
Andrew Nicols 13e34fb428 MDL-42012 cache: Valid definitions are required even when disabled 2020-09-09 14:05:03 +08:00
Andrew Nicols c705434a62 MDL-42012 cache: Fully disable cache for disabled cache factory 2020-09-09 14:05:03 +08:00
Andrew Nicols cfe1a9a8d8 MDL-42012 cache: Allow data sources to work when caching is disabled 2020-09-09 14:05:03 +08:00
Andrew Nicols 94d05a5bfb MDL-68797 tool_mobile: Version bump 2020-09-09 12:43:55 +08:00
Tien Nguyen 2562b9f3a3 MDL-68797 Administration: Setting for mobile file type exclusion list 2020-09-09 12:29:06 +08:00
Andrew Nicols e8b05c6cb4 Merge branch 'MDL-57682-310' of git://github.com/rezaies/moodle into MOODLE_310_STABLE 2020-09-09 12:23:33 +08:00
Eloy Lafuente (stronk7) 8f0297915c Merge branch 'MDL-69116-310' of git://github.com/rezaies/moodle into MOODLE_310_STABLE 2020-09-08 23:16:24 +02:00
Paul Holden b25763e875 MDL-69658 quizaccess_seb: progress bar on install only when necessary. 2020-09-08 19:32:24 +01:00
Eloy Lafuente (stronk7) 84bcfbb0d5 MDL-69521 core: Move all comments in code from 4.4 to 4.2 2020-09-08 19:01:42 +02:00
Eloy Lafuente (stronk7) e419e7acba MDL-69521 core: Move all comments in code from 4.3 to 4.1 2020-09-08 19:01:41 +02:00
Eloy Lafuente (stronk7) 309aad5a82 MDL-69521 core: Move all comments in code from 4.2 to 4.0 2020-09-08 19:01:41 +02:00
Eloy Lafuente (stronk7) 8452418666 MDL-69521 core: Move all comments in code from 4.1 to 3.11 2020-09-08 19:01:36 +02:00
Eloy Lafuente (stronk7) 5ba67416e6 Merge branch 'MDL-69510-310' of https://github.com/snake/moodle into MOODLE_310_STABLE 2020-09-08 15:28:33 +02:00
Sara Arjona bd0de2d965 Merge branch 'MDL-69525-310-1' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-09-08 14:21:46 +02:00
Sara Arjona db54910ce2 Merge branch 'MDL-28501-310' of https://github.com/mackensen/moodle into MOODLE_310_STABLE 2020-09-08 13:28:51 +02:00
Michael Hawkins 9d356676c3 MDL-69340 tag: Correct the filter input HTML in the tag manager 2020-09-08 08:54:33 +02:00
Mihail Geshoski a9d3f4b96c MDL-69048 book: Sanitize previous chapter value in add new chapter page 2020-09-08 08:54:33 +02:00
Andrew Nicols ca6cf0bd21 MDL-68974 calendar: Use page context for block check 2020-09-08 08:54:33 +02:00
Andrew Nicols 7d990ee185 MDL-68974 blocks: Check permission before generating content 2020-09-08 08:54:33 +02:00
Mihail Geshoski e2a11dc2aa MDL-65115 repository: Prevent unzipping if it will exceed allowed quota 2020-09-08 08:54:33 +02:00
Mihail Geshoski a2a6303397 MDL-65115 core_files: Add get_total_content_size() in stored_file class
New function get_total_content_size() is introduced in the stored_file
class. The puprose of this function is to calculate and return the
total size (in bytes) of the content of an archive file.
2020-09-08 08:54:33 +02:00
Andrew Nicols 6c4cdd6d96 MDL-68974 admin: Unit tests for context parent/child test 2020-09-08 08:54:33 +02:00
Andrew Nicols 4bb41b4e5a MDL-68974 admin: Unit tests for loginas 2020-09-08 08:54:33 +02:00
Andrew Nicols a937d4d807 MDL-68974 admin: Prevent login as outside of the desired context 2020-09-08 08:54:33 +02:00
Thong Bui 2301f9bfaa MDL-68344 filepicker: File Picker focus lost on upload 2020-09-08 08:45:09 +02:00
Jun Pataleta 0e9c755896 Merge branch 'MDL-69492-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-08 12:56:38 +08:00
Eloy Lafuente (stronk7) 3452156e6e Merge branch 'MDL-69262-310-2' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-09-07 23:42:53 +02:00
Eloy Lafuente (stronk7) 6ef1780225 Merge branch 'MDL-69448-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-07 23:26:08 +02:00
Eloy Lafuente (stronk7) a8c60a4c31 Merge branch 'MDL-69577-310' of git://github.com/crazyserver/moodle into MOODLE_310_STABLE 2020-09-07 23:09:37 +02:00
Luca Bösch b2995f7a29 MDL-69645 quizaccess: Set allowPreferencesWindow to false in manual conf
Signed-off-by: Luca Bösch <luca.boesch@bfh.ch>
2020-09-07 22:40:58 +02:00
Charles Fulton 51201bc672 MDL-28501 mod_folder: make force downloading behavior configuable 2020-09-07 14:40:40 -04:00
Mathew May aa13890df0 MDL-69240 tool_moodlenet: Clean MoodleNet profile field
Amended by: Eloy Lafuente (stronk7) <stronk7@moodle.org>
- adjust versions for every branch.
- modify verify_webfinger->profileurl external to PARAM_NOTAGS.
2020-09-07 17:36:22 +02:00
Sara Arjona 644b80410d Merge branch 'MDL-69632-310-adminserversettings' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-09-07 13:44:03 +02:00
Sara Arjona b36a28b37a Merge branch 'MDL-67468-MOODLE_310_STABLE' of https://github.com/tuanngocnguyen/moodle into MOODLE_310_STABLE 2020-09-07 13:19:56 +02:00
Mathew May 386223bd86 MDL-62609 lang: Final removal of deprecated strings 2020-09-07 08:06:32 +02:00
Sara Arjona 95359bf9e7 Merge branch 'MDL-63261-310' of https://github.com/Chocolate-lightning/moodle into MOODLE_310_STABLE 2020-09-07 07:30:17 +02:00
Mathew May 1bc2a3b345 MDL-63261 messaging: Final 3.6 deprecations 2020-09-07 09:09:07 +08:00
Eloy Lafuente (stronk7) 709b46dbfd MDL-69521 core: Move all comments in code from 4.0 to 3.10 2020-09-06 17:23:58 +02:00
Shamim Rezaie 94c19e0fea MDL-57682 media_videojs: Cache videojs languages in the localstorage 2020-09-04 18:55:16 +10:00
Shamim Rezaie 4a60349a8a MDL-57682 media_videojs: webservice to get the language pack of videojs 2020-09-04 18:51:37 +10:00
Shamim Rezaie 2189db9c86 MDL-57682 media_videojs: convert videojs loader to es6 2020-09-04 18:51:37 +10:00
David Mudrák f54cb0c257 MDL-69632 admin: Fix the legacy coding style at the server section
No actual changes to the file made, only reformatted and cleaned up to
follow the recent coding guidelines.
2020-09-04 10:23:06 +02:00
Paul Holden 95e0ff974c MDL-69492 auth_ldap: normalise member distinguished name config. 2020-09-04 08:25:58 +01:00
Paul Holden db361e09e7 MDL-69492 auth_cas: normalise member distinguished name config. 2020-09-04 08:25:58 +01:00
Paul Holden f2b1242364 MDL-69448 backup: fix capability checks when unable to copy user data.
When a given user doesn't have the capability to "Include user data"
during course copying, freeze the form element rather than not adding
it at all.

This caused problems as the element was required before preceding with
the course copy.
2020-09-04 08:20:04 +01:00
Nathan Nguyen d0fd7bc58c MDL-67468 filter_activitynames: use MUC 2020-09-04 15:41:52 +10:00
Sara Arjona 916809d995 weekly release 3.10dev 2020-09-03 17:09:17 +02:00
Sara Arjona e22ac10067 NOBUG: Fixed SVG browser compatibility 2020-09-03 17:09:12 +02:00
Andrew Nicols f558127d0e MDL-69391 behat: Grammar correction in feature 2020-09-03 11:35:08 +08:00
Andrew Nicols fc1d22ea70 Merge branch 'MDL-69391-310' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-09-03 11:35:04 +08:00
Jun Pataleta 5d1979c911 MDL-69391 calendar: Accessibility tests for calendar 2020-09-03 11:11:29 +08:00
Jun Pataleta fe346f0afb MDL-69391 auth: Colour contrast accessibility test for login page 2020-09-03 11:11:29 +08:00
Jun Pataleta 8d5470145d MDL-69391 theme: Darken course selector text colour
Use $gray-600 for a darker text colour in the course select box.
This also makes the colour consistent with the view selector which
also uses $gray-600.
2020-09-03 11:11:29 +08:00
Jun Pataleta 61d32ad081 MDL-69391 theme: Darken navbar-light colour
Increase the opacity for the sass variable $navbar-light-color a
little bit in order to achieve an acceptable colour contrast against
the white background.
2020-09-03 11:11:29 +08:00
Dmitrii Metelkin 558ef4f778 MDL-69418 backup: attach data to grade items 2020-09-03 11:08:00 +08:00
Andrew Nicols c8221dedcd Merge branch 'MDL-69360-310' of git://github.com/NoelDeMartin/moodle into MOODLE_310_STABLE 2020-09-03 10:52:02 +08:00
Andrew Nicols 5265491a8f Merge branch 'MDL-69246_310' of https://github.com/timhunt/moodle into MOODLE_310_STABLE 2020-09-03 10:39:58 +08:00
Jake Dallimore b96e85feac MDL-69510 admin: make ldap configuration warnings clear 2020-09-03 10:26:00 +08:00
Andrew Nicols 817d6dcdbb Merge branch 'MDL-55340-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-09-03 10:13:49 +08:00
Andrew Nicols de1a942280 Merge branch 'MDL-69069-310' of git://github.com/bmbrands/moodle into MOODLE_310_STABLE 2020-09-03 09:33:05 +08:00
Andrew Nicols 3e1c856bd9 MDL-69117 output: Correct remove_dir usage 2020-09-03 09:01:43 +08:00
Bas Brands cce23499e6 MDL-69117 theme_boost: themedesigner source maps 2020-09-03 08:40:41 +08:00
Bas Brands 74160de2cb MDL-69117 theme_boost: deprecate the autoprefixer 2020-09-03 08:40:41 +08:00
Eloy Lafuente (stronk7) 4ca7232b1f Merge branch 'MDL-55971-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-03 00:51:33 +02:00
Peter Burnett ded581156a MDL-67306 webservices: Added webservice for Grade category creation 2020-09-03 00:21:44 +02:00
Marina Glancy 4cfc74d176 MDL-69608 core_form: frozen forms do not have form tag 2020-09-02 23:48:39 +02:00
Sara Arjona 893cf77d33 Merge branch '67278-moodle-310-categories-selector' of https://github.com/DSI-Universite-Rennes2/moodle into MOODLE_310_STABLE 2020-09-02 17:37:24 +02:00
Sara Arjona e66f450c8f Merge branch 'MDL-68680-MOODLE_310_STABLE' of https://github.com/tuanngocnguyen/moodle into MOODLE_310_STABLE 2020-09-02 17:16:01 +02:00
Julien Boulen f9f41f5061 MDL-67278 course: Use autocomplete widget for course category selector 2020-09-02 16:00:20 +02:00
Eloy Lafuente (stronk7) 76e2d15794 Merge branch 'MDL-69174-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-09-02 13:14:34 +02:00
Sara Arjona 31d3fd27fc MDL-69174 mod_h5pactivity: component passed always
The $component = 'mod_h5pactivity' will be passed always to the H5P
player because it's required for being able to call these activities
from outside using embed code. The xAPI implementation checks whether
the information should be tracked or not.
2020-09-02 12:12:25 +02:00
Sara Arjona 2874c6d5a1 MDL-69174 h5p: add component to the embed H5P code
When the Moodle component is passed to the player, xAPI tracking
is enabled so, if the component implements required xAPI API methods
(for instance, mod_h5pactivity does), grades and responses are sent.
Adding this component to the embed code will help to add
the embed code from a mod_h5pactivity to any other place (such as label,
page or book), and being able to track the responses to the original
mod_h5pactivity.
2020-09-02 12:12:25 +02:00
Noel De Martin d8892dcca3 MDL-69360 behat: Fix js ready checks for non-moodle sites 2020-09-02 10:20:28 +02:00
Andrew Nicols 85a1c2c99e Merge branch 'MDL-68892-310' of git://github.com/ferranrecio/moodle into MOODLE_310_STABLE 2020-09-02 09:48:59 +08:00
Dan Marsden 58bf730494 MDL-69190 grade: fix slow query. 2020-09-02 09:31:28 +08:00
Farhan Karmali d179137f1b MDL-67419 admin: New admin setting for lang during user creation 2020-09-02 08:54:47 +08:00
Eloy Lafuente (stronk7) 8eafd115cc Merge branch 'wip_MDL-69491_m310' of git://github.com/gjb2048/moodle into MOODLE_310_STABLE 2020-09-02 00:27:36 +02:00
Eloy Lafuente (stronk7) 3b111cf8a0 Merge branch 'MDL-69174-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-09-02 00:21:55 +02:00
Sara Arjona a244344e2e Merge branch 'MDL-63387-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-01 16:58:15 +02:00
Pau Ferrer Ocaña 23fed91412 MDL-69577 forum: Add courseid, forumid on get_discussion_posts response 2020-09-01 14:26:08 +02:00
Sara Arjona dee4097c9d Merge branch 'MDL-64525-m310' of https://github.com/NeillM/moodle into MOODLE_310_STABLE 2020-09-01 14:18:05 +02:00
Paul Holden 7665c701fd MDL-63387 course: use renamed role names, update Behat tests.
Specify that we want both role names (renamed course role plus
original).
2020-09-01 12:05:26 +01:00
Paul Holden 3827cbe523 MDL-63387 user: show both role names on course participants page. 2020-09-01 12:05:26 +01:00
Paul Holden f6a2d57b3e MDL-63387 enrol_cohort: show both roles names in instance config form. 2020-09-01 12:05:25 +01:00
Paul Holden 35a5c1adda MDL-63387 enrol_manual: show both role names in enrol users dialog. 2020-09-01 12:05:25 +01:00
Paul Holden e4d86a6ec4 MDL-63387 access: add parameter to define how role names are returned. 2020-09-01 12:04:47 +01:00
Sara Arjona 8d2229db48 Merge branch 'MDL-51709-310' of git://github.com/lucaboesch/moodle into MOODLE_310_STABLE 2020-09-01 09:04:13 +02:00
Mihail Geshoski 4d6b3406c5 MDL-69525 core: Publish a single event when toggling slave checkboxes 2020-09-01 14:53:54 +08:00
Sara Arjona 11a58dd4b0 Merge branch 'MDL-69394-310' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-09-01 06:45:12 +02:00
Andrew Nicols 0713666486 Merge branch 'MDL-69507_310' of https://github.com/timhunt/moodle into MOODLE_310_STABLE 2020-09-01 11:15:55 +08:00
Andrew Nicols 260e9753d4 Merge branch 'MDL-69387-310-2' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-09-01 10:59:37 +08:00
Sara Arjona e83fad7382 Merge branch 'MDL-38350-m310' of https://github.com/sammarshallou/moodle into MOODLE_310_STABLE 2020-09-01 07:28:40 +08:00
Andrew Nicols c7e5431086 Merge branch 'MDL-69505-310' of https://github.com/snake/moodle into MOODLE_310_STABLE 2020-09-01 07:28:27 +08:00
Andrew Nicols 10ba6d0aa1 Merge branch 'MDL-69270-310' of git://github.com/ferranrecio/moodle into MOODLE_310_STABLE 2020-09-01 07:28:27 +08:00
Andrew Nicols a4f4cbf095 MDL-69269 contentbank: Fix issues identified in integration 2020-09-01 07:28:27 +08:00
Andrew Nicols 66c757f689 Merge branch 'MDL-69269-310' of git://github.com/sarjona/moodle into MOODLE_310_STABLE 2020-09-01 07:28:27 +08:00
Andrew Nicols 2f7236aa3c Merge branch 'MDL-68569-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-01 07:28:26 +08:00
Andrew Nicols a704b87f8b Merge branch 'MDL-56595-310' of https://github.com/paulholden/moodle into MOODLE_310_STABLE 2020-09-01 07:28:26 +08:00
Luca Bösch 59f48908aa MDL-51709 gradebook: Name display in single view. 2020-08-31 17:58:53 +02:00
Shamim Rezaie e6f0b5a3a3 MDL-69116 qtype_multichoice: accessibility improvement
- Screen-readers should not see 'clear my choice' when it is not visible
- 'clear my choice' option should only become visible when a choice is
selected
2020-08-31 23:53:54 +10:00
Shamim Rezaie 7a85cc6d2e MDL-69116 qtype_mutichoice: Use label for the "clear my choice" link 2020-08-31 23:53:54 +10:00
Bas Brands 3d08c7d396 MDL-69069 theme_boost: color contrast for custom alerts 2020-08-31 08:21:27 +02:00
Nathan Nguyen f809bca508 MDL-33981 repository_equella: support internal copy 2020-08-31 10:39:49 +08:00
Jake Dallimore fbcc91236e MDL-69505 core_form: fix js min/max date restriction in dateselector
This was using the yui2-calendar attribute, not the yui 3 attribute.
2020-08-31 07:57:50 +08:00
Ferran Recio 2dab18e681 MDL-69270 contentbank: replace content with file 2020-08-28 17:59:18 +02:00
Ferran Recio 3565a77362 MDL-68892 mod_h5pactivity: add required to package 2020-08-28 17:50:40 +02:00
Gareth Barnard cbecc140f7 MDL-69491 themes: No 'fontsize' setting in Boost causes unit conflict. 2020-08-28 14:14:38 +01:00
Sara Arjona c3a4859c7d MDL-69269 contentbank: add support to download content 2020-08-28 12:29:03 +02:00
Sara Arjona 330ba8cb10 MDL-69174 h5p: add component to the embed H5P code
When the Moodle component is passed to the player, xAPI tracking
is enabled so, if the component implements required xAPI API methods
(for instance, mod_h5pactivity does), grades and responses are sent.
Adding this component to the embed code will help to add
the embed code from a mod_h5pactivity to any other place (such as label,
page or book), and being able to track the responses to the original
mod_h5pactivity.
2020-08-28 12:26:38 +02:00
Marina Glancy 4e32add0ac MDL-55340 mod_feedback: export question labels
This was present in export in 3.0 but got lost during export
refactoring in 3.1
2020-08-28 12:25:09 +02:00
Eric Merrill e48fecc679 MDL-69112 assign: Improve parsing of uploaded feedback names 2020-08-28 13:29:20 +08:00
Nathan Nguyen d7113bee4e MDL-68680 core_grades: check grade item before trigger delete event 2020-08-28 11:40:31 +10:00
Paul Holden 61ce84f178 MDL-56595 tool_usertours: set page params when configuring tours/steps. 2020-08-27 23:08:15 +01:00
Tim Hunt e3bfcb1cde MDL-69246 questions: allow for float issues when validating manual marks
As well as fixing the bug, I also rewrote the test to use
data providers, which should lead to more useful failure messages.

And, I moved the magic number we used as the float tolerence to
be a named constant.
2020-08-27 17:39:15 +01:00
Sara Arjona 4a6a2636a0 weekly release 3.10dev 2020-08-27 17:36:21 +02:00
Jun Pataleta 09646d7b53 MDL-69262 core: Use core/action_menu_link in core/action_menu_trigger
* Introduce the "actionmenulinkclasses" block in the action_menu_link
template so other templates importing it can have the option to override
its classes.
* Have the action menu trigger template use the action menu link
template to reduce code duplication.
2020-08-27 13:30:32 +08:00
Jun Pataleta 9211552660 MDL-69262 core: Make instance count variable as a static class variable
With the static function variable $instance, calls to
\action_menu_link::export_for_template() from its subclasses are stored
in different variables. This causes duplicate IDs when different
implementations of action menu links are rendered on the action menu
trigger/link template. (e.g. action_menu_link and
action_menu_link_secondary both rendered on the same page).
To make the incrementing uniform for the action_menu_link class and its
implementations, the $instance variable is moved out of the
export_to_template() method and is now made to a static class variable.
2020-08-27 13:30:32 +08:00
Andrew Nicols f51678c56a Merge branch 'MOODLE_310_MDL-67211_v6' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-08-27 12:48:33 +08:00
Mihail Geshoski fa3b387185 MDL-69458 report_insights: Respect perpage value in pagination bar 2020-08-27 12:42:57 +08:00
Adrian Greeve dddff390da Merge branch 'MDL-69479-310' of git://github.com/mihailges/moodle into MOODLE_310_STABLE 2020-08-27 11:40:11 +08:00
Andrew Nicols 6bcc070827 Merge branch 'MDL-69501-310-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_310_STABLE 2020-08-27 11:30:53 +08:00
eWallah e1e362b7ff MDL-67413 competencies: do nothing upon activity completion 2020-08-27 11:11:08 +08:00
Mikhail Golenkov ae12edc741 MDL-67211 phpunit: Do not test the order of the running adhoc tasks. 2020-08-27 13:03:49 +10:00
Mikhail Golenkov 5934444b27 MDL-69358 backup: Do not clean up records for incomplete adhoc tasks.
Co-authored-by: Heena Agheda <heenaagheda@catalyst-au.net>
2020-08-27 10:57:48 +08:00
Andrew Nicols c187594e5b Merge branch 'MDL-66810-310' of git://github.com/peterRd/moodle into MOODLE_310_STABLE 2020-08-27 10:23:25 +08:00
Justin Hunt f9f0f1cc26 MDL-66810 mod_lti: Reinstate deprecated default permissions on iframe
microphone, webcam, camera, midi, encrypted-media, geolocation
2020-08-27 09:44:47 +08:00
Andrew Nicols f0b7948c96 MDL-66222 report_antivirus: Correct version number 2020-08-27 09:44:24 +08:00
Andrew Nicols 3114d04721 Merge branch 'MDL-66222-antivirus-reporting' of https://github.com/Peterburnett/moodle into MOODLE_310_STABLE 2020-08-27 09:36:33 +08:00
Adrian Greeve e78b9f9574 Merge branch 'MDL-69419-310' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-08-27 08:08:07 +08:00
Sara Arjona b0d96c297b Merge branch 'MDL-69389-310' of git://github.com/junpataleta/moodle into MOODLE_310_STABLE 2020-08-26 18:02:55 +02:00
Bas Brands 54d32ce4a9 MDL-69114 theme_boost: improve the color contrast for .*-info classes 2020-08-26 16:28:34 +02:00
Andrew Nicols 71f44b0611 Merge branch 'MOODLE_310_MDL-69307_v4' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-08-26 15:03:01 +08:00
Mikhail Golenkov b8a0258357 MDL-69307 restore: Add CLI script to restore a course.
Co-authored-by: Matt Porritt <mattp@catalyst-au.net>
2020-08-26 14:39:41 +10:00
Jun Pataleta db8fea04f5 MDL-69389 auth: Add wcag141 test for the login page accessibility test 2020-08-26 11:05:27 +08:00
Jun Pataleta 227281d355 MDL-69389 theme_classic: Make default body font colour darker
Links and normal text should have at least a colour contrast ratio
of 3:1. To achieve this, $body-color will be using the darker
shade of gray $gray-900 (#212529).
2020-08-26 11:05:27 +08:00
Jun Pataleta fb6460ca98 MDL-69389 theme_boost: Make default body font colour darker
Links and normal text should have at least a colour contrast ratio
of 3:1. To achieve this, $body-color will be using the darker
shade of gray $gray-900 (#212529).
2020-08-26 11:05:27 +08:00
Jun Pataleta 424c5df1eb MDL-69387 pix: Create PNG versions of the darkened completion icons
Thanks to Barbara Ramiro <barbara@moodle.com> for the help in
generating these PNG versions of the darkened completion icons!
2020-08-26 11:03:06 +08:00
Jun Pataleta 64c4074699 MDL-69387 pix: Darken completion icons
Darkened the fills of completion icons in order to meet the required
minimum contrast ratio of 3:1.
* Changed gray fills (#999) to #949494.
* Changed blue fills (#76A1F0) to #6393ee
* Changed green fills (#9C3) to #79a128

Thanks to Barbara Ramiro <barbara@moodle.com> for the help in
updating the SVG icons!
2020-08-26 11:03:06 +08:00
Jun Pataleta b4ab127434 MDL-69394 calendar: Fix event colour indicator contrast
* Darkened the link and clickable icon colours inside coloured events.
* Added borders around event colour indicators inside the month-view of
  the calendar for better contrast against the white background.
2020-08-26 11:00:22 +08:00
Andrew Nicols 4d03cc37b2 MDL-69419 core: Task reset tests cannot use random test times
If a scheduled task which uses a 'R' field is picked, then the reset of
updated task times will not necessarily be correctly determined as the
randomisation is picked during reset.

This can lead to some random test failures.

Actively specifying a test which does not make use of the 'R' random
field time addresses this issue.
2020-08-26 09:58:22 +08:00
Andrew Nicols 195e7c9cf1 Merge branch 'MOODLE_310_MDL-67211_v6' of https://github.com/golenkovm/moodle into MOODLE_310_STABLE 2020-08-26 09:41:07 +08:00
Paul Holden 1ffb6b09ee MDL-55971 dataformat: method to write exports to file storage. 2020-08-25 17:30:51 +01:00
Paul Holden 06411e3689 MDL-68569 customfield_select: get field options via instance method.
Deprecate the previous static method, which was only called from
instantiated field classes.
2020-08-25 15:08:12 +01:00
Mikhail Golenkov e419e18f0d MDL-67211 Tasks: Add cron_enabled setting.
Co-authored-by: Sam Marshall <s.marshall@open.ac.uk>
2020-08-25 17:01:00 +10:00
Mikhail Golenkov 3263daba84 MDL-67211 Tasks: Front-end to display currently running tasks.
Co-authored-by: Sam Marshall <s.marshall@open.ac.uk>
2020-08-25 17:00:46 +10:00
Mikhail Golenkov 59a5923924 MDL-67211 Tasks: Record when a task is running.
Co-authored-by: Sam Marshall <s.marshall@open.ac.uk>
2020-08-25 16:59:47 +10:00
Andrew Nicols f2602288eb MDL-69464 core_output: Whitespace fix 2020-08-25 13:22:36 +08:00
Marina Glancy 4413ca209f MDL-69464 core_output: allow to avoid formatting in page->set_heading 2020-08-25 13:22:36 +08:00
Adrian Greeve 427f046cff Merge branch 'MDL-68921-310' of git://github.com/vmdef/moodle into MOODLE_310_STABLE 2020-08-25 09:43:31 +08:00
Victor Deniz Falcon e29edbe89e MDL-68921 core_h5p: Add H5P libraries metadata settings
An upgrade step updates installed H5P libraries
2020-08-25 00:30:02 +01:00
Helen Foster e9df0c43bc MDL-69501 lang: Import fixed English strings (en_fix) 2020-08-24 09:53:02 +02:00
Neill Magill d71659dd6d MDL-64525 comments: Should not be able to delete frozen comments
Before this change in a frozen context a user would be able to delete
their own comments.

After this change a user will only be able to delete their own comments
if they still have the capability to post new comments or the capability
to delete comments from any user.
2020-08-24 08:00:10 +01:00
Neill Magill fb6c682850 MDL-64525 comments: Tests for deleting frozen comments 2020-08-24 08:00:10 +01:00
Mihail Geshoski 356a8ee948 MDL-69479 core: Change 4.0 to 3.10 in theme/upgrade.txt 2020-08-24 14:08:46 +08:00
Eloy Lafuente (stronk7) fe9ecef92b MDL-69479 upgrade: Change all 4.0 occurrences to 3.10
Under parallel development, when something is worth being commented
in upgrade.txt notes, it will be applied to all the development branches
using the "earliest" one to be released. So, if something changes
in 3.10 (and also is applied to master), the upgrade.txt notes will
show 3.10 in both branches.

Of course, if something only goes to one dev branch (say master), then the
master version will be used in the notes (4.0 in this case).
2020-08-24 14:08:46 +08:00
Paul Holden 9c1f7874d8 MDL-69493 cohort: remove escaping of return URL params. 2020-08-22 17:09:23 +02:00
Eloy Lafuente (stronk7) 96fac6d9ce weekly release 3.10dev 2020-08-21 20:42:59 +02:00
Adrian Greeve 4b327e1109 MDL-68683 competencies: Update previous bad bump update.
I made a mistake with the previous version bump and updated the
line below what I should have changed. This fixes it to the
intended version numbers.
2020-08-21 14:41:09 +08:00
Jun Pataleta f649cd722f Merge branch 'MDL-66818-310' of git://github.com/andrewnicols/moodle into MOODLE_310_STABLE 2020-08-21 11:32:21 +08:00
Andrew Nicols 03e84b68a1 MDL-66818 mod_forum: Use cap manager to check exportability 2020-08-21 08:17:01 +08:00
Andrew Nicols 51dc7d230f MDL-42434 chat: Disable stylelint important check 2020-08-21 07:39:24 +08:00
Sara Arjona 1044e94507 MDL-42434 mod_chat: styles for chat themes to view help-icon properly
The styles for the bubble and the compact themes have been reviewed
because there weren't enough contrast for the help icon.
2020-08-20 23:44:48 +01:00
Sara Arjona c4303bba51 MDL-42434 mod_chat: display the whole help text
When testing this issue was raised that the help text was cut-off.
This patch should fix this issue changing the placement from
right/left to top.
2020-08-20 23:44:47 +01:00
Andrew Nicols 9d32114bf6 MDL-68705 testing: New CLI args to disable composer features
This commit introduces the following new flags:

  --no-composer-self-update   Disable composer self-update of the
                              composer.phar utility

  --no-composer-upgrade       Disable upgrade of development
                              dependencies using Composer.

  --disable-composer          Disable both composer self-update and
                              composer upgrade
2020-08-20 20:14:54 +02:00
Andrew Nicols 8ddb17b641 MDL-68705 testing: Allow composer updates to be disabled 2020-08-20 20:14:50 +02:00
sam marshall 30990ac512 MDL-38350 Lib: Rename directory before removing it, to reduce races 2020-08-20 16:57:06 +01:00
Tim Hunt 0c6f661def MDL-69507 duration form field: should return an int number of seconds 2020-08-20 11:31:28 +01:00
Tim Hunt 24d0335a0a MDL-69507 duration form field: modernise coding style 2020-08-20 11:31:28 +01:00
Sara Arjona 52836faa5b MDL-69055 core_badges: display password/oauth fields properly 2020-08-20 12:01:49 +08:00
Peter Burnett 64f64e44d8 MDL-69486 webservices: Added user and grade idnumber to grade items 2020-08-20 11:59:41 +08:00
carlos a133b89976 MDL-69375 mod_lti: Fix Names and Roles Link header format
- Changed line 469 of memberships.php to build Link header according to the Web Linking specification RFC8288.
2020-08-20 11:50:54 +08:00
Ferran Recio 93fec2c58c MDL-68964 mod_chat: fix theme param 2020-08-20 11:41:10 +08:00
Sara Arjona 3db6d44feb MDL-42434 mod_chat: add again the usingchat help icon
In Moodle 2.4 the help icon displayed in the chat window was
removed. It has been added to gui_ajax and gui_basic in order to help users.
2020-08-20 11:23:03 +08:00
Adrian Greeve 83aa08c7e1 MDL-68683 competencies: Fix bad version bump. 2020-08-20 11:01:31 +08:00
Simey Lameze 79082f8b6b MDL-68683 competencies: fix query to delete stale files 2020-08-20 10:21:00 +08:00
Paul Holden 544c7d68b6 MDL-69449 block_timeline: use dayslimit context data in template.
Ensures the correct value is used when initially rendering the
course timeline.
2020-08-20 09:24:46 +08:00
Bas Brands 699a82df1a MDL-68889 block_recentlyaccessedcourses: small viewport issues
- on small devices the recentlyaccessedcourses does not show any courses
2020-08-20 09:16:38 +08:00
Peter Burnett d369c098be MDL-69170 task: Added timecreated field to adhoc task table 2020-08-20 08:50:42 +08:00
Sara Arjona 191448afc5 MDL-68975 contentbank: add author field to file details view 2020-08-20 08:42:20 +08:00
Eloy Lafuente (stronk7) 606fbca6b4 MDL-67415 environment: change requirements
- mysql requirement up to 5.7
- postgres requirement up to 9.6
2020-08-20 08:29:43 +08:00
Eloy Lafuente (stronk7) 050eb97c33 MDL-67415 environment: 3.10 base information
This is a direct copy of the 3.9 branch to have
changes under control easier for next commits.
2020-08-20 08:29:43 +08:00
Simey Lameze f6f824597a MDL-66818 mod_forum: remove unnecessary behat steps 2020-08-20 08:16:49 +08:00
gthomas2 f2b4fba61e MDL-66818 mod_forum: hide portfolio export button based on caps 2020-08-20 08:16:49 +08:00
Paul Holden 3a394dd671 MDL-66900 course: don't clean category description when editing. 2020-08-20 07:54:13 +08:00
Sara Arjona 98480b3932 MDL-69473 contentbank: change incorrect ref to size in type column 2020-08-20 07:43:56 +08:00
Eloy Lafuente (stronk7) e010b2e75c MDL-69271 auth_ldap: Don't assume any ordering, just verify matches
Both ldap or the DB can return information in a non-consistent
ordering leading to events to be generated in different order.

And current tests are, right now, assuming a given order.

Note this is a rare random, but it's happening, so better
fix it, see the issue for some more details.

So we just do the tests ordering immune, verifying that all the
expected events have been triggered and done. Irrespectively of their order.
2020-08-20 07:35:59 +08:00
Sara Arjona aa3a9c7895 MDL-69054 core_badges: allow editing OBv1.0 backpacks 2020-08-20 07:31:48 +08:00
Sara Arjona f075ec01ca MDL-61215 core_user: use the new optimised_image filetype group
For the user profile picture (instead of the web_image which includes
SVG files).
2020-08-20 07:16:41 +08:00
Sara Arjona c4c770f48c MDL-61215 core_badges: use the new optimised_image filetype group
For the badge picture (instead of the web_image which includes
SVG files).
2020-08-20 07:16:41 +08:00
Sara Arjona 24ce9b8a10 MDL-61215 core_files: add new optimised_image group
Currently, PHP getimagesize method doesn't support SVG images.
As some features, such as badges, processs and optimise the images
before using them, a new filetype group has been created to exclude
SVG from there: optimised_image.
SVG can't be removed from web_image because then users won't be
able to add SVG images to their courses using labels, pages...
2020-08-20 07:16:41 +08:00
Mihail Geshoski adebc5f811 MDL-69401 book: Limit character length in chapter title 2020-08-20 07:03:24 +08:00
Peter Dias afc19a201c MDL-69297 assign: Check whether there is content for a submission
Confirm there is some content to be submitted for an assignment when processing it.
2020-08-19 23:42:27 +01:00
Peter Dias aa7707cd52 MDL-66665 assign: Check whether a modified user could actually grade 2020-08-19 14:27:59 +08:00
Simey Lameze 676c840c5c MDL-68683 competencies: step to delete orphaned evidence files 2020-08-19 12:55:53 +08:00
Simey Lameze 1222c2125e MDL-68683 core: fix DML exception on upgrade step 2020-08-19 12:55:35 +08:00
Simey Lameze 776b4a85d1 MDL-26401 group: add delimiter and encoding fields to import 2020-08-19 11:11:14 +08:00
Amaia Anabitarte 29fe254b17 MDL-69089 core_contentbank: Empty content names are not allowed 2020-08-19 10:51:58 +08:00
Adrian Greeve bf84a08900 Merge branch 'MDL-69475_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-08-19 10:42:51 +08:00
Simey Lameze 97043c76b7 MDL-26401 group: change import to use csv_import_reader class 2020-08-19 08:51:32 +08:00
Andrew Nicols c1813ed818 MDL-67735 theme_boost: Fix incorrect whitespace 2020-08-19 08:39:15 +08:00
Bas Brands 49f1803c9d MDL-67735 theme_boost: remove bs2 and bs4alpha compatibility css 2020-08-19 08:29:50 +08:00
Amaia Anabitarte 157f8a87b4 MDL-69089 core_contentbank: Tests for empty content names 2020-08-19 08:19:44 +08:00
Leon Stringer c66bf80bd8 MDL-65847 auth_db: user_update() handle errors
The external database authentication plugin (auth_db) can update the
external database if mapped fields are set to Update external: On
update.  This change adds error handling in case this update fails.
2020-08-19 00:36:21 +02:00
Juan Leyva ad25efc776 MDL-69095 tool_mobile: Display warning if not allowed to use qr login 2020-08-19 00:20:54 +02:00
Juan Leyva 1019a2b5ba MDL-69095 tool_mobile: Avoid non-https sites using qrlogin by default 2020-08-19 00:20:54 +02:00
Matt Davidson 7404858689 MDL-63375 workshop: fix rubric grid view 2020-08-19 00:13:54 +02:00
Shamim Rezaie 7b313f407a MDL-68444 calendar: Improve how screenreaders say week titles
Also removed the scope attribute from the mini-calendar table
because according to https://www.w3.org/TR/WCAG20-TECHS/H63.html
it was not needed:
  Note 1: For simple tables that have the headers in the first row
  or column then it is sufficient to simply use the TH elements without
  scope.
2020-08-18 19:13:37 +02:00
Shamim Rezaie 931fc89e13 MDL-68444 calendar: Improve how screenreaders read day titles
Screenreaders now know if each day has any event or not
2020-08-18 19:13:27 +02:00
Mathew May fbbfe9aa00 MDL-68928 core_course: Select activity chooser footer 2020-08-18 19:02:25 +02:00
Victor Deniz Falcon b81952a23d Merge branch 'MDL-69477_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-08-18 12:48:09 +01:00
Eloy Lafuente (stronk7) 12ffcc5097 MDL-69475 backup: Proper handling of backup::RELEASE versions
1) Remove any floatval() casting. They are breaking / killing
   .10 versions (converting them to .1). Since Moodle 2.0 all the
   backup::RELEASE have been 100% numerical values.
2) Use version_compare() always to compare backup::RELEASE values.
   They are always versions and the function is aware of versions
   > .9, able to clean/ignore alpha chars... and everything else.

Note that I've also changed a couple of cases in formats (topics and
weeks) that were correct, but just added the same comment and used
the same version_compare() comparison parameters style, so all uses
in core are consistent (and safe to be copied out there).
2020-08-18 12:49:20 +02:00
Andrew Nicols bd1eaea02b MDL-69273 travis: Use exttests for https too 2020-08-18 10:59:13 +02:00
Andrew Nicols 99a8358b85 MDL-69273 travis: Move exttests check to after_script
The result of the final command `script` phase determines the build
result.

The cleanup belongs in the `after_script` phase.
2020-08-18 10:59:13 +02:00
Eloy Lafuente (stronk7) 0a352c4790 MDL-69477 install: Ensure CFG variables are set before using them
On installation (or also phpunit/behat unit) some CFG variables
were being used (on setting validation) before being set.

So this commit just verifies they are set before using them. Note that,
strictly speaking, only one of them ($CFG->searchenginequeryonly)
required the extra check, but I think it's better to apply it to all
them, as a reference and in case validations are run in any other order.
2020-08-17 10:53:38 +02:00
Nadav Kavalerchik 67dfb55d49 MDL-69414 qtype/ddimageortext: Fix dropzones display in RTL mode 2020-08-17 14:53:20 +08:00
Mihail Geshoski 12bd4bc5ad MDL-67943 core: Update timezone list in core_date 2020-08-17 10:36:01 +08:00
Adrian Greeve 22ec6995ea Merge branch 'MDL-69475_310' of https://github.com/stronk7/moodle into MOODLE_310_STABLE 2020-08-17 09:49:54 +08:00
Eloy Lafuente (stronk7) ae3af1d860 MDL-69475 install: Version, env. and minimal changes before branching
- Also bump travis to get builds against 310_STABLE.
- And backup release to match 3.10

Note this doesn't aim to be a complete change-set, but just the
minimum to switch to 3-digit $branches and keep installation, checks
and tests running and passing.
2020-08-17 00:12:30 +02:00
1687 changed files with 48130 additions and 17810 deletions
+3
View File
@@ -67,6 +67,9 @@ lib/babel-polyfill/
lib/polyfills/
lib/emoji-data/
lib/plist/
lib/zipstream/
lib/php-enum/
lib/http-message/
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
+1
View File
@@ -33,6 +33,7 @@ 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
+3
View File
@@ -68,6 +68,9 @@ lib/babel-polyfill/
lib/polyfills/
lib/emoji-data/
lib/plist/
lib/zipstream/
lib/php-enum/
lib/http-message/
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/videojs/
+13 -6
View File
@@ -2,10 +2,9 @@
# process (which uses our internal CI system) this file is here for the benefit
# of community developers git clones - see MDL-51458.
# We currently disable Travis notifications entirely until https://github.com/travis-ci/travis-ci/issues/4976
# is fixed.
notifications:
email: false
email:
if: env(MOODLE_EMAIL) != no
language: php
@@ -174,7 +173,9 @@ before_script:
# Enable test external resources
sed -i \
-e "/require_once/i \\define('TEST_EXTERNAL_FILES_HTTP_URL', 'http://127.0.0.1:8080');" \
-e "/require_once/i \\define('TEST_EXTERNAL_FILES_HTTPS_URL', 'http://127.0.0.1:8080');" \
config.php ;
# Redis cache store tests
sed -i \
-e "/require_once/i \\define('TEST_CACHESTORE_REDIS_TESTSERVERS', '127.0.0.1');" \
@@ -212,7 +213,7 @@ before_script:
# We need the official upstream for comparison
git remote add upstream https://github.com/moodle/moodle.git;
git fetch upstream master;
git fetch upstream MOODLE_310_STABLE;
export GIT_PREVIOUS_COMMIT="`git merge-base FETCH_HEAD $TRAVIS_COMMIT`";
export GIT_COMMIT="$TRAVIS_COMMIT";
export UPSTREAM_FETCH_HEAD=`git rev-parse FETCH_HEAD`
@@ -254,8 +255,6 @@ script:
if [ "$TASK" = 'PHPUNIT' ];
then
vendor/bin/phpunit --fail-on-risky --disallow-test-output --verbose;
EXTTESTS_HITS=$(docker logs exttests 2>&1 | grep -Fv -e 'AH00558' -e '[pid 1]' | wc -l)
echo -e "\nTest local resources number of hits: ${EXTTESTS_HITS}.\n"
fi
- >
@@ -292,3 +291,11 @@ script:
exit 1 ;
fi
fi
after_script:
- >
if [ "$TASK" = 'PHPUNIT' ];
then
EXTTESTS_HITS=$(docker logs exttests 2>&1 | grep -Fv -e 'AH00558' -e '[pid 1]' | wc -l)
echo -e "\nTest local resources number of hits: ${EXTTESTS_HITS}.\n"
fi
@@ -43,7 +43,7 @@ class testoutgoingmailconf_form extends \moodleform {
$mform = $this->_form;
// Recipient.
$options = ['maxlength' => '100', 'size' => '25'];
$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');
@@ -0,0 +1,71 @@
<?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);
}
}
@@ -0,0 +1,206 @@
<?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);
}
}
@@ -178,6 +178,7 @@ class filesize extends \admin_setting {
'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,
@@ -0,0 +1,74 @@
<?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);
}
}
+3
View File
@@ -57,6 +57,8 @@ class task_log_table extends \table_sql {
'userid' => get_string('user', 'admin'),
'timestart' => get_string('task_starttime', 'admin'),
'duration' => get_string('task_duration', 'admin'),
'hostname' => get_string('hostname', 'tool_task'),
'pid' => get_string('pid', 'tool_task'),
'db' => get_string('task_dbstats', 'admin'),
'result' => get_string('task_result', 'admin'),
'actions' => '',
@@ -132,6 +134,7 @@ class task_log_table extends \table_sql {
$sql = "SELECT
tl.id, tl.type, tl.component, tl.classname, tl.userid, tl.timestart, tl.timeend,
tl.hostname, tl.pid,
tl.dbreads, tl.dbwrites, tl.result,
tl.dbreads + tl.dbwrites AS db,
tl.timeend - tl.timestart AS duration,
+9
View File
@@ -37,11 +37,13 @@ list($options, $unrecognized) = cli_get_params(
'showsql' => false,
'showdebugging' => false,
'ignorelimits' => false,
'force' => false,
], [
'h' => 'help',
'e' => 'execute',
'k' => 'keep-alive',
'i' => 'ignorelimits',
'f' => 'force',
]
);
@@ -61,6 +63,7 @@ Options:
-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
Example:
\$sudo -u www-data /usr/bin/php admin/cli/adhoc_task.php --execute
@@ -92,6 +95,12 @@ if (moodle_needs_upgrading()) {
if (empty($options['execute'])) {
exit(0);
}
if (!get_config('core', 'cron_enabled') && !$options['force']) {
mtrace('Cron is disabled. Use --force to override.');
exit(1);
}
if (empty($options['keep-alive'])) {
$options['keep-alive'] = 0;
}
+105 -6
View File
@@ -36,14 +36,23 @@ require_once($CFG->libdir.'/cronlib.php');
// now get cli options
list($options, $unrecognized) = cli_get_params(
array(
[
'help' => false,
'stop' => false,
),
array(
'list' => false,
'force' => false,
'enable' => false,
'disable' => false,
'disable-wait' => false,
], [
'h' => 'help',
's' => 'stop',
)
'l' => 'list',
'f' => 'force',
'e' => 'enable',
'd' => 'disable',
'w' => 'disable-wait',
]
);
if ($unrecognized) {
@@ -56,8 +65,13 @@ if ($options['help']) {
"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
-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)
Example:
\$sudo -u www-data /usr/bin/php admin/cli/cron.php
@@ -74,6 +88,91 @@ if ($options['stop']) {
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();
cron_run();
+109
View File
@@ -0,0 +1,109 @@
<?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 restore a course from CLI.
*
* @package core
* @subpackage cli
* @copyright 2020 Catalyst IT
* @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/restore_includes.php");
list($options, $unrecognized) = cli_get_params([
'file' => '',
'categoryid' => '',
'showdebugging' => false,
'help' => false,
], [
'f' => 'file',
'c' => 'categoryid',
's' => 'showdebugging',
'h' => 'help',
]);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help'] || !($options['file']) || !($options['categoryid'])) {
$help = <<<EOL
Restore backup into provided category.
Options:
-f, --file=STRING Path to the backup file.
-c, --categoryid=INT ID of the category to restore too.
-s, --showdebugging Show developer level debugging information
-h, --help Print out this help.
Example:
\$sudo -u www-data /usr/bin/php admin/cli/restore_backup.php --file=/path/to/backup/file.mbz --categoryid=1\n
EOL;
echo $help;
exit(0);
}
if ($options['showdebugging']) {
set_debugging(DEBUG_DEVELOPER, true);
}
if (!$admin = get_admin()) {
print_error('noadmins');
}
if (!file_exists($options['file'])) {
print_error('filenotfound');
}
if (!$category = $DB->get_record('course_categories', ['id' => $options['categoryid']], 'id')) {
print_error('invalidcategoryid');
}
$backupdir = "restore_" . uniqid();
$path = $CFG->tempdir . DIRECTORY_SEPARATOR . "backup" . DIRECTORY_SEPARATOR . $backupdir;
cli_heading(get_string('extractingbackupfileto', 'backup', $path));
$fp = get_file_packer('application/vnd.moodle.backup');
$fp->extract_to_pathname($options['file'], $path);
cli_heading(get_string('preprocessingbackupfile'));
try {
list($fullname, $shortname) = restore_dbops::calculate_course_names(0, get_string('restoringcourse', 'backup'),
get_string('restoringcourseshortname', 'backup'));
$courseid = restore_dbops::create_new_course($fullname, $shortname, $category->id);
$rc = new restore_controller($backupdir, $courseid, backup::INTERACTIVE_NO,
backup::MODE_GENERAL, $admin->id, backup::TARGET_NEW_COURSE);
$rc->execute_precheck();
$rc->execute_plan();
$rc->destroy();
} catch (Exception $e) {
cli_heading(get_string('cleaningtempdata'));
fulldelete($path);
print_error('generalexceptionmessage', 'error', '', $e->getMessage());
}
cli_heading(get_string('restoredcourseid', 'backup', $courseid));
exit(0);
+19 -2
View File
@@ -30,8 +30,17 @@ require_once("$CFG->libdir/clilib.php");
require_once("$CFG->libdir/cronlib.php");
list($options, $unrecognized) = cli_get_params(
array('help' => false, 'list' => false, 'execute' => false, 'showsql' => false, 'showdebugging' => false),
array('h' => 'help')
[
'help' => false,
'list' => false,
'execute' => false,
'showsql' => false,
'showdebugging' => false,
'force' => false,
], [
'h' => 'help',
'f' => 'force',
]
);
if ($unrecognized) {
@@ -49,6 +58,7 @@ if ($options['help'] or (!$options['list'] and !$options['execute'])) {
--showsql Show sql queries before they are executed
--showdebugging Show developer level debugging information
-h, --help Print out this help
-f, --force Execute task even if cron is disabled
Example:
\$sudo -u www-data /usr/bin/php admin/cli/scheduled_task.php --execute=\\core\\task\\session_cleanup_task
@@ -121,6 +131,13 @@ if ($execute = $options['execute']) {
exit(1);
}
if (!get_config('core', 'cron_enabled') && !$options['force']) {
mtrace('Cron is disabled. Use --force to override.');
exit(1);
}
\core\task\manager::scheduled_task_starting($task);
// Increase memory limit.
raise_memory_limit(MEMORY_EXTRA);
+7 -7
View File
@@ -38,17 +38,17 @@ if ($unrecognized) {
}
// If necessary add files that should be ignored - such as in 3rd party plugins.
$blacklist = array();
$ignorelist = array();
$path = $options['path'];
if (!file_exists($path)) {
cli_error("Invalid path $path");
}
if ($options['ie9fix']) {
core_admin_recurse_svgs($path, '', 'core_admin_svgtool_ie9fix', $blacklist);
core_admin_recurse_svgs($path, '', 'core_admin_svgtool_ie9fix', $ignorelist);
} else if ($options['noaspectratio']) {
core_admin_recurse_svgs($path, '', 'core_admin_svgtool_noaspectratio', $blacklist);
core_admin_recurse_svgs($path, '', 'core_admin_svgtool_noaspectratio', $ignorelist);
} else {
$help =
@@ -153,9 +153,9 @@ function core_admin_svgtool_noaspectratio($file) {
* @param string $base
* @param string $sub
* @param string $filecallback
* @param array $blacklist
* @param array $ignorelist List of files to be ignored and skipped.
*/
function core_admin_recurse_svgs($base, $sub, $filecallback, $blacklist) {
function core_admin_recurse_svgs($base, $sub, $filecallback, $ignorelist) {
if (is_dir("$base/$sub")) {
$items = new DirectoryIterator("$base/$sub");
foreach ($items as $item) {
@@ -163,7 +163,7 @@ function core_admin_recurse_svgs($base, $sub, $filecallback, $blacklist) {
continue;
}
$file = $item->getFilename();
core_admin_recurse_svgs("$base/$sub", $file, $filecallback, $blacklist);
core_admin_recurse_svgs("$base/$sub", $file, $filecallback, $ignorelist);
}
unset($item);
unset($items);
@@ -174,7 +174,7 @@ function core_admin_recurse_svgs($base, $sub, $filecallback, $blacklist) {
return;
}
$file = realpath("$base/$sub");
if (in_array($file, $blacklist)) {
if (in_array($file, $ignorelist)) {
return;
}
$filecallback($file);
+181
View File
@@ -3163,4 +3163,185 @@
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
<MOODLE version="3.10" requires="3.5">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mariadb" version="10.2.29" />
<VENDOR name="mysql" version="5.7" />
<VENDOR name="postgres" version="9.6" />
<VENDOR name="mssql" version="11.0" />
<VENDOR name="oracle" version="11.2" />
</DATABASE>
<PHP version="7.2.0" level="required">
</PHP>
<PCREUNICODE level="optional">
<FEEDBACK>
<ON_CHECK message="pcreunicodewarning" />
</FEEDBACK>
</PCREUNICODE>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_ERROR message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="required">
<FEEDBACK>
<ON_ERROR message="mbstringrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_ERROR message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="required">
<FEEDBACK>
<ON_ERROR message="opensslrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="tokenizer" level="optional">
<FEEDBACK>
<ON_CHECK message="tokenizerrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlrpc" level="optional">
<FEEDBACK>
<ON_CHECK message="xmlrpcrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="soap" level="optional">
<FEEDBACK>
<ON_CHECK message="soaprecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="ctype" level="required">
<FEEDBACK>
<ON_ERROR message="ctyperequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zip" level="required">
<FEEDBACK>
<ON_ERROR message="ziprequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="zlib" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="gd" level="required">
<FEEDBACK>
<ON_ERROR message="gdrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_ERROR message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_ERROR message="splrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="pcre" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="dom" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xml" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="xmlreader" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="intl" level="required">
<FEEDBACK>
<ON_ERROR message="intlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
<PHP_EXTENSION name="hash" level="required"/>
<PHP_EXTENSION name="fileinfo" level="required"/>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="96M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="opcache.enable" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="opcacherecommended" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
<CUSTOM_CHECKS>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_storage_engine" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbstorageengine" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="question/engine/upgrade/upgradelib.php" function="quiz_attempts_upgraded" level="required">
<FEEDBACK>
<ON_ERROR message="quizattemptsupgradedmessage" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_slasharguments" level="optional">
<FEEDBACK>
<ON_CHECK message="slashargumentswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_database_tables_row_format" level="optional">
<FEEDBACK>
<ON_CHECK message="unsupporteddbtablerowformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_unoconv_version" level="optional">
<FEEDBACK>
<ON_CHECK message="unoconvwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_libcurl_version" level="optional">
<FEEDBACK>
<ON_CHECK message="libcurlwarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_format" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfileformat" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_file_per_table" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddbfilepertable" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_large_prefix" level="required">
<FEEDBACK>
<ON_ERROR message="unsupporteddblargeprefix" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_is_https" level="optional">
<FEEDBACK>
<ON_CHECK message="ishttpswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_mysql_incomplete_unicode_support" level="optional">
<FEEDBACK>
<ON_CHECK message="incompleteunicodesupport" />
</FEEDBACK>
</CUSTOM_CHECK>
<CUSTOM_CHECK file="lib/upgradelib.php" function="check_sixtyfour_bits" level="optional">
<FEEDBACK>
<ON_CHECK message="sixtyfourbitswarning" />
</FEEDBACK>
</CUSTOM_CHECK>
</CUSTOM_CHECKS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+4 -2
View File
@@ -49,6 +49,7 @@
array($module->id));
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
redirect(new moodle_url('/admin/modules.php'));
}
if (!empty($show) and confirm_sesskey()) {
@@ -66,6 +67,7 @@
array($module->id));
core_plugin_manager::reset_caches();
admin_get_root(true, false); // settings not required - only pages
redirect(new moodle_url('/admin/modules.php'));
}
echo $OUTPUT->header();
@@ -121,8 +123,8 @@
$count = -1;
}
if ($count>0) {
$countlink = "<a href=\"{$CFG->wwwroot}/course/search.php?modulelist=$module->name" .
"&amp;sesskey=".sesskey()."\" title=\"$strshowmodulecourse\">$count</a>";
$countlink = $OUTPUT->action_link(new moodle_url('/course/search.php', ['modulelist' => $module->name]),
$count, null, ['title' => $strshowmodulecourse]);
} else if ($count < 0) {
$countlink = get_string('error');
} else {
+1 -1
View File
@@ -53,7 +53,6 @@ $pageurl = new moodle_url('/admin/plugins.php', $pageparams);
$pluginman = core_plugin_manager::instance();
if ($uninstall) {
require_sesskey();
if (!$confirmed) {
admin_externalpage_setup('pluginsoverview', '', $pageparams);
@@ -92,6 +91,7 @@ if ($uninstall) {
exit();
} else {
require_sesskey();
$SESSION->pluginuninstallreturn = $pluginfo->get_return_url_after_uninstall($return);
$progress = new progress_trace_buffer(new text_progress_trace(), false);
$pluginman->uninstall_plugin($pluginfo->component, $progress);
+7 -7
View File
@@ -536,7 +536,7 @@ class core_role_privacy_testcase extends provider_testcase {
$user1->id,
$admin->id
];
$this->assertEquals($expected, $userlist2->get_userids(), '', 0.0, 10, true);
$this->assertEqualsCanonicalizing($expected, $userlist2->get_userids());
// The user list for coursecontext1 should user1, user2 and admin (role creator).
$userlist3 = new \core_privacy\local\request\userlist($coursecontext1, $component);
@@ -547,7 +547,7 @@ class core_role_privacy_testcase extends provider_testcase {
$user2->id,
$admin->id
];
$this->assertEquals($expected, $userlist3->get_userids(), '', 0.0, 10, true);
$this->assertEqualsCanonicalizing($expected, $userlist3->get_userids());
// The user list for coursecatcontext should user2 and admin (role creator).
$userlist4 = new \core_privacy\local\request\userlist($coursecatcontext, $component);
@@ -557,7 +557,7 @@ class core_role_privacy_testcase extends provider_testcase {
$user2->id,
$admin->id
];
$this->assertEquals($expected, $userlist4->get_userids(), '', 0.0, 10, true);
$this->assertEqualsCanonicalizing($expected, $userlist4->get_userids());
// The user list for systemcontext should user1 and admin (role creator).
$userlist6 = new \core_privacy\local\request\userlist($systemcontext, $component);
@@ -567,7 +567,7 @@ class core_role_privacy_testcase extends provider_testcase {
$user1->id,
$admin->id
];
$this->assertEquals($expected, $userlist6->get_userids(), '', 0.0, 10, true);
$this->assertEqualsCanonicalizing($expected, $userlist6->get_userids());
// The user list for cmcontext should user1, user2 and admin (role creator).
$userlist7 = new \core_privacy\local\request\userlist($cmcontext, $component);
@@ -578,7 +578,7 @@ class core_role_privacy_testcase extends provider_testcase {
$user2->id,
$admin->id
];
$this->assertEquals($expected, $userlist7->get_userids(), '', 0.0, 10, true);
$this->assertEqualsCanonicalizing($expected, $userlist7->get_userids());
// The user list for blockcontext should user1 and admin (role creator).
$userlist8 = new \core_privacy\local\request\userlist($blockcontext, $component);
@@ -588,7 +588,7 @@ class core_role_privacy_testcase extends provider_testcase {
$user1->id,
$admin->id
];
$this->assertEquals($expected, $userlist8->get_userids(), '', 0.0, 10, true);
$this->assertEqualsCanonicalizing($expected, $userlist8->get_userids());
}
/**
@@ -744,4 +744,4 @@ class core_role_privacy_testcase extends provider_testcase {
}
return $rolesnames;
}
}
}
+10 -3
View File
@@ -68,9 +68,16 @@ if ($errormsg !== '') {
$showsettingslinks = true;
if ($hassiteconfig) {
require_once("admin_settings_search_form.php");
$form = new admin_settings_search_form();
$form->display();
$data = [
'action' => new moodle_url('/admin/search.php'),
'btnclass' => 'btn-primary',
'inputname' => 'query',
'searchstring' => get_string('search'),
'query' => $query,
'extraclasses' => 'd-flex justify-content-center'
];
echo $OUTPUT->render_from_template('core/search_input', $data);
echo '<hr>';
if ($query) {
echo admin_search_settings_html($query);
+3 -8
View File
@@ -131,15 +131,10 @@ if ($hassiteconfig && \core_analytics\manager::is_analytics_enabled()) {
$timesplittingdefaults, $timesplittingoptions)
);
// Predictions processor output dir.
$defaultmodeloutputdir = rtrim($CFG->dataroot, '/') . DIRECTORY_SEPARATOR . 'models';
if (empty(get_config('analytics', 'modeloutputdir')) && !file_exists($defaultmodeloutputdir) &&
is_writable($defaultmodeloutputdir)) {
// Automatically create the dir for them so users don't see the invalid value red cross.
mkdir($defaultmodeloutputdir, $CFG->directorypermissions, true);
}
// Predictions processor output dir - specify default in setting description (used if left blank).
$defaultmodeloutputdir = \core_analytics\model::default_output_dir();
$settings->add(new admin_setting_configdirectory('analytics/modeloutputdir', new lang_string('modeloutputdir', 'analytics'),
new lang_string('modeloutputdirinfo', 'analytics'), $defaultmodeloutputdir));
new lang_string('modeloutputdirwithdefaultinfo', 'analytics', $defaultmodeloutputdir), ''));
// Disable web interface evaluation and get predictions.
$settings->add(new admin_setting_configcheckbox('analytics/onlycli', new lang_string('onlycli', 'analytics'),
+67
View File
@@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use core_admin\local\settings\filesize;
$capabilities = array(
'moodle/backup:backupcourse',
'moodle/category:manage',
@@ -75,6 +77,17 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp->add(new admin_setting_configselect('moodlecourse/visible', new lang_string('visible'), new lang_string('visible_help'),
1, $choices));
// Enable/disable download course content.
$choices = [
DOWNLOAD_COURSE_CONTENT_DISABLED => new lang_string('no'),
DOWNLOAD_COURSE_CONTENT_ENABLED => new lang_string('yes'),
];
$downloadcontentsitedefault = new admin_setting_configselect('moodlecourse/downloadcontentsitedefault',
new lang_string('enabledownloadcoursecontent', 'course'),
new lang_string('downloadcoursecontent_help', 'course'), 0, $choices);
$downloadcontentsitedefault->add_dependent_on('downloadcoursecontentallowed');
$temp->add($downloadcontentsitedefault);
// Course format.
$temp->add(new admin_setting_heading('courseformathdr', new lang_string('type_format', 'plugin'), ''));
@@ -161,6 +174,21 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$ADMIN->add('courses', $temp);
// Download course content.
$downloadcoursedefaulturl = new moodle_url('/admin/settings.php', ['section' => 'coursesettings']);
$temp = new admin_settingpage('downloadcoursecontent', new lang_string('downloadcoursecontent', 'course'));
$temp->add(new admin_setting_configcheckbox('downloadcoursecontentallowed',
new lang_string('downloadcoursecontentallowed', 'admin'),
new lang_string('downloadcoursecontentallowed_desc', 'admin', $downloadcoursedefaulturl->out()), 0));
// 50MB default maximum size per file when downloading course content.
$defaultmaxdownloadsize = 50 * filesize::UNIT_MB;
$temp->add(new filesize('maxsizeperdownloadcoursefile', new lang_string('maxsizeperdownloadcoursefile', 'admin'),
new lang_string('maxsizeperdownloadcoursefile_desc', 'admin'), $defaultmaxdownloadsize, filesize::UNIT_MB));
$temp->hide_if('maxsizeperdownloadcoursefile', 'downloadcoursecontentallowed');
$ADMIN->add('courses', $temp);
// "courserequests" settingpage.
$temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests',
@@ -184,6 +212,7 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
// Add a category for the Activity Chooser.
$ADMIN->add('courses', new admin_category('activitychooser', new lang_string('activitychoosercategory', 'course')));
$temp = new admin_settingpage('activitychoosersettings', new lang_string('activitychoosersettings', 'course'));
// Tab mode for the activity chooser.
$temp->add(
new admin_setting_configselect(
'activitychoosertabmode',
@@ -197,6 +226,31 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
]
)
);
// Build a list of plugins that use the footer callback.
$pluginswithfunction = get_plugins_with_function('custom_chooser_footer', 'lib.php');
$pluginsoptions = [];
$pluginsoptions[COURSE_CHOOSER_FOOTER_NONE] = get_string('activitychooserhidefooter', 'course');
if ($pluginswithfunction) {
foreach ($pluginswithfunction as $plugintype => $plugins) {
foreach ($plugins as $pluginname => $pluginfunction) {
$plugin = $plugintype.'_'.$pluginname;
$pluginsoptions[$plugin] = get_string('pluginname', $plugin);
}
}
}
// Select what plugin to show in the footer.
$temp->add(
new admin_setting_configselect(
'activitychooseractivefooter',
new lang_string('activitychooseractivefooter', 'course'),
new lang_string('activitychooseractivefooter_desc', 'course'),
COURSE_CHOOSER_FOOTER_NONE,
$pluginsoptions
)
);
$ADMIN->add('activitychooser', $temp);
$ADMIN->add('activitychooser',
new admin_externalpage('activitychooserrecommended', new lang_string('activitychooserrecommendations', 'course'),
@@ -259,6 +313,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
['value' => 1, 'locked' => 0])
);
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_general_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
$ADMIN->add('backups', $temp);
// Create a page for general import configuration and defaults.
@@ -285,6 +342,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
new lang_string('configgeneralcontentbankcontent', 'backup'),
['value' => 1, 'locked' => 0])
);
$temp->add(new admin_setting_configcheckbox_with_lock('backup/backup_import_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
$ADMIN->add('backups', $temp);
@@ -411,6 +471,10 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
1)
);
$temp->add(new admin_setting_configcheckbox('backup/backup_auto_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), 1));
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_messages', new lang_string('messages', 'message'), new lang_string('backupmessageshelp','message'), 0));
//$temp->add(new admin_setting_configcheckbox('backup/backup_auto_blogs', new lang_string('blogs', 'blog'), new lang_string('backupblogshelp','blog'), 0));
@@ -473,6 +537,9 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_contentbankcontent',
new lang_string('generalcontentbankcontent', 'backup'),
new lang_string('configrestorecontentbankcontent', 'backup'), array('value' => 1, 'locked' => 0)));
$temp->add(new admin_setting_configcheckbox_with_lock('restore/restore_general_legacyfiles',
new lang_string('generallegacyfiles', 'backup'),
new lang_string('configlegacyfiles', 'backup'), array('value' => 1, 'locked' => 0)));
// Restore defaults when merging into another course.
$temp->add(new admin_setting_heading('mergerestoredefaults', new lang_string('mergerestoredefaults', 'backup'), ''));
+2
View File
@@ -8,6 +8,8 @@ if ($hassiteconfig) {
$temp = new admin_settingpage('langsettings', new lang_string('languagesettings', 'admin'));
$temp->add(new admin_setting_configcheckbox('autolang', new lang_string('autolang', 'admin'), new lang_string('configautolang', 'admin'), 1));
$temp->add(new admin_setting_configselect('lang', new lang_string('lang', 'admin'), new lang_string('configlang', 'admin'), current_language(), get_string_manager()->get_list_of_translations())); // $CFG->lang might be set in installer already, default en is in setup.php
$temp->add(new admin_setting_configcheckbox('autolangusercreation', new lang_string('autolangusercreation', 'admin'),
new lang_string('configautolangusercreation', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('langmenu', new lang_string('langmenu', 'admin'), new lang_string('configlangmenu', 'admin'), 1));
$temp->add(new admin_setting_langlist());
$temp->add(new admin_setting_configcheckbox('langcache', new lang_string('langcache', 'admin'), new lang_string('langcache_desc', 'admin'), 1));
+50 -14
View File
@@ -1,21 +1,57 @@
<?php
// This file is part of Moodle - https://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/>.
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
/**
* Define administration settings on the Location settings page.
*
* @package core
* @category admin
* @copyright 2006 Martin Dougiamas <martin@moodle.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
// "locations" settingpage
$temp = new admin_settingpage('locationsettings', new lang_string('locationsettings', 'admin'));
$temp->add(new admin_setting_servertimezone());
$temp->add(new admin_setting_forcetimezone());
$temp->add(new admin_settings_country_select('country', new lang_string('country', 'admin'), new lang_string('configcountry', 'admin'), 0));
$temp->add(new admin_setting_configtext('defaultcity', new lang_string('defaultcity', 'admin'), new lang_string('defaultcity_help', 'admin'), ''));
defined('MOODLE_INTERNAL') || die();
$temp->add(new admin_setting_heading('iplookup', new lang_string('iplookup', 'admin'), new lang_string('iplookupinfo', 'admin')));
$temp->add(new admin_setting_configfile('geoip2file', new lang_string('geoipfile', 'admin'),
new lang_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLite2-City.mmdb'));
$temp->add(new admin_setting_configtext('googlemapkey3', new lang_string('googlemapkey3', 'admin'), new lang_string('googlemapkey3_help', 'admin'), '', PARAM_RAW, 60));
if ($hassiteconfig) {
$temp = new admin_settingpage('locationsettings', new lang_string('locationsettings', 'core_admin'));
$temp->add(new admin_setting_configtext('allcountrycodes', new lang_string('allcountrycodes', 'admin'), new lang_string('configallcountrycodes', 'admin'), '', '/^(?:\w+(?:,\w+)*)?$/'));
if ($ADMIN->fulltree) {
$temp->add(new admin_setting_servertimezone());
$temp->add(new admin_setting_forcetimezone());
$temp->add(new admin_settings_country_select('country', new lang_string('country', 'core_admin'),
new lang_string('configcountry', 'core_admin'), 0));
$temp->add(new admin_setting_configtext('defaultcity', new lang_string('defaultcity', 'core_admin'),
new lang_string('defaultcity_help', 'core_admin'), ''));
$temp->add(new admin_setting_heading('iplookup', new lang_string('iplookup', 'core_admin'),
new lang_string('iplookupinfo', 'core_admin')));
$temp->add(new admin_setting_configfile('geoip2file', new lang_string('geoipfile', 'core_admin'),
new lang_string('configgeoipfile', 'core_admin', $CFG->dataroot . '/geoip/'),
$CFG->dataroot . '/geoip/GeoLite2-City.mmdb'));
$temp->add(new admin_setting_configtext('googlemapkey3', new lang_string('googlemapkey3', 'core_admin'),
new lang_string('googlemapkey3_help', 'core_admin'), '', PARAM_RAW, 60));
$temp->add(new admin_setting_countrycodes('allcountrycodes', new lang_string('allcountrycodes', 'core_admin'),
new lang_string('configallcountrycodes', 'core_admin')));
}
$ADMIN->add('location', $temp);
} // end of speedup
}
+29
View File
@@ -0,0 +1,29 @@
<?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/>.
/**
* Adds payments links to the admin tree
*
* @package core
* @copyright 2020 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$ADMIN->add('payment', new admin_externalpage(
'paymentaccounts',
new lang_string('paymentaccounts', 'payment'),
new moodle_url("/payment/accounts.php"),
['moodle/payment:manageaccounts', 'moodle/payment:viewpayments']));
+21 -2
View File
@@ -280,6 +280,25 @@ if ($hassiteconfig) {
$plugin->load_settings($ADMIN, 'mediaplayers', $hassiteconfig);
}
// Payment gateway plugins.
$ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_paygw_plural', 'plugin')));
$temp = new admin_settingpage('managepaymentgateways', new lang_string('type_paygwmanage', 'plugin'));
$temp->add(new \core_admin\local\settings\manage_payment_gateway_plugins());
$temp->add(new admin_setting_description(
'managepaymentgatewayspostfix',
'',
new lang_string('gotopaymentaccounts', 'payment',
html_writer::link(new moodle_url('/payment/accounts.php'), get_string('paymentaccounts', 'payment')))
));
$ADMIN->add('paymentgateways', $temp);
$plugins = core_plugin_manager::instance()->get_plugins_of_type('paygw');
core_collator::asort_objects_by_property($plugins, 'displayname');
foreach ($plugins as $plugin) {
/** @var \core\plugininfo\paygw $plugin */
$plugin->load_settings($ADMIN, 'paymentgateways', $hassiteconfig);
}
// Data format settings.
$ADMIN->add('modules', new admin_category('dataformatsettings', new lang_string('dataformats')));
$temp = new admin_settingpage('managedataformats', new lang_string('managedataformats'));
@@ -591,7 +610,7 @@ if ($hassiteconfig) {
global $CFG;
// Check nobody's setting the indexing and query-only server to the same one.
if ($CFG->searchenginequeryonly === $value) {
if (isset($CFG->searchenginequeryonly) && $CFG->searchenginequeryonly === $value) {
return get_string('searchenginequeryonlysame', 'admin');
} else {
return '';
@@ -661,7 +680,7 @@ if ($hassiteconfig) {
global $CFG;
// Check nobody's setting the indexing and query-only server to the same one.
if ($CFG->searchengine === $value) {
if (isset($CFG->searchengine) && $CFG->searchengine === $value) {
return get_string('searchenginequeryonlysame', 'admin');
} else {
return '';
+457 -318
View File
@@ -1,162 +1,225 @@
<?php
// This file is part of Moodle - https://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
// This file defines settingpages and externalpages under the "server" category
/**
* Defines settingpages and externalpages under the "server" category.
*
* @package core
* @category admin
* @copyright 2006 Martin Dougiamas
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
defined('MOODLE_INTERNAL') || die();
// "systempaths" settingpage
$temp = new admin_settingpage('systempaths', new lang_string('systempaths','admin'));
$temp->add(new admin_setting_configexecutable('pathtophp', new lang_string('pathtophp', 'admin'),
new lang_string('configpathtophp', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'), new lang_string('configpathtodu', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'), new lang_string('edhelpaspellpath'), ''));
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'), new lang_string('pathtodot_help', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'), new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
$temp->add(new admin_setting_configexecutable('pathtopython', new lang_string('pathtopython', 'admin'),
new lang_string('pathtopythondesc', 'admin'), ''));
$ADMIN->add('server', $temp);
if ($hassiteconfig) {
// System paths.
$temp = new admin_settingpage('systempaths', new lang_string('systempaths', 'admin'));
$temp->add(new admin_setting_configexecutable('pathtophp', new lang_string('pathtophp', 'admin'),
new lang_string('configpathtophp', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtodu', new lang_string('pathtodu', 'admin'),
new lang_string('configpathtodu', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('aspellpath', new lang_string('aspellpath', 'admin'),
new lang_string('edhelpaspellpath'), ''));
$temp->add(new admin_setting_configexecutable('pathtodot', new lang_string('pathtodot', 'admin'),
new lang_string('pathtodot_help', 'admin'), ''));
$temp->add(new admin_setting_configexecutable('pathtogs', new lang_string('pathtogs', 'admin'),
new lang_string('pathtogs_help', 'admin'), '/usr/bin/gs'));
$temp->add(new admin_setting_configexecutable('pathtopython', new lang_string('pathtopython', 'admin'),
new lang_string('pathtopythondesc', 'admin'), ''));
$ADMIN->add('server', $temp);
// Support contact.
$temp = new admin_settingpage('supportcontact', new lang_string('supportcontact', 'admin'));
$primaryadmin = get_admin();
if ($primaryadmin) {
$primaryadminemail = $primaryadmin->email;
$primaryadminname = fullname($primaryadmin, true);
} else {
// No defaults during installation - admin user must be created first.
$primaryadminemail = null;
$primaryadminname = null;
}
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
$setting = new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'),
new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_EMAIL);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'),
new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
$ADMIN->add('server', $temp);
// Session handling.
$temp = new admin_settingpage('sessionhandling', new lang_string('sessionhandling', 'admin'));
if (empty($CFG->session_handler_class) and $DB->session_lock_supported()) {
$temp->add(new admin_setting_configcheckbox('dbsessions', new lang_string('dbsessions', 'admin'),
new lang_string('configdbsessions', 'admin'), 0));
}
// "supportcontact" settingpage
$temp = new admin_settingpage('supportcontact', new lang_string('supportcontact','admin'));
$primaryadmin = get_admin();
if ($primaryadmin) {
$primaryadminemail = $primaryadmin->email;
$primaryadminname = fullname($primaryadmin, true);
} else {
// no defaults during installation - admin user must be created first
$primaryadminemail = NULL;
$primaryadminname = NULL;
}
$temp->add(new admin_setting_configtext('supportname', new lang_string('supportname', 'admin'),
new lang_string('configsupportname', 'admin'), $primaryadminname, PARAM_NOTAGS));
$setting = new admin_setting_configtext('supportemail', new lang_string('supportemail', 'admin'),
new lang_string('configsupportemail', 'admin'), $primaryadminemail, PARAM_EMAIL);
$setting->set_force_ltr(true);
$temp->add($setting);
$temp->add(new admin_setting_configtext('supportpage', new lang_string('supportpage', 'admin'), new lang_string('configsupportpage', 'admin'), '', PARAM_URL));
$ADMIN->add('server', $temp);
$temp->add(new admin_setting_configduration('sessiontimeout', new lang_string('sessiontimeout', 'admin'),
new lang_string('configsessiontimeout', 'admin'), 8 * 60 * 60));
$temp->add(new admin_setting_configtext('sessioncookie', new lang_string('sessioncookie', 'admin'),
new lang_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
$temp->add(new admin_setting_configtext('sessioncookiepath', new lang_string('sessioncookiepath', 'admin'),
new lang_string('configsessioncookiepath', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtext('sessioncookiedomain', new lang_string('sessioncookiedomain', 'admin'),
new lang_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50));
$ADMIN->add('server', $temp);
// "sessionhandling" settingpage
$temp = new admin_settingpage('sessionhandling', new lang_string('sessionhandling', 'admin'));
if (empty($CFG->session_handler_class) and $DB->session_lock_supported()) {
$temp->add(new admin_setting_configcheckbox('dbsessions', new lang_string('dbsessions', 'admin'), new lang_string('configdbsessions', 'admin'), 0));
}
// Statistics.
$temp = new admin_settingpage('stats', new lang_string('stats'), 'moodle/site:config', empty($CFG->enablestats));
$temp->add(new admin_setting_configselect('statsfirstrun', new lang_string('statsfirstrun', 'admin'),
new lang_string('configstatsfirstrun', 'admin'), 'none',
[
'none' => new lang_string('none'),
60 * 60 * 24 * 7 => new lang_string('numweeks', 'moodle', 1),
60 * 60 * 24 * 14 => new lang_string('numweeks', 'moodle', 2),
60 * 60 * 24 * 21 => new lang_string('numweeks', 'moodle', 3),
60 * 60 * 24 * 28 => new lang_string('nummonths', 'moodle', 1),
60 * 60 * 24 * 56 => new lang_string('nummonths', 'moodle', 2),
60 * 60 * 24 * 84 => new lang_string('nummonths', 'moodle', 3),
60 * 60 * 24 * 112 => new lang_string('nummonths', 'moodle', 4),
60 * 60 * 24 * 140 => new lang_string('nummonths', 'moodle', 5),
60 * 60 * 24 * 168 => new lang_string('nummonths', 'moodle', 6),
'all' => new lang_string('all')
]
));
$temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('statsmaxruntime', 'admin'),
new lang_string('configstatsmaxruntime3', 'admin'), 0,
[
0 => new lang_string('untilcomplete'),
60 * 30 => '10 ' . new lang_string('minutes'),
60 * 30 => '30 ' . new lang_string('minutes'),
60 * 60 => '1 ' . new lang_string('hour'),
60 * 60 * 2 => '2 ' . new lang_string('hours'),
60 * 60 * 3 => '3 ' . new lang_string('hours'),
60 * 60 * 4 => '4 ' . new lang_string('hours'),
60 * 60 * 5 => '5 ' . new lang_string('hours'),
60 * 60 * 6 => '6 ' . new lang_string('hours'),
60 * 60 * 7 => '7 ' . new lang_string('hours'),
60 * 60 * 8 => '8 ' . new lang_string('hours'),
]
));
$temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'),
new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
$temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'),
new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
$ADMIN->add('server', $temp);
$temp->add(new admin_setting_configduration('sessiontimeout', new lang_string('sessiontimeout', 'admin'),
new lang_string('configsessiontimeout', 'admin'), 8 * 60 * 60));
// HTTP.
$temp = new admin_settingpage('http', new lang_string('http', 'admin'));
$temp->add(new admin_setting_configcheckbox('slasharguments', new lang_string('slasharguments', 'admin'),
new lang_string('configslasharguments', 'admin'), 1));
$temp->add(new admin_setting_heading('reverseproxy', new lang_string('reverseproxy', 'admin'), '', ''));
$options = [
0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR'
];
$temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'),
new lang_string('configgetremoteaddrconf', 'admin'),
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR | GETREMOTEADDR_SKIP_HTTP_CLIENT_IP, $options));
$temp->add(new admin_setting_configtext('reverseproxyignore', new lang_string('reverseproxyignore', 'admin'),
new lang_string('configreverseproxyignore', 'admin'), ''));
$temp->add(new admin_setting_configtext('sessioncookie', new lang_string('sessioncookie', 'admin'), new lang_string('configsessioncookie', 'admin'), '', PARAM_ALPHANUM));
$temp->add(new admin_setting_configtext('sessioncookiepath', new lang_string('sessioncookiepath', 'admin'), new lang_string('configsessioncookiepath', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtext('sessioncookiedomain', new lang_string('sessioncookiedomain', 'admin'), new lang_string('configsessioncookiedomain', 'admin'), '', PARAM_RAW, 50));
$ADMIN->add('server', $temp);
$temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'),
new lang_string('webproxyinfo', 'admin')));
$temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'),
new lang_string('configproxyhost', 'admin'), '', PARAM_HOST));
$temp->add(new admin_setting_configtext('proxyport', new lang_string('proxyport', 'admin'),
new lang_string('configproxyport', 'admin'), 0, PARAM_INT));
$options = ['HTTP' => 'HTTP'];
if (defined('CURLPROXY_SOCKS5')) {
$options['SOCKS5'] = 'SOCKS5';
}
$temp->add(new admin_setting_configselect('proxytype', new lang_string('proxytype', 'admin'),
new lang_string('configproxytype', 'admin'), 'HTTP', $options));
$temp->add(new admin_setting_configtext('proxyuser', new lang_string('proxyuser', 'admin'),
new lang_string('configproxyuser', 'admin'), ''));
$temp->add(new admin_setting_configpasswordunmask('proxypassword', new lang_string('proxypassword', 'admin'),
new lang_string('configproxypassword', 'admin'), ''));
$temp->add(new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'),
new lang_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
$ADMIN->add('server', $temp);
$temp = new admin_settingpage('maintenancemode', new lang_string('sitemaintenancemode', 'admin'));
$options = [0 => new lang_string('disable'), 1 => new lang_string('enable')];
$temp->add(new admin_setting_configselect('maintenance_enabled', new lang_string('sitemaintenancemode', 'admin'),
new lang_string('helpsitemaintenance', 'admin'), 0, $options));
$temp->add(new admin_setting_confightmleditor('maintenance_message', new lang_string('optionalmaintenancemessage', 'admin'),
'', ''));
$ADMIN->add('server', $temp);
// "stats" settingpage
$temp = new admin_settingpage('stats', new lang_string('stats'), 'moodle/site:config', empty($CFG->enablestats));
$temp->add(new admin_setting_configselect('statsfirstrun', new lang_string('statsfirstrun', 'admin'), new lang_string('configstatsfirstrun', 'admin'), 'none', array('none' => new lang_string('none'),
60*60*24*7 => new lang_string('numweeks','moodle',1),
60*60*24*14 => new lang_string('numweeks','moodle',2),
60*60*24*21 => new lang_string('numweeks','moodle',3),
60*60*24*28 => new lang_string('nummonths','moodle',1),
60*60*24*56 => new lang_string('nummonths','moodle',2),
60*60*24*84 => new lang_string('nummonths','moodle',3),
60*60*24*112 => new lang_string('nummonths','moodle',4),
60*60*24*140 => new lang_string('nummonths','moodle',5),
60*60*24*168 => new lang_string('nummonths','moodle',6),
'all' => new lang_string('all') )));
$temp->add(new admin_setting_configselect('statsmaxruntime', new lang_string('statsmaxruntime', 'admin'), new lang_string('configstatsmaxruntime3', 'admin'), 0, array(0 => new lang_string('untilcomplete'),
60*30 => '10 '.new lang_string('minutes'),
60*30 => '30 '.new lang_string('minutes'),
60*60 => '1 '.new lang_string('hour'),
60*60*2 => '2 '.new lang_string('hours'),
60*60*3 => '3 '.new lang_string('hours'),
60*60*4 => '4 '.new lang_string('hours'),
60*60*5 => '5 '.new lang_string('hours'),
60*60*6 => '6 '.new lang_string('hours'),
60*60*7 => '7 '.new lang_string('hours'),
60*60*8 => '8 '.new lang_string('hours') )));
$temp->add(new admin_setting_configtext('statsruntimedays', new lang_string('statsruntimedays', 'admin'), new lang_string('configstatsruntimedays', 'admin'), 31, PARAM_INT));
$temp->add(new admin_setting_configtext('statsuserthreshold', new lang_string('statsuserthreshold', 'admin'), new lang_string('configstatsuserthreshold', 'admin'), 0, PARAM_INT));
$ADMIN->add('server', $temp);
// Cleanup.
$temp = new admin_settingpage('cleanup', new lang_string('cleanup', 'admin'));
$temp->add(new admin_setting_configselect('deleteunconfirmed', new lang_string('deleteunconfirmed', 'admin'),
new lang_string('configdeleteunconfirmed', 'admin'), 168,
[
0 => new lang_string('never'),
168 => new lang_string('numdays', '', 7),
144 => new lang_string('numdays', '', 6),
120 => new lang_string('numdays', '', 5),
96 => new lang_string('numdays', '', 4),
72 => new lang_string('numdays', '', 3),
48 => new lang_string('numdays', '', 2),
24 => new lang_string('numdays', '', 1),
12 => new lang_string('numhours', '', 12),
6 => new lang_string('numhours', '', 6),
1 => new lang_string('numhours', '', 1),
]
));
$temp->add(new admin_setting_configselect('deleteincompleteusers', new lang_string('deleteincompleteusers', 'admin'),
new lang_string('configdeleteincompleteusers', 'admin'), 0,
[
0 => new lang_string('never'),
168 => new lang_string('numdays', '', 7),
144 => new lang_string('numdays', '', 6),
120 => new lang_string('numdays', '', 5),
96 => new lang_string('numdays', '', 4),
72 => new lang_string('numdays', '', 3),
48 => new lang_string('numdays', '', 2),
24 => new lang_string('numdays', '', 1),
]
));
// "http" settingpage
$temp = new admin_settingpage('http', new lang_string('http', 'admin'));
$temp->add(new admin_setting_configcheckbox('slasharguments', new lang_string('slasharguments', 'admin'), new lang_string('configslasharguments', 'admin'), 1));
$temp->add(new admin_setting_heading('reverseproxy', new lang_string('reverseproxy', 'admin'), '', ''));
$options = array(
0 => 'HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'HTTP_X_FORWARDED_FOR, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR => 'HTTP_CLIENT, REMOTE_ADDR',
GETREMOTEADDR_SKIP_HTTP_X_FORWARDED_FOR|GETREMOTEADDR_SKIP_HTTP_CLIENT_IP => 'REMOTE_ADDR');
$temp->add(new admin_setting_configselect('getremoteaddrconf', new lang_string('getremoteaddrconf', 'admin'),
new lang_string('configgetremoteaddrconf', 'admin'),
GETREMOTEADDR_SKIP_DEFAULT, $options));
$temp->add(new admin_setting_configtext('reverseproxyignore', new lang_string('reverseproxyignore', 'admin'), new lang_string('configreverseproxyignore', 'admin'), ''));
$temp->add(new admin_setting_configcheckbox('disablegradehistory', new lang_string('disablegradehistory', 'grades'),
new lang_string('disablegradehistory_help', 'grades'), 0));
$temp->add(new admin_setting_heading('webproxy', new lang_string('webproxy', 'admin'), new lang_string('webproxyinfo', 'admin')));
$temp->add(new admin_setting_configtext('proxyhost', new lang_string('proxyhost', 'admin'), new lang_string('configproxyhost', 'admin'), '', PARAM_HOST));
$temp->add(new admin_setting_configtext('proxyport', new lang_string('proxyport', 'admin'), new lang_string('configproxyport', 'admin'), 0, PARAM_INT));
$options = array('HTTP'=>'HTTP');
if (defined('CURLPROXY_SOCKS5')) {
$options['SOCKS5'] = 'SOCKS5';
}
$temp->add(new admin_setting_configselect('proxytype', new lang_string('proxytype', 'admin'), new lang_string('configproxytype','admin'), 'HTTP', $options));
$temp->add(new admin_setting_configtext('proxyuser', new lang_string('proxyuser', 'admin'), new lang_string('configproxyuser', 'admin'), ''));
$temp->add(new admin_setting_configpasswordunmask('proxypassword', new lang_string('proxypassword', 'admin'), new lang_string('configproxypassword', 'admin'), ''));
$temp->add(new admin_setting_configtext('proxybypass', new lang_string('proxybypass', 'admin'), new lang_string('configproxybypass', 'admin'), 'localhost, 127.0.0.1'));
$ADMIN->add('server', $temp);
$temp->add(new admin_setting_configselect('gradehistorylifetime', new lang_string('gradehistorylifetime', 'grades'),
new lang_string('gradehistorylifetime_help', 'grades'), 0,
[
0 => new lang_string('neverdeletehistory', 'grades'),
1000 => new lang_string('numdays', '', 1000),
365 => new lang_string('numdays', '', 365),
180 => new lang_string('numdays', '', 180),
150 => new lang_string('numdays', '', 150),
120 => new lang_string('numdays', '', 120),
90 => new lang_string('numdays', '', 90),
60 => new lang_string('numdays', '', 60),
30 => new lang_string('numdays', '', 30),
]
));
$temp = new admin_settingpage('maintenancemode', new lang_string('sitemaintenancemode', 'admin'));
$options = array(0=>new lang_string('disable'), 1=>new lang_string('enable'));
$temp->add(new admin_setting_configselect('maintenance_enabled', new lang_string('sitemaintenancemode', 'admin'),
new lang_string('helpsitemaintenance', 'admin'), 0, $options));
$temp->add(new admin_setting_confightmleditor('maintenance_message', new lang_string('optionalmaintenancemessage', 'admin'),
'', ''));
$ADMIN->add('server', $temp);
$temp = new admin_settingpage('cleanup', new lang_string('cleanup', 'admin'));
$temp->add(new admin_setting_configselect('deleteunconfirmed', new lang_string('deleteunconfirmed', 'admin'), new lang_string('configdeleteunconfirmed', 'admin'), 168, array(0 => new lang_string('never'),
168 => new lang_string('numdays', '', 7),
144 => new lang_string('numdays', '', 6),
120 => new lang_string('numdays', '', 5),
96 => new lang_string('numdays', '', 4),
72 => new lang_string('numdays', '', 3),
48 => new lang_string('numdays', '', 2),
24 => new lang_string('numdays', '', 1),
12 => new lang_string('numhours', '', 12),
6 => new lang_string('numhours', '', 6),
1 => new lang_string('numhours', '', 1))));
$temp->add(new admin_setting_configselect('deleteincompleteusers', new lang_string('deleteincompleteusers', 'admin'), new lang_string('configdeleteincompleteusers', 'admin'), 0, array(0 => new lang_string('never'),
168 => new lang_string('numdays', '', 7),
144 => new lang_string('numdays', '', 6),
120 => new lang_string('numdays', '', 5),
96 => new lang_string('numdays', '', 4),
72 => new lang_string('numdays', '', 3),
48 => new lang_string('numdays', '', 2),
24 => new lang_string('numdays', '', 1))));
$temp->add(new admin_setting_configcheckbox('disablegradehistory', new lang_string('disablegradehistory', 'grades'),
new lang_string('disablegradehistory_help', 'grades'), 0));
$temp->add(new admin_setting_configselect('gradehistorylifetime', new lang_string('gradehistorylifetime', 'grades'),
new lang_string('gradehistorylifetime_help', 'grades'), 0, array(0 => new lang_string('neverdeletehistory', 'grades'),
1000 => new lang_string('numdays', '', 1000),
365 => new lang_string('numdays', '', 365),
180 => new lang_string('numdays', '', 180),
150 => new lang_string('numdays', '', 150),
120 => new lang_string('numdays', '', 120),
90 => new lang_string('numdays', '', 90),
60 => new lang_string('numdays', '', 60),
30 => new lang_string('numdays', '', 30))));
$temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_string('tempdatafoldercleanup', 'admin'),
new lang_string('configtempdatafoldercleanup', 'admin'), 168, array(
$temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_string('tempdatafoldercleanup', 'admin'),
new lang_string('configtempdatafoldercleanup', 'admin'), 168,
[
1 => new lang_string('numhours', '', 1),
3 => new lang_string('numhours', '', 3),
6 => new lang_string('numhours', '', 6),
@@ -166,227 +229,303 @@ $temp->add(new admin_setting_configselect('tempdatafoldercleanup', new lang_stri
24 => new lang_string('numhours', '', 24),
48 => new lang_string('numdays', '', 2),
168 => new lang_string('numdays', '', 7),
)));
]
));
$ADMIN->add('server', $temp);
$ADMIN->add('server', $temp);
$temp->add(new admin_setting_configduration('filescleanupperiod',
new lang_string('filescleanupperiod', 'admin'),
new lang_string('filescleanupperiod_help', 'admin'),
86400));
$ADMIN->add('server', new admin_externalpage('environment', new lang_string('environment','admin'), "$CFG->wwwroot/$CFG->admin/environment.php"));
$ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo'), "$CFG->wwwroot/$CFG->admin/phpinfo.php"));
$ADMIN->add('server', new admin_externalpage('testoutgoingmailconf', new lang_string('testoutgoingmailconf', 'admin'),
new moodle_url("$CFG->wwwroot/$CFG->admin/testoutgoingmailconf.php"), 'moodle/site:config', true));
// Environment.
$ADMIN->add('server', new admin_externalpage('environment', new lang_string('environment', 'admin'),
"{$CFG->wwwroot}/{$CFG->admin}/environment.php"));
// PHP info.
$ADMIN->add('server', new admin_externalpage('phpinfo', new lang_string('phpinfo'),
"{$CFG->wwwroot}/{$CFG->admin}/phpinfo.php"));
// "performance" settingpage
$temp = new admin_settingpage('performance', new lang_string('performance', 'admin'));
// Test outgoing mail configuration (hidden, accessed via direct link from the settings page).
$ADMIN->add('server', new admin_externalpage('testoutgoingmailconf', new lang_string('testoutgoingmailconf', 'admin'),
new moodle_url('/admin/testoutgoingmailconf.php'), 'moodle/site:config', true));
// Memory limit options for large administration tasks.
$memoryoptions = array(
'64M' => '64M',
'128M' => '128M',
'256M' => '256M',
'512M' => '512M',
'1024M' => '1024M',
'2048M' => '2048M');
// Performance.
$temp = new admin_settingpage('performance', new lang_string('performance', 'admin'));
// Allow larger memory usage for 64-bit sites only.
if (PHP_INT_SIZE === 8) {
$memoryoptions['3072M'] = '3072M';
$memoryoptions['4096M'] = '4096M';
}
// Memory limit options for large administration tasks.
$memoryoptions = [
'64M' => '64M',
'128M' => '128M',
'256M' => '256M',
'512M' => '512M',
'1024M' => '1024M',
'2048M' => '2048M',
];
$temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'),
new lang_string('configextramemorylimit', 'admin'), '512M',
$memoryoptions));
$temp->add(new admin_setting_configtext('maxtimelimit', new lang_string('maxtimelimit', 'admin'),
// Allow larger memory usage for 64-bit sites only.
if (PHP_INT_SIZE === 8) {
$memoryoptions['3072M'] = '3072M';
$memoryoptions['4096M'] = '4096M';
}
$temp->add(new admin_setting_configselect('extramemorylimit', new lang_string('extramemorylimit', 'admin'),
new lang_string('configextramemorylimit', 'admin'), '512M', $memoryoptions));
$temp->add(new admin_setting_configtext('maxtimelimit', new lang_string('maxtimelimit', 'admin'),
new lang_string('maxtimelimit_desc', 'admin'), 0, PARAM_INT));
$temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'),
new lang_string('configcurlcache', 'admin'), 120, PARAM_INT));
$temp->add(new admin_setting_configtext('curlcache', new lang_string('curlcache', 'admin'),
new lang_string('configcurlcache', 'admin'), 120, PARAM_INT));
$temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('curltimeoutkbitrate', 'admin'),
new lang_string('curltimeoutkbitrate_help', 'admin'), 56, PARAM_INT));
$temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('curltimeoutkbitrate', 'admin'),
new lang_string('curltimeoutkbitrate_help', 'admin'), 56, PARAM_INT));
$ADMIN->add('server', $temp);
$ADMIN->add('server', $temp);
// Tasks.
$ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin')));
$ADMIN->add('server', new admin_category('taskconfig', new lang_string('taskadmintitle', 'admin')));
$temp = new admin_settingpage('taskprocessing', new lang_string('taskprocessing','admin'));
$temp->add(
new admin_setting_configtext(
'task_scheduled_concurrency_limit',
new lang_string('task_scheduled_concurrency_limit', 'admin'),
new lang_string('task_scheduled_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
// Task processing.
$temp = new admin_settingpage('taskprocessing', new lang_string('taskprocessing', 'admin'));
$temp->add(
new admin_setting_configduration(
'task_scheduled_max_runtime',
new lang_string('task_scheduled_max_runtime', 'admin'),
new lang_string('task_scheduled_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$temp->add(
new admin_setting_configtext(
'task_adhoc_concurrency_limit',
new lang_string('task_adhoc_concurrency_limit', 'admin'),
new lang_string('task_adhoc_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
$temp->add(
new admin_setting_configduration(
'task_adhoc_max_runtime',
new lang_string('task_adhoc_max_runtime', 'admin'),
new lang_string('task_adhoc_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$ADMIN->add('taskconfig', $temp);
$temp = new admin_settingpage('tasklogging', new lang_string('tasklogging','admin'));
$temp->add(
new admin_setting_configselect(
'task_logmode',
new lang_string('task_logmode', 'admin'),
new lang_string('task_logmode_desc', 'admin'),
\core\task\logmanager::MODE_ALL,
[
\core\task\logmanager::MODE_ALL => new lang_string('task_logmode_all', 'admin'),
\core\task\logmanager::MODE_FAILONLY => new lang_string('task_logmode_failonly', 'admin'),
\core\task\logmanager::MODE_NONE => new lang_string('task_logmode_none', 'admin'),
]
)
);
$temp->add(
new admin_setting_configcheckbox(
'task_logtostdout',
new lang_string('task_logtostdout', 'admin'),
new lang_string('task_logtostdout_desc', 'admin'),
$setting = new admin_setting_configcheckbox(
'cron_enabled',
new lang_string('cron_enabled', 'admin'),
new lang_string('cron_enabled_desc', 'admin'),
1
)
);
);
$setting->set_updatedcallback('theme_reset_static_caches');
$temp->add($setting);
$temp->add(
new admin_setting_configtext(
'task_scheduled_concurrency_limit',
new lang_string('task_scheduled_concurrency_limit', 'admin'),
new lang_string('task_scheduled_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
if (\core\task\logmanager::uses_standard_settings()) {
$temp->add(
new admin_setting_configduration(
'task_logretention',
new \lang_string('task_logretention', 'admin'),
new \lang_string('task_logretention_desc', 'admin'),
28 * DAYSECS
'task_scheduled_max_runtime',
new lang_string('task_scheduled_max_runtime', 'admin'),
new lang_string('task_scheduled_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$temp->add(
new admin_setting_configtext(
'task_logretainruns',
new \lang_string('task_logretainruns', 'admin'),
new \lang_string('task_logretainruns_desc', 'admin'),
20,
'task_adhoc_concurrency_limit',
new lang_string('task_adhoc_concurrency_limit', 'admin'),
new lang_string('task_adhoc_concurrency_limit_desc', 'admin'),
3,
PARAM_INT
)
);
}
$ADMIN->add('taskconfig', $temp);
if (\core\task\logmanager::uses_standard_settings()) {
$ADMIN->add('taskconfig', new admin_externalpage(
'tasklogs',
new lang_string('tasklogs','admin'),
"{$CFG->wwwroot}/{$CFG->admin}/tasklogs.php"
));
}
$temp->add(
new admin_setting_configduration(
'task_adhoc_max_runtime',
new lang_string('task_adhoc_max_runtime', 'admin'),
new lang_string('task_adhoc_max_runtime_desc', 'admin'),
30 * MINSECS
)
);
$ADMIN->add('taskconfig', $temp);
// E-mail settings.
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
// Task log configuration.
$temp = new admin_settingpage('tasklogging', new lang_string('tasklogging', 'admin'));
$temp->add(
new admin_setting_configselect(
'task_logmode',
new lang_string('task_logmode', 'admin'),
new lang_string('task_logmode_desc', 'admin'),
\core\task\logmanager::MODE_ALL,
[
\core\task\logmanager::MODE_ALL => new lang_string('task_logmode_all', 'admin'),
\core\task\logmanager::MODE_FAILONLY => new lang_string('task_logmode_failonly', 'admin'),
\core\task\logmanager::MODE_NONE => new lang_string('task_logmode_none', 'admin'),
]
)
);
$temp->add(
new admin_setting_configcheckbox(
'task_logtostdout',
new lang_string('task_logtostdout', 'admin'),
new lang_string('task_logtostdout_desc', 'admin'),
1
)
);
$temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin'));
if (\core\task\logmanager::uses_standard_settings()) {
$temp->add(
new admin_setting_configduration(
'task_logretention',
new \lang_string('task_logretention', 'admin'),
new \lang_string('task_logretention_desc', 'admin'),
28 * DAYSECS
)
);
$temp->add(new admin_setting_heading('smtpheading', new lang_string('smtp', 'admin'),
new lang_string('smtpdetail', 'admin')));
$temp->add(new admin_setting_configtext('smtphosts', new lang_string('smtphosts', 'admin'),
new lang_string('configsmtphosts', 'admin'), '', PARAM_RAW));
$options = array('' => new lang_string('none', 'admin'), 'ssl' => 'SSL', 'tls' => 'TLS');
$temp->add(new admin_setting_configselect('smtpsecure', new lang_string('smtpsecure', 'admin'),
new lang_string('configsmtpsecure', 'admin'), '', $options));
$authtypeoptions = array('LOGIN' => 'LOGIN', 'PLAIN' => 'PLAIN', 'NTLM' => 'NTLM', 'CRAM-MD5' => 'CRAM-MD5');
$temp->add(new admin_setting_configselect('smtpauthtype', new lang_string('smtpauthtype', 'admin'),
new lang_string('configsmtpauthtype', 'admin'), 'LOGIN', $authtypeoptions));
$temp->add(new admin_setting_configtext('smtpuser', new lang_string('smtpuser', 'admin'),
new lang_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configpasswordunmask('smtppass', new lang_string('smtppass', 'admin'),
new lang_string('configsmtpuser', 'admin'), ''));
$temp->add(new admin_setting_configtext('smtpmaxbulk', new lang_string('smtpmaxbulk', 'admin'),
new lang_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_heading('noreplydomainheading', new lang_string('noreplydomain', 'admin'),
$temp->add(
new admin_setting_configtext(
'task_logretainruns',
new \lang_string('task_logretainruns', 'admin'),
new \lang_string('task_logretainruns_desc', 'admin'),
20,
PARAM_INT
)
);
}
$ADMIN->add('taskconfig', $temp);
// Task logs.
if (\core\task\logmanager::uses_standard_settings()) {
$ADMIN->add('taskconfig', new admin_externalpage(
'tasklogs',
new lang_string('tasklogs', 'admin'),
"{$CFG->wwwroot}/{$CFG->admin}/tasklogs.php"
));
}
// Email.
$ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
// Outgoing mail configuration.
$temp = new admin_settingpage('outgoingmailconfig', new lang_string('outgoingmailconfig', 'admin'));
$temp->add(new admin_setting_heading('smtpheading', new lang_string('smtp', 'admin'),
new lang_string('smtpdetail', 'admin')));
$temp->add(new admin_setting_configtext('smtphosts', new lang_string('smtphosts', 'admin'),
new lang_string('configsmtphosts', 'admin'), '', PARAM_RAW));
$options = [
'' => new lang_string('none', 'admin'),
'ssl' => 'SSL',
'tls' => 'TLS',
];
$temp->add(new admin_setting_configselect('smtpsecure', new lang_string('smtpsecure', 'admin'),
new lang_string('configsmtpsecure', 'admin'), '', $options));
$authtypeoptions = [
'LOGIN' => 'LOGIN',
'PLAIN' => 'PLAIN',
'NTLM' => 'NTLM',
'CRAM-MD5' => 'CRAM-MD5',
];
$temp->add(new admin_setting_configselect('smtpauthtype', new lang_string('smtpauthtype', 'admin'),
new lang_string('configsmtpauthtype', 'admin'), 'LOGIN', $authtypeoptions));
$temp->add(new admin_setting_configtext('smtpuser', new lang_string('smtpuser', 'admin'),
new lang_string('configsmtpuser', 'admin'), '', PARAM_NOTAGS));
$temp->add(new admin_setting_configpasswordunmask('smtppass', new lang_string('smtppass', 'admin'),
new lang_string('configsmtpuser', 'admin'), ''));
$temp->add(new admin_setting_configtext('smtpmaxbulk', new lang_string('smtpmaxbulk', 'admin'),
new lang_string('configsmtpmaxbulk', 'admin'), 1, PARAM_INT));
$temp->add(new admin_setting_heading('noreplydomainheading', new lang_string('noreplydomain', 'admin'),
new lang_string('noreplydomaindetail', 'admin')));
$temp->add(new admin_setting_configtext('noreplyaddress', new lang_string('noreplyaddress', 'admin'),
new lang_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_EMAIL));
$temp->add(new admin_setting_configtextarea('allowedemaildomains',
$temp->add(new admin_setting_configtext('noreplyaddress', new lang_string('noreplyaddress', 'admin'),
new lang_string('confignoreplyaddress', 'admin'), 'noreply@' . get_host_from_url($CFG->wwwroot), PARAM_EMAIL));
$temp->add(new admin_setting_configtextarea('allowedemaildomains',
new lang_string('allowedemaildomains', 'admin'),
new lang_string('configallowedemaildomains', 'admin'),
''));
$url = new moodle_url('/admin/testoutgoingmailconf.php');
$link = html_writer::link($url, get_string('testoutgoingmailconf', 'admin'));
$temp->add(new admin_setting_heading('testoutgoinmailc', new lang_string('testoutgoingmailconf', 'admin'),
$temp->add(new admin_setting_heading('divertallemailsheading', new lang_string('divertallemails', 'admin'),
new lang_string('divertallemailsdetail', 'admin')));
$temp->add(new admin_setting_configtext('divertallemailsto',
new lang_string('divertallemailsto', 'admin'),
new lang_string('divertallemailsto_desc', 'admin'),
''));
$temp->add(new admin_setting_configtextarea('divertallemailsexcept',
new lang_string('divertallemailsexcept', 'admin'),
new lang_string('divertallemailsexcept_desc', 'admin'),
'', PARAM_RAW, '50', '4'));
$noreplyaddress = isset($CFG->noreplyaddress) ? $CFG->noreplyaddress : 'noreply@example.com';
$dkimdomain = substr(strrchr($noreplyaddress, "@"), 1);
$dkimselector = empty($CFG->emaildkimselector) ? '[selector]' : $CFG->emaildkimselector;
$pempath = "\$CFG->dataroot/dkim/{$dkimdomain}/{$dkimselector}.private";
$temp->add(new admin_setting_heading('emaildkim', new lang_string('emaildkim', 'admin'),
new lang_string('emaildkiminfo', 'admin', ['path' => $pempath, 'docs' => \get_docs_url('Mail_configuration#DKIM')])));
$temp->add(new admin_setting_configtext('emaildkimselector', new lang_string('emaildkimselector', 'admin'),
new lang_string('configemaildkimselector', 'admin'), '', PARAM_FILE));
$url = new moodle_url('/admin/testoutgoingmailconf.php');
$link = html_writer::link($url, get_string('testoutgoingmailconf', 'admin'));
$temp->add(new admin_setting_heading('testoutgoinmailc', new lang_string('testoutgoingmailconf', 'admin'),
new lang_string('testoutgoingmaildetail', 'admin', $link)));
$temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'),
$temp->add(new admin_setting_heading('emaildoesnotfit', new lang_string('doesnotfit', 'admin'),
new lang_string('doesnotfitdetail', 'admin')));
$charsets = get_list_of_charsets();
unset($charsets['UTF-8']); // Not needed here.
$options = array();
$options['0'] = 'UTF-8';
$options = array_merge($options, $charsets);
$temp->add(new admin_setting_configselect('sitemailcharset', new lang_string('sitemailcharset', 'admin'),
new lang_string('configsitemailcharset','admin'), '0', $options));
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', new lang_string('allowusermailcharset', 'admin'),
new lang_string('configallowusermailcharset', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowattachments', new lang_string('allowattachments', 'admin'),
new lang_string('configallowattachments', 'admin'), 1));
$options = array('LF' => 'LF', 'CRLF' => 'CRLF');
$temp->add(new admin_setting_configselect('mailnewline', new lang_string('mailnewline', 'admin'),
new lang_string('configmailnewline', 'admin'), 'LF', $options));
$choices = array(new lang_string('never', 'admin'),
new lang_string('always', 'admin'),
new lang_string('onlynoreply', 'admin'));
$temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
new lang_string('configemailfromvia', 'admin'), 1, $choices));
$charsets = get_list_of_charsets();
unset($charsets['UTF-8']);
$options = [
'0' => 'UTF-8',
];
$options = array_merge($options, $charsets);
$temp->add(new admin_setting_configselect('sitemailcharset', new lang_string('sitemailcharset', 'admin'),
new lang_string('configsitemailcharset', 'admin'), '0', $options));
$temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'),
$temp->add(new admin_setting_configcheckbox('allowusermailcharset', new lang_string('allowusermailcharset', 'admin'),
new lang_string('configallowusermailcharset', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowattachments', new lang_string('allowattachments', 'admin'),
new lang_string('configallowattachments', 'admin'), 1));
$options = [
'LF' => 'LF',
'CRLF' => 'CRLF',
];
$temp->add(new admin_setting_configselect('mailnewline', new lang_string('mailnewline', 'admin'),
new lang_string('configmailnewline', 'admin'), 'LF', $options));
$choices = [
new lang_string('never', 'admin'),
new lang_string('always', 'admin'),
new lang_string('onlynoreply', 'admin'),
];
$temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
new lang_string('configemailfromvia', 'admin'), 1, $choices));
$temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'),
new lang_string('configemailsubjectprefix', 'admin'), '', PARAM_RAW));
$temp->add(new admin_setting_configtextarea('emailheaders', new lang_string('emailheaders', 'admin'),
$temp->add(new admin_setting_configtextarea('emailheaders', new lang_string('emailheaders', 'admin'),
new lang_string('configemailheaders', 'admin'), '', PARAM_RAW, '50', '3'));
$ADMIN->add('email', $temp);
$ADMIN->add('email', $temp);
// "update notifications" settingpage
if (empty($CFG->disableupdatenotifications)) {
$temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin'));
$temp->add(new admin_setting_configcheckbox('updateautocheck', new lang_string('updateautocheck', 'core_admin'),
new lang_string('updateautocheck_desc', 'core_admin'), 1));
$temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
array(
MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'),
MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'),
MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'),
MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'),
)));
$temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'),
new lang_string('updatenotifybuilds_desc', 'core_admin'), 0));
$ADMIN->add('server', $temp);
// Update notifications.
if (empty($CFG->disableupdatenotifications)) {
$temp = new admin_settingpage('updatenotifications', new lang_string('updatenotifications', 'core_admin'));
$temp->add(new admin_setting_configcheckbox('updateautocheck', new lang_string('updateautocheck', 'core_admin'),
new lang_string('updateautocheck_desc', 'core_admin'), 1));
$temp->add(new admin_setting_configselect('updateminmaturity', new lang_string('updateminmaturity', 'core_admin'),
new lang_string('updateminmaturity_desc', 'core_admin'), MATURITY_STABLE,
[
MATURITY_ALPHA => new lang_string('maturity'.MATURITY_ALPHA, 'core_admin'),
MATURITY_BETA => new lang_string('maturity'.MATURITY_BETA, 'core_admin'),
MATURITY_RC => new lang_string('maturity'.MATURITY_RC, 'core_admin'),
MATURITY_STABLE => new lang_string('maturity'.MATURITY_STABLE, 'core_admin'),
]
));
$temp->add(new admin_setting_configcheckbox('updatenotifybuilds', new lang_string('updatenotifybuilds', 'core_admin'),
new lang_string('updatenotifybuilds_desc', 'core_admin'), 0));
$ADMIN->add('server', $temp);
}
}
} // end of speedup
+1
View File
@@ -39,6 +39,7 @@ $ADMIN->add('root', new admin_category('license', new lang_string('license')));
$ADMIN->add('root', new admin_category('location', new lang_string('location','admin')));
$ADMIN->add('root', new admin_category('language', new lang_string('language')));
$ADMIN->add('root', new admin_category('messaging', new lang_string('messagingcategory', 'admin')));
$ADMIN->add('root', new admin_category('payment', new lang_string('payments', 'payment')));
$ADMIN->add('root', new admin_category('modules', new lang_string('plugins', 'admin')));
$ADMIN->add('root', new admin_category('security', new lang_string('security','admin')));
$ADMIN->add('root', new admin_category('appearance', new lang_string('appearance','admin')));
@@ -0,0 +1,87 @@
{{!
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 core_admin\local\settings\autocomplete
Admin setting auto complete.
Context variables required for this template:
* name - element name
* id - element id
* options - choices
* multiple - is multiple choices?
* manageurl - url to manage choices
* managetext - string to display manage url
* tags - Should we allow typing new entries to the field?
* ajax - Name of an AMD module to send/process ajax requests
* placeholder - Placeholder text for an empty list
* casesensitive - Whether the search has to be case-sensitive
* showsuggestions - Show suggestions by default - but this can be turned off
* noselectionstring - String that is shown when there are no selections
Example context (json):
{
"name": "name0",
"id": "id0",
"options": [{
"value": "1",
"text": "option 1",
"selected": true,
"disabled": false
}],
"multiple": true,
"manageurl": "",
"managetext": "",
"tags": false,
"ajax": "",
"placeholder": "",
"casesensitive": false,
"showsuggestions": true,
"noselectionstring": ""
}
}}
{{!
Setting autocomplete.
}}
<div class="form-select defaultsnext">
<input type="hidden" name="{{name}}[xxxxx]" value="_qf__force_multiselect_submission">
<select class="custom-select" name="{{name}}[]"
id="{{id}}"
{{#multiple}}multiple{{/multiple}}>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{{text}}}</option>
{{/options}}
</select>
{{#manageurl}}
<a href="{{manageurl}}">{{managetext}}</a>
{{/manageurl}}
</div>
<br/>
{{#js}}
require(['core/form-autocomplete'], function(module) {
module.enhance({{#quote}}#{{id}}{{/quote}},
{{tags}},
{{#quote}}{{ajax}}{{/quote}},
{{#quote}}{{placeholder}}{{/quote}},
{{casesensitive}},
{{showsuggestions}},
{{#quote}}{{noselectionstring}}{{/quote}});
});
{{/js}}
@@ -25,6 +25,7 @@
* value - yes value
* id - element id
* checked - boole
* readonly - bool
Example context (json):
{
@@ -32,10 +33,11 @@
"no": "False",
"value": "True",
"id": "test0",
"checked": "checked"
"checked": "checked",
"readonly": false
}
}}
<div class="form-checkbox defaultsnext">
<input type="hidden" name="{{name}}" value="{{no}}">
<input type="checkbox" name="{{name}}" value="{{value}}" id="{{id}}" {{#checked}}checked{{/checked}}>
<input {{#readonly}}disabled{{/readonly}} type="checkbox" name="{{name}}" value="{{value}}" id="{{id}}" {{#checked}}checked{{/checked}}>
</div>
@@ -25,6 +25,7 @@
* id - element id
* value - element value
* haspreviewconfig - show preview of selected color
* readonly - bool
Example context (json):
{
@@ -32,6 +33,7 @@
"name": "name0",
"id": "id0",
"value": "#555655",
"readonly": false,
"haspreviewconfig": false
}
}}
@@ -44,7 +46,7 @@
{{>core/pix_icon}}
{{/icon}}
</div>
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="form-control text-ltr">
<input type="text" name="{{name}}" id="{{id}}" value="{{value}}" size="12" class="form-control text-ltr" {{#readonly}}disabled{{/readonly}}>
{{#haspreviewconfig}}
<input type="button" id="{{id}}_preview" value={{#quote}}{{#str}}preview{{/str}}{{/quote}} class="admin_colourpicker_preview">
{{/haspreviewconfig}}
@@ -33,7 +33,7 @@
"name": "test",
"value": "/my-super-secret-path/",
"id": "test0",
"readonly": true,
"readonly": false,
"showvalidity": true,
"valid": false
}
@@ -23,6 +23,7 @@
* name - form element name
* options - list of options for units containing name, value, selected
* value - yes
* readonly - bool
* id - element id
Example context (json):
@@ -30,6 +31,7 @@
"name": "test",
"value": "5",
"id": "test0",
"readonly": false,
"options": [ { "name": "Minutes", "value": "mins", "selected": true } ]
}
}}
@@ -38,9 +40,9 @@
}}
<div class="form-duration defaultsnext">
<div class="form-inline">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="form-control text-ltr">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="form-control text-ltr" {{#readonly}}disabled{{/readonly}}>
<label class="sr-only" for="{{id}}u">{{#str}}durationunits, admin{{/str}}</label>
<select id="{{id}}u" name="{{name}}[u]" class="form-control custom-select">
<select id="{{id}}u" name="{{name}}[u]" class="form-control custom-select" {{#readonly}}disabled{{/readonly}}>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
@@ -33,7 +33,7 @@
"name": "test",
"value": "/usr/bin/cowsay",
"id": "test0",
"readonly": true,
"readonly": false,
"showvalidity": true,
"valid": false
}
+3 -1
View File
@@ -26,6 +26,7 @@
* readonly - Make the field readonly
* value - value
* showvalidity - Show a green check if the path is readable
* readonly - bool
* valid - True if the path is readable
Example context (json):
@@ -33,8 +34,9 @@
"name": "test",
"value": "/my-super-secret-path/file",
"id": "test0",
"readonly": true,
"readonly": false,
"showvalidity": true,
"readonly": false,
"valid": false
}
}}
@@ -24,12 +24,14 @@
* options - list of options for units containing name, value, selected
* value - yes
* id - element id
* readonly - bool
Example context (json):
{
"name": "test",
"value": "5",
"id": "test0",
"readonly": false,
"options": [ { "name": "KB", "value": "1024", "selected": true } ]
}
}}
@@ -38,9 +40,9 @@
}}
<div class="form-filesize defaultsnext">
<div class="form-inline">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="form-control text-ltr">
<input type="text" size="5" id="{{id}}v" name="{{name}}[v]" value="{{value}}" class="form-control text-ltr" {{#readonly}}disabled{{/readonly}}>
<label class="sr-only" for="{{id}}u">{{#str}}filesizeunits, admin{{/str}}</label>
<select id="{{id}}u" name="{{name}}[u]" class="form-control custom-select">
<select id="{{id}}u" name="{{name}}[u]" class="form-control custom-select" {{#readonly}}disabled{{/readonly}}>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
@@ -24,11 +24,13 @@
* id - element id
* size - element size
* options - list of options containing name, value, selected
* readonly - bool
Example context (json):
{
"name": "test",
"id": "test0",
"readonly": false,
"size": "3",
"options": [ { "name": "Option 1", "value": "V", "selected": true },
{ "name": "Option 2", "value": "V", "selected": true } ]
@@ -39,7 +41,7 @@
}}
<div class="form-select">
<input type="hidden" name="{{name}}[xxxxx]" value="1">
<select id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
@@ -25,11 +25,13 @@
* size - element size
* options - list of options not grouped
* optgroups - list of options grouped containing the group label and for each option: name, value, selected
* readonly - bool
Example context (json):
{
"name": "test",
"id": "test0",
"readonly": false,
"size": "3",
"options": [
{ "name": "Option 1", "value": "V", "selected": false },
@@ -58,7 +60,7 @@
}}
<div class="form-select">
<input type="hidden" name="{{name}}[xxxxx]" value="1">
<select id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}[]" size="{{size}}" class="form-control" multiple>
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
@@ -24,7 +24,7 @@
* size - form element size
* value - form element value
* id - element id
* forced - has value been defined in config.php
* readonly - has value been defined in config.php
Example context (json):
{
@@ -32,10 +32,10 @@
"id": "test0",
"size": "8",
"value": "secret",
"forced": false
"readonly": false
}
}}
{{#forced}}
{{#readonly}}
<div class="form-password">
<input type="text"
name = "{{ name }}"
@@ -46,8 +46,8 @@
disabled
>
</div>
{{/forced}}
{{^forced}}
{{/readonly}}
{{^readonly}}
<div class="form-password">
<span data-passwordunmask="wrapper" data-passwordunmaskid="{{ id }}">
<span data-passwordunmask="editor">
@@ -76,4 +76,4 @@ require(['core_form/passwordunmask'], function(PasswordUnmask) {
new PasswordUnmask("{{ id }}");
});
{{/js}}
{{/forced}}
{{/readonly}}
@@ -23,11 +23,13 @@
* name - form element name
* id - element id
* options - list of options containing name, value, selected
* readonly - bool
Example context (json):
{
"name": "test",
"id": "test0",
"readonly": false,
"options": [
{ "name": "Option 1", "value": "V", "selected": true },
{ "name": "Option 2", "value": "V", "selected": true }
@@ -38,7 +40,7 @@
Setting configselect.
}}
<div class="form-select defaultsnext">
<select id="{{id}}" name="{{name}}" class="custom-select">
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}" class="custom-select">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
@@ -22,6 +22,7 @@
Context variables required for this template:
* name - form element name
* id - element id
* readonly - bool
* options - list of options (not grouped)
* optgroups - list of options grouped containing the group label and for each option: name, value, selected
@@ -29,6 +30,7 @@
{
"name": "test",
"id": "test0",
"readonly": false,
"options": [
{ "name": "Option 1", "value": "V", "selected": false },
{ "name": "Option 2", "value": "V", "selected": false }
@@ -55,7 +57,7 @@
Setting configselect with optgroup support.
}}
<div class="form-select defaultsnext">
<select id="{{id}}" name="{{name}}" class="custom-select">
<select {{#readonly}}disabled{{/readonly}} id="{{id}}" name="{{name}}" class="custom-select">
{{#options}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/options}}
+3 -1
View File
@@ -26,6 +26,7 @@
* size - element size
* forceltr - always display as ltr
* attributes - list of additional attributes containing name, value
* readonly - bool
Example context (json):
{
@@ -34,6 +35,7 @@
"value": "A tall, dark stranger will have more fun than you.",
"size": "21",
"forceltr": false,
"readonly": false,
"attributes": [ { "name": "readonly", "value": "readonly" } ]
}
}}
@@ -41,5 +43,5 @@
Setting configtext.
}}
<div class="form-text defaultsnext">
<input type="text" name="{{name}}" value="{{value}}" size="{{size}}" id="{{id}}" class="form-control {{#forceltr}}text-ltr{{/forceltr}}">
<input type="text" name="{{name}}" value="{{value}}" size="{{size}}" id="{{id}}" class="form-control {{#forceltr}}text-ltr{{/forceltr}}" {{#readonly}}disabled{{/readonly}}>
</div>
@@ -33,6 +33,7 @@
"cols": "30",
"rows": "3",
"value": "Excellent day for putting Slinkies on an escalator.",
"readonly": false,
"id": "test0"
}
}}
@@ -40,5 +41,5 @@
Setting configtextarea.
}}
<div class="form-textarea">
<textarea rows="{{rows}}" cols="{{cols}}" id="{{id}}" name="{{name}}" spellcheck="true" class="form-control {{#forceltr}}text-ltr{{/forceltr}}">{{value}}</textarea>
<textarea {{#readonly}}disabled{{/readonly}} rows="{{rows}}" cols="{{cols}}" id="{{id}}" name="{{name}}" spellcheck="true" class="form-control {{#forceltr}}text-ltr{{/forceltr}}">{{value}}</textarea>
</div>
+4 -2
View File
@@ -24,11 +24,13 @@
* id - element id
* hours - list of valid hour options containing name, value, selected
* minutes - list of valid minute options containing name, value, selected
* readonly - bool
Example context (json):
{
"name": "test",
"id": "test0",
"readonly": false,
"minutes": [
{ "name": "00", "value": "0", "selected": true },
{ "name": "01", "value": "1", "selected": false }
@@ -45,13 +47,13 @@
<div class="form-time defaultsnext">
<div class="form-inline text-ltr">
<label class="sr-only" for="{{id}}h">{{#str}}hours{{/str}}</label>
<select id="{{id}}h" name="{{name}}[h]" class="custom-select">
<select id="{{id}}h" name="{{name}}[h]" class="custom-select" {{#readonly}}disabled{{/readonly}}>
{{#hours}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/hours}}
</select>:
<label class="sr-only" for="{{id}}m">{{#str}}minutes{{/str}}</label>
<select id="{{id}}m" name="{{name}}[m]" class="custom-select">
<select id="{{id}}m" name="{{name}}[m]" class="custom-select" {{#readonly}}disabled{{/readonly}}>
{{#minutes}}
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/minutes}}
+1 -1
View File
@@ -56,7 +56,7 @@ class behat_admin extends behat_base {
$this->execute('behat_navigation::i_select_from_flat_navigation_drawer', [get_string('administrationsite')]);
// Search by label.
$this->execute('behat_forms::i_set_the_field_to', [get_string('query', 'admin'), $label]);
$this->execute('behat_forms::i_set_the_field_to', [get_string('search'), $label]);
$this->execute("behat_forms::press_button", get_string('search', 'admin'));
// Admin settings does not use the same DOM structure than other moodle forms
@@ -0,0 +1,29 @@
@core @core_admin
Feature: Administrator is warned and when trying to set invalid allcountrycodes value.
In order to avoid misconfiguration of the country selector fields
As an admin
I want to be warned when I try to set an invalid country code in the allcountrycodes field
Scenario: Attempting to set allcountrycodes field with valid country codes
Given I log in as "admin"
And I navigate to "Location > Location settings" in site administration
When I set the following administration settings values:
| All country codes | CZ,BE,GB,ES |
Then I should not see "Invalid country code"
Scenario: Attempting to set allcountrycodes field with invalid country code
Given I log in as "admin"
And I navigate to "Location > Location settings" in site administration
When I set the following administration settings values:
| All country codes | CZ,BE,FOOBAR,GB,ES |
Then I should see "Invalid country code: FOOBAR"
Scenario: Attempting to unset allcountrycodes field
Given I log in as "admin"
And I navigate to "Location > Location settings" in site administration
And I set the following administration settings values:
| All country codes | CZ,BE,GB,ES |
And I navigate to "Location > Location settings" in site administration
When I set the following administration settings values:
| All country codes | |
Then I should not see "Invalid country code"
@@ -0,0 +1,34 @@
@core @core_admin
Feature: Configure language settings for the site
In order to configure language settings for the site
As an admin
I want to set language settings relevant to my site users
Scenario: Set languages on language menu
Given I log in as "admin"
And I navigate to "Language > Language settings" in site administration
When I set the field "Languages on language menu" to "en"
And I press "Save changes"
Then I should not see "Invalid language code"
Scenario: Reset languages on language menu
Given I log in as "admin"
And I navigate to "Language > Language settings" in site administration
When I set the field "Languages on language menu" to ""
And I press "Save changes"
Then I should not see "Invalid language code"
Scenario Outline: Set languages on language menu with invalid language
Given I log in as "admin"
And I navigate to "Language > Language settings" in site administration
When I set the field "Languages on language menu" to "<fieldvalue>"
And I press "Save changes"
Then I should see "Invalid language code: <invalidlang>"
Examples:
| fieldvalue | invalidlang |
| xx | xx |
| xx\|Bad | xx |
| en,qq | qq |
| en,qq\|Bad | qq |
| en$$ | en$$ |
| en$$\|Bad | en$$ |
@@ -64,7 +64,7 @@ class models_list implements \renderable, \templatable {
$data = new \stdClass();
$newmodelmenu = new \action_menu();
$newmodelmenu->set_menu_trigger(get_string('newmodel', 'tool_analytics'), 'btn btn-default');
$newmodelmenu->set_menu_trigger(get_string('newmodel', 'tool_analytics'), 'btn btn-secondary');
$newmodelmenu->set_alignment(\action_menu::TL, \action_menu::BL);
$newmodelmenu->add(new \action_menu_link(
@@ -57,10 +57,10 @@
{{/trainedexternally}}
{{! Hidden by default if #trainedexternally as the default option is trainedmodel in this case.}}
<div id="id-evaluation-timesplitting-container" class="m-t-1 {{#trainedexternally}}hidden{{/trainedexternally}}">
<div id="id-evaluation-timesplitting-container" class="mt-3 {{#trainedexternally}}hidden{{/trainedexternally}}">
{{#str}} selecttimesplittingforevaluation, tool_analytics {{/str}}
<div>
<select id="id-evaluation-timesplitting" name="timesplitting" class="custom-select m-t-1">
<select id="id-evaluation-timesplitting" name="timesplitting" class="custom-select mt-3">
{{#timesplittingmethods}}
<option value="{{id}}">{{text}}</option>
{{/timesplittingmethods}}
@@ -39,7 +39,7 @@
<input class="custom-control-input" type="radio" name="exportoption" id="id-mode-exportmodel" value="exportmodel" checked>
<label class="custom-control-label" for="id-mode-exportmodel">{{#str}} exportmodel, tool_analytics {{/str}}</label>
</div>
<div class="custom-control custom-checkbox m-l-2" id="id-includeweights-container">
<div class="custom-control custom-checkbox ml-5" id="id-includeweights-container">
<input class="custom-control-input" type="checkbox" id="id-includeweights" value="1" checked>
<label class="custom-control-label" for="id-includeweights">{{#str}} exportincludeweights, tool_analytics {{/str}}</label>
</div>
+1 -2
View File
@@ -66,8 +66,6 @@ class tool_analytics_external_testcase extends externallib_advanced_testcase {
/**
* test_potential_contexts description
*
* @expectedException required_capability_exception
*/
public function test_potential_contexts_no_manager() {
$this->resetAfterTest();
@@ -75,6 +73,7 @@ class tool_analytics_external_testcase extends externallib_advanced_testcase {
$user = $this->getDataGenerator()->create_user();
$this->setUser($user);
$this->expectException(required_capability_exception::class);
$this->assertCount(2, \tool_analytics\external::potential_contexts());
}
}
+38 -11
View File
@@ -50,6 +50,9 @@ list($options, $unrecognized) = cli_get_params(
'optimize-runs' => '',
'add-core-features-to-theme' => false,
'axe' => false,
'disable-composer' => false,
'composer-upgrade' => true,
'composer-self-update' => true,
),
array(
'j' => 'parallel',
@@ -65,19 +68,36 @@ $help = "
Behat utilities to initialise behat tests
Usage:
php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]] [--help]
php init.php [--parallel=value [--maxruns=value] [--fromrun=value --torun=value]]
[--axe] [-o | --optimize-runs] [-a | --add-core-features-to-theme]
[--no-composer-self-update] [--no-composer-upgrade]
[--disable-composer]
[--help]
Options:
-j, --parallel Number of parallel behat run to initialise
-m, --maxruns Max parallel processes to be executed at one time.
--fromrun Execute run starting from (Used for parallel runs on different vms)
--torun Execute run till (Used for parallel runs on different vms)
--axe Include axe accessibility tests
-j, --parallel Number of parallel behat run to initialise
-m, --maxruns Max parallel processes to be executed at one time
--fromrun Execute run starting from (Used for parallel runs on different vms)
--torun Execute run till (Used for parallel runs on different vms)
--axe Include axe accessibility tests
-o, --optimize-runs Split features with specified tags in all parallel runs.
-a, --add-core-features-to-theme Add all core features to specified theme's
-o, --optimize-runs
Split features with specified tags in all parallel runs.
-h, --help Print out this help
-a, --add-core-features-to-theme
Add all core features to specified theme's
--no-composer-self-update
Prevent upgrade of the composer utility using its self-update command
--no-composer-upgrade
Prevent update development dependencies using composer
--disable-composer
A shortcut to disable composer self-update and dependency update
Note: Installation of composer and/or dependencies will still happen as required
-h, --help Print out this help
Example from Moodle root directory:
\$ php admin/tool/behat/cli/init.php --parallel=2
@@ -120,8 +140,15 @@ if ($options['parallel'] && $options['parallel'] > 1) {
$cwd = getcwd();
$output = null;
// If behat dependencies not downloaded then do it first, else symfony/process can't be used.
testing_update_composer_dependencies();
if ($options['disable-composer']) {
// Disable self-update and upgrade easily.
// Note: Installation will still occur regardless of this setting.
$options['composer-self-update'] = false;
$options['composer-upgrade'] = false;
}
// Install and update composer and dependencies as required.
testing_update_composer_dependencies($options['composer-self-update'], $options['composer-upgrade']);
// Check whether the behat test environment needs to be updated.
chdir(__DIR__);
+4 -1
View File
@@ -187,10 +187,13 @@ if ($options['install']) {
behat_config_manager::set_behat_run_config_value('axe', $options['axe']);
// Enable test mode.
$timestart = microtime(true);
mtrace('Creating Behat configuration ...', '');
behat_util::start_test_mode($options['add-core-features-to-theme'], $options['optimize-runs'], $parallel, $run);
mtrace(' done in ' . round(microtime(true) - $timestart, 2) . ' seconds.');
// Themes are only built in the 'enable' command.
behat_util::build_themes();
behat_util::build_themes(true);
mtrace("Testing environment themes built");
// This is only displayed once for parallel install.
+15 -15
View File
@@ -87,7 +87,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
/**
* Setup test.
*/
public function setup() {
public function setUp(): void {
global $CFG;
$this->resetAfterTest();
@@ -165,7 +165,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
@@ -219,7 +219,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
@@ -264,7 +264,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
@@ -295,7 +295,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
// Check contexts.
@@ -324,7 +324,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
// Check contexts.
@@ -368,7 +368,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
// Check contexts.
@@ -399,7 +399,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
// Check contexts.
@@ -428,7 +428,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
// Check contexts.
@@ -532,7 +532,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
// Check contexts.
@@ -611,7 +611,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
// Check contexts.
@@ -646,7 +646,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
@@ -662,7 +662,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
@@ -678,7 +678,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
@@ -693,7 +693,7 @@ class tool_behat_manager_util_testcase extends advanced_testcase {
$this->assertCount(count($paths), $suites[$themename]['paths']);
foreach ($paths as $key => $feature) {
$this->assertContains($feature, $suites[$themename]['paths'][$key]);
$this->assertStringContainsString($feature, $suites[$themename]['paths'][$key]);
}
}
}
+1 -1
View File
@@ -36,7 +36,7 @@ class tool_capability_events_testcase extends advanced_testcase {
/**
* Setup testcase.
*/
public function setUp() {
public function setUp(): void {
$this->setAdminUser();
$this->resetAfterTest();
}
@@ -53,6 +53,13 @@ SEARCH.prototype = {
* @protected
*/
button: null,
/**
* The cancel button for the form.
* @property button
* @type Node
* @protected
*/
cancel: null,
/**
* The last search node if there is one.
* If there is a last search node then the last search term will be persisted between requests.
@@ -76,17 +83,28 @@ SEARCH.prototype = {
this.button = this.form.all('input[type=submit]');
this.lastsearch = this.form.one('input[name=search]');
var div = Y.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');
var div = Y.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"' +
'data-fieldtype="text"></div>'),
label = Y.Node.create('<label for="capabilitysearch"><span class="sr-only"' +
this.get('strsearch') + '</span></label>');
this.cancel = Y.Node.create('<a class="btn btn-clear d-none icon-no-margin">' +
'<i class="icon fa fa-times fa-fw " aria-hidden="true"></i>' +
'</a>');
this.input = Y.Node.create('<input type="text" class="form-control withclear" placeholder="' +
this.get('strsearch') + '"id="capabilitysearch" />');
div.append(label).append(this.input);
div.append(label).append(this.input).append(this.cancel);
this.select.insert(div, 'before');
this.input.on('keyup', this.typed, this);
this.select.on('change', this.validate, this);
this.cancel.on('click', function() {
this.input.set('value', '');
this.typed();
}, this);
if (this.lastsearch) {
this.input.set('value', this.lastsearch.get('value'));
this.typed();
@@ -133,6 +151,11 @@ SEARCH.prototype = {
last.set('selected', true);
}
}
if (search !== '') {
this.cancel.removeClass("d-none");
} else {
this.cancel.addClass("d-none");
}
this.validate();
}
};
@@ -1 +1 @@
YUI.add("moodle-tool_capability-search",function(i,t){var e=function(){e.superclass.constructor.apply(this,arguments)};e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,lastsearch:null,initializer:function(){this.form=i.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(t){var e=t.get("value");this.selectoptions[e]=t},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=i.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),e=i.Node.create('<label for="capabilitysearch">'+this.get("strsearch")+"</label>");this.input=i.Node.create('<input type="text" id="capabilitysearch" />'),t.append(e).append(this.input),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",""===this.select.get("value"))},typed:function(){var t,e=this.input.get("value"),i=0,s=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(i++,s=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===i?this.input.addClass("error"):(this.input.removeClass("error"),1===i&&s.set("selected",!0)),this.validate()}},i.extend(e,i.Base,e.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(t){new e(t)}},"@VERSION@",{requires:["base","node"]});
YUI.add("moodle-tool_capability-search",function(s,t){var e=function(){e.superclass.constructor.apply(this,arguments)};e.prototype={form:null,select:null,selectoptions:{},input:null,button:null,cancel:null,lastsearch:null,initializer:function(){this.form=s.one("#capability-overview-form"),this.select=this.form.one("select[data-search=capability]"),this.select.setStyle("minWidth",this.select.get("offsetWidth")),this.select.get("options").each(function(t){var e=t.get("value");this.selectoptions[e]=t},this),this.button=this.form.all("input[type=submit]"),this.lastsearch=this.form.one("input[name=search]");var t=s.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"data-fieldtype="text"></div>'),e=s.Node.create('<label for="capabilitysearch"><span class="sr-only"'+this.get("strsearch")+"</span></label>");this.cancel=s.Node.create('<a class="btn btn-clear d-none icon-no-margin"><i class="icon fa fa-times fa-fw " aria-hidden="true"></i></a>'),this.input=s.Node.create('<input type="text" class="form-control withclear" placeholder="'+this.get("strsearch")+'"id="capabilitysearch" />'),t.append(e).append(this.input).append(this.cancel),this.select.insert(t,"before"),this.input.on("keyup",this.typed,this),this.select.on("change",this.validate,this),this.cancel.on("click",function(){this.input.set("value",""),this.typed()},this),this.lastsearch&&(this.input.set("value",this.lastsearch.get("value")),this.typed(),this.select.one("option[selected]")&&this.select.set("scrollTop",this.select.one("option[selected]").get("getX"))),this.validate()},validate:function(){this.button.set("disabled",""===this.select.get("value"))},typed:function(){var t,e=this.input.get("value"),s=0,i=null;for(t in this.lastsearch&&this.lastsearch.set("value",e),this.select.all("option").remove(),this.selectoptions)0<=t.indexOf(e)&&(s++,i=this.selectoptions[t],this.select.append(this.selectoptions[t]));0===s?this.input.addClass("error"):(this.input.removeClass("error"),1===s&&i.set("selected",!0)),""!==e?this.cancel.removeClass("d-none"):this.cancel.addClass("d-none"),this.validate()}},s.extend(e,s.Base,e.prototype,{NAME:"tool_capability-search",ATTRS:{strsearch:{}}}),M.tool_capability=M.tool_capability||{},M.tool_capability.init_capability_search=function(t){new e(t)}},"@VERSION@",{requires:["base","node"]});
@@ -53,6 +53,13 @@ SEARCH.prototype = {
* @protected
*/
button: null,
/**
* The cancel button for the form.
* @property button
* @type Node
* @protected
*/
cancel: null,
/**
* The last search node if there is one.
* If there is a last search node then the last search term will be persisted between requests.
@@ -76,17 +83,28 @@ SEARCH.prototype = {
this.button = this.form.all('input[type=submit]');
this.lastsearch = this.form.one('input[name=search]');
var div = Y.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');
var div = Y.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"' +
'data-fieldtype="text"></div>'),
label = Y.Node.create('<label for="capabilitysearch"><span class="sr-only"' +
this.get('strsearch') + '</span></label>');
this.cancel = Y.Node.create('<a class="btn btn-clear d-none icon-no-margin">' +
'<i class="icon fa fa-times fa-fw " aria-hidden="true"></i>' +
'</a>');
this.input = Y.Node.create('<input type="text" class="form-control withclear" placeholder="' +
this.get('strsearch') + '"id="capabilitysearch" />');
div.append(label).append(this.input);
div.append(label).append(this.input).append(this.cancel);
this.select.insert(div, 'before');
this.input.on('keyup', this.typed, this);
this.select.on('change', this.validate, this);
this.cancel.on('click', function() {
this.input.set('value', '');
this.typed();
}, this);
if (this.lastsearch) {
this.input.set('value', this.lastsearch.get('value'));
this.typed();
@@ -133,6 +151,11 @@ SEARCH.prototype = {
last.set('selected', true);
}
}
if (search !== '') {
this.cancel.removeClass("d-none");
} else {
this.cancel.addClass("d-none");
}
this.validate();
}
};
+27 -4
View File
@@ -51,6 +51,13 @@ SEARCH.prototype = {
* @protected
*/
button: null,
/**
* The cancel button for the form.
* @property button
* @type Node
* @protected
*/
cancel: null,
/**
* The last search node if there is one.
* If there is a last search node then the last search term will be persisted between requests.
@@ -74,17 +81,28 @@ SEARCH.prototype = {
this.button = this.form.all('input[type=submit]');
this.lastsearch = this.form.one('input[name=search]');
var div = Y.Node.create('<div id="capabilitysearchui" data-fieldtype="text"></div>'),
label = Y.Node.create('<label for="capabilitysearch">' + this.get('strsearch') + '</label>');
this.input = Y.Node.create('<input type="text" id="capabilitysearch" />');
var div = Y.Node.create('<div id="capabilitysearchui" class="input-group simplesearchform mb-2"' +
'data-fieldtype="text"></div>'),
label = Y.Node.create('<label for="capabilitysearch"><span class="sr-only"' +
this.get('strsearch') + '</span></label>');
this.cancel = Y.Node.create('<a class="btn btn-clear d-none icon-no-margin">' +
'<i class="icon fa fa-times fa-fw " aria-hidden="true"></i>' +
'</a>');
this.input = Y.Node.create('<input type="text" class="form-control withclear" placeholder="' +
this.get('strsearch') + '"id="capabilitysearch" />');
div.append(label).append(this.input);
div.append(label).append(this.input).append(this.cancel);
this.select.insert(div, 'before');
this.input.on('keyup', this.typed, this);
this.select.on('change', this.validate, this);
this.cancel.on('click', function() {
this.input.set('value', '');
this.typed();
}, this);
if (this.lastsearch) {
this.input.set('value', this.lastsearch.get('value'));
this.typed();
@@ -131,6 +149,11 @@ SEARCH.prototype = {
last.set('selected', true);
}
}
if (search !== '') {
this.cancel.removeClass("d-none");
} else {
this.cancel.addClass("d-none");
}
this.validate();
}
};
+5 -13
View File
@@ -49,7 +49,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
/**
* Setup function- we will create a course and add an assign instance to it.
*/
protected function setUp() {
protected function setUp(): void {
$this->resetAfterTest(true);
// Create some users.
@@ -60,9 +60,6 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
cohort_add_member($this->cohort->id, $this->userassignover->id);
}
/**
* @expectedException required_capability_exception
*/
public function test_create_cohort_role_assignment_without_permission() {
$this->setUser($this->userassignto);
$params = (object) array(
@@ -70,12 +67,10 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
'roleid' => $this->roleid,
'cohortid' => $this->cohort->id
);
$this->expectException(required_capability_exception::class);
api::create_cohort_role_assignment($params);
}
/**
* @expectedException core_competency\invalid_persistent_exception
*/
public function test_create_cohort_role_assignment_with_invalid_data() {
$this->setAdminUser();
$params = (object) array(
@@ -83,6 +78,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
'roleid' => -8,
'cohortid' => $this->cohort->id
);
$this->expectException(\core_competency\invalid_persistent_exception::class);
api::create_cohort_role_assignment($params);
}
@@ -100,9 +96,6 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
$this->assertEquals($result->get('cohortid'), $this->cohort->id);
}
/**
* @expectedException required_capability_exception
*/
public function test_delete_cohort_role_assignment_without_permission() {
$this->setAdminUser();
$params = (object) array(
@@ -112,12 +105,10 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
);
$result = api::create_cohort_role_assignment($params);
$this->setUser($this->userassignto);
$this->expectException(required_capability_exception::class);
api::delete_cohort_role_assignment($result->get('id'));
}
/**
* @expectedException dml_missing_record_exception
*/
public function test_delete_cohort_role_assignment_with_invalid_data() {
$this->setAdminUser();
$params = (object) array(
@@ -126,6 +117,7 @@ class tool_cohortroles_api_testcase extends advanced_testcase {
'cohortid' => $this->cohort->id
);
$result = api::create_cohort_role_assignment($params);
$this->expectException(dml_missing_record_exception::class);
api::delete_cohort_role_assignment($result->get('id') + 1);
}
@@ -43,7 +43,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
/**
* Overriding setUp() function to always reset after tests.
*/
public function setUp() {
public function setUp(): void {
$this->resetAfterTest(true);
}
@@ -87,7 +87,7 @@ class tool_cohortroles_privacy_testcase extends \core_privacy\tests\provider_tes
CONTEXT_COURSECAT
];
// Test the User's contexts equal the system and course category context.
$this->assertEquals($expected, $contextlevels, '', 0, 10, true);
$this->assertEqualsCanonicalizing($expected, $contextlevels);
}
/**
@@ -0,0 +1,68 @@
<?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/>.
/**
* Creates Formular for customlang file export
*
* @package tool_customlang
* @copyright 2020 Thomas Wedekind <Thomas.Wedekind@univie.ac.at>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_customlang\form;
use tool_customlang_utils;
/**
* Formular for customlang file export
*
* @copyright 2020 Thomas Wedekind <Thomas.Wedekind@univie.ac.at>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class export extends \moodleform {
/**
* Add elements to form
*/
public function definition() {
$lng = $this->_customdata['lng'];
$mform = $this->_form;
$langdir = tool_customlang_utils::get_localpack_location($lng);
// The export button only appears if a local lang is present.
if (!check_dir_exists($langdir) || !count(glob("$langdir/*"))) {
print_error('nolocallang', 'tool_customlang');
}
$langfiles = scandir($langdir);
$fileoptions = [];
foreach ($langfiles as $file) {
if (substr($file, 0, 1) != '.') {
$fileoptions[$file] = $file;
}
}
$mform->addElement('hidden', 'lng', $lng);
$mform->setType('lng', PARAM_LANG);
$select = $mform->addElement('select', 'files', get_string('exportfilter', 'tool_customlang'), $fileoptions);
$select->setMultiple(true);
$mform->addRule('files', get_string('required'), 'required', null, 'client');
$mform->setDefault('files', $fileoptions);
$this->add_action_buttons(true, get_string('export', 'tool_customlang'));
}
}
@@ -0,0 +1,68 @@
<?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/>.
/**
* Upload a zip of custom lang php files.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_customlang\form;
use tool_customlang\local\importer;
/**
* Upload a zip/php of custom lang php files.
*
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class import extends \moodleform {
/**
* Form definition.
*/
public function definition() {
$mform = $this->_form;
$mform->addElement('header', 'settingsheader', get_string('import', 'tool_customlang'));
$mform->addElement('hidden', 'lng');
$mform->setType('lng', PARAM_LANG);
$mform->setDefault('lng', $this->_customdata['lng']);
$filemanageroptions = array(
'accepted_types' => array('.php', '.zip'),
'maxbytes' => 0,
'maxfiles' => 1,
'subdirs' => 0
);
$mform->addElement('filepicker', 'pack', get_string('langpack', 'tool_customlang'),
null, $filemanageroptions);
$mform->addRule('pack', null, 'required');
$modes = [
importer::IMPORTALL => get_string('import_all', 'tool_customlang'),
importer::IMPORTUPDATE => get_string('import_update', 'tool_customlang'),
importer::IMPORTNEW => get_string('import_new', 'tool_customlang'),
];
$mform->addElement('select', 'importmode', get_string('import_mode', 'tool_customlang'), $modes);
$mform->addElement('submit', 'importcustomstrings', get_string('importfile', 'tool_customlang'));
}
}
@@ -0,0 +1,268 @@
<?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/>.
/**
* Custom lang importer.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_customlang\local;
use tool_customlang\local\mlang\phpparser;
use tool_customlang\local\mlang\logstatus;
use tool_customlang\local\mlang\langstring;
use core\output\notification;
use stored_file;
use coding_exception;
use moodle_exception;
use core_component;
use stdClass;
/**
* Class containing tha custom lang importer
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class importer {
/** @var int imports will only create new customizations */
public const IMPORTNEW = 1;
/** @var int imports will only update the current customizations */
public const IMPORTUPDATE = 2;
/** @var int imports all strings */
public const IMPORTALL = 3;
/**
* @var string the language name
*/
protected $lng;
/**
* @var int the importation mode (new, update, all)
*/
protected $importmode;
/**
* @var string request folder path
*/
private $folder;
/**
* @var array import log messages
*/
private $log;
/**
* Constructor for the importer class.
*
* @param string $lng the current language to import.
* @param int $importmode the import method (IMPORTALL, IMPORTNEW, IMPORTUPDATE).
*/
public function __construct(string $lng, int $importmode = self::IMPORTALL) {
$this->lng = $lng;
$this->importmode = $importmode;
$this->log = [];
}
/**
* Returns the last parse log.
*
* @return logstatus[] mlang logstatus with the messages
*/
public function get_log(): array {
return $this->log;
}
/**
* Import customlang files.
*
* @param stored_file[] $files array of files to import
*/
public function import(array $files): void {
// Create a temporal folder to store the files.
$this->folder = make_request_directory(false);
$langfiles = $this->deploy_files($files);
$this->process_files($langfiles);
}
/**
* Deploy all files into a request folder.
*
* @param stored_file[] $files array of files to deploy
* @return string[] of file paths
*/
private function deploy_files(array $files): array {
$result = [];
// Desploy all files.
foreach ($files as $file) {
if ($file->get_mimetype() == 'application/zip') {
$result = array_merge($result, $this->unzip_file($file));
} else {
$path = $this->folder.'/'.$file->get_filename();
$file->copy_content_to($path);
$result = array_merge($result, [$path]);
}
}
return $result;
}
/**
* Unzip a file into the request folder.
*
* @param stored_file $file the zip file to unzip
* @return string[] of zip content paths
*/
private function unzip_file(stored_file $file): array {
$fp = get_file_packer('application/zip');
$zipcontents = $fp->extract_to_pathname($file, $this->folder);
if (!$zipcontents) {
throw new moodle_exception("Error Unzipping file", 1);
}
$result = [];
foreach ($zipcontents as $contentname => $success) {
if ($success) {
$result[] = $this->folder.'/'.$contentname;
}
}
return $result;
}
/**
* Import strings from a list of langfiles.
*
* @param string[] $langfiles an array with file paths
*/
private function process_files(array $langfiles): void {
$parser = phpparser::get_instance();
foreach ($langfiles as $filepath) {
$component = $this->component_from_filepath($filepath);
if ($component) {
$strings = $parser->parse(file_get_contents($filepath));
$this->import_strings($strings, $component);
}
}
}
/**
* Try to get the component from a filepath.
*
* @param string $filepath the filepath
* @return stdCalss|null the DB record of that component
*/
private function component_from_filepath(string $filepath) {
global $DB;
// Get component from filename.
$pathparts = pathinfo($filepath);
if (empty($pathparts['filename'])) {
throw new coding_exception("Cannot get filename from $filepath", 1);
}
$filename = $pathparts['filename'];
$normalized = core_component::normalize_component($filename);
if (count($normalized) == 1 || empty($normalized[1])) {
$componentname = $normalized[0];
} else {
$componentname = implode('_', $normalized);
}
$result = $DB->get_record('tool_customlang_components', ['name' => $componentname]);
if (!$result) {
$this->log[] = new logstatus('notice_missingcomponent', notification::NOTIFY_ERROR, null, $componentname);
return null;
}
return $result;
}
/**
* Import an array of strings into the customlang tables.
*
* @param langstring[] $strings the langstring to set
* @param stdClass $component the target component
*/
private function import_strings(array $strings, stdClass $component): void {
global $DB;
foreach ($strings as $newstring) {
// Check current DB entry.
$customlang = $DB->get_record('tool_customlang', [
'componentid' => $component->id,
'stringid' => $newstring->id,
'lang' => $this->lng,
]);
if (!$customlang) {
$customlang = null;
}
if ($this->can_save_string($customlang, $newstring, $component)) {
$customlang->local = $newstring->text;
$customlang->timecustomized = $newstring->timemodified;
$customlang->outdated = 0;
$customlang->modified = 1;
$DB->update_record('tool_customlang', $customlang);
}
}
}
/**
* Determine if a specific string can be saved based on the current importmode.
*
* @param stdClass $customlang customlang original record
* @param langstring $newstring the new strign to store
* @param stdClass $component the component target
* @return bool if the string can be stored
*/
private function can_save_string(?stdClass $customlang, langstring $newstring, stdClass $component): bool {
$result = false;
$message = 'notice_success';
if (empty($customlang)) {
$message = 'notice_inexitentstring';
$this->log[] = new logstatus($message, notification::NOTIFY_ERROR, null, $component->name, $newstring);
return $result;
}
switch ($this->importmode) {
case self::IMPORTNEW:
$result = empty($customlang->local);
$warningmessage = 'notice_ignoreupdate';
break;
case self::IMPORTUPDATE:
$result = !empty($customlang->local);
$warningmessage = 'notice_ignorenew';
break;
case self::IMPORTALL:
$result = true;
break;
}
if ($result) {
$errorlevel = notification::NOTIFY_SUCCESS;
} else {
$errorlevel = notification::NOTIFY_ERROR;
$message = $warningmessage;
}
$this->log[] = new logstatus($message, $errorlevel, null, $component->name, $newstring);
return $result;
}
}
@@ -0,0 +1,177 @@
<?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/>.
/**
* Language string based on David Mudrak langstring from local_amos.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_customlang\local\mlang;
use moodle_exception;
use stdclass;
/**
* Class containing a lang string cleaned.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Represents a single string
*/
class langstring {
/** @var string identifier */
public $id = null;
/** @var string */
public $text = '';
/** @var int the time stamp when this string was saved */
public $timemodified = null;
/** @var bool is deleted */
public $deleted = false;
/** @var stdclass extra information about the string */
public $extra = null;
/**
* Class constructor.
*
* @param string $id string identifier
* @param string $text string text
* @param int $timemodified
* @param int $deleted
* @param stdclass $extra
*/
public function __construct(string $id, string $text = '', int $timemodified = null,
int $deleted = 0, stdclass $extra = null) {
if (is_null($timemodified)) {
$timemodified = time();
}
$this->id = $id;
$this->text = $text;
$this->timemodified = $timemodified;
$this->deleted = $deleted;
$this->extra = $extra;
}
/**
* Given a string text, returns it being formatted properly for storing in AMOS repository.
*
* Note: This method is taken directly from local_amos as it is highly tested and robust.
* The Moodle 1.x part is keep on puspose to make it easier the copy paste from both codes.
* This could change in the future when AMOS stop suporting the 1.x langstrings.
*
* We need to know for what branch the string should be prepared due to internal changes in
* format required by get_string()
* - for get_string() in Moodle 1.6 - 1.9 use $format == 1
* - for get_string() in Moodle 2.0 and higher use $format == 2
*
* Typical usages of this methods:
* $t = langstring::fix_syntax($t); // sanity new translations of 2.x strings
* $t = langstring::fix_syntax($t, 1); // sanity legacy 1.x strings
* $t = langstring::fix_syntax($t, 2, 1); // convert format of 1.x strings into 2.x
*
* Backward converting 2.x format into 1.x is not supported
*
* @param string $text string text to be fixed
* @param int $format target get_string() format version
* @param int $from which format version does the text come from, defaults to the same as $format
* @return string
*/
public static function fix_syntax(string $text, int $format = 2, ?int $from = null): string {
if (is_null($from)) {
$from = $format;
}
// Common filter.
$clean = trim($text);
$search = [
// Remove \r if it is part of \r\n.
'/\r(?=\n)/',
// Control characters to be replaced with \n
// LINE TABULATION, FORM FEED, CARRIAGE RETURN, END OF TRANSMISSION BLOCK,
// END OF MEDIUM, SUBSTITUTE, BREAK PERMITTED HERE, NEXT LINE, START OF STRING,
// STRING TERMINATOR and Unicode character categorys Zl and Zp.
'/[\x{0B}-\r\x{17}\x{19}\x{1A}\x{82}\x{85}\x{98}\x{9C}\p{Zl}\p{Zp}]/u',
// Control characters to be removed
// NULL, ENQUIRY, ACKNOWLEDGE, BELL, SHIFT {OUT,IN}, DATA LINK ESCAPE,
// DEVICE CONTROL {ONE,TWO,THREE,FOUR}, NEGATIVE ACKNOWLEDGE, SYNCHRONOUS IDLE, ESCAPE,
// DELETE, PADDING CHARACTER, HIGH OCTET PRESET, NO BREAK HERE, INDEX,
// {START,END} OF SELECTED AREA, CHARACTER TABULATION {SET,WITH JUSTIFICATION},
// LINE TABULATION SET, PARTIAL LINE {FORWARD,BACKWARD}, REVERSE LINE FEED,
// SINGLE SHIFT {TWO,THREE}, DEVICE CONTROL STRING, PRIVATE USE {ONE,TWO},
// SET TRANSMIT STATE, MESSAGE WAITING, {START,END} OF GUARDED AREA,
// {SINGLE {GRAPHIC,} CHARACTER,CONTROL SEQUENCE} INTRODUCER, OPERATING SYSTEM COMMAND,
// PRIVACY MESSAGE, APPLICATION PROGRAM COMMAND, ZERO WIDTH {,NO-BREAK} SPACE,
// REPLACEMENT CHARACTER.
'/[\0\x{05}-\x{07}\x{0E}-\x{16}\x{1B}\x{7F}\x{80}\x{81}\x{83}\x{84}\x{86}-\x{93}\x{95}-\x{97}\x{99}-\x{9B}\x{9D}-\x{9F}\x{200B}\x{FEFF}\x{FFFD}]++/u',
// Remove trailing whitespace at the end of lines in a multiline string.
'/[ \t]+(?=\n)/',
];
$replace = [
'',
"\n",
'',
'',
];
$clean = preg_replace($search, $replace, $clean);
if (($format === 2) && ($from === 2)) {
// Sanity translations of 2.x strings.
$clean = preg_replace("/\n{3,}/", "\n\n\n", $clean); // Collapse runs of blank lines.
} else if (($format === 2) && ($from === 1)) {
// Convert 1.x string into 2.x format.
$clean = preg_replace("/\n{3,}/", "\n\n\n", $clean); // Collapse runs of blank lines.
$clean = preg_replace('/%+/', '%', $clean); // Collapse % characters.
$clean = str_replace('\$', '@@@___XXX_ESCAPED_DOLLAR__@@@', $clean); // Remember for later.
$clean = str_replace("\\", '', $clean); // Delete all slashes.
$clean = preg_replace('/(^|[^{])\$a\b(\->[a-zA-Z0-9_]+)?/', '\\1{$a\\2}', $clean); // Wrap placeholders.
$clean = str_replace('@@@___XXX_ESCAPED_DOLLAR__@@@', '$', $clean);
$clean = str_replace('&#36;', '$', $clean);
} else if (($format === 1) && ($from === 1)) {
// Sanity legacy 1.x strings.
$clean = preg_replace("/\n{3,}/", "\n\n", $clean); // Collapse runs of blank lines.
$clean = str_replace('\$', '@@@___XXX_ESCAPED_DOLLAR__@@@', $clean);
$clean = str_replace("\\", '', $clean); // Delete all slashes.
$clean = str_replace('$', '\$', $clean); // Escape all embedded variables.
// Unescape placeholders: only $a and $a->something are allowed. All other $variables are left escaped.
$clean = preg_replace('/\\\\\$a\b(\->[a-zA-Z0-9_]+)?/', '$a\\1', $clean); // Unescape placeholders.
$clean = str_replace('@@@___XXX_ESCAPED_DOLLAR__@@@', '\$', $clean);
$clean = str_replace('"', "\\\"", $clean); // Add slashes for ".
$clean = preg_replace('/%+/', '%', $clean); // Collapse % characters.
$clean = str_replace('%', '%%', $clean); // Duplicate %.
} else {
throw new moodle_exception('Unknown get_string() format version');
}
return $clean;
}
}
@@ -0,0 +1,92 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Language string based on David Mudrak langstring from local_amos.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_customlang\local\mlang;
use moodle_exception;
use stdclass;
/**
* Class containing a lang string cleaned.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
/**
* Represents a single string
*/
class logstatus {
/** @var langstring the current string */
public $langstring = null;
/** @var string the component */
public $component = null;
/** @var string the string ID */
public $stringid = null;
/** @var string the original filename */
public $filename = null;
/** @var int the error level */
public $errorlevel = null;
/** @var string the message identifier */
private $message;
/**
* Class creator.
*
* @param string $message the message identifier to display
* @param string $errorlevel the notice level
* @param string|null $filename the filename of this log
* @param string|null $component the component of this log
* @param langstring|null $langstring the langstring of this log
*/
public function __construct(string $message, string $errorlevel, ?string $filename = null,
?string $component = null, ?langstring $langstring = null) {
$this->filename = $filename;
$this->component = $component;
$this->langstring = $langstring;
$this->message = $message;
$this->errorlevel = $errorlevel;
if ($langstring) {
$this->stringid = $langstring->id;
}
}
/**
* Get the log message.
*
* @return string the log message.
*/
public function get_message(): string {
return get_string($this->message, 'tool_customlang', $this);
}
}
@@ -0,0 +1,260 @@
<?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/>.
/**
* Mlang PHP based on David Mudrak phpparser for local_amos.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_customlang\local\mlang;
use coding_exception;
use moodle_exception;
/**
* Parser of Moodle strings defined as associative array.
*
* Moodle core just includes this file format directly as normal PHP code. However
* for security reasons, we must not do this for files uploaded by anonymous users.
* This parser reconstructs the associative $string array without actually including
* the file.
*/
class phpparser {
/** @var holds the singleton instance of self */
private static $instance = null;
/**
* Prevents direct creation of object
*/
private function __construct() {
}
/**
* Prevent from cloning the instance
*/
public function __clone() {
throw new coding_exception('Cloning os singleton is not allowed');
}
/**
* Get the singleton instance fo this class
*
* @return phpparser singleton instance of phpparser
*/
public static function get_instance(): phpparser {
if (is_null(self::$instance)) {
self::$instance = new phpparser();
}
return self::$instance;
}
/**
* Parses the given data in Moodle PHP string format
*
* Note: This method is adapted from local_amos as it is highly tested and robust.
* The priority is keeping it similar to the original one to make it easier to mantain.
*
* @param string $data definition of the associative array
* @param int $format the data format on the input, defaults to the one used since 2.0
* @return langstring[] array of langstrings of this file
*/
public function parse(string $data, int $format = 2): array {
$result = [];
$strings = $this->extract_strings($data);
foreach ($strings as $id => $text) {
$cleaned = clean_param($id, PARAM_STRINGID);
if ($cleaned !== $id) {
continue;
}
$text = langstring::fix_syntax($text, 2, $format);
$result[] = new langstring($id, $text);
}
return $result;
}
/**
* Low level parsing method
*
* Note: This method is adapted from local_amos as it is highly tested and robust.
* The priority is keeping it similar to the original one to make it easier to mantain.
*
* @param string $data
* @return string[] the data strings
*/
protected function extract_strings(string $data): array {
$strings = []; // To be returned.
if (empty($data)) {
return $strings;
}
// Tokenize data - we expect valid PHP code.
$tokens = token_get_all($data);
// Get rid of all non-relevant tokens.
$rubbish = [T_WHITESPACE, T_INLINE_HTML, T_COMMENT, T_DOC_COMMENT, T_OPEN_TAG, T_CLOSE_TAG];
foreach ($tokens as $i => $token) {
if (is_array($token)) {
if (in_array($token[0], $rubbish)) {
unset($tokens[$i]);
}
}
}
$id = null;
$text = null;
$line = 0;
$expect = 'STRING_VAR'; // The first expected token is '$string'.
// Iterate over tokens and look for valid $string array assignment patterns.
foreach ($tokens as $token) {
$foundtype = null;
$founddata = null;
if (is_array($token)) {
$foundtype = $token[0];
$founddata = $token[1];
if (!empty($token[2])) {
$line = $token[2];
}
} else {
$foundtype = 'char';
$founddata = $token;
}
if ($expect == 'STRING_VAR') {
if ($foundtype === T_VARIABLE and $founddata === '$string') {
$expect = 'LEFT_BRACKET';
continue;
} else {
// Allow other code at the global level.
continue;
}
}
if ($expect == 'LEFT_BRACKET') {
if ($foundtype === 'char' and $founddata === '[') {
$expect = 'STRING_ID';
continue;
} else {
throw new moodle_exception('Parsing error. Expected character [ at line '.$line);
}
}
if ($expect == 'STRING_ID') {
if ($foundtype === T_CONSTANT_ENCAPSED_STRING) {
$id = $this->decapsulate($founddata);
$expect = 'RIGHT_BRACKET';
continue;
} else {
throw new moodle_exception('Parsing error. Expected T_CONSTANT_ENCAPSED_STRING array key at line '.$line);
}
}
if ($expect == 'RIGHT_BRACKET') {
if ($foundtype === 'char' and $founddata === ']') {
$expect = 'ASSIGNMENT';
continue;
} else {
throw new moodle_exception('Parsing error. Expected character ] at line '.$line);
}
}
if ($expect == 'ASSIGNMENT') {
if ($foundtype === 'char' and $founddata === '=') {
$expect = 'STRING_TEXT';
continue;
} else {
throw new moodle_exception('Parsing error. Expected character = at line '.$line);
}
}
if ($expect == 'STRING_TEXT') {
if ($foundtype === T_CONSTANT_ENCAPSED_STRING) {
$text = $this->decapsulate($founddata);
$expect = 'SEMICOLON';
continue;
} else {
throw new moodle_exception(
'Parsing error. Expected T_CONSTANT_ENCAPSED_STRING array item value at line '.$line
);
}
}
if ($expect == 'SEMICOLON') {
if (is_null($id) or is_null($text)) {
throw new moodle_exception('Parsing error. NULL string id or value at line '.$line);
}
if ($foundtype === 'char' and $founddata === ';') {
if (!empty($id)) {
$strings[$id] = $text;
}
$id = null;
$text = null;
$expect = 'STRING_VAR';
continue;
} else {
throw new moodle_exception('Parsing error. Expected character ; at line '.$line);
}
}
}
return $strings;
}
/**
* Given one T_CONSTANT_ENCAPSED_STRING, return its value without quotes
*
* Also processes escaped quotes inside the text.
*
* Note: This method is taken directly from local_amos as it is highly tested and robust.
*
* @param string $text value obtained by token_get_all()
* @return string value without quotes
*/
protected function decapsulate(string $text): string {
if (strlen($text) < 2) {
throw new moodle_exception('Parsing error. Expected T_CONSTANT_ENCAPSED_STRING in decapsulate()');
}
if (substr($text, 0, 1) == "'" and substr($text, -1) == "'") {
// Single quoted string.
$text = trim($text, "'");
$text = str_replace("\'", "'", $text);
$text = str_replace('\\\\', '\\', $text);
return $text;
} else if (substr($text, 0, 1) == '"' and substr($text, -1) == '"') {
// Double quoted string.
$text = trim($text, '"');
$text = str_replace('\"', '"', $text);
$text = str_replace('\\\\', '\\', $text);
return $text;
} else {
throw new moodle_exception(
'Parsing error. Unexpected quotation in T_CONSTANT_ENCAPSED_STRING in decapsulate(): '.$text
);
}
}
}
@@ -57,8 +57,9 @@ class renderer extends \plugin_renderer_base {
protected function render_tool_customlang_menu(\tool_customlang_menu $menu) {
$output = '';
foreach ($menu->get_items() as $item) {
$output .= $this->single_button($item->url, $item->title, $item->method);
$button = $this->single_button($item->url, $item->title, $item->method);
$output .= $this->box($button, 'menu');
}
return $this->box($output, 'menu');
return $output;
}
}
+135
View File
@@ -0,0 +1,135 @@
<?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/>.
/**
* Export custom language strings to zip files.
*
* @package tool_customlang
* @subpackage customlang
* @copyright 2020 Thomas Wedekind <thomas.wedekind@univie.ac.at>
* @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/$CFG->admin/tool/customlang/locallib.php");
$usage = <<<EOF
"Export custom language files to a target folder.
Useful for uploading custom langstrings to AMOS or importing or syncing them to other moodle instances.
Options:
-l, --lang Comma seperated language ids to export, default: all
-c, --components Comma seperated components to export, default: all
-t, --target Target to copy the zip files to, default: $CFG->tempdir/customlang
-o, --overwrite Overwrite existing files in the target folder.
Note: If the target is not set, the files are always overwritten!
-h, --help Print out this help
Examples:
Export all custom language files to the default folder:
\$ sudo -u www-data /usr/bin/php admin/tool/customlang/cli/export.php
Export just the english files of moodle core and the activity 'quiz' in a subfolder in my home folder:
\$ sudo -u www-data /usr/bin/php admin/tool/customlang/cli/export.php --lang='en' --components='moodle,quiz' --target='~/customdir'
EOF;
$dafaulttarget = "$CFG->tempdir/customlang/";
// Now get cli options.
list($options, $unrecognized) = cli_get_params(
[
'lang' => '',
'components' => '',
'target' => $dafaulttarget,
'overwrite' => false,
'help' => false,
],
['h' => 'help', 'c' => 'components', 't' => 'target', 'o' => 'overwrite']
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
echo $usage;
die;
}
if (!file_exists($options['target'])) {
mkdir($options['target'], 0777, true);
}
cli_writeln(get_string('cliexportheading', 'tool_customlang'));
$langs = [];
if ($options['lang']) {
$langs = explode(',', $options['lang']);
} else {
// No language set. We export all installed languages.
$langs = array_keys(get_string_manager()->get_list_of_translations(true));
}
foreach ($langs as $lang) {
$filename = $options['target'] . get_string('exportzipfilename', 'tool_customlang', ['lang' => $lang]);
// If the file exists and we are not using the temp folder it requires an ovewrite.
if ($options['target'] != $dafaulttarget && file_exists($filename) && !$options['overwrite']) {
cli_problem(get_string('cliexportfileexists', 'tool_customlang', $lang));
continue;
}
cli_heading(get_string('cliexportstartexport', 'tool_customlang', $lang));
$langdir = tool_customlang_utils::get_localpack_location($lang);
if (!file_exists($langdir)) {
// No custom files set for this language set.
cli_writeln(get_string('cliexportnofilefoundforlang', 'tool_customlang', ['lang' => $lang]));
continue;
}
$zipper = get_file_packer();
$tempzip = tempnam($CFG->tempdir . '/', 'tool_customlang_export');
$filelist = [];
if ($options['components']) {
$components = explode(',', $options['components']);
foreach ($components as $component) {
$filepath = "$langdir/$component.php";
if (file_exists($filepath)) {
$filelist["$component.php"] = $filepath;
} else {
cli_problem(
get_string('cliexportfilenotfoundforcomponent', 'tool_customlang', ['lang' => $lang, 'file' => $filepath])
);
}
}
} else {
$langfiles = scandir($langdir);
foreach ($langfiles as $file) {
if (substr($file, 0, 1) != '.') {
$filelist[$file] = "$langdir/$file";
}
}
}
if (empty($filelist)) {
cli_problem(get_string('cliexportnofilefoundforlang', 'tool_customlang', ['lang' => $lang]));
continue;
}
if ($zipper->archive_to_pathname($filelist, $filename)) {
cli_writeln(get_string('cliexportzipdone', 'tool_customlang', $filename));
} else {
cli_problem(get_string('cliexportzipfail', 'tool_customlang', $filename));
}
}
+204
View File
@@ -0,0 +1,204 @@
<?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 customlang import tool.
*
* @package tool_customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use tool_customlang\local\importer;
use core\output\notification;
define('CLI_SCRIPT', true);
require(__DIR__ . '/../../../../config.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
require_once("$CFG->libdir/clilib.php");
$usage =
"Import lang customization.
It can get a single file or a folder.
If no lang is provided it will try to infere from the filename
Options:
--lang The target language (will get from filename if not provided)
--source=path File or folder of the custom lang files (zip or php files)
--mode What string should be imported. Options are:
- all: all string will be imported (default)
- new: only string with no previous customisation
- update: only strings already modified
--checkin Save strings to the language pack
-h, --help Print out this help
Examples:
\$ sudo -u www-data /usr/bin/php admin/tool/customlang/cli/import.php --lang=en --source=customlangs.zip
\$ sudo -u www-data /usr/bin/php admin/tool/customlang/cli/import.php --source=/tmp/customlangs --checkin
\$ sudo -u www-data /usr/bin/php admin/tool/customlang/cli/import.php --lang=en --source=/tmp/customlangs
";
list($options, $unrecognized) = cli_get_params(
[
'help' => false,
'lang' => false,
'source' => false,
'mode' => 'all',
'checkin' => false,
],
['h' => 'help']
);
if ($unrecognized) {
$unrecognized = implode("\n ", $unrecognized);
cli_error(get_string('cliunknowoption', 'admin', $unrecognized));
}
if ($options['help']) {
cli_write($usage);
exit(0);
}
$source = $options['source'] ?? null;
$lang = $options['lang'] ?? null;
$modeparam = $options['mode'] ?? 'all';
$checkin = $options['checkin'] ?? false;
$modes = [
'all' => importer::IMPORTALL,
'update' => importer::IMPORTUPDATE,
'new' => importer::IMPORTNEW,
];
if (!isset($modes[$modeparam])) {
cli_error(get_string('climissingmode', 'tool_customlang'));
}
$mode = $modes[$modeparam];
if (empty($source)) {
$source = $CFG->dataroot.'/temp/customlang';
}
if (!file_exists($source)) {
cli_error(get_string('climissingsource', 'tool_customlang'));
}
// Emulate normal session - we use admin account by default.
cron_setup_user();
// Get the file list.
$files = [];
$langfiles = [];
if (is_file($source)) {
$files[] = $source;
}
if (is_dir($source)) {
$filelist = glob("$source/*");
foreach ($filelist as $filename) {
$files[] = "$filename";
}
}
$countfiles = 0;
foreach ($files as $filepath) {
// Try to get the lang.
$filelang = $lang;
// Get component from filename.
$pathparts = pathinfo($filepath);
$filename = $pathparts['filename'];
$extension = $pathparts['extension'];
if ($extension == 'zip') {
if (!$filelang) {
// Try to get the lang from the filename.
if (strrpos($filename, 'customlang_') === 0) {
$parts = explode('_', $filename);
if (!empty($parts[1])) {
$filelang = $parts[1];
}
}
}
} else if ($extension != 'php') {
// Ignore any other file extension.
continue;
}
if (empty($filelang)) {
cli_error(get_string('climissinglang', 'tool_customlang'));
}
if (!isset($langfiles[$filelang])) {
$langfiles[$filelang] = [];
}
$langfiles[$filelang][] = $filepath;
$countfiles ++;
}
if (!$countfiles) {
cli_error(get_string('climissingfiles', 'tool_customlang'));
}
foreach ($langfiles as $lng => $files) {
$importer = new importer($lng, $mode);
$storedfiles = [];
$fs = get_file_storage();
cli_heading(get_string('clifiles', 'tool_customlang', $lng));
foreach ($files as $file) {
// Generate a valid stored_file from this file.
$record = (object)[
'filearea' => 'draft',
'component' => 'user',
'filepath' => '/',
'itemid' => file_get_unused_draft_itemid(),
'license' => $CFG->sitedefaultlicense,
'author' => '',
'filename' => clean_param(basename($file), PARAM_FILE),
'contextid' => \context_user::instance($USER->id)->id,
'userid' => $USER->id,
];
cli_writeln($file);
$storedfiles[] = $fs->create_file_from_pathname($record, $file);
}
cli_writeln("");
// Import files.
cli_heading(get_string('cliimporting', 'tool_customlang', $modeparam));
$importer->import($storedfiles);
// Display logs.
$log = $importer->get_log();
if (empty($log)) {
cli_problem(get_string('clinolog', 'tool_customlang', $lng));
}
foreach ($log as $message) {
if ($message->errorlevel == notification::NOTIFY_ERROR) {
cli_problem($message->get_message());
} else {
cli_writeln($message->get_message());
}
}
// Do the checkin if necessary.
if ($checkin) {
tool_customlang_utils::checkin($lng);
cli_writeln(get_string('savecheckin', 'tool_customlang'));
}
cli_writeln("");
}
exit(0);
+9
View File
@@ -46,5 +46,14 @@ $capabilities = array(
'manager' => CAP_ALLOW
),
),
/* allows the user to export the current language customization */
'tool/customlang:export' => array(
'riskbitmask' => RISK_CONFIG,
'captype' => 'read',
'contextlevel' => CONTEXT_SYSTEM,
'archetypes' => array(
'manager' => CAP_ALLOW
),
),
);
+68
View File
@@ -0,0 +1,68 @@
<?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/>.
/**
* Performs the custom lang export.
*
* @package tool_customlang
* @subpackage customlang
* @copyright 2020 Thomas Wedekind <thomas.wedekind@univie.ac.at>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require(__DIR__ . '/../../../config.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
require_once($CFG->libdir.'/adminlib.php');
global $PAGE, $CFG;
require_login(SITEID, false);
require_capability('tool/customlang:export', context_system::instance());
$lng = required_param('lng', PARAM_LANG);
admin_externalpage_setup('toolcustomlang', '', null,
new moodle_url('/admin/tool/customlang/import.php', ['lng' => $lng]));
$form = new \tool_customlang\form\export(null, ['lng' => $lng]);
if ($form->is_cancelled()) {
redirect('index.php');
die();
} else if ($formdata = $form->get_data()) {
$tempzip = tempnam($CFG->tempdir . '/', 'tool_customlang_export');
$filelist = [];
foreach ($formdata->files as $file) {
$filepath = tool_customlang_utils::get_localpack_location($lng). '/' . $file;
if (file_exists($filepath)) {
$filelist[$file] = $filepath;
}
}
$zipper = new zip_packer();
if (!empty($filelist) && $zipper->archive_to_pathname($filelist, $tempzip)) {
// Filename include the lang name so the file can be imported with automatic language detection.
send_temp_file($tempzip, "customlang_$lng.zip");
die();
}
}
$output = $PAGE->get_renderer('tool_customlang');
echo $output->header();
echo $output->heading(get_string('pluginname', 'tool_customlang'));
$form->display();
echo $OUTPUT->footer();
-1
View File
@@ -32,7 +32,6 @@ class tool_customlang_filter_form extends moodleform {
function definition() {
$mform = $this->_form;
$current = $this->_customdata['current'];
$mform->addElement('header', 'filtersettings', get_string('filter', 'tool_customlang'));
+74
View File
@@ -0,0 +1,74 @@
<?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/>.
/**
* Import custom lang files.
*
* @package tool_customlang
* @subpackage customlang
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use tool_customlang\form\import;
use tool_customlang\local\importer;
require(__DIR__ . '/../../../config.php');
require_once($CFG->dirroot.'/'.$CFG->admin.'/tool/customlang/locallib.php');
require_once($CFG->libdir.'/adminlib.php');
require_login(SITEID, false);
require_capability('tool/customlang:edit', context_system::instance());
$lng = required_param('lng', PARAM_LANG);
admin_externalpage_setup('toolcustomlang', '', null,
new moodle_url('/admin/tool/customlang/import.php', ['lng' => $lng]));
$output = $PAGE->get_renderer('tool_customlang');
$form = new import(null, ['lng' => $lng]);
if ($data = $form->get_data()) {
require_sesskey();
// Get the file from the users draft area.
$usercontext = context_user::instance($USER->id);
$fs = get_file_storage();
$files = $fs->get_area_files($usercontext->id, 'user', 'draft', $data->pack, 'id',
false);
// Send files to the importer.
$importer = new importer($data->lng, $data->importmode);
$importer->import($files);
echo $output->header();
// Display logs.
$log = $importer->get_log();
foreach ($log as $message) {
echo $output->notification($message->get_message(), $message->errorlevel);
}
// Show continue button.
echo $output->continue_button(new moodle_url('index.php', array('lng' => $lng)));
} else {
echo $output->header();
$form->display();
}
echo $OUTPUT->footer();
+17 -2
View File
@@ -35,6 +35,7 @@ require_capability('tool/customlang:view', context_system::instance());
$action = optional_param('action', '', PARAM_ALPHA);
$confirm = optional_param('confirm', false, PARAM_BOOL);
$lng = optional_param('lng', '', PARAM_LANG);
$next = optional_param('next', 'edit', PARAM_ALPHA);
admin_externalpage_setup('toolcustomlang');
$langs = get_string_manager()->get_list_of_translations();
@@ -59,11 +60,10 @@ if ($action === 'checkout') {
raise_memory_limit(MEMORY_EXTRA);
tool_customlang_utils::checkout($lng, $progressbar);
echo $output->continue_button(new moodle_url('/admin/tool/customlang/edit.php', array('lng' => $lng)), 'get');
echo $output->continue_button(new moodle_url("/admin/tool/customlang/{$next}.php", array('lng' => $lng)), 'get');
echo $output->footer();
exit;
}
if ($action === 'checkin') {
require_sesskey();
require_capability('tool/customlang:edit', context_system::instance());
@@ -132,6 +132,21 @@ if (has_capability('tool/customlang:edit', context_system::instance())) {
'method' => 'post',
);
}
$menu['import'] = array(
'title' => get_string('import', 'tool_customlang'),
'url' => new moodle_url($PAGE->url, ['action' => 'checkout', 'lng' => $lng, 'next' => 'import']),
'method' => 'post',
);
}
if (has_capability('tool/customlang:export', context_system::instance())) {
$langdir = tool_customlang_utils::get_localpack_location($lng);
if (check_dir_exists(dirname($langdir)) && count(glob("$langdir/*"))) {
$menu['export'] = [
'title' => get_string('export', 'tool_customlang'),
'url' => new moodle_url("/admin/tool/customlang/export.php", ['lng' => $lng]),
'method' => 'post',
];
}
}
echo $output->render(new tool_customlang_menu($menu));
@@ -30,9 +30,26 @@ $string['checkin'] = 'Save strings to language pack';
$string['checkout'] = 'Open language pack for editing';
$string['checkoutdone'] = 'Language pack loaded';
$string['checkoutinprogress'] = 'Loading language pack';
$string['cliexportfileexists'] = 'File for {$a->lang} already exists, skipping. If you want to overwrite add the --override=true option.';
$string['cliexportheading'] = 'Starting to export lang files.';
$string['cliexportnofilefoundforlang'] = 'No file found to export. Skipping export for this language.';
$string['cliexportfilenotfoundforcomponent'] = 'File {$a->filepath} not found for language {$a->lang}.Skipping this file.';
$string['cliexportstartexport'] = 'Exporting language "{$a}"';
$string['cliexportzipdone'] = 'Zip created: {$a}';
$string['cliexportzipfail'] = 'Cannot create zip {$a}';
$string['clifiles'] = 'Files to import into {$a}';
$string['cliimporting'] = 'Import files string (mode {$a})';
$string['clinolog'] = 'Nothing to import into {$a}';
$string['climissinglang'] = 'Missing language';
$string['climissingfiles'] = 'Missing valid files';
$string['climissingmode'] = 'Missing or invalid mode (valid is all, new or update)';
$string['climissingsource'] = 'Missing file or folder';
$string['confirmcheckin'] = 'You are about to save modifications to your local language pack. This will export the customised strings from the translator into your site data directory and your site will start using the modified strings. Press \'Continue\' to proceed with saving.';
$string['customlang:edit'] = 'Edit local translation';
$string['customlang:export'] = 'Export local translation';
$string['customlang:view'] = 'View local translation';
$string['export'] = 'Export custom strings';
$string['exportfilter'] = 'Select component(s) to export';
$string['filter'] = 'Filter strings';
$string['filtercomponent'] = 'Show strings of these components';
$string['filtercustomized'] = 'Customised only';
@@ -45,11 +62,24 @@ $string['headingcomponent'] = 'Component';
$string['headinglocal'] = 'Local customisation';
$string['headingstandard'] = 'Standard text';
$string['headingstringid'] = 'String';
$string['import'] = 'Import custom strings';
$string['import_mode'] = 'Import mode';
$string['import_new'] = 'Create only strings without local customisation';
$string['import_update'] = 'Update only strings with local customisation';
$string['import_all'] = 'Create or update all strings from the component(s)';
$string['importfile'] = 'Import file';
$string['langpack'] = 'Language component(s)';
$string['markinguptodate'] = 'Marking the customisation as up-to-date';
$string['markinguptodate_help'] = 'The customised translation may get outdated if either the English original or the master translation has modified since the string was customised on your site. Review the customised translation. If you find it up-to-date, click the checkbox. Edit it otherwise.';
$string['markuptodate'] = 'mark as up-to-date';
$string['modifiedno'] = 'There are no modified strings to save.';
$string['modifiednum'] = 'There are {$a} modified strings. Do you wish to save these changes to your local language pack?';
$string['nolocallang'] = 'No local strings found.';
$string['notice_ignorenew'] = 'Ignoring string {$a->component}/{$a->stringid} because it is not customised.';
$string['notice_ignoreupdate'] = 'Ignoring string {$a->component}/{$a->stringid} because it is already defined.';
$string['notice_inexitentstring'] = 'String {$a->component}/{$a->stringid} not found.';
$string['notice_missingcomponent'] = 'Missing component {$a->component}.';
$string['notice_success'] = 'String {$a->component}/{$a->stringid} updated successfully.';
$string['nostringsfound'] = 'No strings found, please modify the filter settings';
$string['placeholder'] = 'Placeholders';
$string['placeholder_help'] = 'Placeholders are special statements like `{$a}` or `{$a->something}` within the string. They are replaced with a value when the string is actually printed.
+1 -1
View File
@@ -243,7 +243,7 @@ class tool_customlang_utils {
* @param string $lang language code
* @return string full path
*/
protected static function get_localpack_location($lang) {
public static function get_localpack_location($lang) {
global $CFG;
return $CFG->langlocalroot.'/'.$lang.'_local';
@@ -59,7 +59,7 @@
<input type="hidden" name="sesskey" value="{{{ sesskey }}}">
<input type="hidden" name="p" value="{{ currentpage }}">
<fieldset class="m-a-1 m-3">
<fieldset class="m-3">
<button type="submit" name="savecontinue" class="btn btn-secondary">
{{#str}}savecontinue, tool_customlang{{/str}}
</button>
@@ -70,7 +70,7 @@
<div class="list-group">
<div class="container-fluid d-none d-md-block list-group-item border-bottom-0">
<div class="row-fluid">
<div class="row">
<div class="col-sm-4 col-md-2">
<strong>{{#str}}headingcomponent, tool_customlang{{/str}}</strong>
</div>
@@ -81,7 +81,7 @@
<strong>{{#str}}headingstandard, tool_customlang{{/str}}</strong>
</div>
<div class="col-sm-12 col-md-6">
<span class="p-l-1 pl-3">
<span class="pl-3">
<strong>{{#str}}headinglocal, tool_customlang{{/str}}</strong>
</span>
</div>
@@ -96,7 +96,7 @@
{{#outdated}}list-group-item-warning{{/outdated}}
{{#modified}}list-group-item-info{{/modified}}"
>
<div class="row-fluid ">
<div class="row">
<div class="col-sm-4 col-md-2">
<div class="d-md-none">
<strong>{{#str}}headingcomponent, tool_customlang{{/str}}</strong>
@@ -129,8 +129,8 @@
<strong>{{#str}}headinglocal, tool_customlang{{/str}}</strong>
</div>
<div class="py-2 py-md-0 px-md-3">
<textarea class="form-control w-100 border-box" name="cust[{{id}}]" cols="40" rows="3">{{{ local }}}</textarea>
<label for="{{id}}" class="sr-only sr-only-focusable">{{{ component }}}/{{{ stringid }}}</label>
<textarea class="form-control w-100 border-box" id="{{id}}" name="cust[{{id}}]" cols="40" rows="3">{{{ local }}}</textarea>
{{#checkupdated}}
<div class="uptodatewrapper">
<div class="form-check">
@@ -147,7 +147,7 @@
{{/strings}}
</div>
<fieldset class="m-a-1 m-3">
<fieldset class="m-3">
<button type="submit" name="savecontinue" class="btn btn-secondary">
{{#str}}savecontinue, tool_customlang{{/str}}
</button>
@@ -0,0 +1,30 @@
@tool @tool_customlang
Feature: Within a moodle instance, an administrator should be able to modify langstrings for the entire Moodle installation.
In order to change langstrings in the adminsettings of the instance,
As an admin
I need to be able to access and change values in the the language customisation of the language pack.
Background:
Given I log in as "admin"
And I navigate to "Language > Language customisation" in site administration
And I set the field "lng" to "en"
And I press "Open language pack for editing"
And I press "Continue"
And I set the field "Show strings of these components" to "moodle.php"
And I set the field "String identifier" to "administrationsite"
And I press "Show strings"
And I set the field "core/administrationsite" to "Custom string example"
@javascript
Scenario: Edit an string but don't save it to lang pack.
When I press "Apply changes and continue editing"
Then I should see "Site administration" in the "page-header" "region"
And I should not see "Custom string example" in the "page-header" "region"
@javascript
Scenario: Customize an string as admin and save it to lang pack.
Given I press "Save changes to the language pack"
And I should see "There are 1 modified strings."
When I click on "Continue" "button"
Then I should see "Custom string example" in the "page-header" "region"
And I should not see "Site administration" in the "page-header" "region"
@@ -0,0 +1,49 @@
@tool @tool_customlang
Feature: Within a moodle instance, an administrator should be able to export modified langstrings.
In order to export modified langstrings in the adminsettings of the instance,
As an admin
I need to be able to export the php-files of the language customisation of a language.
@javascript
Scenario: Export button should not appear if no customization is made
Given I log in as "admin"
And I navigate to "Language > Language customisation" in site administration
And I set the field "lng" to "en"
Then I should see "Open language pack for editing"
And I should not see "Export custom strings"
@javascript
Scenario: Export button should not appear if no customization is saved into langpack
Given I log in as "admin"
And I navigate to "Language > Language customisation" in site administration
And I set the field "lng" to "en"
And I press "Open language pack for editing"
And I press "Continue"
And I set the field "Show strings of these components" to "moodle.php"
And I set the field "String identifier" to "accept"
And I press "Show strings"
And I set the field "core/accept" to "Accept-custom_export"
When I press "Apply changes and continue editing"
And I navigate to "Language > Language customisation" in site administration
And I set the field "lng" to "en"
Then I should see "Open language pack for editing"
And I should see "There are 1 modified strings."
And I should not see "Export custom strings"
@javascript
Scenario: Export the php-file including a customised langstring.
Given I log in as "admin"
And I navigate to "Language > Language customisation" in site administration
And I set the field "lng" to "en"
And I press "Open language pack for editing"
And I press "Continue"
And I set the field "Show strings of these components" to "moodle.php"
And I set the field "String identifier" to "accept"
And I press "Show strings"
And I set the field "core/accept" to "Accept-custom_export"
When I press "Save changes to the language pack"
And I should see "There are 1 modified strings."
And I click on "Continue" "button"
Then I set the field "lng" to "en"
And I click on "Export custom strings" "button"
And I set the field "Select component(s) to export" to "moodle.php"
@@ -0,0 +1,48 @@
@tool @tool_customlang @_file_upload
Feature: Within a moodle instance, an administrator should be able to import modified langstrings.
In order to import modified langstrings in the adminsettings from one to another instance,
As an admin
I need to be able to import the zips and php files of the language customisation of a language.
Background:
Given I log in as "admin"
And I navigate to "Language > Language customisation" in site administration
And I set the field "lng" to "en"
And I click on "Import custom strings" "button"
And I press "Continue"
@javascript
Scenario: Import a PHP file to add a new core lang customization
When I upload "admin/tool/customlang/tests/fixtures/tool_customlang.php" file to "Language component(s)" filemanager
And I press "Import file"
Then I should see "String tool_customlang/pluginname updated successfully."
And I should see "String tool_customlang/nonexistentinvetedstring not found."
And I click on "Continue" "button"
And I should see "There are 1 modified strings."
And I click on "Save strings to language pack" "button"
And I click on "Continue" "button"
And I should see "An amazing import feature" in the "page-header" "region"
@javascript
Scenario: Try to import a PHP file from a non existent component
When I upload "admin/tool/customlang/tests/fixtures/mod_fakecomponent.php" file to "Language component(s)" filemanager
And I press "Import file"
Then I should see "Missing component mod_fakecomponent."
@javascript
Scenario: Import a zip file with some PHP files in it.
When I upload "admin/tool/customlang/tests/fixtures/customlang.zip" file to "Language component(s)" filemanager
And I press "Import file"
Then I should see "String core/administrationsite updated successfully."
And I should see "String core/language updated successfully."
And I should see "String core/nonexistentinvetedstring not found."
And I should see "String tool_customlang/pluginname updated successfully."
And I should see "String tool_customlang/nonexistentinvetedstring not found."
And I should see "Missing component mod_fakecomponent."
And I click on "Continue" "button"
And I should see "There are 3 modified strings."
And I click on "Save strings to language pack" "button"
And I click on "Continue" "button"
And I should see "Uploaded custom string" in the "page-header" "region"
And I should see "Another Uploaded string" in the "page-header" "region"
And I should see "An amazing import feature" in the "page-header" "region"
@@ -0,0 +1,81 @@
@tool @tool_customlang @_file_upload
Feature: Within a moodle instance, an administrator should be able to import langstrings with several modes.
In order to import modified langstrings in the adminsettings from one to another instance,
As an admin
I need to be able to import only some language customisation strings depending on some conditions.
Background:
# Add one customization.
Given I log in as "admin"
And I navigate to "Language > Language customisation" in site administration
And I set the field "lng" to "en"
And I press "Open language pack for editing"
And I press "Continue"
And I set the field "Show strings of these components" to "moodle.php"
And I set the field "String identifier" to "administrationsite"
And I press "Show strings"
And I set the field "core/administrationsite" to "Custom string example"
And I press "Save changes to the language pack"
And I should see "There are 1 modified strings."
And I click on "Continue" "button"
And I should see "Custom string example" in the "page-header" "region"
@javascript
Scenario: Update only customized strings
When I set the field "lng" to "en"
And I click on "Import custom strings" "button"
And I press "Continue"
And I upload "admin/tool/customlang/tests/fixtures/moodle.php" file to "Language component(s)" filemanager
And I set the field "Import mode" to "Update only strings with local customisation"
And I press "Import file"
Then I should see "String core/administrationsite updated successfully."
And I should see "Ignoring string core/language because it is not customised."
And I should see "String core/nonexistentinvetedstring not found."
And I click on "Continue" "button"
And I should see "There are 1 modified strings."
And I should not see "Uploaded custom string" in the "page-header" "region"
And I click on "Save strings to language pack" "button"
And I click on "Continue" "button"
And I should not see "Custom string example" in the "page-header" "region"
And I should see "Uploaded custom string" in the "page-header" "region"
And I should not see "Another Uploaded string" in the "page-header" "region"
@javascript
Scenario: Create only new strings
When I set the field "lng" to "en"
And I click on "Import custom strings" "button"
And I press "Continue"
And I upload "admin/tool/customlang/tests/fixtures/moodle.php" file to "Language component(s)" filemanager
And I set the field "Import mode" to "Create only strings without local customisation"
And I press "Import file"
Then I should see "Ignoring string core/administrationsite because it is already defined."
And I should see "String core/language updated successfully."
And I should see "String core/nonexistentinvetedstring not found."
And I click on "Continue" "button"
And I should see "There are 1 modified strings."
And I should not see "Uploaded custom string" in the "page-header" "region"
And I click on "Save strings to language pack" "button"
And I click on "Continue" "button"
And I should see "Custom string example" in the "page-header" "region"
And I should not see "Uploaded custom string" in the "page-header" "region"
And I should see "Another Uploaded string" in the "page-header" "region"
@javascript
Scenario: Import all strings
When I set the field "lng" to "en"
And I click on "Import custom strings" "button"
And I press "Continue"
And I upload "admin/tool/customlang/tests/fixtures/moodle.php" file to "Language component(s)" filemanager
And I set the field "Import mode" to "Create or update all strings from the component(s)"
And I press "Import file"
Then I should see "String core/administrationsite updated successfully."
And I should see "String core/language updated successfully."
And I should see "String core/nonexistentinvetedstring not found."
And I click on "Continue" "button"
And I should see "There are 2 modified strings."
And I should not see "Uploaded custom string" in the "page-header" "region"
And I click on "Save strings to language pack" "button"
And I click on "Continue" "button"
And I should not see "Custom string example" in the "page-header" "region"
And I should see "Uploaded custom string" in the "page-header" "region"
And I should see "Another Uploaded string" in the "page-header" "region"
Binary file not shown.
@@ -0,0 +1,29 @@
<?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/>.
/**
* Local language pack.
*
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['administrationsite'] = 'Uploaded custom string';
$string['language'] = 'Another Uploaded string';
$string['nonexistentinvetedstring'] = 'This should not be imported';
+28
View File
@@ -0,0 +1,28 @@
<?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/>.
/**
* Local language pack.
*
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['administrationsite'] = 'Uploaded custom string';
$string['language'] = 'Another Uploaded string';
$string['nonexistentinvetedstring'] = 'This should not be imported';
@@ -0,0 +1,28 @@
<?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/>.
/**
* Local language pack from http://localhost/m/MDL-69583
*
* @copyright 2020 Ferran Recio <ferran@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
$string['pluginname'] = 'An amazing import feature';
$string['nonexistentinvetedstring'] = 'This string should not be imported';
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,207 @@
<?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/>.
/**
* PHP lang parser test.
*
* @package tool_customlang
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace tool_customlang\local\mlang;
use advanced_testcase;
use moodle_exception;
/**
* PHP lang parser test class.
*
* @package tool_customlang
* @copyright 2015 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class phpparser_testcase extends advanced_testcase {
/**
* Test get instance static method.
*
*/
public function test_get_instance(): void {
$instance = phpparser::get_instance();
$this->assertInstanceOf('tool_customlang\local\mlang\phpparser', $instance);
$this->assertEquals($instance, phpparser::get_instance());
}
/**
* Test get instance parse method.
*
* @dataProvider parse_provider
* @param string $phpcode PHP code to test
* @param array $expected Expected result
* @param bool $exception if an exception is expected
*/
public function test_parse(string $phpcode, array $expected, bool $exception): void {
$instance = phpparser::get_instance();
if ($exception) {
$this->expectException(moodle_exception::class);
}
$strings = $instance->parse($phpcode);
$this->assertEquals(count($expected), count($strings));
foreach ($strings as $key => $langstring) {
$this->assertEquals($expected[$key][0], $langstring->id);
$this->assertEquals($expected[$key][1], $langstring->text);
}
}
/**
* Data provider for the test_parse.
*
* @return array
*/
public function parse_provider() : array {
return [
'Invalid PHP code' => [
'No PHP code', [], false
],
'No PHP open tag' => [
"\$string['example'] = 'text';\n", [], false
],
'One string code' => [
"<?php \$string['example'] = 'text';\n", [['example', 'text']], false
],
'Extra spaces' => [
"<?php \$string['example'] = 'text';\n", [['example', 'text']], false
],
'Extra tabs' => [
"<?php \$string['example']\t=\t'text';\n", [['example', 'text']], false
],
'Double quote string' => [
"<?php
\$string['example'] = \"text\";
\$string[\"example2\"] = 'text2';
\$string[\"example3\"] = \"text3\";
", [
['example', 'text'],
['example2', 'text2'],
['example3', 'text3'],
], false
],
'Multiple lines strings' => [
"<?php
\$string['example'] = 'First line\nsecondline';
\$string['example2'] = \"First line\nsecondline2\";
", [
['example', "First line\nsecondline"],
['example2', "First line\nsecondline2"],
], false
],
'Two strings code' => [
"<?php
\$string['example'] = 'text';
\$string['example2'] = 'text2';
", [
['example', 'text'],
['example2', 'text2'],
], false
],
'Scaped characters' => [
"<?php
\$string['example'] = 'Thos are \\' quotes \" 1';
\$string['example2'] = \"Thos are ' quotes \\\" 2\";
", [
['example', "Thos are ' quotes \" 1"],
['example2', "Thos are ' quotes \" 2"],
], false
],
'PHP with single line comments' => [
"<?php
// This is a comment.
\$string['example'] = 'text';
// This is another commment.
", [
['example', 'text'],
], false
],
'PHP with block comments' => [
"<?php
/* This is a block comment. */
\$string['example'] = 'text';
/* This is another
block comment. */
", [
['example', 'text'],
], false
],
'Wrong variable name' => [
"<?php
\$stringwrong['example'] = 'text';
\$wringstring['example'] = 'text';
", [], false
],
'Single line commented valid line' => [
"<?php
// \$string['example'] = 'text';
", [], false
],
'Block commented valid line' => [
"<?php
/*
\$string['example'] = 'text';
*/
", [], false
],
'Syntax error 1 (double assignation)' => [
"<?php
\$string['example'] = 'text' = 'wrong';
", [], true
],
'Syntax error 2 (no closing string)' => [
"<?php
\$string['example'] = 'wrong;
", [], true
],
'Syntax error 3 (Array without key)' => [
"<?php
\$string[] = 'wrong';
", [], true
],
'Syntax error 4 (Array not open)' => [
"<?php
\$string'example'] = 'wrong';
", [], true
],
'Syntax error 5 (Array not closed)' => [
"<?php
\$string['example' = 'wrong';
", [], true
],
'Syntax error 6 (Missing assignment)' => [
"<?php
\$string['example'] 'wrong';
", [], true
],
];
}
}
+1 -1
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020061500;
$plugin->version = 2020101300;
$plugin->requires = 2020060900;
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
+1 -1
View File
@@ -1613,7 +1613,7 @@ class external extends external_api {
*/
private static function get_tree_node_structure($allowchildbranches = true) {
$fields = [
'text' => new external_value(PARAM_TEXT, 'The node text', VALUE_REQUIRED),
'text' => new external_value(PARAM_RAW, 'The node text', VALUE_REQUIRED),
'expandcontextid' => new external_value(PARAM_INT, 'The contextid this node expands', VALUE_REQUIRED),
'expandelement' => new external_value(PARAM_ALPHA, 'What element is this node expanded to', VALUE_REQUIRED),
'contextid' => new external_value(PARAM_INT, 'The node contextid', VALUE_REQUIRED),
@@ -63,7 +63,6 @@ class renderer extends plugin_renderer_base {
$params = [
'data-action' => 'contactdpo',
'data-replytoemail' => $replytoemail,
'class' => 'contactdpo'
];
return html_writer::link('#', get_string('contactdataprotectionofficer', 'tool_dataprivacy'), $params);
}
@@ -1 +0,0 @@
statuspreprocessing,tool_dataprivacy
@@ -135,7 +135,7 @@ $string['effectiveretentionperioduser'] = '{$a} (since the last time the user ac
$string['emailsalutation'] = 'Dear {$a},';
$string['errorcannotrequestdeleteforself'] = 'You don\'t have permission to create deletion request for yourself.';
$string['errorcannotrequestdeleteforother'] = 'You don\'t have permission to create deletion request for this user.';
$string['errorinvalidrequestcomments'] = 'Please ensure your comment contains plain text only.';
$string['errorinvalidrequestcomments'] = 'The comments field may contain plain text only.';
$string['errorinvalidrequestcreationmethod'] = 'Invalid request creation method!';
$string['errorinvalidrequeststatus'] = 'Invalid request status!';
$string['errorinvalidrequesttype'] = 'Invalid request type!';
@@ -344,6 +344,3 @@ $string['role_help'] = 'The role which the override should apply to.';
$string['duplicaterole'] = 'Role already specified';
$string['purposeoverview'] = 'A purpose describes the intended use and retention policy for stored data. The basis for storing and retaining that data is also described in the purpose.';
$string['roleoverrideoverview'] = 'The default retention policy can be overridden for specific user roles, allowing you to specify a longer, or a shorter, retention policy. A user is only expired when all of their roles have expired.';
// Deprecated since Moodle 3.6.
$string['statuspreprocessing'] = 'Pre-processing';
@@ -50,12 +50,12 @@
<hr />
<div class="row">
{{#compliant}}
<a class="component-expand p-l-2" data-component="{{raw_component}}" href='#'>
<h4 class=" d-inline p-l-2 " id="{{raw_component}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugin, tool_dataprivacy{{/str}}{{/pix}}{{component}}</h4>
<a class="component-expand pl-5" data-component="{{raw_component}}" href='#'>
<h4 class=" d-inline pl-5 " id="{{raw_component}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugin, tool_dataprivacy{{/str}}{{/pix}}{{component}}</h4>
</a>
{{/compliant}}
{{^compliant}}
<h4 class="d-inline p-l-3 " id="{{raw_component}}">{{component}}</h4>
<h4 class="d-inline pl-6 " id="{{raw_component}}">{{component}}</h4>
<span>{{#pix}}i/risk_xss, moodle, {{#str}}requiresattention, tool_dataprivacy{{/str}}{{/pix}}</span>
{{/compliant}}
{{#external}}
@@ -73,7 +73,7 @@
<div class="hide" data-section="{{raw_component}}" aria-expanded="false" role="contentinfo">
{{#metadata}}
<hr />
<div class="p-l-3">
<div class="pl-6">
<dl class="row">
<dt class="col-3">
{{#link}}
@@ -98,7 +98,7 @@
{{/metadata}}
{{#nullprovider}}
<hr />
<div class="p-l-3">
<div class="pl-6">
<div class="row">
<div class="col-12">
{{nullprovider}}
@@ -108,4 +108,4 @@
{{/nullprovider}}
</div>
{{/compliant}}
</div>
</div>
@@ -54,7 +54,7 @@
<div class="container-fluid mt-2">
<div class="row">
<div class="col-md-4 p-l-0 nav-pills context-tree">
<div class="col-md-4 pl-0 nav-pills context-tree">
{{#tree}}
{{> tool_dataprivacy/context_tree_node}}
{{/tree}}
@@ -59,7 +59,7 @@
<h3 id="{{plugin_type_raw}}">{{#pix}}t/collapsed, moodle, {{#str}}expandplugintype, tool_dataprivacy{{/str}}{{/pix}}{{plugin_type}}</h3>
</a>
</div>
<div class="hide p-b-1" data-plugintarget="{{plugin_type_raw}}" aria-expanded="false" role="contentinfo">
<div class="hide pb-3" data-plugintarget="{{plugin_type_raw}}" aria-expanded="false" role="contentinfo">
{{#plugins}}
{{> tool_dataprivacy/component_status}}
{{/plugins}}
@@ -41,9 +41,9 @@
"contextlevel": 70
}
}}
<div class="row-fluid rtl-compatible mt-1 mb-1">
<div class="row rtl-compatible mt-1 mb-1">
<div class="col-md-9">
<div class="row-fluid rtl-compatible mt-1 mb-1">
<div class="row rtl-compatible mt-1 mb-1">
<div class="col-md-3">
<strong>{{#str}}category, tool_dataprivacy{{/str}}</strong>
</div>
@@ -51,7 +51,7 @@
{{category}}
</div>
</div>
<div class="row-fluid rtl-compatible mt-1 mb-1">
<div class="row rtl-compatible mt-1 mb-1">
<div class="col-md-3">
<strong>{{#str}}purpose, tool_dataprivacy{{/str}}</strong>
</div>
@@ -74,7 +74,7 @@
{{#contexts}}
<div class="card mb-3">
<div class="card-header"><h3>{{contextname}}</h3></div>
<div class="card-body p-l-2 p-r-2">
<div class="card-body pl-5 pr-5">
{{#category.name}}
<h4>{{#str}}category, tool_dataprivacy{{/str}}</h4>
@@ -120,4 +120,4 @@
</div>
</div>
{{/contexts}}
</div>
</div>
+2 -2
View File
@@ -997,8 +997,8 @@ class tool_dataprivacy_api_testcase extends advanced_testcase {
$this->assertEquals($subject, $message->subject);
$this->assertEquals('tool_dataprivacy', $message->component);
$this->assertEquals('contactdataprotectionofficer', $message->eventtype);
$this->assertContains(fullname($dpo), $message->fullmessage);
$this->assertContains(fullname($user1), $message->fullmessage);
$this->assertStringContainsString(fullname($dpo), $message->fullmessage);
$this->assertStringContainsString(fullname($user1), $message->fullmessage);
}
/**
@@ -44,7 +44,7 @@ class tool_dataprivacy_expired_data_requests_testcase extends data_privacy_testc
/**
* Test tearDown.
*/
public function tearDown() {
public function tearDown(): void {
\core_privacy\local\request\writer::reset();
}

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