Commit graph

7744 commits

Author SHA1 Message Date
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
dongsheng
7a34d20d47 "REPOSITORY/MDL-13766, return unknown type icon for repository api" 2009-03-12 08:02:51 +00:00
stronk7
1263a0ff1d MDL-18518 user firstaccess - added suport to display user->firstaccess. Credit goes to Anthony Borrow!
Merged from 19_STABLE
2009-03-11 11:22:55 +00:00
tjhunt
f3a076ded4 MDL-18500 New formslib element type duration for periods of time. 2009-03-11 06:07:33 +00:00
dongsheng
7719860b60 "ADMINLIB/MDL-17966, display changes saved in admin page, merged from 1.9" 2009-03-11 02:42:28 +00:00
tjhunt
84e628a027 quiz settings: MDL-18485 Improve quiz settings form
* Reorder form fields to group things more logically.
** and on the corresponding admin page too.

* Set some options to be 'Advanced' by default:
** Apply penalties.
** Each attempt builds on the last.
** Decimal places for question grades.
** The five 'Extra restrictions on attempts' settings. (password, etc.)
* Admins can still change this to suit their institiution at Administration > Plugins > Activity modules > Quiz.
* These new defaults are applied if the admin had not previously set any fields to be advanced.

* Disable some filds when they are not applicable:
** Grading method, if num attempts = 1
** Penaly scheme, if adaptive mode = no
** Each attempt builds of last, if num attempts = 1
** Review after quiz closed options, if no close date.
** Delay between 1st and 2nd attempts, if num attempts = 1
** Delay between later attempts, if num attempts < 3

* Convert quiz.timelimit to be in seconds, for consistency, and ready for the new duration field type (MDL 18500).
** Including ensuring that backup and restore is backwards compatible.

* MDL-5537 New setting, questiondecimalpoints, so, for example, you can show the quiz grade as an integer, but have fractional question grades.
** There is a 'Same as overall decimal points' option, which is the default.

* Improve some field labels.

* Make corresponding changes in the help files.
2009-03-10 08:39:51 +00:00
tjhunt
48f7eb9868 ajaxlib: fix unit tests. 2009-03-10 08:01:57 +00:00
tjhunt
2e710be856 Unit tests: in recurseFolders, skip files/folders whose names begnis with '.'/ 2009-03-10 07:53:42 +00:00
tjhunt
3744f3770c ajaxlib: fix unit tests. 2009-03-10 07:48:29 +00:00
dongsheng
1b25f19692 "FILE_MANAGER, REPOSITORY/MDL-16597, remove padding in file listing" 2009-03-10 07:31:14 +00:00
tjhunt
32fa227255 duration formslib element: MDL-18500 crude initial version so I can commit some dependant quiz changes
This will be a formslib element for entering a time duration, like a quiz time limit. A better version to follow.
2009-03-10 06:46:34 +00:00
tjhunt
25fe66b094 date form fields: MDL-18502 Change the optional 'disabled' checkbox to an 'enabled' on
Better for usability to avoid a double-negative.
2009-03-10 06:44:05 +00:00
tjhunt
de9c561ba9 admin setting: MDL-18485 Improve the display of defaults for admin_setting_text_with_advanced 2009-03-10 06:43:07 +00:00
tjhunt
eba40bfe7a tablelib: Fix typo. 2009-03-10 05:00:16 +00:00
dongsheng
8763ab760b "REPOSITORY, UPGRADE/MDL-18354, upgrade/install repository plugins using moodle hook" 2009-03-10 02:01:24 +00:00
poltawski
6667f9e439 repository/googledocs New repository plugin MDL-16383
Google have now allowed documents to be downloaded via their API
(http://googledataapis.blogspot.com/2009/02/start-downloads.html) so
the google docs repo plugin could be finished.

At the moment i've set the export format hardcoded, hopefully we can allow the
repo api let the user choose later...
2009-03-08 15:53:11 +00:00
dongsheng
a75c78d318 "REPOSITORY/MDL-18354, enabled local and upload repository plugins when upgrading" 2009-03-05 04:40:51 +00:00
tjhunt
c65921d422 Question categories. Move code to a more appropriate place. 2009-03-05 04:19:33 +00:00
tjhunt
6a2084067d Fix comment. 2009-03-05 03:35:13 +00:00
stronk7
e0ec2d45b8 MDL-18440 email_to_user() - avoid some notices ; merged from 19_STABLE 2009-03-04 15:03:00 +00:00
sam_marshall
7a7dbd77d1 MDL-18427: Completion system does not require_once gradelib when used 2009-03-03 17:04:49 +00:00
tjhunt
af52eceef4 qtype admin: MDL-18425 also related to MDL-18355.
Allow question types  to be displayed in order that is better than random or alphabetical. Since we don't know all the qtypes there may be:
1. Store the order in the DB (config plugins).
2. Set up a good default order for the standard types. (Unknown types go at the end by default.)
3. Allow admins to edit the order on the qtype admin screen.
2009-03-03 07:47:32 +00:00
tjhunt
7f92f0ad39 quiz editing: MDL-18355 further refinements to the UI. 2009-03-03 05:13:53 +00:00
danmarsden
bc7ec91a0d MDL-12037 Backup Log - add new field to backup_log table to allow other backup related functions to save log data 2009-03-03 00:06:08 +00:00
stronk7
6dc72d7506 MDL-18420 reserved words - lowercase sqlite reserved words 2009-03-02 19:20:47 +00:00