35547 Commits

Author SHA1 Message Date
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
dongsheng
e437618bdd "REPOSITORY/MDL-18520, fix undefined warning" 2009-03-23 07:53:32 +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
02193ad706 accesslib: MDL-18620 - followup - remove the one case of external code using one of the accesslib private globals. 2009-03-23 04:02:28 +00:00
tjhunt
c159da4ce5 Fix typo. 2009-03-23 03:57:45 +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
tjhunt
44d1cba4af quiz: MDL-18635 log every single hit to mod/quiz/attempts.php
I don't know why the quiz only logged every 10 minutes. No other part of Moodle worked like that. However, it has always been like that and I did not have a good reason to change it until now.

What was a problem becuase it made it harder to catch people doing a primitive DOS attack against the server by hitting Reload repeatedly.
2009-03-23 01:59:30 +00:00
moodlerobot
7edeb08cd3 Updated the HEAD build version to 20090323 2009-03-22 23:40:34 +00:00
moodlerobot
82bf09743f Automatic installer.php lang files by installer_builder (20090323) 2009-03-22 23:29:42 +00:00
poltawski
8a083dc75b Messages block: Incorrect link to user profile
The block incorrectly links to site profile in the current pageid.
This doens't make sense in a number of different scenarios, but
most notably if the user who messaged isn't enrolled in the current
course. Instead link to the profile at site context like the messaging
popup does.

Fixes: MDL-18279 MDL-6890 MDL-5887
merged from MOODLE_19_STABLE
2009-03-22 22:40:07 +00:00
moodlerobot
a3a07950d2 Updated the HEAD build version to 20090322 2009-03-21 23:37:31 +00:00
moodlerobot
668af2ad0f Updated the HEAD build version to 20090321 2009-03-20 23:39:05 +00:00
poltawski
a99543ca32 mod/forum - invalid html in q&a forum MDL-18305
thanks to Neil Streeter for the patch
2009-03-20 13:39:07 +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
thepurpleblob
6bfa3f3ecf MDL-18542:
Aaargh... yet another one missed. Hopefully that's it.

Merged from STABLE_19
2009-03-20 11:36:17 +00:00
tjhunt
ea26b22262 accesslib. Improve comment. 2009-03-20 07:41:49 +00:00
jerome
71b77297a9 web service MDL-12886 add standard Course web service functions 2009-03-20 06:53:03 +00:00
moodlerobot
403d51f2fa Updated the HEAD build version to 20090320 2009-03-19 23:34:11 +00:00
thepurpleblob
ff7636f7ff MDL-18542:
Missed the format field for textarea.

Merged from STABLE_19
2009-03-19 21:17:25 +00:00
thepurpleblob
cfd7998216 MDL-18542:
Correctly deals with field types that have multiple parts (e.g. data and lat/long)
Thanks to Eloy for spotting this.

Merged from STABLE_19
2009-03-19 20:45:40 +00:00
stronk7
53dd63837d MDL-18594 restore check - skip maintenance.html file on restore of sie files. Credit goes to Juan Segarra. Merged from 19_STABLE 2009-03-19 14:45:01 +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
1d693c8fd0 course settings: MDL-18595: Fix regression caused by switching the course settings form to use the new date selector.
The bad commit was http://cvs.moodle.org/moodle/course/edit_form.php?r1=1.65&r2=1.66

Sorry everyone who was inconvenienced by this.
2009-03-19 03:14:11 +00:00
moodlerobot
add53f6587 Updated the HEAD build version to 20090319 2009-03-18 23:34:41 +00:00
danmarsden
caab877486 MDL-18564 choice - fix grammar - thanks to Ray Lawrence for the report 2009-03-18 23:04:30 +00:00
exe-cutor
ad9f023c64 MDL-18597 Merging from STABLE 2009-03-18 13:28:57 +00:00
exe-cutor
1f4650184e MDL-18597 Merged from STABLE 2009-03-18 13:22:31 +00:00
thepurpleblob
10b4a508ae MDL-18579:
Provide nicer message if 'Stop on error' is selected and errors are found.

Merged from STABLE_19
2009-03-18 11:15:51 +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
e0b7cfcb31 quiz settings: MDL-18583 When a quiz has no grade, make it clear that you can only enter one lot of overall feedback.
When the maximum grade for the quiz is 0, we disable all the overall feedback form controls except for the first, and display an explanitory message.
2009-03-18 07:33:56 +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
5ecfab5148 quiz outline report: MDL-18285 Show regrade date, not last attempt date.
I also took the opportunity to clean up the code a bit.
2009-03-18 05:16:49 +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
moodlerobot
89175225bf Updated the HEAD build version to 20090318 2009-03-17 23:37:36 +00:00
mark-nielsen
ab1e7c397f shortanswer grading: MDL-18347 shortanswer was not grading correctly with custom scoring set to No, merged from 19 2009-03-17 16:27:40 +00:00
sam_marshall
fdec3d4f88 MDL-18582: Made config.php consistently require_once 2009-03-17 10:52:27 +00:00
tjhunt
3e10e4292d quiz editing: MDL-17454 first attemtp, and MDL-18554
This is a minimal fix for MDL-18554, I have just added a cancel button and made it work.

The more substantial part of this is MDL-17454, trying to make the quiz editing screen behave appropriately when shuffle questions is on. I am sure Olli will have opinions about this and want to change it further. Rought summary:
* When shufflequestions is off, never restrict manual paging, even if questionsperpage is set.
* When shuffle questions is on:
** Always display the quiz with the defined number of questions per page.
** Remove controls to add things except at the end of the quiz.
** Disable most of the order and paging tab, but still allow the question list to be reordered, in case that helps teachers track which questions they have added.
** Still allow questions to be reordered on the edit tab, but when moving the top question on a page up, reorder with the previous question, rather than moving to the previous page.
* Change the status bar, so that the yellow highlight is reserved for alert information. The more informative stuff is now plain, and moved to under the title. To my mind that associates it more closely with the quiz name. Also it moves Total of grades and Maximum grade closer together.
* JavaScript cleaned up. I learn more about YUI every day.
* Some PHP code clean ups that I forgot to commit separately before making substantive changes.
2009-03-17 09:51:34 +00:00
tjhunt
babcc520a7 Minor coding style cleanup. 2009-03-17 08:34:56 +00:00
tjhunt
de57941d2a quiz editing: unindent entire file. 2009-03-17 08:21:37 +00:00
tjhunt
b4a33c4ba6 formslib dates: MDL-16592 Forgot to commit these stylesheet changes. 2009-03-17 07:15:51 +00:00
tjhunt
c34760f93c Whitespace fix. 2009-03-17 07:14:14 +00:00
tjhunt
8c87920373 quiz settings: MDL-17333 drat, missed one lang string. 2009-03-17 07:10:45 +00:00
tjhunt
eeab18f0b3 quiz settings: MDL-17333 Resolve the interrelations between shufflequestions and questionsperpage.
* change the wording of the settings.
* add a repaginate now checkbox (disabled if shuffle is on).
* JavaScript to automatically check the checkbox when qpp changes.
* (remove some irrelevant return value checks now we use exceptions.)
2009-03-17 07:08:33 +00:00
dongsheng
64115dc8b3 "REPOSITORY/MDL-18520, hard-coded block list in file system plugin" 2009-03-17 05:21:03 +00:00
tjhunt
cf0e8bdba8 database mod: XHTML strict! 2009-03-17 04:28:47 +00:00