Commit graph

7868 commits

Author SHA1 Message Date
tjhunt
832e13f144 editor formslib element: symbolic constant EDITOR_UNLIMITED_FILES instead of hard-coded -1. 2009-03-30 10:01:39 +00:00
tjhunt
50da63ebd9 qtypes: MDL-18711 Allow qtype plugins to have custom CSS and JavaScript on the editing page. 2009-03-30 09:15:46 +00:00
tjhunt
b810a4d3c9 filters: MDL-17684 Look for the filter name in filter_myfilter.php first.
This makes filters more plugginable, becuase with this lang file name, get_string will look for the filter name in filter/myfilter/lang/en_utf8/filter_myfilter.php.

To do this, there is a new function filter_get_name in filterlib that contains the logic.

Also, a new function filter_get_all_installed to replace the logic for getting all filters that was duplicated in three places.

filter_get_name no longer does such a nice fall-back if the name is missing, to encourage people to supply the right string. The fallback now looks like '[[filtername]] (filter/tidy)'.
2009-03-30 08:33:13 +00:00
tjhunt
240be1d71c DB unit tests: improve the class so it is easier to use. 2009-03-30 07:05:29 +00:00
tjhunt
e7b818807c get_string: MDL-13816 allow third-partly modules to register sub-plugin types that have their own lang files.
I suppose to be really useful we should deal with database, capabiltities, etc. too in due course. Still, this is a start.
2009-03-30 06:13:35 +00:00
tjhunt
e79079deae help.php: related to MDL-13816. Clean up the URLs used for help files by removing unused parameters. 2009-03-30 06:11:32 +00:00
tjhunt
bb45fe62c4 get_string: Refactoring, performance improvements, bug fixes and unit tests
MDL-18669 get_string refactored to elimiate duplicate code and make it easier to understand.
MDL-17763 parent language not processed correctly when getting a plugin string.
MDL-16181 more intelligent caching to avoid repeated file_exists checks.
MDL-12434 move values to array keys to improve lookup times.

The main part of the refactoring is to create a singleton string_manager class to encapsulate the cached data and the processing, while breaking the code up into more smaller methods.

Other performance improvements include:
* Cache results of plugin name -> locations to search array.
* Cache parent lang lookup.
* Skip eval if the string does not contain $ \ or %.
* Remove the unnecessary sprintf from the eval.

There is a performance testing script in lib/simpletest/getstringperformancetester.php. For now this script has the old get_string implementation copied and pasted to the end, and renamed to old_get_string to allow for comparitive timings.

There are now some unit tests for get_string in lib/simpletest/teststringmanager.php. I think I have managed to cover most of the tricky cases.
2009-03-30 02:21:27 +00:00
tjhunt
edbc93a7e4 Remove failing unit tests. (We are going to remove enum support from the database layer anyway.) 2009-03-30 01:57:47 +00:00
skodak
fe772c2aa7 MDL-18472 fixed missing argument in deprecated function, thanks Gordon Bateson 2009-03-26 20:53:03 +00:00
dongsheng
a774767903 "MDL-17966, fixed installation blocker, merged from 1.9" 2009-03-26 13:32:28 +00:00
dongsheng
b2bf016e1b "ADMINLIB/MDL-17966, overwrite write_setting to update settings instead execute sql execute in get_settings, this will not hurt performance, merged from 1.9" 2009-03-26 08:56:08 +00:00
dongsheng
145c285b43 "ADMINLIB/MDL-17966, update after writing settings, fix dml calls" 2009-03-26 02:39:35 +00:00
dongsheng
dbeb0aa7f2 "ADMINLIB/MDL-17966, update after writing settings, merged from 1.9" 2009-03-26 02:34:42 +00:00
dongsheng
ff601bf011 "ADMINLIB/MDL-17966, update after writing settings, merged from 1.9" 2009-03-26 02:25:46 +00:00
dongsheng
7022dd3930 "MEMORY/MDL-18540,remove hard-coded php memory limit, added system setting for it, create a function reduce_memory_limit to reduce memroy limit and respect php.ini setting in the meanwhile, merged from 1.9" 2009-03-26 02:09:28 +00:00
tjhunt
574c37507f random essay questions: MDL-8648 fix merge problem. 2009-03-26 01:54:40 +00:00
poltawski
9b831e01d2 lib/moodlelib.php MDL-18406 - use more robust require path
thanks to Daniel Neis
merged from MOODLE_19_STABLE
2009-03-25 09:38:41 +00:00
poltawski
eac4623d29 lib/email_to_user MDL-10384 Recipeint names broken
When emailcharset is not utf8 the charset conversion was breaking
recipient/replyto names

thanks to Tatsuya Shirai
merged from MOODLE_19_STABLE
2009-03-25 09:18:19 +00:00
tjhunt
c468795ce9 switch roles: MDL-18132 New Role allow switches page finished.
I also set up a reasonable set of default allows, including setting up some sensible allow_overrides, whatever the rant in MDL-15841 says.
2009-03-25 04:20:57 +00:00
skodak
cb5f2411d7 MDL-17966 reverting previous commit, solution proposed in tracker 2009-03-24 11:01:45 +00:00
mudrd8mz
3a77043c00 MDL-18644 Add a note about the bug found and upstream bug link 2009-03-23 10:53:10 +00:00
mudrd8mz
081a9b0dad MDL-18644 Bugs found by syntax checker, merged from MOODLE_19_STABLE 2009-03-23 09:53:02 +00:00
nicolasconnault
9fb1634910 MDL-18402 Merged from MOODLE_19_STABLE 2009-03-23 08:35:06 +00:00
tjhunt
82701e2443 switch roles: MDL-18132 separate database table role_allow_switch instead of re-using role_allow_assign.
This is part 1 that does the back-end:

1. New table role_allow_switch.
2. Upgrade that copies all the allows from role_allow_assign, and then drops the old CFG->allowuserswitchrolestheycantassign.
3. Old function get_assignable_roles_for_switchrole renamed to get_switchable_roles and changed to use the new table. Fixes MDL-18604 in HEAD.
4. Switch callers to use the new function name.
5. Unit tests for this new function.
6. To make those unit tests work, new switch_global_user_id and revert_global_user_id methods in UnitTestCaseUsingDatabase for toggling $USER->id.

I still need to do the editing interface under Administration ► Users ► Permissions ► Define roles. That will be done as a second commit.
2009-03-23 08:15:21 +00:00
tjhunt
ffdd703a99 MDL-18637 fix Moodle 1.9-style {$CFG->prefix}tablename in HEAD, and a few missing $DB->s.
I did not fix all the DB problems in search, there are too many there for me to be prepared to clean up other people's mess.

(For once, it was not me making this mistake ;-))
2009-03-23 05:19:53 +00:00
tjhunt
b695b4e16c Make accesslib unit tests work once again using the new UnitTestCaseUsingDatabase 2009-03-23 04:18:44 +00:00
tjhunt
f68cb08bbe unit tests: MDL-18607 new way to do unit tests involving the database.
This is not as ambitious as the abortive FakeDBUnitTests scheme, but this one works for simple cases.

There is a new test case class UnitTestCaseUsingDatabase to inherit from. I hope it is sufficiently well documented in its PHPdocs.
* It users $CFG->unittestprefix.
* You can access that database using $this->testdb.
* That database is empty by default, you have to call create_test_table to create the ones you want, and drop_test_table to clean them up in the end. The table definitions are read from the XMLDB file.
* When you are ready to call real Moodle code that users $DB, call switch_to_test_db and then revert_to_real_db when you are done.
* If you forget to call drop_test_table or switch_to_test_db, the class will attempt to clean up after you, but will also print rude developer debug messages telling you not to be stupid.
* There is also a load_test_data method for populating a table from an array.

The is an example of its use in lib/simpletest/testunittestusingdb.php.
2009-03-23 04:12:37 +00:00
tjhunt
67d5e9df39 ddl: New method install_one_table_from_xmldb_file ready for MDL-18607 unit test changes.
Plus small refactoring to avoid duplicating code.
2009-03-23 04:04:37 +00:00
tjhunt
d867e696aa accesslib: MDL-18620 do not used static to cache things, it makes unit testing impossible.
Instead we have a new $ACCESSLIB_PRIVATE for all caching. Regrettably, the only way to make this work in PHP (other than rewriting everything to be methods of a class rather than functions) is to make this a global variable. However $ACCESSLIB_PRIVATE should not be thought of a global, it is a private implementation detail of accesslib.php. (And there is a comment saying that.)

There is a new function accesslib_clear_all_caches_for_unit_testing(). In a unit test, you need to call this at the start of your test method, before you set up any test data, and again at the end, after you have discarded all your test data.

This new $ACCESSLIB_PRIVATE subsumes the old $ACCESS, $RDEFS and $DITRYCONTEXTS globals.

Also, I took the opportunity to refactor the (inconsistently) duplicated code for adding a context to the caches code into a cache_context function.
2009-03-23 03:54:50 +00:00
tjhunt
4e42a90c53 weblib: Fix test_format_text_email and unit tests. 2009-03-23 03:41:34 +00:00
stronk7
004865e20d MDL-15748 get_user_access_sitewide() - reduce looking for perms in any context below category level.
Dramatic speed-up in sites with zillions of contexts and overrides. Credit goes to Samuli Karevaara.
Merged from 19_STABLE
2009-03-20 12:10:47 +00:00
tjhunt
ea26b22262 accesslib. Improve comment. 2009-03-20 07:41:49 +00:00
poltawski
2029fcf47f email_to_user: MDL-16328 - prevent empty receeipent address
Be a bit defensive as it seems to be possible for this to happen
with LDAP auth
2009-03-19 10:35:08 +00:00
tjhunt
2d10b78980 XHTML strict! If you must write inline JavaScript, please at least remember the CDATA tags. 2009-03-18 08:30:13 +00:00
tjhunt
414f7bee6b formslib: MDL-15827 disabledif option to repeat_elements did not work if you depend on another repeated element.
Patch thanks to Matthieu Nué.
2009-03-18 07:08:18 +00:00
tjhunt
80f7bafdab question bank: MDL-18531 Sorry, capability name typo. 2009-03-18 05:33:56 +00:00
tjhunt
353b2d700d question bank: MDL-18531 if someone can use questions in the quiz context, but not the course context, choose a more sensible default category in the question bank. Merged from MOODLE_19_STABLE. 2009-03-18 05:02:27 +00:00
stronk7
cf8a2e9f8d MDL-18576 timezones - info updated to tzdata2009c ; merged from 19_STABLE 2009-03-16 17:55:26 +00:00
tjhunt
8f732f2ec7 formslib dates: MDL-16592 Take out copy-and-paste snafu 2009-03-16 07:47:01 +00:00
tjhunt
b3a4937663 formslib dates: MDL-16592 by popular demand, a close icon on the popup. 2009-03-16 07:38:27 +00:00
tjhunt
b51709c14c formslib disabledif: MDL-18522 make it work if either end of a disabledif relationship is a set of radio buttons. 2009-03-16 06:09:05 +00:00
tjhunt
562b75b21f formslib durations: MDL-18500 Let the form control the default unit. 2009-03-16 05:57:25 +00:00
tjhunt
bd55319b37 formslib dates: MDL-16592 fix a couple of remaining niggles.
* Hide when focus leaves in almost all cases.
* Reposition the calendar after a delay after changing to a month with a different number of weeks.
2009-03-16 03:42:14 +00:00
tjhunt
9bad31f562 formslib dates: MDL-16592 Fix problem when trying to select a time when the calendar is not visible. 2009-03-16 02:27:08 +00:00
tjhunt
f6b6861d9d javascript: MDL-18568 We don't need a function called uncheckall, as well as one called checknone!
Also, clean up coding style in the popupchecker function.
2009-03-16 02:11:15 +00:00
skodak
cb551e3625 MDL-18550 fixed DML typo and bad coding style - yes sam, whitespace is part of the official coding style! thanks nigel daley for spotting of the typo 2009-03-15 13:29:40 +00:00
tjhunt
8e7cebb0d8 formslib dates: MDL-16592 show a pop-up calendar for picking dates.
Not quite finished. There is a small issue with keyboard focus. See bug.
2009-03-13 09:56:53 +00:00
tjhunt
5f5b443ea8 gift import: MDL-18390 better way to get the question type name. 2009-03-13 09:19:01 +00:00
dongsheng
fe4126c8c3 "REPOSITORY, SMB/MDL-16907, remove smb plugin from core" 2009-03-13 02:59:45 +00:00
danmarsden
b555127fc5 MDL-18517 Stats - Course Overview Weighted report returning incorrect information 2009-03-13 02:52:53 +00:00