Compare commits

...

289 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) a1d246334b Moodle release 2.2.1 2012-01-07 17:04:34 +01:00
Eloy Lafuente (stronk7) 7ca0ece0db weekly release 2.2+ 2012-01-05 15:06:46 +01:00
Eloy Lafuente (stronk7) dcfc7a875a Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2012-01-05 12:50:26 +01:00
Sam Hemelryk ffd6212152 Merge branch 'MDL-31017_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2012-01-05 11:17:13 +13:00
Eloy Lafuente (stronk7) 1cf721e235 MDL-31017 whitespace clean - take1 2012-01-04 16:28:59 +01:00
Eloy Lafuente (stronk7) aed7f32783 Merge branch 'MDL-30865-workshop-unittest_22_STABLE' of git://github.com/mudrd8mz/moodle into MOODLE_22_STABLE 2012-01-04 02:19:11 +01:00
Eloy Lafuente (stronk7) dbc7d20cf5 Merge branch 'MDL-30879-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2012-01-04 02:14:34 +01:00
Petr Skoda 6357d61912 MDL-30945 add support for unenrolling of individual users + code cleanup 2012-01-04 01:53:33 +01:00
AMOS bot 3acce7a095 Automatically generated installer lang files 2012-01-04 00:31:17 +00:00
Petr Skoda a36531da4f MDL-30948 do not generate new passwords for suspended accounts because they would not get any emails 2012-01-04 00:49:04 +01:00
Petr Skoda 7d1906cf7c MDL-30948 stop messaging suspended and deleted users 2012-01-04 00:49:03 +01:00
Petr Skoda 8be58774cd MDL-30951 prevent fatal error when category sync enrolment not configured 2012-01-04 00:40:26 +01:00
Petr Skoda ffbcd681f3 MDL-29917 prevent form autocompletion in most Moodle forms
The password autocompletion in case of Moodle makes sense only on the login page, the form autocompletion in general is most probably useful only on the user signup page.

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

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

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

This make all our overriding of _generateId unnecessary.

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

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

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

Conflicts:

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

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

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

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

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

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

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

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

The data returned by mnet_get_hosts() function now contain the deleted
status, too. It is possible to obtain deleted hosts from that function
now.
2011-12-15 21:15:56 +01:00
Tim Hunt 98402da094 MDL-29176 quiz editing: can't move questions onto a new page. 2011-12-15 19:33:01 +00:00
Tim Hunt 76ffac7f93 MDL-30646 default qbank sort should only use visible columns. 2011-12-15 18:40:32 +00:00
sam marshall 782b21dc0f MDL-30764 Activity settings: do not disable grouping dropdown if it is already set 2011-12-15 16:47:08 +00:00
Justin Filip e0b587be49 MDL-30741 Adding a new test to check for incorrect parsing of complicate HTML with a PRE tag. 2011-12-15 11:10:32 -05:00
Justin Filip e60d8e5a42 MDL-30741 Fix the handling of PRE tags with the latest code from upstream: http://trac.roundcube.net/browser/trunk/roundcubemail/program/lib/html2text.php?rev=5497 2011-12-15 11:10:20 -05:00
Tim Hunt 67cb80dc09 MDL-30758 quiz_statistics report fails if all 1st attempts require grading 2011-12-15 12:52:10 +00:00
Tim Hunt abe73c6d99 MDL-30739 qtype numerical: upgrade script uses SQL that is not cross-DB. 2011-12-15 12:22:27 +00:00
Tim Hunt f455e4e9bd MDL-30744 question editing permissions. Update to new accessslib.php code.
I don't believe this will actually fix the reported problem, which I
cannot reproduce, but it should give us much better error messages, at
which point we can fix it.
2011-12-15 11:56:21 +00:00
Tim Hunt 6d3ac4035b MDL-30592 / MDL-27183 quiz statistics: fix merge problem.
These two fixes changes the same file in different ways, causing breakage.
2011-12-15 11:22:33 +00:00
Aparup Banerjee b057855440 MDL-28126 webservice : string fixed. 2011-12-15 18:05:13 +08:00
Marina Glancy 92ec74a9a7 MDL-30733: synchronizing view_feedback with parent function to work with advanced grading
assignment_upload::view_feedback was overriden. It is altered the same way as parent function was to work with advanced grading and so it is displayed correctly in user complete report
2011-12-15 16:47:18 +08:00
Jamie Pratt 9abb69aacb MDL-30749 fixing typo referring to question instead of answer object 2011-12-15 14:47:15 +07:00
Aparup Banerjee cb8e878573 Revert "MDL-30482 create new capability for viewing glossary entries" (test failed)
This reverts commit 03adb289ec.
2011-12-15 15:46:22 +08:00
Aparup Banerjee ba0c76e7a9 Revert "MDL-30482 - Glossary - Adding capability to other areas using glossary" (testing failed)
This reverts commit b2b9890d08.
2011-12-15 15:29:36 +08:00
Eloy Lafuente (stronk7) 40ab5a4010 MDL-30592 moodlelib: minor phpdocs/debug tweaks 2011-12-14 22:44:47 +01:00
Eloy Lafuente (stronk7) a30e3c5a1a Merge branch 'MDL-30592_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-14 22:44:33 +01:00
Tim Lock cb140ca0d6 MDL-30419: IMS package content missing when using Blackboard packages 2011-12-14 21:36:04 +01:00
Darko Miletic 4026898f5c MDL-30738: Fix for 2.2 stable 2011-12-14 15:06:31 -03:00
Tim Hunt 51d861632b MDL-30742 restoring 1.9 backups with missing question data should be robust 2011-12-14 17:18:04 +00:00
Jerome Mouneyrac 72306a6ff4 MDL-28126 webservices : should not able to create token if user is deleted,unconfirmed,suspended or guest. 2011-12-15 00:52:16 +08:00
Tim Hunt 9831354928 MDL-30734 question engine: sum_usage_marks_subquery edge-case.
When all qas in a useage are 'gaveup' state, it gives NULL, not 0.0, for the total.
2011-12-14 14:30:25 +00:00
Andrew Davis 925d068de1 MDL-13572 message: added validation of the email address in the messaging preferences 2011-12-14 17:48:36 +08:00
Andrew Davis 1a35796fba MDL-25561 grade: made the student names clickable on the user report 2011-12-14 15:33:10 +08:00
Jason Fowler b2b9890d08 MDL-30482 - Glossary - Adding capability to other areas using glossary 2011-12-14 15:02:51 +08:00
Aparup Banerjee 4f7dc83fe8 Revert "MDL-30482 - Glossary - Adding capability to other areas using glossary"
This reverts commit b23dd6ee72.
2011-12-14 15:02:37 +08:00
Dan Marsden 7c183f44d4 MDL-28728 SCORM - only show delete button if data exists for this user in this scorm 2011-12-14 13:42:14 +08:00
Dan Marsden 7d919d8f27 MDL-28728 SCORM - add capability to allow users to delete own attempts - given to no-one by default. 2011-12-14 13:42:06 +08:00
Aparup Banerjee 324ea4d7de MDL-29325 fixed typo - camelcasing. 2011-12-14 13:14:28 +08:00
Mayank Gupa 9ff12f3dae MDL-30576, Fixing cmi.completion_threshold and default value of minProgressMeasure to be saved correctly in the database. 2011-12-14 17:22:45 +13:00
Sam Hemelryk 83688ab542 Merge branch 'MDL-27183_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-14 17:17:29 +13:00
Eloy Lafuente (stronk7) 2b6d08a333 Merge branch 'wip-MDL-27767-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2011-12-14 03:16:31 +01:00
Mark Nielsen e2acc0a010 MDL-29048 Glossary Force glossary type to secondary while trying to duplicate a mail glossary 2011-12-14 07:28:28 +05:30
Eloy Lafuente (stronk7) c5b8cda403 Merge branch 'w51_MDL-30605_m22_env23' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-14 02:39:11 +01:00
Sam Hemelryk d4b584c5f6 Merge branch 'MDL-30463_m22' of git://github.com/rwijaya/moodle into MOODLE_22_STABLE 2011-12-14 14:25:17 +13:00
Sam Hemelryk 2f24a39b5b Merge branch 'MDL-30140-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2011-12-14 14:08:21 +13:00
AMOS bot de1b85d795 Automatically generated installer lang files 2011-12-14 00:31:23 +00:00
Tim Hunt d6b040af81 MDL-30683 don't show overall feedback in the quiz grades report.
The grades are small, while the feedback can be big, which breaks the table layout.
2011-12-13 16:51:35 +00:00
Aparup Banerjee a23463acec Merge branch 'MDL-29772-22' of git://github.com/bostelm/moodle into MOODLE_22_STABLE 2011-12-13 17:05:07 +08:00
Aparup Banerjee 3b89933d9f MDL-29325 Enrol : reduced isset calls and improved readability 2011-12-13 16:36:49 +08:00
Dan Marsden 903ab24de4 MDL-29325 imsenterprise enrolment - allow more flexible naming of courses - thanks to Adam Barbary for patch 2011-12-13 16:27:37 +08:00
Mayank Gupa 5c8e2b97d3 MDL-30577, fixing cmi.credit, cmi.mode are not evaluated correctly 2011-12-13 14:49:47 +08:00
Aparup Banerjee 9dfd9a124d Merge branch 'MDL-30472-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-13 14:36:02 +08:00
Andrew Robert Nicols db5602f751 MDL-30362 Change icon class for editsection icons in course formats 2011-12-13 14:30:21 +08:00
Aparup Banerjee a3bb5afdd0 Merge branch 'MDL-30562_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 14:01:57 +08:00
Alexnader Bias 423dc3b17e MDL-30472 Course Making user lists sortable when lastacess field is hidden 2011-12-13 10:53:52 +05:30
Aparup Banerjee 3a353b12ba Merge branch 'MDL-30655-m22' of git://github.com/sammarshallou/moodle into MOODLE_22_STABLE 2011-12-13 13:21:05 +08:00
Tim Hunt 26ebc41703 MDL-30559 conditional availability: missing validation of grade rules. 2011-12-13 12:07:47 +08:00
Jason Fowler b23dd6ee72 MDL-30482 - Glossary - Adding capability to other areas using glossary 2011-12-13 11:51:40 +08:00
Charles Fulton 03adb289ec MDL-30482 create new capability for viewing glossary entries 2011-12-13 11:51:33 +08:00
Petr Skoda 1a52d9e2cc MDL-30575 more mail header cleanup 2011-12-13 10:23:56 +08:00
Mayank Gupa 1daa8c0821 MDL-30645, Fixing evaluation of default value of CMI elements. 2011-12-13 10:16:09 +08:00
Andrew Robert Nicols 51a2716e6b MDL-30653 Remove duplicate Participants link from navbar 2011-12-13 12:09:02 +13:00
Sam Hemelryk b3463f416c Merge branch 'MDL-30677_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 11:20:04 +13:00
Sam Hemelryk fc97bb9863 Merge branch 'MDL-30532_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 11:15:08 +13:00
Sam Hemelryk 8c495ea4ee Merge branch 'MDL-30498a_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 11:11:21 +13:00
Sam Hemelryk bb0ece5a0c Merge branch 'MDL-27143_22' of git://github.com/timhunt/moodle into MOODLE_22_STABLE 2011-12-13 10:26:31 +13:00
Sam Hemelryk e79c09855c Merge branch 'w51_MDL-30621_m22_protectdir' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-13 10:17:56 +13:00
Henning Bostelmann 1f00dc45d4 MDL-29772 Adaptive question behaviour: improve penalty information
also fixes MDL-29780: suppress penalty information if question penalty is 0
2011-12-12 15:38:16 +00:00
Petr Skoda f9c5bd9234 MDL-30621 more dataroot protection 2011-12-12 15:07:25 +01:00
Rossiani Wijaya f6b9be73f5 MDL-30463 lesson module: add space between yes and no options on start last attempt page 2011-12-12 17:13:45 +08:00
Rossiani Wijaya f08f05610b MDL-29239 fixed edit course setting for moodle/course:changesummary permission is set to prevent. 2011-12-12 15:53:54 +08:00
Aparup Banerjee b750cfde81 Merge branch 'w51_MDL-30613_m22_FULLME' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 15:05:37 +08:00
Aparup Banerjee 7210cb5d19 MDL-30603 synced and renamed incorrect ZF 1.10.6 file and name 2011-12-12 14:08:00 +08:00
Sam Hemelryk 860f7f9195 Merge branch 'w51_MDL-29117_m22_enrolnewcourse' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:59:24 +13:00
Sam Hemelryk a3a3186770 Merge branch 'w51_MDL-30292_m22_health' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:41:00 +13:00
Sam Hemelryk 424f91c056 Merge branch 'w51_MDL-30364_m22_report' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:37:39 +13:00
Petr Skoda 56b77440ad MDL-30415 prevent yui2 rollups in debug mode 2011-12-12 17:33:22 +13:00
Petr Skoda 92bf70765a MDL-30502 remove bogus role name param
Credit goes to Michael J Litzkow.
2011-12-12 17:24:43 +13:00
Sam Hemelryk 653599b3a4 Merge branch 'w51_MDL-30588_m22_switchrole' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 17:14:58 +13:00
Sam Hemelryk ba9489ce91 Merge branch 'w51_MDL-30659_m22_yuidebug' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 16:37:03 +13:00
Sam Hemelryk 6aabb69f9e Merge branch 'w51_MDL-30687_m22_ldapnewcourse' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-12 16:10:19 +13:00
Sam Hemelryk 02af5654f2 Merge branch 'MDL-29942-MOODLE_22_STABLE' of git://github.com/mouneyrac/moodle into MOODLE_22_STABLE 2011-12-12 15:13:01 +13:00
Sam Hemelryk 4e8da675ac Merge branch 'MDL-28180_22' of git://github.com/stronk7/moodle into MOODLE_22_STABLE 2011-12-12 14:56:40 +13:00
Sam Hemelryk d3054582d5 Merge branch 'MDL-30198-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-12 13:57:40 +13:00
Andrew Robert Nicols c3c2a213a2 MDL-29195 Remove duplicate Participants -> Notes from navbar 2011-12-12 13:51:07 +13:00
Eloy Lafuente (stronk7) ed9c60fed7 MDL-28180 backup - on restore always prevent completion_aggr_methd dupes
This covers the last case where dupes could be happening in the
completion_aggr_methd table: Restoring one complete course into
an existing one, adding information. Now we always check if the
aggr_method exists before inserting it.
2011-12-11 23:03:51 +01:00
Eloy Lafuente (stronk7) 9de951556f MDL-28180 backup - take rid of dupes in course_completion_aggr_methd 2011-12-11 22:14:02 +01:00
Eloy Lafuente (stronk7) ff4a2ddef7 MDL-28180 backup - set excluded activities for any non-course operation 2011-12-11 21:37:33 +01:00
Petr Skoda 8d7ec82427 MDL-30687 use course defaults when template not set in ldap enrol 2011-12-11 11:07:00 +01:00
Petr Skoda c4437be63b MDL-29117 use default course settings when template not set in db enrol 2011-12-11 10:58:37 +01:00
Petr Skoda 7f467e69c0 MDL-30292 rework trailing whitespace test
Now compatible with zlib compression.
2011-12-10 20:34:20 +01:00
Petr Skoda d59ef547c9 MDL-30364 fix user report regressions 2011-12-10 20:19:07 +01:00
Petr Skoda abf82af8f7 MDL-30621 prevent warnings when creating temp and cache dirs 2011-12-10 17:35:56 +01:00
Petr Skoda 5cb418e9f8 MDL-30659 fix use of yui filters 2011-12-10 13:52:41 +01:00
Petr Skoda 7109330e9a MDL-30659 fix phpdocs problems 2011-12-10 13:52:40 +01:00
Petr Skoda e467ed219f DML-30588 do not require enrollment after switching of roles 2011-12-10 12:45:06 +01:00
AMOS bot f0c8bb711f Automatically generated installer lang files 2011-12-10 00:31:25 +00:00
Petr Skoda cfef4e754a MDL-30610 new environment requirements for 2.3 2011-12-09 21:55:23 +01:00
Petr Skoda cbd8609407 MDL-30613 use standard https checks 2011-12-09 21:27:10 +01:00
Tim Hunt 2a1733aafc MDL-30592 question_bank: make files in qtext work in the question list. 2011-12-09 19:24:20 +00:00
Tim Hunt 1357ab1d5b MDL-30592 quiz statistics, ensure images in the question text appear. 2011-12-09 19:24:13 +00:00
Tim Hunt 001f78b41f MDL-30592 moodlelib: new helper component_callback
I chose to be slighly inconsistent with plugin_callback in order to make a nicer API.
2011-12-09 19:23:54 +00:00
Tim Hunt 853f2e8eea MDL-30677 quiz: fix attempt counts when a student is in several groups. 2011-12-09 17:59:29 +00:00
Valeriy Streltsov 00c7590c95 MDL-30562 qtypes: extra_answer_fields & questionid_column_name public
Will let us make more of qtype backup and restore work automatically.
2011-12-09 17:58:31 +00:00
Tim Hunt 24e5fcbe26 MDL-30532 qeupgradehelper has broken links to quizzes. 2011-12-09 17:57:35 +00:00
Tim Hunt 4d8a37a0db MDL-30498 user name can overlap user report icon. 2011-12-09 17:57:06 +00:00
Tim Hunt 3cba5809ae MDL-27183 quiz reports: don't show data to users not in any group
if the quiz is set to separate groups, and the user does not have access all groups.
2011-12-09 17:56:35 +00:00
Tim Hunt d7320fc84a MDL-27143 question bank: questions not saved when deleting a category.
Based on a fix by Nikhil Gupta.
2011-12-09 17:56:05 +00:00
sam marshall cff596e51b MDL-30655 Blocks: Moving block to top of list can cause (harmless) PHP warnings 2011-12-09 17:45:57 +00:00
Eloy Lafuente (stronk7) acb3bf8ac1 weekly release 2.2+ 2011-12-09 16:27:08 +01:00
Eloy Lafuente (stronk7) ebd748fd71 Merge branch 'install_22_STABLE' of git://github.com/amosbot/moodle into MOODLE_22_STABLE 2011-12-09 16:09:25 +01:00
Tim Hunt 653e811ec0 MDL-30660 javascript-static: another yui3/ticket/2531561 work-around. 2011-12-09 12:41:36 +01:00
Petr Skoda 81dda1da15 MDL-30625 fail gracefully when admins not defined 2011-12-09 10:57:42 +01:00
Aparup Banerjee 9cd8fdda3c MDL-30542 minor string change 2011-12-09 17:10:12 +08:00
Jerome Mouneyrac c532957be2 MDL-30140 alternative way to select user when adding a token. When more than 500 users we display a text box instead of a select box 2011-12-09 14:51:31 +08:00
Mitsuhiro ad86ee91e9 MDL-30198 Glossary Changing string during imports 2011-12-09 10:10:38 +05:30
Petr Skoda 11892d8fdf MDL-27364 use https for recaptcha when site runs via https
Based on solution by Rajesh Taneja.
2011-12-09 11:10:13 +08:00
Tim Hunt 00aa596e8e MDL-30558 question bank, missing string with obscure permissions.
AMOS BEGIN
 MOV [selectcategoryabove,mod_quiz],[selectcategoryabove,question]
AMOS END
2011-12-09 10:47:19 +08:00
Dan Marsden 7b80d3c65a MDL-26974 - add extra logging information all the time - not just when debugging is on. 2011-12-09 10:21:08 +08:00
Mayank Gupa 7da6c0f82d MDL-30579, fixing Data Model Elements are being initialized with an empty string 2011-12-09 10:16:06 +08:00
Tim Hunt a6395af1b9 MDL-27314 quiz reports: fix JS confirmation before deleting attempts. 2011-12-09 02:35:38 +01:00
Eloy Lafuente (stronk7) 4dbdc834ff MDL-30604 Added 2 missing messages andd deleting an incorrect one 2011-12-09 02:10:18 +01:00
Aparup Banerjee bc3801cb9c MDL-30604 Added upgrade lines to upgrade.php(s) 2011-12-09 02:03:58 +01:00
AMOS bot 4e7a371b2e Automatically generated installer lang files 2011-12-09 00:31:16 +00:00
Petr Skoda db48cf080d MDL-30625 full support for main admin 2011-12-09 00:13:05 +01:00
Sam Hemelryk e0745be16b Merge branch 'MDL-30660' of git://github.com/timhunt/moodle 2011-12-09 11:48:01 +13:00
Tim Hunt 9671325a35 MDL-29579 quiz statistics, include qtext in full XHTML export. 2011-12-08 23:37:19 +01:00
Tim Hunt 1e92c729ba MDL-30660 javascript-static: M.util.show_confirm_dialog fixes 2011-12-08 17:51:45 +00:00
Dan Marsden 347f822856 MDL-30028 - use page pref correctly when pagination or re-ordering 2011-12-08 17:07:32 +08:00
Aparup Banerjee 0f69a9eaaf Merge branch 'wip-MDL-30336-MOODLE_22_STABLE' of git://github.com/abgreeve/moodle into MOODLE_22_STABLE 2011-12-08 16:19:02 +08:00
Aparup Banerjee cdbd44f00e Merge branch 'wip-mdl-30560-m22' of git://github.com/rajeshtaneja/moodle into MOODLE_22_STABLE 2011-12-08 15:54:55 +08:00
Jerome Mouneyrac 6ae2048c1f MDL-29942 trigger user events in web service calls 2011-12-08 15:19:45 +08:00
Andrew Robert Nicols 02ed16902b MDL-30350 Highlight late submissions in the submission overview page 2011-12-08 14:27:22 +08:00
Aparup Banerjee 30e1b79889 Merge branch 'MDL-27432_gd_error_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 14:04:46 +08:00
Aparup Banerjee d30043c852 Merge branch 'MDL-28710_rating_classes_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 13:48:27 +08:00
Aparup Banerjee add75e9682 Merge branch 'MDL-30607_override_email_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 13:39:49 +08:00
Sam Hemelryk 78baf38ea4 Merge branch 'MDL-30518' of git://github.com/mackensen/moodle into MOODLE_22_STABLE 2011-12-08 16:05:08 +13:00
Petr Skoda cad8d5ccb0 MDL-30528 stop recreating role_assignments on every login attempt for each user
Credit goes to Luis Gustavo Mueller de Alcantara.
2011-12-08 15:51:08 +13:00
adrian@moodle.com a52422abcb MDL-30336 - login - Added a setting in security that allows auto complete to be set to off in password fields. 2011-12-08 09:08:38 +08:00
Sam Hemelryk a33d85b374 Merge branch 'w50_MDL-30623_m22_guest' of git://github.com/skodak/moodle into MOODLE_22_STABLE 2011-12-08 13:50:03 +13:00
Eloy Lafuente (stronk7) da3494a8c4 Merge branch 'wip-MDL-30582-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2011-12-08 01:37:03 +01:00
AMOS bot ae7aad593c Automatically generated installer lang files 2011-12-08 00:31:19 +00:00
Eloy Lafuente (stronk7) cf2d7311ab Merge branch 'MDL-26522_user_report_menu_22' of git://github.com/andyjdavis/moodle into MOODLE_22_STABLE 2011-12-08 01:02:01 +01:00
Igor Sazonov 8f64668af2 MDL-27314 quiz attempts cannot be deleted in separate groups mode. 2011-12-08 00:46:49 +01:00
Jerome Mouneyrac 2af51a1dc3 MDL-29712 REST-XML server was translating too many HTML characters. use htmlspecialchars instead of htmlentities. Translated characters by htmlspecialchars are compatible with XML validation, and so XML parsers for javascript, java... 2011-12-08 12:42:44 +13:00
Eloy Lafuente (stronk7) 17e0ed7919 Merge branch 'wip-MDL-30222-m22' of git://github.com/samhemelryk/moodle into MOODLE_22_STABLE 2011-12-08 00:39:53 +01:00
Dan Marsden 7e4c833c5a MDL-30211 imsenterprise enrolment - set up default enrolment methods in new courses 2011-12-08 10:49:58 +13:00
Dan Marsden 264ca6c58d MDL-30536 Choice - remove setType so that validation works when JS is disabled 2011-12-08 10:36:48 +13:00
Sam Hemelryk b1d4c42ad6 Merge branch 'MDL-28282-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-08 10:22:58 +13:00
Sam Hemelryk 7f96df6222 Merge branch 'MDL-28588-m22' of git://github.com/ankitagarwal/moodle into MOODLE_22_STABLE 2011-12-08 10:19:22 +13:00
Petr Skoda 73553ddbaa MDL-30623 fix password upgrade path from 1.9 2011-12-07 09:15:37 +01:00
Petr Skoda a6adddfb7d MDL-30623 fix null guest passwords in existing 2.2 sites 2011-12-07 09:15:37 +01:00
Petr Skoda f10ad2d4eb MDL-30623 make sure guest password field is not null 2011-12-07 09:15:36 +01:00
Rajesh Taneja e61eecacc8 MDL-30560 Forms Lib: 'type' key for repeat_elements is restored 2011-12-07 12:04:54 +08:00
Andrew Davis 924deffba6 MDL-30607 message: removed an if condition that prevented you from clearing an overrident email address 2011-12-07 12:04:47 +08:00
Andrew Davis de276c9216 MDL-28710 rating: added some more classes to the html for entering ratings 2011-12-07 11:54:10 +08:00
Andrew Davis aed70c6d40 MDL-27432 mod_data: improved handling of the absence of the GD php extension 2011-12-07 11:48:49 +08:00
Andrew Davis b11d6236df MDL-26522 grade: made the user selection drop down on the user report behave more sensibly 2011-12-07 11:42:44 +08:00
Charles Fulton 4921fb4c9f MDL-19147 - forum - Removed single discussions from the pull down menu for moving posts to different forums. 2011-12-07 14:21:21 +13:00
AMOS bot 6a8a17eb28 Automatically generated installer lang files 2011-12-07 00:31:18 +00:00
Charles Fulton c114ff92bb MDL-19147 - forum - Removed single discussions from the pull down menu for moving posts to different forums. 2011-12-07 12:39:56 +13:00
Ankit Kumar Agarwal a77b489d67 MDL-28588 Removing IN from SQL statments 2011-12-06 11:06:23 +05:30
Ankit Kumar Agarwal 9d7ce57ae3 MDL-28282 Scorm Restorting Groups support in Scorm reports 2011-12-06 09:59:26 +05:30
Sam Hemelryk 28a6552570 MDL-30582 navigation: Fixed regression in generation of front page modules 2011-12-06 13:34:27 +13:00
Sam Hemelryk 6f2d62d022 MDL-27767 install: Shows notifications rather than throwing exceptions when installation encounters unexpected id for guest or admin 2011-12-06 12:22:17 +13:00
Sam Hemelryk a9cc3954b9 MDL-30222 Fixed home page redirection madness. Thank you Julien Boulen for providing the solution 2011-12-06 12:08:32 +13:00
AMOS bot 2324ddd3d5 Automatically generated installer lang files 2011-12-05 18:36:41 +01:00
Charles Fulton 59c1a98c05 MDL-30518 get_context_instance takes one parameter at the SYSTEM level 2011-11-30 05:47:50 -08:00
303 changed files with 3219 additions and 1514 deletions
+114
View File
@@ -556,4 +556,118 @@
</PHP_SETTING>
</PHP_SETTINGS>
</MOODLE>
<MOODLE version="2.3" requires="2.2">
<UNICODE level="required">
<FEEDBACK>
<ON_ERROR message="unicoderequired" />
</FEEDBACK>
</UNICODE>
<DATABASE level="required">
<VENDOR name="mysql" version="5.0.25">
<FEEDBACK>
<ON_ERROR message="mysql416required" />
</FEEDBACK>
</VENDOR>
<VENDOR name="postgres" version="8.3" />
<VENDOR name="mssql" version="9.0" />
<VENDOR name="odbc_mssql" version="9.0" />
<VENDOR name="mssql_n" version="9.0" />
<VENDOR name="oracle" version="10.2" />
<VENDOR name="sqlite" version="2.0" />
</DATABASE>
<PHP version="5.3.2" level="required">
</PHP>
<PHP_EXTENSIONS>
<PHP_EXTENSION name="iconv" level="required">
<FEEDBACK>
<ON_CHECK message="iconvrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="mbstring" level="optional">
<FEEDBACK>
<ON_CHECK message="mbstringrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="curl" level="required">
<FEEDBACK>
<ON_CHECK message="curlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="openssl" level="optional">
<FEEDBACK>
<ON_CHECK message="opensslrecommended" />
</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="gd" level="optional">
<FEEDBACK>
<ON_CHECK message="gdrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="simplexml" level="required">
<FEEDBACK>
<ON_CHECK message="simplexmlrequired" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="spl" level="required">
<FEEDBACK>
<ON_CHECK 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="intl" level="optional">
<FEEDBACK>
<ON_CHECK message="intlrecommended" />
</FEEDBACK>
</PHP_EXTENSION>
<PHP_EXTENSION name="json" level="required">
</PHP_EXTENSION>
</PHP_EXTENSIONS>
<PHP_SETTINGS>
<PHP_SETTING name="memory_limit" value="40M" level="required">
<FEEDBACK>
<ON_ERROR message="settingmemorylimit" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="safe_mode" value="0" level="optional">
<FEEDBACK>
<ON_CHECK message="settingsafemode" />
</FEEDBACK>
</PHP_SETTING>
<PHP_SETTING name="file_uploads" value="1" level="optional">
<FEEDBACK>
<ON_CHECK message="settingfileuploads" />
</FEEDBACK>
</PHP_SETTING>
</PHP_SETTINGS>
</MOODLE>
</COMPATIBILITY_MATRIX>
+19 -13
View File
@@ -38,9 +38,10 @@ class mnet_simple_host_form extends moodleform {
$mform = $this->_form;
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
$mform->setType('wwwroot', PARAM_URL);
$mform->addRule('wwwroot', null, 'required', null, 'client');
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->addElement('select', 'applicationid', get_string('applicationtype', 'mnet'),
$DB->get_records_menu('mnet_application', array(), 'id,display_name'));
@@ -81,11 +82,13 @@ class mnet_review_host_form extends moodleform {
$mform->addElement('hidden', 'applicationid');
$mform->addElement('hidden', 'oldpublickey');
$mform->addElement('text', 'name', get_string('site'));
$mform->addElement('text', 'name', get_string('site'), array('maxlength' => 80, 'size' => 50));
$mform->setType('name', PARAM_NOTAGS);
$mform->addRule('name', get_string('maximumchars', '', 80), 'maxlength', 80, 'client');
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
$mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
$mform->setType('wwwroot', PARAM_URL);
$mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$themes = array('' => get_string('forceno'));
foreach (array_keys(get_plugin_list('theme')) as $themename) {
@@ -96,15 +99,6 @@ class mnet_review_host_form extends moodleform {
$mform->addElement('textarea', 'public_key', get_string('publickey', 'mnet'), array('rows' => 17, 'cols' => 100, 'class' => 'smalltext'));
$mform->setType('public_key', PARAM_PEM);
if ($mnet_peer && !empty($mnet_peer->deleted)) {
$radioarray = array();
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' '), false);
} else {
$mform->addElement('hidden', 'deleted');
}
// finished with form controls, now the static informational stuff
if ($mnet_peer && !empty($mnet_peer->bootstrapped)) {
$expires = '';
@@ -140,7 +134,19 @@ class mnet_review_host_form extends moodleform {
}
}
$mform->addElement('static', 'certdetails', get_string('certdetails', 'mnet'), $OUTPUT->box('<pre>' . $credstr . '</pre>'));
$mform->addElement('static', 'certdetails', get_string('certdetails', 'mnet'),
$OUTPUT->box('<pre>' . $credstr . '</pre>', 'generalbox certdetails'));
}
if ($mnet_peer && !empty($mnet_peer->deleted)) {
$radioarray = array();
$radioarray[] = MoodleQuickForm::createElement('static', 'deletedinfo', '',
$OUTPUT->container(get_string('deletedhostinfo', 'mnet'), 'deletedhostinfo'));
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('yes'), 1);
$radioarray[] = MoodleQuickForm::createElement('radio', 'deleted', '', get_string('no'), 0);
$mform->addGroup($radioarray, 'radioar', get_string('deleted'), array(' ', ' '), false);
} else {
$mform->addElement('hidden', 'deleted');
}
// finished with static stuff, print save button
+19 -4
View File
@@ -190,7 +190,7 @@ if ($formdata = $reviewform->get_data()) {
// normal flow - just display all hosts with links
echo $OUTPUT->header();
$hosts = mnet_get_hosts();
$hosts = mnet_get_hosts(true);
// print the table to display the register all hosts setting
$table = new html_table();
@@ -231,28 +231,43 @@ $table->head = array(
);
$table->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap');
$baseurl = new moodle_url('/admin/mnet/peers.php');
$deleted = array();
foreach($hosts as $host) {
$hosturl = new moodle_url($baseurl, array('hostid' => $host->id));
if (trim($host->name) === '') {
// should not happen but...
$host->name = '???';
}
// process all hosts first since it's the easiest
if ($host->id == $CFG->mnet_all_hosts_id) {
$table->data[] = array(html_writer::tag('a', $host->name, array('href'=>$hosturl)), '', '', '');
$table->data[] = array(html_writer::link($hosturl, get_string('allhosts', 'core_mnet')), '*', '', '');
continue;
}
// populate the list of deleted hosts
if ($host->deleted) {
$deleted[] = html_writer::link($hosturl, $host->name);
continue;
}
if ($host->last_connect_time == 0) {
$last_connect = get_string('never');
} else {
$last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
$last_connect = userdate($host->last_connect_time, get_string('strftimedatetime', 'core_langconfig'));
}
$table->data[] = array(
html_writer::link($hosturl, $host->name),
html_writer::link($hosturl, $host->wwwroot),
html_writer::link($host->wwwroot, $host->wwwroot),
$last_connect,
$OUTPUT->single_button(new moodle_url('/admin/mnet/delete.php', array('hostid' => $host->id)), get_string('delete'))
);
}
echo html_writer::table($table);
if ($deleted) {
echo $OUTPUT->box(get_string('deletedhosts', 'core_mnet', join(', ', $deleted)), 'deletedhosts');
}
// finally, print the initial form to add a new host
echo $OUTPUT->box_start();
echo $OUTPUT->heading(get_string('addnewhost', 'mnet'), 3);
+5 -5
View File
@@ -52,16 +52,16 @@ foreach ($behaviours as $behaviour => $notused) {
if (!array_key_exists($behaviour, $counts)) {
$counts[$behaviour] = 0;
}
$needed[$behaviour] = ($counts[$behaviour] > 0) &&
$needed[$behaviour] = ($counts[$behaviour] > 0) ||
$pluginmanager->other_plugins_that_require('qbehaviour_' . $behaviour);
$archetypal[$behaviour] = question_engine::is_behaviour_archetypal($behaviour);
}
foreach ($counts as $behaviour => $count) {
if (!array_key_exists($behaviour, $behaviours)) {
$counts['missingtype'] += $count;
$counts['missing'] += $count;
}
}
$needed['missing'] = true;
// Work of the correct sort order.
$config = get_config('question');
@@ -179,7 +179,7 @@ if (($delete = optional_param('delete', '', PARAM_PLUGIN)) && confirm_sesskey())
unset($disabledbehaviours[$key]);
set_config('disabledbehaviours', implode(',', $disabledbehaviours), 'question');
}
$behaviourorder = explode(',', $config->behavioursortorder);
$behaviourorder = array_keys($sortedbehaviours);
if (($key = array_search($delete, $behaviourorder)) !== false) {
unset($behaviourorder[$key]);
set_config('behavioursortorder', implode(',', $behaviourorder), 'question');
@@ -248,7 +248,7 @@ foreach ($sortedbehaviours as $behaviour => $behaviourname) {
$row[] = '';
}
// Are people allowed to create new questions of this type?
// Are people allowed to select this behaviour?
$rowclass = '';
if ($archetypal[$behaviour]) {
$enabled = array_search($behaviour, $disabledbehaviours) === false;
+1 -1
View File
@@ -217,7 +217,7 @@ foreach ($sortedqtypes as $qtypename => $localname) {
$strcount = $counts[$qtypename]->numquestions;
}
if ($canviewreports) {
$row[] = html_writer::link(new moodle_url('/admin/report/questioninstances/index.php',
$row[] = html_writer::link(new moodle_url('/report/questioninstances/index.php',
array('qtype' => $qtypename)), $strcount, array('title' => get_string('showdetails', 'admin')));
} else {
$strcount;
+1 -1
View File
@@ -192,7 +192,7 @@ class core_admin_renderer extends plugin_renderer_base {
$output .= $this->maturity_info($maturity);
$output .= $this->insecure_dataroot_warning($insecuredataroot);
$output .= $this->display_errors_warning($errorsdisplayed);
$output .= $this->cron_overdue_warning($errorsdisplayed);
$output .= $this->cron_overdue_warning($cronoverdue);
$output .= $this->db_problems($dbproblems);
$output .= $this->maintenance_mode_warning($maintenancemode);
+21
View File
@@ -67,6 +67,26 @@ if (optional_param('add', false, PARAM_BOOL) and confirm_sesskey()) {
}
}
} else if (optional_param('main', false, PARAM_BOOL) and confirm_sesskey()) {
if ($newmain = $admisselector->get_selected_users()) {
$newmain = reset($newmain);
$newmain = $newmain->id;
$admins = array();
foreach(explode(',', $CFG->siteadmins) as $admin) {
$admin = (int)$admin;
if ($admin) {
$admins[$admin] = $admin;
}
}
if (isset($admins[$newmain])) {
unset($admins[$newmain]);
array_unshift($admins, $newmain);
set_config('siteadmins', implode(',', $admins));
redirect($PAGE->url);
}
}
} else if ($confirmadd and confirm_sesskey()) {
$admins = array();
foreach(explode(',', $CFG->siteadmins) as $admin) {
@@ -115,6 +135,7 @@ echo $OUTPUT->header();
<p class="arrow_button">
<input name="add" id="add" type="submit" value="<?php echo $OUTPUT->larrow().'&nbsp;'.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').'&nbsp;'.$OUTPUT->rarrow(); ?>" title="<?php print_string('remove'); ?>" />
<input name="main" id="main" type="submit" value="<?php echo get_string('mainadminset', 'role'); ?>" title="<?php print_string('mainadminset', 'role'); ?>" />
</p>
</td>
<td id='potentialcell'>
+23 -5
View File
@@ -1584,13 +1584,31 @@ class admins_existing_selector extends user_selector_base {
return array();
}
if ($search) {
$groupname = get_string('extusersmatching', 'role', $search);
} else {
$groupname = get_string('extusers', 'role');
$mainadmin = array();
$adminids = explode(',', $CFG->siteadmins);
foreach ($adminids as $id) {
if (isset($availableusers[$id])) {
$mainadmin = array($id=>$availableusers[$id]);
unset($availableusers[$id]);
break;
}
}
return array($groupname => $availableusers);
$result = array();
if ($mainadmin) {
$result[get_string('mainadmin', 'role')] = $mainadmin;
}
if ($availableusers) {
if ($search) {
$groupname = get_string('extusersmatching', 'role', $search);
} else {
$groupname = get_string('extusers', 'role');
}
$result[$groupname] = $availableusers;
}
return $result;
}
protected function get_options() {
+1 -1
View File
@@ -98,13 +98,13 @@ if (empty($SITE->fullname)) {
$url->param('adminedit', 'on');
}
$buttons = $OUTPUT->single_button($url, $caption, 'get');
$PAGE->set_button($buttons);
}
$visiblepathtosection = array_reverse($settingspage->visiblepath);
$PAGE->set_title("$SITE->shortname: " . implode(": ",$visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
$PAGE->set_button($buttons);
echo $OUTPUT->header();
if ($errormsg !== '') {
+3
View File
@@ -22,6 +22,9 @@ if (isset($CFG->mnet_dispatcher_mode) and $CFG->mnet_dispatcher_mode !== 'off')
$hosts = mnet_get_hosts();
foreach ($hosts as $host) {
if ($host->id == $CFG->mnet_all_hosts_id) {
$host->name = get_string('allhosts', 'core_mnet');
}
$ADMIN->add('mnetpeercat',
new admin_externalpage(
'mnetpeer' . $host->id,
+2
View File
@@ -16,6 +16,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('protectusernames', get_string('protectusernames', 'admin'), get_string('configprotectusernames', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forcelogin', get_string('forcelogin', 'admin'), get_string('configforcelogin', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('forceloginforprofiles', get_string('forceloginforprofiles', 'admin'), get_string('configforceloginforprofiles', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('forceloginforprofileimage', get_string('forceloginforprofileimage', 'admin'), get_string('forceloginforprofileimage_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('opentogoogle', get_string('opentogoogle', 'admin'), get_string('configopentogoogle', 'admin'), 0));
$temp->add(new admin_setting_pickroles('profileroles',
get_string('profileroles','admin'),
@@ -81,6 +82,7 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$temp->add(new admin_setting_configcheckbox('cookiesecure', get_string('cookiesecure', 'admin'), get_string('configcookiesecure', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('cookiehttponly', get_string('cookiehttponly', 'admin'), get_string('configcookiehttponly', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('allowframembedding', get_string('allowframembedding', 'admin'), get_string('allowframembedding_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('loginpasswordautocomplete', get_string('loginpasswordautocomplete', 'admin'), get_string('loginpasswordautocomplete_help', 'admin'), 0));
$ADMIN->add('security', $temp);
+3 -1
View File
@@ -127,7 +127,9 @@ if ($hassiteconfig
'firstaccess' => get_string('firstaccess'),
'lastaccess' => get_string('lastaccess'),
'mycourses' => get_string('mycourses'),
'groups' => get_string('groups'))));
'groups' => get_string('groups'),
'suspended' => get_string('suspended', 'auth'),
)));
// Select fields to display as part of user identity (only to those
// with moodle/site:viewuseridentity).
+2 -1
View File
@@ -29,7 +29,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
@@ -57,6 +57,8 @@ class database_transfer_form extends moodleform {
$mform->addElement('text', 'dbuser', get_string('user'));
$mform->addElement('text', 'dbpass', get_string('password'));
$mform->addElement('text', 'prefix', get_string('dbprefix', 'install'));
$mform->addElement('text', 'dbport', get_string('dbport', 'install'));
$mform->addElement('text', 'dbsocket', get_string('databasesocket', 'install'));
$mform->addRule('dbhost', get_string('required'), 'required', null);
$mform->addRule('dbname', get_string('required'), 'required', null);
+8 -1
View File
@@ -40,7 +40,14 @@ if ($data = $form->get_data()) {
// Connect to the other database.
list($dbtype, $dblibrary) = explode('/', $data->driver);
$targetdb = moodle_database::get_driver_instance($dbtype, $dblibrary);
if (!$targetdb->connect($data->dbhost, $data->dbuser, $data->dbpass, $data->dbname, $data->prefix, null)) {
$dboptions = array();
if ($data->dbport) {
$dboptions['dbport'] = $data->dbport;
}
if ($data->dbsocket) {
$dboptions['dbsocket'] = $data->dbsocket;
}
if (!$targetdb->connect($data->dbhost, $data->dbuser, $data->dbpass, $data->dbname, $data->prefix, $dboptions)) {
throw new dbtransfer_exception('notargetconectexception', null, "$CFG->wwwroot/$CFG->admin/tool/dbtransfer/");
}
if ($targetdb->get_tables()) {
+1 -7
View File
@@ -25,13 +25,7 @@
ob_start(); //for whitespace test
require('../../../config.php');
// extra whitespace test - intentionally breaks cookieless mode
$extraws = '';
while (ob_get_level()) {
$extraws .= ob_get_contents();
ob_end_clean();
}
$extraws = ob_get_clean();
require_once($CFG->libdir.'/adminlib.php');
+1 -1
View File
@@ -178,7 +178,7 @@ abstract class tool_qeupgradehelper_quiz_list {
html_writer::link(new moodle_url('/course/view.php',
array('id' => $quizinfo->courseid)), format_string($quizinfo->shortname)),
html_writer::link(new moodle_url('/mod/quiz/view.php',
array('id' => $quizinfo->name)), format_string($quizinfo->name)),
array('q' => $quizinfo->id)), format_string($quizinfo->name)),
$quizinfo->attemptcount,
$quizinfo->questionattempts ? $quizinfo->questionattempts : 0,
);
+51 -2
View File
@@ -157,21 +157,54 @@ function search_spammers($keywords) {
$params['descpat'.$i] = "%$keyword%";
$keywordfull2[] = $DB->sql_like('p.summary', ':sumpat'.$i, false);
$params['sumpat'.$i] = "%$keyword%";
$keywordfull3[] = $DB->sql_like('p.subject', ':subpat'.$i, false);
$params['subpat'.$i] = "%$keyword%";
$keywordfull4[] = $DB->sql_like('c.content', ':contpat'.$i, false);
$params['contpat'.$i] = "%$keyword%";
$keywordfull5[] = $DB->sql_like('m.fullmessage', ':msgpat'.$i, false);
$params['msgpat'.$i] = "%$keyword%";
$keywordfull6[] = $DB->sql_like('fp.message', ':forumpostpat'.$i, false);
$params['forumpostpat'.$i] = "%$keyword%";
$keywordfull7[] = $DB->sql_like('fp.subject', ':forumpostsubpat'.$i, false);
$params['forumpostsubpat'.$i] = "%$keyword%";
$i++;
}
$conditions = '( '.implode(' OR ', $keywordfull).' )';
$conditions2 = '( '.implode(' OR ', $keywordfull2).' )';
$conditions3 = '( '.implode(' OR ', $keywordfull3).' )';
$conditions4 = '( '.implode(' OR ', $keywordfull4).' )';
$conditions5 = '( '.implode(' OR ', $keywordfull5).' )';
$conditions6 = '( '.implode(' OR ', $keywordfull6).' )';
$conditions7 = '( '.implode(' OR ', $keywordfull7).' )';
$sql = "SELECT * FROM {user} WHERE deleted = 0 AND id <> :userid AND $conditions"; // Exclude oneself
$sql2 = "SELECT u.*, p.summary FROM {user} AS u, {post} AS p WHERE $conditions2 AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
$sql3 = "SELECT u.*, p.subject as postsubject FROM {user} AS u, {post} AS p WHERE $conditions3 AND u.deleted = 0 AND u.id=p.userid AND u.id <> :userid";
$sql4 = "SELECT u.*, c.content FROM {user} AS u, {comments} AS c WHERE $conditions4 AND u.deleted = 0 AND u.id=c.userid AND u.id <> :userid";
$sql5 = "SELECT u.*, m.fullmessage FROM {user} AS u, {message} AS m WHERE $conditions5 AND u.deleted = 0 AND u.id=m.useridfrom AND u.id <> :userid";
$sql6 = "SELECT u.*, fp.message FROM {user} AS u, {forum_posts} AS fp WHERE $conditions6 AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
$sql7 = "SELECT u.*, fp.subject FROM {user} AS u, {forum_posts} AS fp WHERE $conditions7 AND u.deleted = 0 AND u.id=fp.userid AND u.id <> :userid";
$spamusers_desc = $DB->get_recordset_sql($sql, $params);
$spamusers_blog = $DB->get_recordset_sql($sql2, $params);
$spamusers_blogsub = $DB->get_recordset_sql($sql3, $params);
$spamusers_comment = $DB->get_recordset_sql($sql4, $params);
$spamusers_message = $DB->get_recordset_sql($sql5, $params);
$spamusers_forumpost = $DB->get_recordset_sql($sql6, $params);
$spamusers_forumpostsub = $DB->get_recordset_sql($sql7, $params);
$keywordlist = implode(', ', $keywords);
echo $OUTPUT->box(get_string('spamresult', 'tool_spamcleaner').s($keywordlist)).' ...';
print_user_list(array($spamusers_desc, $spamusers_blog), $keywords);
print_user_list(array($spamusers_desc,
$spamusers_blog,
$spamusers_blogsub,
$spamusers_comment,
$spamusers_message,
$spamusers_forumpost,
$spamusers_forumpostsub
),
$keywords);
}
@@ -212,7 +245,23 @@ function filter_user($user, $keywords, $count) {
if (isset($user->summary)) {
$user->description = '<h3>'.get_string('spamfromblog', 'tool_spamcleaner').'</h3>'.$user->summary;
unset($user->summary);
} else if (isset($user->postsubject)) {
$user->description = '<h3>'.get_string('spamfromblog', 'tool_spamcleaner').'</h3>'.$user->postsubject;
unset($user->postsubject);
} else if (isset($user->content)) {
$user->description = '<h3>'.get_string('spamfromcomments', 'tool_spamcleaner').'</h3>'.$user->content;
unset($user->content);
} else if (isset($user->fullmessage)) {
$user->description = '<h3>'.get_string('spamfrommessages', 'tool_spamcleaner').'</h3>'.$user->fullmessage;
unset($user->fullmessage);
} else if (isset($user->message)) {
$user->description = '<h3>'.get_string('spamfromforumpost', 'tool_spamcleaner').'</h3>'.$user->message;
unset($user->message);
} else if (isset($user->subject)) {
$user->description = '<h3>'.get_string('spamfromforumpost', 'tool_spamcleaner').'</h3>'.$user->subject;
unset($user->subject);
}
if (preg_match('#<img.*src=[\"\']('.$CFG->wwwroot.')#', $user->description, $matches)
&& $image_search) {
$result = false;
@@ -34,6 +34,9 @@ $string['spamdeleteconfirm'] = 'Are you sure you want to delete this entry? You
$string['spamdesc'] = 'Description';
$string['spameg'] = 'eg: casino, porn, xxx';
$string['spamfromblog'] = 'From blog post:';
$string['spamfromcomments'] = 'From comments:';
$string['spamfrommessages'] = 'From messages:';
$string['spamfromforumpost'] = 'From forum post:';
$string['spaminvalidresult'] = 'Unknown but invalid result';
$string['spamoperation'] = 'Operation';
$string['spamresult'] = 'Results of searching user profiles containing:';
+99 -51
View File
@@ -14,7 +14,8 @@
$ru = optional_param('ru', '2', PARAM_INT); // show remote users
$lu = optional_param('lu', '2', PARAM_INT); // show local users
$acl = optional_param('acl', '0', PARAM_INT); // id of user to tweak mnet ACL (requires $access)
$suspend = optional_param('suspend', 0, PARAM_INT);
$unsuspend = optional_param('unsuspend', 0, PARAM_INT);
admin_externalpage_setup('editusers');
@@ -29,6 +30,9 @@
$strdelete = get_string('delete');
$strdeletecheck = get_string('deletecheck');
$strshowallusers = get_string('showallusers');
$strsuspend = get_string('suspenduser', 'admin');
$strunsuspend = get_string('unsuspenduser', 'admin');
$strconfirm = get_string('confirm');
if (empty($CFG->loginhttps)) {
$securewwwroot = $CFG->wwwroot;
@@ -36,10 +40,11 @@
$securewwwroot = str_replace('http:','https:',$CFG->wwwroot);
}
$returnurl = "$CFG->wwwroot/$CFG->admin/user.php";
$returnurl = new moodle_url('/admin/user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage, 'page'=>$page));
if ($confirmuser and confirm_sesskey()) {
if (!$user = $DB->get_record('user', array('id'=>$confirmuser))) {
require_capability('moodle/user:update', $sitecontext);
if (!$user = $DB->get_record('user', array('id'=>$confirmuser, 'mnethostid'=>$CFG->mnet_localhost_id))) {
print_error('nousers');
}
@@ -55,10 +60,9 @@
}
} else if ($delete and confirm_sesskey()) { // Delete a selected user, after confirmation
require_capability('moodle/user:delete', $sitecontext);
$user = $DB->get_record('user', array('id'=>$delete), '*', MUST_EXIST);
$user = $DB->get_record('user', array('id'=>$delete, 'mnethostid'=>$CFG->mnet_localhost_id), '*', MUST_EXIST);
if (is_siteadmin($user->id)) {
print_error('useradminodelete', 'error');
@@ -69,7 +73,7 @@
$fullname = fullname($user, true);
echo $OUTPUT->heading(get_string('deleteuser', 'admin'));
$optionsyes = array('delete'=>$delete, 'confirm'=>md5($delete), 'sesskey'=>sesskey());
echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'$fullname'"), new moodle_url('user.php', $optionsyes), 'user.php');
echo $OUTPUT->confirm(get_string('deletecheckfull', '', "'$fullname'"), new moodle_url($returnurl, $optionsyes), $returnurl);
echo $OUTPUT->footer();
die;
} else if (data_submitted() and !$user->deleted) {
@@ -83,8 +87,7 @@
}
}
} else if ($acl and confirm_sesskey()) {
if (!has_capability('moodle/user:delete', $sitecontext)) {
// TODO: this should be under a separate capability
if (!has_capability('moodle/user:update', $sitecontext)) {
print_error('nopermissions', 'error', '', 'modify the NMET access control list');
}
if (!$user = $DB->get_record('user', array('id'=>$acl))) {
@@ -110,6 +113,36 @@
}
$mnethosts = $DB->get_records('mnet_host', null, 'id', 'id,wwwroot,name');
redirect($returnurl);
} else if ($suspend and confirm_sesskey()) {
require_capability('moodle/user:update', $sitecontext);
if ($user = $DB->get_record('user', array('id'=>$suspend, 'mnethostid'=>$CFG->mnet_localhost_id, 'deleted'=>0))) {
if (!is_siteadmin($user) and $USER->id != $user->id and $user->suspended != 1) {
$user->suspended = 1;
$user->timemodified = time();
$DB->set_field('user', 'suspended', $user->suspended, array('id'=>$user->id));
$DB->set_field('user', 'timemodified', $user->timemodified, array('id'=>$user->id));
// force logout
session_kill_user($user->id);
events_trigger('user_updated', $user);
}
}
redirect($returnurl);
} else if ($unsuspend and confirm_sesskey()) {
require_capability('moodle/user:update', $sitecontext);
if ($user = $DB->get_record('user', array('id'=>$unsuspend, 'mnethostid'=>$CFG->mnet_localhost_id, 'deleted'=>0))) {
if ($user->suspended != 0) {
$user->suspended = 0;
$user->timemodified = time();
$DB->set_field('user', 'suspended', $user->suspended, array('id'=>$user->id));
$DB->set_field('user', 'timemodified', $user->timemodified, array('id'=>$user->id));
events_trigger('user_updated', $user);
}
}
redirect($returnurl);
}
// create the user filter form
@@ -163,7 +196,7 @@
$strall = get_string('all');
$baseurl = new moodle_url('user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
$baseurl = new moodle_url('/admin/user.php', array('sort' => $sort, 'dir' => $dir, 'perpage' => $perpage));
echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl);
flush();
@@ -225,9 +258,7 @@
$table->align[] = 'left';
$table->head[] = $lastaccess;
$table->align[] = 'left';
$table->head[] = "";
$table->align[] = 'center';
$table->head[] = "";
$table->head[] = get_string('edit');
$table->align[] = 'center';
$table->head[] = "";
$table->align[] = 'center';
@@ -238,52 +269,65 @@
continue; // do not display guest here
}
if ($user->id == $USER->id or is_siteadmin($user)) {
$deletebutton = "";
} else {
if (has_capability('moodle/user:delete', $sitecontext)) {
$deletebutton = "<a href=\"user.php?delete=$user->id&amp;sesskey=".sesskey()."\">$strdelete</a>";
$buttons = array();
$lastcolumn = '';
// delete button
if (has_capability('moodle/user:delete', $sitecontext)) {
if (is_mnet_remote_user($user) or $user->id == $USER->id or is_siteadmin($user)) {
// no deleting of self, mnet accounts or admins allowed
} else {
$deletebutton ="";
$buttons[] = html_writer::link(new moodle_url($returnurl, array('delete'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/delete'), 'alt'=>$strdelete, 'class'=>'iconsmall')), array('title'=>$strdelete));
}
}
if (has_capability('moodle/user:update', $sitecontext) and (is_siteadmin($USER) or !is_siteadmin($user)) and !is_mnet_remote_user($user)) {
$editbutton = "<a href=\"$securewwwroot/user/editadvanced.php?id=$user->id&amp;course=$site->id\">$stredit</a>";
if ($user->confirmed == 0) {
$confirmbutton = "<a href=\"user.php?confirmuser=$user->id&amp;sesskey=".sesskey()."\">" . get_string('confirm') . "</a>";
// suspend button
if (has_capability('moodle/user:update', $sitecontext)) {
if (is_mnet_remote_user($user)) {
// mnet users have special access control, they can not be deleted the standard way or suspended
$accessctrl = 'allow';
if ($acl = $DB->get_record('mnet_sso_access_control', array('username'=>$user->username, 'mnet_host_id'=>$user->mnethostid))) {
$accessctrl = $acl->accessctrl;
}
$changeaccessto = ($accessctrl == 'deny' ? 'allow' : 'deny');
$buttons[] = " (<a href=\"?acl={$user->id}&amp;accessctrl=$changeaccessto&amp;sesskey=".sesskey()."\">".get_string($changeaccessto, 'mnet') . " access</a>)";
} else {
$confirmbutton = "";
}
} else {
$editbutton ="";
if ($user->confirmed == 0) {
$confirmbutton = "<span class=\"dimmed_text\">".get_string('confirm')."</span>";
} else {
$confirmbutton = "";
if ($user->suspended) {
$buttons[] = html_writer::link(new moodle_url($returnurl, array('unsuspend'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/show'), 'alt'=>$strunsuspend, 'class'=>'iconsmall')), array('title'=>$strunsuspend));
} else {
if ($user->id == $USER->id or is_siteadmin($user)) {
// no suspending of admins or self!
} else {
$buttons[] = html_writer::link(new moodle_url($returnurl, array('suspend'=>$user->id, 'sesskey'=>sesskey())), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/hide'), 'alt'=>$strsuspend, 'class'=>'iconsmall')), array('title'=>$strsuspend));
}
}
}
}
// for remote users, shuffle columns around and display MNET stuff
// edit button
if (has_capability('moodle/user:update', $sitecontext)) {
// prevent editing of admins by non-admins
if (is_siteadmin($USER) or !is_siteadmin($user)) {
$buttons[] = html_writer::link(new moodle_url($securewwwroot.'/user/editadvanced.php', array('id'=>$user->id, 'course'=>$site->id)), html_writer::empty_tag('img', array('src'=>$OUTPUT->pix_url('t/edit'), 'alt'=>$stredit, 'class'=>'iconsmall')), array('title'=>$stredit));
}
}
// the last column - confirm or mnet info
if (is_mnet_remote_user($user)) {
$accessctrl = 'allow';
if ($acl = $DB->get_record('mnet_sso_access_control', array('username'=>$user->username, 'mnet_host_id'=>$user->mnethostid))) {
$accessctrl = $acl->accessctrl;
}
$changeaccessto = ($accessctrl == 'deny' ? 'allow' : 'deny');
// delete button in confirm column - remote users should already be confirmed
// TODO: no delete for remote users, for now. new userid, delete flag, unique on username/host...
$confirmbutton = "";
// ACL in delete column
$deletebutton = get_string($accessctrl, 'mnet');
if (has_capability('moodle/user:delete', $sitecontext)) {
// TODO: this should be under a separate capability
$deletebutton .= " (<a href=\"?acl={$user->id}&amp;accessctrl=$changeaccessto&amp;sesskey=".sesskey()."\">"
. get_string($changeaccessto, 'mnet') . " access</a>)";
}
// mnet info in edit column
// all mnet users are confirmed, let's print just the name of the host there
if (isset($mnethosts[$user->mnethostid])) {
$editbutton = $mnethosts[$user->mnethostid]->name;
$lastcolumn = get_string($accessctrl, 'mnet').': '.$mnethosts[$user->mnethostid]->name;
} else {
$lastcolumn = get_string($accessctrl, 'mnet');
}
} else if ($user->confirmed == 0) {
if (has_capability('moodle/user:update', $sitecontext)) {
$lastcolumn = html_writer::link(new moodle_url($returnurl, array('confirmuser'=>$user->id, 'sesskey'=>sesskey())), $strconfirm);
} else {
$lastcolumn = "<span class=\"dimmed_text\">".get_string('confirm')."</span>";
}
}
@@ -302,9 +346,13 @@
$row[] = $user->city;
$row[] = $user->country;
$row[] = $strlastaccess;
$row[] = $editbutton;
$row[] = $deletebutton;
$row[] = $confirmbutton;
if ($user->suspended) {
foreach ($row as $k=>$v) {
$row[$k] = html_writer::tag('span', $v, array('class'=>'usersuspended'));
}
}
$row[] = implode(' ', $buttons);
$row[] = $lastcolumn;
$table->data[] = $row;
}
}
+59 -11
View File
@@ -179,7 +179,7 @@ class external_service_functions_form extends moodleform {
class web_service_token_form extends moodleform {
function definition() {
global $USER, $DB;
global $USER, $DB, $CFG;
$mform = $this->_form;
$data = $this->_customdata;
@@ -187,16 +187,28 @@ class web_service_token_form extends moodleform {
$mform->addElement('header', 'token', get_string('token', 'webservice'));
if (empty($data->nouserselection)) {
//user searchable selector - get all users (admin and guest included)
$sql = "SELECT u.id, u.firstname, u.lastname
FROM {user} u
ORDER BY u.lastname";
$users = $DB->get_records_sql($sql, array());
$options = array();
foreach ($users as $userid => $user) {
$options[$userid] = $user->firstname . " " . $user->lastname;
//check if the number of user is reasonable to be displayed in a select box
$usertotal = $DB->count_records('user',
array('deleted' => 0, 'suspended' => 0, 'confirmed' => 1));
if ($usertotal < 500) {
//user searchable selector - get all users (admin and guest included)
//user must be confirmed, not deleted, not suspended, not guest
$sql = "SELECT u.id, u.firstname, u.lastname
FROM {user} u
WHERE u.deleted = 0 AND u.confirmed = 1 AND u.suspended = 0 AND u.id != ?
ORDER BY u.lastname";
$users = $DB->get_records_sql($sql, array($CFG->siteguest));
$options = array();
foreach ($users as $userid => $user) {
$options[$userid] = $user->firstname . " " . $user->lastname;
}
$mform->addElement('searchableselector', 'user', get_string('user'), $options);
} else {
//simple text box for username or user id (if two username exists, a form error is displayed)
$mform->addElement('text', 'user', get_string('usernameorid', 'webservice'));
}
$mform->addElement('searchableselector', 'user', get_string('user'), $options);
$mform->addRule('user', get_string('required'), 'required', null, 'client');
}
@@ -230,8 +242,44 @@ class web_service_token_form extends moodleform {
$this->set_data($data);
}
function validation($data, $files) {
function get_data() {
global $DB;
$data = parent::get_data();
if (!empty($data) && !is_numeric($data->user)) {
//retrieve username
$user = $DB->get_record('user', array('username' => $data->user), 'id');
$data->user = $user->id;
}
return $data;
}
function validation(&$data, $files) {
global $DB;
$errors = parent::validation($data, $files);
if (is_numeric($data['user'])) {
$searchtype = 'id';
} else {
$searchtype = 'username';
//check the username is valid
if (clean_param($data['user'], PARAM_USERNAME) != $data['user']) {
$errors['user'] = get_string('invalidusername');
}
}
if (!isset($errors['user'])) {
$users = $DB->get_records('user', array($searchtype => $data['user']), '', 'id');
//check that the user exists in the database
if (count($users) == 0) {
$errors['user'] = get_string('usernameoridnousererror', 'webservice');
} else if (count($users) > 1) { //can only be a username search as id are unique
$errors['user'] = get_string('usernameoridoccurenceerror', 'webservice');
}
}
return $errors;
}
+6
View File
@@ -71,6 +71,12 @@ switch ($action) {
}
}
//check if the user is deleted. unconfirmed, suspended or guest
$user = $DB->get_record('user', array('id' => $data->user));
if ($user->id == $CFG->siteguest or $user->deleted or !$user->confirmed or $user->suspended) {
throw new moodle_exception('forbiddenwsuser', 'webservice');
}
//process the creation
if (empty($errormsg)) {
//TODO improvement: either move this function from externallib.php to webservice/lib.php
+1 -1
View File
@@ -520,7 +520,7 @@ $yesno = array(get_string('no'), get_string('yes'));
<?php echo html_writer::select($yesno, 'ntlmsso_ie_fastpath', $config->ntlmsso_ie_fastpath, false); ?>
</td>
<td>
<?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
<?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
</td>
</tr>
<tr valign="top">
+3
View File
@@ -48,5 +48,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+3
View File
@@ -46,5 +46,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+5 -5
View File
@@ -278,8 +278,8 @@ just before the <MetadataProvider> element.
--
<Notify
Channel="back"
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
Channel="back"
Location="https://#YOUR_MOODLE_HOSTNAME#/moodle/auth/shibboleth/logout.php" />
--
Then restart the Shibboleth daemon and check the log file for errors. If there
@@ -300,9 +300,9 @@ Requirements:
--
<Directory /path/to/moodle/auth/shibboleth/logout.php>
AuthType shibboleth
ShibRequireSession Off
require shibboleth
AuthType shibboleth
ShibRequireSession Off
require shibboleth
</Directory>
--
When using IIS, the same can be achieved by something like:
+4 -4
View File
@@ -42,12 +42,12 @@ $PAGE->https_required();
set_saml_cookie($selectedIdP);
// Redirect to SessionInitiator with entityID as argument
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])){
if (isset($IdPs[$selectedIdP][1]) && !empty($IdPs[$selectedIdP][1])) {
// For Shibbolet 1.x Service Providers
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
header('Location: '.$IdPs[$selectedIdP][1].'?providerId='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
// For Shibbolet 2.x Service Providers
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
// For Shibbolet 2.x Service Providers
// header('Location: '.$IdPs[$selectedIdP][1].'?entityID='. urlencode($selectedIdP) .'&target='. urlencode($CFG->wwwroot.'/auth/shibboleth/index.php'));
} else {
// For Shibbolet 1.x Service Providers
+1 -1
View File
@@ -379,7 +379,7 @@ class cc2moodle {
if (!empty($CFG->defaultblocks)) {
$blocknames = $CFG->defaultblocks;
} else {
$blocknames = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
$blocknames = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
}
}
+5 -7
View File
@@ -208,9 +208,8 @@ class entities {
if (!empty($files)) {
foreach ($files as $file) {
$source = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
$destination = $destination_folder . DIRECTORY_SEPARATOR . $file->nodeValue;
$source = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $file;
$destination = $destination_folder . DIRECTORY_SEPARATOR . $file;
$destination_directory = dirname($destination);
@@ -251,10 +250,9 @@ class entities {
if (in_array($ext, array('html', 'htm', 'xhtml'))) {
continue;
}
$all_files[] = $file;
$all_files[] = $file->nodeValue;
}
}
unset($files);
}
@@ -264,8 +262,8 @@ class entities {
if (!empty($labels) && ($labels->length > 0)) {
$tname = 'course_files';
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
$fpath = $dpath . DIRECTORY_SEPARATOR . 'folder.gif';
$rfpath = $tname.'/folder.gif';
$rfpath = 'folder.gif';
$fpath = $dpath . DIRECTORY_SEPARATOR . $rfpath;
if (!file_exists($dpath)) {
mkdir($dpath);
+2 -2
View File
@@ -51,7 +51,7 @@ class entities11 extends entities {
if (in_array($ext, array('html', 'htm', 'xhtml'))) {
continue;
}
$all_files[] = $file;
$all_files[] = $file->nodeValue;
}
unset($files);
}
@@ -62,8 +62,8 @@ class entities11 extends entities {
if (!empty($labels) && ($labels->length > 0)) {
$tname = 'course_files';
$dpath = cc2moodle::$path_to_manifest_folder . DIRECTORY_SEPARATOR . $tname;
$rfpath = 'folder.gif';
$fpath = $dpath . DIRECTORY_SEPARATOR . 'folder.gif';
$rfpath = $tname.'/folder.gif';
if (!file_exists($dpath)) {
mkdir($dpath);
}
+18
View File
@@ -276,6 +276,7 @@ class cc_quiz extends entities {
'[#question_text#]',
'[#question_type#]',
'[#question_general_feedback#]',
'[#question_defaultgrade#]',
'[#date_now#]',
'[#question_type_nodes#]',
'[#question_stamp#]',
@@ -308,6 +309,7 @@ class cc_quiz extends entities {
self::safexml($question['title']),
$question_moodle_type,
self::safexml($question['feedback']),
$question['defaultgrade'], //default grade
time(),
$question_type_node,
$quiz_stamp,
@@ -368,6 +370,7 @@ class cc_quiz extends entities {
$questions[$question_identifier]['moodle_type'] = $question_type['moodle'];
$questions[$question_identifier]['cc_type'] = $question_type['cc'];
$questions[$question_identifier]['feedback'] = $this->get_general_feedback($assessment, $question_identifier);
$questions[$question_identifier]['defaultgrade'] = $this->get_defaultgrade($assessment, $question_identifier);
$questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id);
}
@@ -395,6 +398,21 @@ class cc_quiz extends entities {
}
}
private function get_defaultgrade($assessment, $question_identifier) {
$result = 1;
$xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns());
$query = '//xmlns:item[@ident="' . $question_identifier . '"]';
$query .= '//xmlns:qtimetadatafield[xmlns:fieldlabel="cc_weighting"]/xmlns:fieldentry';
$defgrade = $xpath->query($query);
if (!empty($defgrade) && ($defgrade->length > 0)) {
$resp = (int)$defgrade->item(0)->nodeValue;
if ($resp >= 0 && $resp <= 99) {
$result = $resp;
}
}
return $result;
}
private function get_general_feedback ($assessment, $question_identifier) {
$xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns());
+18
View File
@@ -276,6 +276,7 @@ class cc11_quiz extends entities11 {
'[#question_text#]',
'[#question_type#]',
'[#question_general_feedback#]',
'[#question_defaultgrade#]',
'[#date_now#]',
'[#question_type_nodes#]',
'[#question_stamp#]',
@@ -308,6 +309,7 @@ class cc11_quiz extends entities11 {
self::safexml($question['title']),
$question_moodle_type,
self::safexml($question['feedback']),
$question['defaultgrade'],
time(),
$question_type_node,
$quiz_stamp,
@@ -368,6 +370,7 @@ class cc11_quiz extends entities11 {
$questions[$question_identifier]['moodle_type'] = $question_type['moodle'];
$questions[$question_identifier]['cc_type'] = $question_type['cc'];
$questions[$question_identifier]['feedback'] = $this->get_general_feedback($assessment, $question_identifier);
$questions[$question_identifier]['defaultgrade'] = $this->get_defaultgrade($assessment, $question_identifier);
$questions[$question_identifier]['answers'] = $this->get_answers($question_identifier, $assessment, $last_answer_id);
}
@@ -395,6 +398,21 @@ class cc11_quiz extends entities11 {
}
}
private function get_defaultgrade($assessment, $question_identifier) {
$result = 1;
$xpath = cc2moodle::newx_path($assessment, cc2moodle::getquizns());
$query = '//xmlns:item[@ident="' . $question_identifier . '"]';
$query .= '//xmlns:qtimetadatafield[xmlns:fieldlabel="cc_weighting"]/xmlns:fieldentry';
$defgrade = $xpath->query($query);
if (!empty($defgrade) && ($defgrade->length > 0)) {
$resp = (int)$defgrade->item(0)->nodeValue;
if ($resp >= 0 && $resp <= 99) {
$result = $resp;
}
}
return $result;
}
private function get_general_feedback ($assessment, $question_identifier) {
$xpath = cc112moodle::newx_path($assessment, cc112moodle::getquizns());
@@ -6,7 +6,7 @@
<QUESTIONTEXTFORMAT>1</QUESTIONTEXTFORMAT>
<IMAGE></IMAGE>
<GENERALFEEDBACK>[#question_general_feedback#]</GENERALFEEDBACK>
<DEFAULTGRADE>1</DEFAULTGRADE>
<DEFAULTGRADE>[#question_defaultgrade#]</DEFAULTGRADE>
<PENALTY>0</PENALTY>
<QTYPE>[#question_type#]</QTYPE>
<LENGTH>1</LENGTH>
@@ -293,6 +293,14 @@ class backup_controller extends backup implements loggable {
// Basic/initial prevention against time/memory limits
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
raise_memory_limit(MEMORY_EXTRA);
// If this is not a course backup, inform the plan we are not
// including all the activities for sure. This will affect any
// task/step executed conditionally to stop including information
// for section and activity backup. MDL-28180.
if ($this->get_type() !== backup::TYPE_1COURSE) {
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
$this->plan->set_excluding_activities();
}
return $this->plan->execute();
}
@@ -299,6 +299,14 @@ class restore_controller extends backup implements loggable {
// Basic/initial prevention against time/memory limits
set_time_limit(1 * 60 * 60); // 1 hour for 1 course initially granted
raise_memory_limit(MEMORY_EXTRA);
// If this is not a course restore, inform the plan we are not
// including all the activities for sure. This will affect any
// task/step executed conditionally to stop processing information
// for section and activity restore. MDL-28180.
if ($this->get_type() !== backup::TYPE_1COURSE) {
$this->log('notifying plan about excluded activities by type', backup::LOG_DEBUG);
$this->plan->set_excluding_activities();
}
return $this->plan->execute();
}
+1 -1
View File
@@ -99,7 +99,7 @@ class imscc1_converter extends base_converter {
$manifestdir = dirname($manifest);
$cc2moodle = new cc2moodle($manifest);
if ($cc2moodle->is_auth()) {
throw new imscc1_convert_exception('Protected cartridge content - Skipping import!');
throw new imscc1_convert_exception('protected_cc_not_supported');
}
$status = $cc2moodle->generate_moodle_xml();
//Final cleanup
+1 -1
View File
@@ -99,7 +99,7 @@ class imscc11_converter extends base_converter {
$manifestdir = dirname($manifest);
$cc112moodle = new cc112moodle($manifest);
if ($cc112moodle->is_auth()) {
throw new imscc11_convert_exception('Protected cartridge content - Skipping import!');
throw new imscc11_convert_exception('protected_cc_not_supported');
}
$status = $cc112moodle->generate_moodle_xml();
//Final cleanup
+1 -1
View File
@@ -8,4 +8,4 @@
require_capability('moodle/backup:backupcourse', get_context_instance(CONTEXT_SYSTEM));
redirect("$CFG->wwwroot/$CFG->admin/report/backups/index.php", '', 'admin', 1);
redirect("$CFG->wwwroot/report/backups/index.php", '', 'admin', 1);
+13 -8
View File
@@ -1805,15 +1805,20 @@ class restore_course_completion_structure_step extends restore_structure_step {
$data->course = $this->get_courseid();
$params = array(
'course' => $data->course,
'criteriatype' => $data->criteriatype,
'method' => $data->method,
'value' => $data->value,
);
$DB->insert_record('course_completion_aggr_methd', $params);
// Only create the course_completion_aggr_methd records if
// the target course has not them defined. MDL-28180
if (!$DB->record_exists('course_completion_aggr_methd', array(
'course' => $data->course,
'criteriatype' => $data->criteriatype))) {
$params = array(
'course' => $data->course,
'criteriatype' => $data->criteriatype,
'method' => $data->method,
'value' => $data->value,
);
$DB->insert_record('course_completion_aggr_methd', $params);
}
}
}
@@ -195,7 +195,7 @@ abstract class backup_cron_automated_helper {
//Reference
if ($haserrors) {
$message .= " ".get_string('backupfailed')."\n\n";
$dest_url = "$CFG->wwwroot/$CFG->admin/report/backups/index.php";
$dest_url = "$CFG->wwwroot/report/backups/index.php";
$message .= " ".get_string('backuptakealook','',$dest_url)."\n\n";
//Set message priority
$admin->priority = 1;
+1
View File
@@ -44,6 +44,7 @@ class backup_plan extends base_plan implements loggable {
}
$this->controller = $controller;
$this->basepath = $CFG->tempdir . '/backup/' . $controller->get_backupid();
$this->excludingdactivities = false;
parent::__construct('backup_plan');
}
@@ -49,7 +49,7 @@ abstract class backup_setting extends base_setting implements checksumable {
/**
* Returns the level of the setting
*
*
* @return {int} One of the above constants
*/
public function get_level() {
@@ -145,7 +145,7 @@ class setting_test extends UnitTestCase {
$this->assertEqual($e->errorcode, 'incorrect_object_passed');
}
restore_error_handler();
// Try to change value of locked setting by permission
$bs = new mock_base_setting('test', base_setting::IS_BOOLEAN, null, null, base_setting::LOCKED_BY_PERMISSION);
try {
@@ -448,4 +448,4 @@ function backup_setting_error_handler($errno, $errstr, $errfile, $errline, $errc
return false;
}
throw new backup_setting_exception('incorrect_object_passed');
}
}
@@ -47,7 +47,7 @@ class backup_optigroup extends base_optigroup implements processable {
public function add_child($element) {
if (!($element instanceof backup_optigroup_element)) { // parameter must be backup_optigroup_element
if (is_object($element)) {
$found = get_class($element);
$found = get_class($element);
} else {
$found = 'non object';
}
+2 -2
View File
@@ -137,7 +137,7 @@ class backup_ui extends base_ui {
*/
public function get_progress_bar() {
global $PAGE;
$stage = self::STAGE_COMPLETE;
$currentstage = $this->stage->get_stage();
$items = array();
@@ -190,4 +190,4 @@ class backup_ui extends base_ui {
/**
* Backup user interface exception. Modelled off the backup_exception class
*/
class backup_ui_exception extends base_ui_exception {}
class backup_ui_exception extends base_ui_exception {}
+11 -11
View File
@@ -16,7 +16,7 @@ M.core_backup_files_tree = {
// XXX: the id in params['contextid'] is current context
// request file list, so should be user context
params['contextid'] = this.usercontextid;
}
}
var scope = this;
params['sesskey']=M.cfg.sesskey;
var cfg = {
@@ -38,14 +38,14 @@ M.core_backup_files_tree = {
var n = new YAHOO.widget.TextNode(info, node, false);
YAHOO.util.Event.addListener(n.labelElId, "click", function(e) {
YAHOO.util.Event.preventDefault(e);
});
});
n.isLeaf = false;
} else {
var params = data[i].params;
if (params['filearea'] == 'backup' && params['component'] == 'user') {
// XXX: display the restore link, so should be context id
params['contextid'] = scope.currentcontextid;
}
}
params.action = 'choosebackupfile';
var restoreurl = M.cfg.wwwroot+'/backup/restorefile.php?'+build_querystring(params);
var info = {label: data[i].filename, 'href': data[i].url, 'restoreurl': restoreurl};
@@ -89,14 +89,14 @@ M.core_backup_files_tree = {
// prevent link
YAHOO.util.Event.addListener(node.labelElId, "click", function(e) {
YAHOO.util.Event.preventDefault(e);
});
});
} else {
node.isLeaf = true;
}
}
tree.render();
this.y3 = Y;
},
},
dynload: function(node, oncompletecb) {
M.core_backup_files_tree.request(node.href, node, oncompletecb);
},
@@ -115,7 +115,7 @@ M.core_backup_files_tree = {
YAHOO.widget.RestoreNode = function(oData, oParent, expanded) {
if (oData) {
if (oData) {
if (YAHOO.lang.isString(oData)) {
oData = { label: oData };
}
@@ -132,10 +132,10 @@ YAHOO.extend(YAHOO.widget.RestoreNode, YAHOO.widget.TextNode, {
href: null,
target: "_blank",
_type: "RestoreNode",
setUpLabel: function(oData) {
setUpLabel: function(oData) {
if (YAHOO.lang.isString(oData)) {
oData = {
label: oData
oData = {
label: oData
};
} else {
if (oData.style) {
@@ -147,7 +147,7 @@ YAHOO.extend(YAHOO.widget.RestoreNode, YAHOO.widget.TextNode, {
this.restoreurl = oData.restoreurl;
this.labelElId = "ygtvlabelel" + this.index;
},
getContentHtml: function() {
getContentHtml: function() {
var sb = [];
sb[sb.length] = '<a';
sb[sb.length] = ' id="' + this.labelElId + '"';
@@ -155,7 +155,7 @@ YAHOO.extend(YAHOO.widget.RestoreNode, YAHOO.widget.TextNode, {
if (this.href) {
sb[sb.length] = ' href="' + this.href + '"';
sb[sb.length] = ' target="' + this.target + '"';
}
}
if (this.title) {
sb[sb.length] = ' title="' + this.title + '"';
}
+2 -2
View File
@@ -4,7 +4,7 @@ YUI.add('moodle-backup-confirmcancel', function(Y) {
M.core_backup = M.core_backup || {};
/**
* Adds confirmation dialogues to the cancel buttons on the page.
*
*
* @param {object} config
*/
M.core_backup.watch_cancel_buttons = function(config) {
@@ -27,4 +27,4 @@ M.core_backup.watch_cancel_buttons = function(config) {
});
}
}, '@VERSION@', {'requires':['base','node','node-event-simulate','moodle-enrol-notification']});
}, '@VERSION@', {'requires':['base','node','node-event-simulate','moodle-enrol-notification']});
+3
View File
@@ -76,5 +76,8 @@ function xmldb_block_community_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
-7
View File
@@ -31,13 +31,6 @@ YUI.add('moodle-block_community-comments', function(Y) {
this.overlays[commentid].render();
this.overlays[commentid].hide();
// position the overlay in the middle of the web browser window
var WidgetPositionAlign = Y.WidgetPositionAlign;
this.overlays[commentid].set("align", {
node:"", //empty => viewport
points:[WidgetPositionAlign.CC, WidgetPositionAlign.CC]
});
Y.one('#comments-'+commentid).on('click', this.show, this, commentid);
}
+1 -1
View File
@@ -219,7 +219,7 @@ class block_edit_form extends moodleform {
$mform->addHelpButton('bui_defaultweight', 'defaultweight', 'block');
// Where this block is positioned on this page.
$mform->addElement('header', 'whereheader', get_string('onthispage', 'block'));
$mform->addElement('header', 'onthispage', get_string('onthispage', 'block'));
$mform->addElement('selectyesno', 'bui_visible', get_string('visible', 'block'));
+3
View File
@@ -66,5 +66,8 @@ function xmldb_block_html_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1
View File
@@ -39,6 +39,7 @@ class block_html_edit_form extends block_edit_form {
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean'=>true, 'context'=>$this->block->context);
$mform->addElement('editor', 'config_text', get_string('configcontent', 'block_html'), null, $editoroptions);
$mform->addRule('config_text', null, 'required', null, 'client');
$mform->setType('config_text', PARAM_RAW); // XSS is prevented when printing the block contents and serving files
}
+9 -2
View File
@@ -35,6 +35,12 @@ class block_login extends block_base {
// TODO: now that we have multiauth it is hard to find out if there is a way to change password
$forgot = $wwwroot . '/login/forgot_password.php';
if (empty($CFG->xmlstrictheaders) and !empty($CFG->loginpasswordautocomplete)) {
$autocomplete = 'autocomplete="off"';
} else {
$autocomplete = '';
}
$username = get_moodle_cookie();
$this->content->footer = '';
@@ -42,13 +48,14 @@ class block_login extends block_base {
if (!isloggedin() or isguestuser()) { // Show the block
$this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.get_login_url().'">';
$this->content->text .= "\n".'<form class="loginform" id="login" method="post" action="'.get_login_url().'" '.$autocomplete.'>';
$this->content->text .= '<div class="c1 fld username"><label for="login_username">'.get_string('username').'</label>';
$this->content->text .= '<input type="text" name="username" id="login_username" value="'.s($username).'" /></div>';
$this->content->text .= '<div class="c1 fld password"><label for="login_password">'.get_string('password').'</label>';
$this->content->text .= '<input type="password" name="password" id="login_password" value="" /></div>';
$this->content->text .= '<input type="password" name="password" id="login_password" value="" '.$autocomplete.' /></div>';
if (isset($CFG->rememberusername) and $CFG->rememberusername == 2) {
$checked = $username ? 'checked="checked"' : '';
+3
View File
@@ -75,5 +75,8 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+3
View File
@@ -75,5 +75,8 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+7 -9
View File
@@ -134,27 +134,25 @@ class blog_edit_form extends moodleform {
// validate course association
if (!empty($data['courseassoc']) && has_capability('moodle/blog:associatecourse', $sitecontext)) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $data['courseassoc']);
$coursecontext = context::instance_by_id($data['courseassoc'], IGNORE_MISSING);
if ($coursecontext) {
if ($coursecontext and $coursecontext->contextlevel == CONTEXT_COURSE) {
if (!is_enrolled($coursecontext) and !is_viewing($coursecontext)) {
$errors['courseassoc'] = get_string('studentnotallowed', '', fullname($USER, true));
}
} else {
$errors['courseassoc'] = get_string('invalidcontextid', 'blog');
$errors['courseassoc'] = get_string('error');
}
}
// validate mod association
if (!empty($data['modassoc'])) {
$modcontextid = $data['modassoc'];
$modcontext = context::instance_by_id($modcontextid, IGNORE_MISSING);
$modcontext = get_context_instance(CONTEXT_MODULE, $modcontextid);
if ($modcontext) {
if ($modcontext and $modcontext->contextlevel == CONTEXT_MODULE) {
// get context of the mod's course
$path = explode('/', $modcontext->path);
$coursecontext = get_context_instance_by_id($path[(count($path) - 2)]);
$coursecontext = $modcontext->get_course_context(true);
// ensure only one course is associated
if (!empty($data['courseassoc'])) {
@@ -170,7 +168,7 @@ class blog_edit_form extends moodleform {
$errors['modassoc'] = get_string('studentnotallowed', '', fullname($USER, true));
}
} else {
$errors['modassoc'] = get_string('invalidcontextid', 'blog');
$errors['modassoc'] = get_string('error');
}
}
+6 -2
View File
@@ -212,9 +212,13 @@ if (empty($entryid) && empty($modid) && empty($groupid)) {
}
if ($CFG->enablerssfeeds) {
$rsscontext = $filtertype = $thingid = null;
$rsscontext = null;
$filtertype = null;
$thingid = null;
list($thingid, $rsscontext, $filtertype) = blog_rss_get_params($blogheaders['filters']);
if (empty($rsscontext)) {
$rsscontext = get_system_context();
}
$rsstitle = $blogheaders['heading'];
//check we haven't started output by outputting an error message
+10 -4
View File
@@ -529,7 +529,10 @@ function blog_get_options_for_course(stdClass $course, stdClass $user=null) {
return $courseoptions[$key];
}
if (has_capability('moodle/blog:view', get_context_instance(CONTEXT_COURSE, $course->id))) {
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$canparticipate = (is_enrolled($coursecontext) or is_viewing($coursecontext));
if (has_capability('moodle/blog:view', $coursecontext)) {
// We can view!
if ($CFG->bloglevel >= BLOG_SITE_LEVEL) {
// View entries about this course
@@ -552,7 +555,7 @@ function blog_get_options_for_course(stdClass $course, stdClass $user=null) {
}
}
if (has_capability('moodle/blog:create', $sitecontext)) {
if (has_capability('moodle/blog:create', $sitecontext) and $canparticipate) {
// We can blog about this course
$options['courseadd'] = array(
'string' => get_string('blogaboutthiscourse', 'blog'),
@@ -604,7 +607,10 @@ function blog_get_options_for_module($module, $user=null) {
return $moduleoptions[$module->id];
}
if (has_capability('moodle/blog:view', get_context_instance(CONTEXT_MODULE, $module->id))) {
$modcontext = get_context_instance(CONTEXT_MODULE, $module->id);
$canparticipate = (is_enrolled($modcontext) or is_viewing($modcontext));
if (has_capability('moodle/blog:view', $modcontext)) {
// We can view!
if ($CFG->bloglevel >= BLOG_SITE_LEVEL) {
// View all entries about this module
@@ -632,7 +638,7 @@ function blog_get_options_for_module($module, $user=null) {
}
}
if (has_capability('moodle/blog:create', $sitecontext)) {
if (has_capability('moodle/blog:create', $sitecontext) and $canparticipate) {
// The user can blog about this module
$options['moduleadd'] = array(
'string' => get_string('blogaboutthismodule', 'blog', $module->modname),
+6 -6
View File
@@ -196,17 +196,17 @@ $CFG->admin = 'admin';
//
// These variables define DEFAULT block variables for new courses
// If this one is set it overrides all others and is the only one used.
// $CFG->defaultblocks_override = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_override = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
//
// These variables define the specific settings for defined course formats.
// They override any settings defined in the formats own config file.
// $CFG->defaultblocks_site = 'site_main_menu,admin,course_list:course_summary,calendar_month';
// $CFG->defaultblocks_social = 'participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,admin,course_list';
// $CFG->defaultblocks_topics = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_weeks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_site = 'site_main_menu,course_list:course_summary,calendar_month';
// $CFG->defaultblocks_social = 'participants,search_forums,calendar_month,calendar_upcoming,social_activities,recent_activity,course_list';
// $CFG->defaultblocks_topics = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks_weeks = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
//
// These blocks are used when no other default setting is found.
// $CFG->defaultblocks = 'participants,activity_modules,search_forums,admin,course_list:news_items,calendar_upcoming,recent_activity';
// $CFG->defaultblocks = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
//
// You can specify a different class to be created for the $PAGE global, and to
// compute which blocks appear on each page. However, I cannot think of any good
+2 -2
View File
@@ -110,7 +110,7 @@ if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing())
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $coursecontext)) {
echo '<a title="'.$streditsummary.'" '.
' href="editsection.php?id='.$thissection->id.'"><img src="'.$OUTPUT->pix_url('t/edit') . '" '.
' class="icon edit" alt="'.$streditsummary.'" /></a>';
' class="iconsmall edit" alt="'.$streditsummary.'" /></a>';
}
echo '</div>';
@@ -234,7 +234,7 @@ while ($section <= $course->numsections) {
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="icon edit" alt="'.$streditsummary.'" /></a><br /><br />';
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="iconsmall edit" alt="'.$streditsummary.'" /></a><br /><br />';
}
echo '</div>';
+2 -2
View File
@@ -103,7 +103,7 @@ defined('MOODLE_INTERNAL') || die();
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
echo '<p><a title="'.$streditsummary.'" '.
' href="editsection.php?id='.$thissection->id.'"><img src="'.$OUTPUT->pix_url('t/edit') . '" '.
' class="icon edit" alt="'.$streditsummary.'" /></a></p>';
' class="iconsmall edit" alt="'.$streditsummary.'" /></a></p>';
}
echo '</div>';
@@ -234,7 +234,7 @@ defined('MOODLE_INTERNAL') || die();
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
echo ' <a title="'.$streditsummary.'" href="editsection.php?id='.$thissection->id.'">'.
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="icon edit" alt="'.$streditsummary.'" /></a><br /><br />';
'<img src="'.$OUTPUT->pix_url('t/edit') . '" class="iconsmall edit" alt="'.$streditsummary.'" /></a><br /><br />';
}
echo '</div>';
+32 -28
View File
@@ -1606,8 +1606,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
// If specified, display extra content after link
if ($content) {
$contentpart = '<div class="contentafterlink' .
trim($textclasses) . '">' . $content . '</div>';
$contentpart = '<div class="' . trim('contentafterlink' . $textclasses) .
'">' . $content . '</div>';
}
} else {
// No link, so display only content
@@ -3062,13 +3062,13 @@ function moveto_module($mod, $section, $beforemod=NULL) {
* @global core_renderer $OUTPUT
* @staticvar type $str
* @param stdClass $mod The module to produce editing buttons for
* @param bool $absolute If true an absolute link is produced (default true)
* @param bool $absolute_ignored ignored - all links are absolute
* @param bool $moveselect If true a move seleciton process is used (default true)
* @param int $indent The current indenting
* @param int $section The section to link back to
* @return string XHTML for the editing buttons
*/
function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = true, $indent=-1, $section=-1) {
function make_editing_buttons(stdClass $mod, $absolute_ignored = true, $moveselect = true, $indent=-1, $section=-1) {
global $CFG, $OUTPUT;
static $str;
@@ -3076,11 +3076,16 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
$coursecontext = get_context_instance(CONTEXT_COURSE, $mod->course);
$modcontext = get_context_instance(CONTEXT_MODULE, $mod->id);
// no permission to edit
if (!has_capability('moodle/course:manageactivities', $modcontext)) {
$editcaps = array('moodle/course:manageactivities', 'moodle/course:activityvisibility', 'moodle/role:assign');
$dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
// no permission to edit anything
if (!has_any_capability($editcaps, $modcontext) and !has_all_capabilities($dupecaps, $coursecontext)) {
return false;
}
$hasmanageactivities = has_capability('moodle/course:manageactivities', $modcontext);
if (!isset($str)) {
$str = new stdClass;
$str->assign = get_string("assignroles", 'role');
@@ -3101,11 +3106,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
$str->groupsvisible = get_string("groupsvisible");
}
if ($absolute) {
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
} else {
$baseurl = new moodle_url('mod.php', array('sesskey' => sesskey()));
}
$baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
if ($section >= 0) {
$baseurl->param('sr', $section);
@@ -3113,7 +3114,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
$actions = array();
// leftright
if (has_capability('moodle/course:update', $coursecontext)) {
if ($hasmanageactivities) {
if (right_to_left()) { // Exchange arrows on RTL
$rightarrow = 't/left';
$leftarrow = 't/right';
@@ -3141,7 +3142,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
}
// move
if (has_capability('moodle/course:update', $coursecontext)) {
if ($hasmanageactivities) {
if ($moveselect) {
$actions[] = new action_link(
new moodle_url($baseurl, array('copy' => $mod->id)),
@@ -3166,15 +3167,16 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
}
// Update
$actions[] = new action_link(
new moodle_url($baseurl, array('update' => $mod->id)),
new pix_icon('t/edit', $str->update, 'moodle', array('class' => 'iconsmall')),
null,
array('class' => 'editing_update', 'title' => $str->update)
);
if ($hasmanageactivities) {
$actions[] = new action_link(
new moodle_url($baseurl, array('update' => $mod->id)),
new pix_icon('t/edit', $str->update, 'moodle', array('class' => 'iconsmall')),
null,
array('class' => 'editing_update', 'title' => $str->update)
);
}
// Duplicate (require both target import caps to be able to duplicate, see modduplicate.php)
$dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
if (has_all_capabilities($dupecaps, $coursecontext)) {
$actions[] = new action_link(
new moodle_url($baseurl, array('duplicate' => $mod->id)),
@@ -3185,12 +3187,14 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
}
// Delete
$actions[] = new action_link(
new moodle_url($baseurl, array('delete' => $mod->id)),
new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall')),
null,
array('class' => 'editing_delete', 'title' => $str->delete)
);
if ($hasmanageactivities) {
$actions[] = new action_link(
new moodle_url($baseurl, array('delete' => $mod->id)),
new pix_icon('t/delete', $str->delete, 'moodle', array('class' => 'iconsmall')),
null,
array('class' => 'editing_delete', 'title' => $str->delete)
);
}
// hideshow
if (has_capability('moodle/course:activityvisibility', $modcontext)) {
@@ -3212,7 +3216,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
}
// groupmode
if ($mod->groupmode !== false) {
if ($hasmanageactivities and $mod->groupmode !== false) {
if ($mod->groupmode == SEPARATEGROUPS) {
$groupmode = 0;
$grouptitle = $str->groupsseparate;
@@ -3242,7 +3246,7 @@ function make_editing_buttons(stdClass $mod, $absolute = true, $moveselect = tru
}
// Assign
if (has_capability('moodle/course:managegroups', $modcontext)){
if (has_capability('moodle/role:assign', $modcontext)){
$actions[] = new action_link(
new moodle_url('/'.$CFG->admin.'/roles/assign.php', array('contextid' => $modcontext->id)),
new pix_icon('i/roles', $str->assign, 'moodle', array('class' => 'iconsmall')),
+51 -61
View File
@@ -26,8 +26,6 @@
require("../config.php");
require_once("lib.php");
require_login();
$sectionreturn = optional_param('sr', '', PARAM_INT);
$add = optional_param('add', '', PARAM_ALPHA);
$type = optional_param('type', '', PARAM_ALPHA);
@@ -66,6 +64,8 @@ if ($groupmode !== '') {
}
$PAGE->set_url($url);
require_login();
//check if we are adding / editing a module that has new forms using formslib
if (!empty($add)) {
$id = required_param('id', PARAM_INT);
@@ -76,9 +76,7 @@ if (!empty($add)) {
redirect("$CFG->wwwroot/course/modedit.php?add=$add&type=$type&course=$id&section=$section&return=$returntomod");
} else if (!empty($update)) {
if (!$cm = get_coursemodule_from_id('', $update, 0, true)) {
print_error('invalidcoursemodule');
}
$cm = get_coursemodule_from_id('', $update, 0, true, MUST_EXIST);
$returntomod = optional_param('return', 0, PARAM_BOOL);
redirect("$CFG->wwwroot/course/modedit.php?update=$update&return=$returntomod");
@@ -86,7 +84,7 @@ if (!empty($add)) {
$cm = get_coursemodule_from_id('', $duplicate, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course->id);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $coursecontext);
@@ -119,17 +117,13 @@ if (!empty($add)) {
}
} else if (!empty($delete)) {
if (!$cm = get_coursemodule_from_id('', $delete, 0, true)) {
print_error('invalidcoursemodule');
}
$cm = get_coursemodule_from_id('', $delete, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
print_error('invalidcourseid');
}
require_login($course->id); // needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $context);
require_capability('moodle/course:manageactivities', $modcontext);
$return = "$CFG->wwwroot/course/view.php?id=$cm->course#section-$cm->sectionnum";
@@ -203,9 +197,13 @@ if (!empty($add)) {
if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
if (!$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true)) {
print_error('invalidcoursemodule');
}
$cm = get_coursemodule_from_id('', $USER->activitycopy, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $modcontext);
if (!empty($movetosection)) {
if (!$section = $DB->get_record('course_sections', array('id'=>$movetosection, 'course'=>$cm->course))) {
@@ -222,10 +220,6 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
}
}
require_login($section->course); // needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_COURSE, $section->course);
require_capability('moodle/course:manageactivities', $context);
if (!ismoving($section->course)) {
print_error('needcopy', '', "view.php?id=$section->course");
}
@@ -246,13 +240,14 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
} else if (!empty($indent) and confirm_sesskey()) {
$id = required_param('id', PARAM_INT);
if (!$cm = get_coursemodule_from_id('', $id, 0, true)) {
print_error('invalidcoursemodule');
}
require_login($cm->course); // needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_COURSE, $cm->course);
require_capability('moodle/course:manageactivities', $context);
$cm = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $modcontext);
$cm->indent += $indent;
@@ -271,13 +266,13 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
}
} else if (!empty($hide) and confirm_sesskey()) {
if (!$cm = get_coursemodule_from_id('', $hide, 0, true)) {
print_error('invalidcoursemodule');
}
$cm = get_coursemodule_from_id('', $hide, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($cm->course); // needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:activityvisibility', $context);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:activityvisibility', $modcontext);
set_coursemodule_visible($cm->id, 0);
@@ -290,21 +285,17 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
}
} else if (!empty($show) and confirm_sesskey()) {
if (!$cm = get_coursemodule_from_id('', $show, 0, true)) {
print_error('invalidcoursemodule');
}
$cm = get_coursemodule_from_id('', $show, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($cm->course); // needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_COURSE, $cm->course);
require_capability('moodle/course:activityvisibility', $context);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:activityvisibility', $modcontext);
if (!$section = $DB->get_record('course_sections', array('id'=>$cm->section))) {
print_error('sectionnotexist');
}
$section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
if (!$module = $DB->get_record('modules', array('id'=>$cm->module))) {
print_error('moduledoesnotexist');
}
$module = $DB->get_record('modules', array('id'=>$cm->module), '*', MUST_EXIST);
if ($module->visible and ($section->visible or (SITEID == $cm->course))) {
set_coursemodule_visible($cm->id, 1);
@@ -319,13 +310,14 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
} else if ($groupmode > -1 and confirm_sesskey()) {
$id = required_param('id', PARAM_INT);
if (!$cm = get_coursemodule_from_id('', $id, 0, true)) {
print_error('invalidcoursemodule');
}
require_login($cm->course); // needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $context);
$cm = get_coursemodule_from_id('', $id, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $modcontext);
set_coursemodule_groupmode($cm->id, $groupmode);
@@ -338,17 +330,15 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
}
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
if (!$cm = get_coursemodule_from_id('', $copy, 0, true)) {
print_error('invalidcoursemodule');
}
$cm = get_coursemodule_from_id('', $copy, 0, true, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($cm->course); // needed to setup proper $COURSE
$context = get_context_instance(CONTEXT_COURSE, $cm->course);
require_capability('moodle/course:manageactivities', $context);
require_login($course, false, $cm);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $modcontext);
if (!$section = $DB->get_record('course_sections', array('id'=>$cm->section))) {
print_error('sectionnotexist');
}
$section = $DB->get_record('course_sections', array('id'=>$cm->section), '*', MUST_EXIST);
$USER->activitycopy = $copy;
$USER->activitycopycourse = $cm->course;
+4 -1
View File
@@ -365,7 +365,9 @@ if ($mform->is_cancelled()) {
}
// make sure visibility is set correctly (in particular in calendar)
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
if (has_capability('moodle/course:activityvisibility', $modcontext)) {
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
}
if (isset($fromform->cmidnumber)) { //label
// set cm idnumber - uniqueness is already verified by form validation
@@ -477,6 +479,7 @@ if ($mform->is_cancelled()) {
$DB->set_field('course_modules', 'section', $sectionid, array('id'=>$fromform->coursemodule));
// make sure visibility is set correctly (in particular in calendar)
// note: allow them to set it even without moodle/course:activityvisibility
set_coursemodule_visible($fromform->coursemodule, $fromform->visible);
if (isset($fromform->cmidnumber)) { //label
+48 -10
View File
@@ -173,16 +173,21 @@ abstract class moodleform_mod extends moodleform {
}
}
if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
// Don't disable/remove groupingid if it is currently set to something,
// otherwise you cannot turn it off at same time as turning off other
// option (MDL-30764)
if (empty($this->_cm) || !$this->_cm->groupingid) {
if ($mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly') and empty($COURSE->groupmodeforce)) {
$mform->disabledIf('groupingid', 'groupmode', 'eq', NOGROUPS);
} else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
$mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
} else if (!$mform->elementExists('groupmode') and $mform->elementExists('groupmembersonly')) {
$mform->disabledIf('groupingid', 'groupmembersonly', 'notchecked');
} else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
// groupings have no use without groupmode or groupmembersonly
if ($mform->elementExists('groupingid')) {
$mform->removeElement('groupingid');
} else if (!$mform->elementExists('groupmode') and !$mform->elementExists('groupmembersonly')) {
// groupings have no use without groupmode or groupmembersonly
if ($mform->elementExists('groupingid')) {
$mform->removeElement('groupingid');
}
}
}
@@ -313,6 +318,35 @@ abstract class moodleform_mod extends moodleform {
$errors['availablefrom'] = get_string('badavailabledates', 'condition');
}
// Conditions: Verify that the grade conditions are numbers, and make sense.
if (array_key_exists('conditiongradegroup', $data)) {
foreach ($data['conditiongradegroup'] as $i => $gradedata) {
if ($gradedata['conditiongrademin'] !== '' && !is_numeric($gradedata['conditiongrademin'])) {
$errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
continue;
}
if ($gradedata['conditiongrademax'] !== '' && !is_numeric($gradedata['conditiongrademax'])) {
$errors["conditiongradegroup[{$i}]"] = get_string('gradesmustbenumeric', 'condition');
continue;
}
if ($gradedata['conditiongrademin'] !== '' && $gradedata['conditiongrademax'] !== '' &&
$gradedata['conditiongrademax'] < $gradedata['conditiongrademin']) {
$errors["conditiongradegroup[{$i}]"] = get_string('badgradelimits', 'condition');
continue;
}
if ($gradedata['conditiongrademin'] === '' && $gradedata['conditiongrademax'] === '' &&
$gradedata['conditiongradeitemid']) {
$errors["conditiongradegroup[{$i}]"] = get_string('gradeitembutnolimits', 'condition');
continue;
}
if (($gradedata['conditiongrademin'] !== '' || $gradedata['conditiongrademax'] !== '') &&
!$gradedata['conditiongradeitemid']) {
$errors["conditiongradegroup[{$i}]"] = get_string('gradelimitsbutnoitem', 'condition');
continue;
}
}
}
return $errors;
}
@@ -422,6 +456,12 @@ abstract class moodleform_mod extends moodleform {
}
$mform->addElement('modvisible', 'visible', get_string('visible'));
if (!empty($this->_cm)) {
$context = get_context_instance(CONTEXT_MODULE, $this->_cm->id);
if (!has_capability('moodle/course:activityvisibility', $context)) {
$mform->hardFreeze('visible');
}
}
if ($this->_features->idnumber) {
$mform->addElement('text', 'cmidnumber', get_string('idnumbermod'));
@@ -471,8 +511,6 @@ abstract class moodleform_mod extends moodleform {
$grouparray[] =& $mform->createElement('static', '', '','% '.get_string('grade_upto','condition').' ');
$grouparray[] =& $mform->createElement('text', 'conditiongrademax','',array('size'=>3));
$grouparray[] =& $mform->createElement('static', '', '','%');
$mform->setType('conditiongrademin',PARAM_FLOAT);
$mform->setType('conditiongrademax',PARAM_FLOAT);
$group = $mform->createElement('group','conditiongradegroup',
get_string('gradecondition', 'condition'),$grouparray);
+22 -20
View File
@@ -43,16 +43,16 @@ $pageaction = optional_param('action', '', PARAM_ALPHA); // Used to simulate a D
$PAGE->set_url('/course/rest.php', array('courseId'=>$courseid,'class'=>$class));
//NOTE: when making any changes here please make sure it is using the same access control as course/mod.php !!
require_login();
// Authorise the user and verify some incoming data
if (!$course = $DB->get_record('course', array('id'=>$courseid))) {
error_log('AJAX commands.php: Course does not exist');
die;
}
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_login($course);
require_capability('moodle/course:update', $context);
if (empty($CFG->enablecourseajax)) {
error_log('Course AJAX not allowed');
die;
@@ -72,22 +72,13 @@ switch($requestmethod) {
switch ($class) {
case 'block':
switch ($field) {
case 'visible':
blocks_execute_action($PAGE, $pageblocks, 'toggle', $blockinstance);
break;
case 'position': // Misleading case. Should probably call it 'move'.
// We want to move the block around. This means changing
// the column (position field) and/or block sort order
// (weight field).
blocks_move_block($PAGE, $blockinstance, $column, $value);
break;
}
// not used any more
break;
case 'section':
require_login($course);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/course:update', $coursecontext);
if (!$DB->record_exists('course_sections', array('course'=>$course->id, 'section'=>$id))) {
error_log('AJAX commands.php: Bad Section ID '.$id);
@@ -111,16 +102,21 @@ switch($requestmethod) {
error_log('AJAX commands.php: Bad course module ID '.$id);
die;
}
require_login($course, false, $cm);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
switch ($field) {
case 'visible':
require_capability('moodle/course:activityvisibility', $modcontext);
set_coursemodule_visible($cm->id, $value);
break;
case 'groupmode':
require_capability('moodle/course:manageactivities', $modcontext);
set_coursemodule_groupmode($cm->id, $value);
break;
case 'indentleft':
require_capability('moodle/course:manageactivities', $modcontext);
if ($cm->indent > 0) {
$cm->indent--;
$DB->update_record('course_modules', $cm);
@@ -128,11 +124,13 @@ switch($requestmethod) {
break;
case 'indentright':
require_capability('moodle/course:manageactivities', $modcontext);
$cm->indent++;
$DB->update_record('course_modules', $cm);
break;
case 'move':
require_capability('moodle/course:manageactivities', $modcontext);
if (!$section = $DB->get_record('course_sections', array('course'=>$course->id, 'section'=>$sectionid))) {
error_log('AJAX commands.php: Bad section ID '.$sectionid);
die;
@@ -158,6 +156,9 @@ switch($requestmethod) {
case 'course':
switch($field) {
case 'marker':
require_login($course);
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
require_capability('moodle/course:update', $coursecontext);
$newcourse = new stdClass();
$newcourse->id = $course->id;
$newcourse->marker = $value;
@@ -171,7 +172,7 @@ switch($requestmethod) {
case 'DELETE':
switch ($class) {
case 'block':
blocks_execute_action($PAGE, $pageblocks, 'delete', $blockinstance);
// not used any more
break;
case 'resource':
@@ -179,6 +180,9 @@ switch($requestmethod) {
error_log('AJAX rest.php: Bad course module ID '.$id);
die;
}
require_login($course, false, $cm);
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $modcontext);
$modlib = "$CFG->dirroot/mod/$cm->modname/lib.php";
if (file_exists($modlib)) {
@@ -195,8 +199,6 @@ switch($requestmethod) {
die;
}
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
// remove all module files in case modules forget to do that
$fs = get_file_storage();
$fs->delete_area_files($modcontext->id);
+2
View File
@@ -55,6 +55,8 @@ if ($mode === 'coursecompletions' or $mode === 'coursecompletion') {
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
$PAGE->set_url('/course/user.php', array('id'=>$id, 'user'=>$user->id, 'mode'=>$mode));
require_login();
$PAGE->set_pagelayout('admin');
if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext) and !is_enrolled($coursecontext)) {
+27 -15
View File
@@ -107,32 +107,44 @@
if ($PAGE->user_allowed_editing()) {
if (($edit == 1) and confirm_sesskey()) {
$USER->editing = 1;
redirect($PAGE->url);
// Redirect to site root if Editing is toggled on frontpage
if ($course->id == SITEID) {
redirect($CFG->wwwroot .'/?redirect=0');
} else {
redirect($PAGE->url);
}
} else if (($edit == 0) and confirm_sesskey()) {
$USER->editing = 0;
if(!empty($USER->activitycopy) && $USER->activitycopycourse == $course->id) {
$USER->activitycopy = false;
$USER->activitycopycourse = NULL;
}
redirect($PAGE->url);
// Redirect to site root if Editing is toggled on frontpage
if ($course->id == SITEID) {
redirect($CFG->wwwroot .'/?redirect=0');
} else {
redirect($PAGE->url);
}
}
if ($hide && confirm_sesskey()) {
set_section_visible($course->id, $hide, '0');
}
if (has_capability('moodle/course:update', $context)) {
if ($hide && confirm_sesskey()) {
set_section_visible($course->id, $hide, '0');
}
if ($show && confirm_sesskey()) {
set_section_visible($course->id, $show, '1');
}
if ($show && confirm_sesskey()) {
set_section_visible($course->id, $show, '1');
}
if (!empty($section)) {
if (!empty($move) and confirm_sesskey()) {
if (!move_section($course, $section, $move)) {
echo $OUTPUT->notification('An error occurred while moving a section');
if (!empty($section)) {
if (!empty($move) and confirm_sesskey()) {
if (!move_section($course, $section, $move)) {
echo $OUTPUT->notification('An error occurred while moving a section');
}
// Clear the navigation cache at this point so that the affects
// are seen immediately on the navigation.
$PAGE->navigation->clear_cache();
}
// Clear the navigation cache at this point so that the affects
// are seen immediately on the navigation.
$PAGE->navigation->clear_cache();
}
}
} else {
+1 -1
View File
@@ -63,7 +63,7 @@ switch ($action) {
case 'unenrol':
$ue = $DB->get_record('user_enrolments', array('id'=>required_param('ue', PARAM_INT)), '*', MUST_EXIST);
list ($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if (!$instance || !$plugin || !$plugin->allow_unenrol($instance) || !has_capability("enrol/$instance->enrol:unenrol", $manager->get_context()) || !$manager->unenrol_user($ue)) {
if (!$instance || !$plugin || !$plugin->allow_unenrol_user($instance, $ue) || !has_capability("enrol/$instance->enrol:unenrol", $manager->get_context()) || !$manager->unenrol_user($ue)) {
throw new enrol_ajax_exception('unenrolnotpermitted');
}
break;
+3
View File
@@ -96,5 +96,8 @@ function xmldb_enrol_authorize_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1 -1
View File
@@ -31,7 +31,7 @@ require_once("$CFG->dirroot/group/lib.php");
$id = required_param('id', PARAM_INT); // course id
$bulkuserop = required_param('bulkuserop', PARAM_ALPHANUMEXT);
$userids = required_param('bulkuser', PARAM_INT);
$userids = required_param_array('bulkuser', PARAM_INT);
$action = optional_param('action', '', PARAM_ACTION);
$filter = optional_param('ifilter', 0, PARAM_INT);
+3 -1
View File
@@ -99,7 +99,9 @@ class enrol_category_handler {
// now this is going to be a bit slow, take all enrolments in child courses and verify each separately
$syscontext = get_context_instance(CONTEXT_SYSTEM);
$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext);
if (!$roles = get_roles_with_capability('enrol/category:synchronised', CAP_ALLOW, $syscontext)) {
return true;
}
$plugin = enrol_get_plugin('category');
+3
View File
@@ -39,5 +39,8 @@ function xmldb_enrol_database_upgrade($oldversion) {
}
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+28 -6
View File
@@ -185,7 +185,7 @@ class enrol_database_plugin extends enrol_plugin {
$existing = array();
foreach ($current as $r) {
if (in_array($r->id, $roles)) {
if (in_array($r->roleid, $roles)) {
$existing[$r->roleid] = $r->roleid;
} else {
role_unassign($r->roleid, $user->id, $context->id, 'enrol_database', $instance->id);
@@ -639,22 +639,44 @@ class enrol_database_plugin extends enrol_plugin {
if ($createcourses) {
require_once("$CFG->dirroot/course/lib.php");
$template = $this->get_config('templatecourse');
$templatecourse = $this->get_config('templatecourse');
$defaultcategory = $this->get_config('defaultcategory');
if ($template) {
if ($template = $DB->get_record('course', array('shortname'=>$template))) {
$template = false;
if ($templatecourse) {
if ($template = $DB->get_record('course', array('shortname'=>$templatecourse))) {
unset($template->id);
unset($template->fullname);
unset($template->shortname);
unset($template->idnumber);
} else {
$template = new stdClass();
if ($verbose) {
mtrace(" can not find template for new course!");
}
}
} else {
}
if (!$template) {
$courseconfig = get_config('moodlecourse');
$template = new stdClass();
$template->summary = '';
$template->summaryformat = FORMAT_HTML;
$template->format = $courseconfig->format;
$template->numsections = $courseconfig->numsections;
$template->hiddensections = $courseconfig->hiddensections;
$template->newsitems = $courseconfig->newsitems;
$template->showgrades = $courseconfig->showgrades;
$template->showreports = $courseconfig->showreports;
$template->maxbytes = $courseconfig->maxbytes;
$template->groupmode = $courseconfig->groupmode;
$template->groupmodeforce = $courseconfig->groupmodeforce;
$template->visible = $courseconfig->visible;
$template->lang = $courseconfig->lang;
$template->groupmodeforce = $courseconfig->groupmodeforce;
}
if (!$DB->record_exists('course_categories', array('id'=>$defaultcategory))) {
if ($verbose) {
mtrace(" default course category does not exist!");
}
$categories = $DB->get_records('course_categories', array(), 'sortorder', 'id', 0, 1);
$first = reset($categories);
$defaultcategory = $first->id;
+2
View File
@@ -62,6 +62,8 @@ function xmldb_enrol_flatfile_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2010091400, 'enrol', 'flatfile');
}
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return $result;
}
+35
View File
@@ -0,0 +1,35 @@
<?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/>.
/**
* Guest enrol plugin installation.
*
* @package enrol
* @subpackage guest
* @copyright 2011 Petr Skoda {@link http://skodak.org}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_guest_install() {
global $CFG, $DB;
// migrate settings during 2.0 upgrade
// convert all null passwords to empty strings
$DB->set_field('enrol', 'password', '', array('enrol'=>'guest', 'password'=>null));
}
+46
View File
@@ -0,0 +1,46 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This file keeps track of upgrades to the guest enrolment plugin
*
* @package enrol
* @subpackage guest
* @copyright 2011 Petr Skoda {@link http://skodak.org
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
function xmldb_enrol_guest_upgrade($oldversion) {
global $CFG, $DB, $OUTPUT;
$dbman = $DB->get_manager();
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
if ($oldversion < 2011112901) {
// convert all null passwords to empty strings
$DB->set_field('enrol', 'password', '', array('enrol'=>'guest', 'password'=>null));
upgrade_plugin_savepoint(true, 2011112901, 'enrol', 'guest');
}
return true;
}
+26 -2
View File
@@ -178,8 +178,12 @@ class enrol_guest_plugin extends enrol_plugin {
public function course_edit_form($instance, MoodleQuickForm $mform, $data, $context) {
$i = isset($instance->id) ? $instance->id : 0;
$plugin = enrol_get_plugin('guest');
$header = $plugin->get_instance_name($instance);
if (!$i and !$this->get_config('defaultenrol')) {
return;
}
$header = $this->get_instance_name($instance);
$config = has_capability('enrol/guest:config', $context);
$mform->addElement('header', 'enrol_guest_header_'.$i, $header);
@@ -230,6 +234,10 @@ class enrol_guest_plugin extends enrol_plugin {
$i = isset($instance->id) ? $instance->id : 0;
if (!isset($data['enrol_guest_status_'.$i])) {
return $errors;
}
$password = empty($data['enrol_guest_password_'.$i]) ? '' : $data['enrol_guest_password_'.$i];
$checkpassword = false;
@@ -327,6 +335,22 @@ class enrol_guest_plugin extends enrol_plugin {
}
}
/**
* Add new instance of enrol plugin.
* @param object $course
* @param array instance fields
* @return int id of new instance, null if can not be created
*/
public function add_instance($course, array $fields = NULL) {
$fields = (array)$fields;
if (!isset($fields['password'])) {
$fields['password'] = '';
}
return parent::add_instance($course, $fields);
}
/**
* Add new instance of enrol plugin with default settings.
* @param object $course
+1 -1
View File
@@ -25,6 +25,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2011112900; // The current plugin version (Date: YYYYMMDDXX)
$plugin->version = 2011112901; // The current plugin version (Date: YYYYMMDDXX)
$plugin->requires = 2011112900; // Requires this Moodle version
$plugin->component = 'enrol_guest'; // Full name of the plugin (used for diagnostics)
+3
View File
@@ -83,6 +83,9 @@ function xmldb_enrol_imsenterprise_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+23 -2
View File
@@ -315,9 +315,12 @@ function process_group_tag($tagcontents) {
if (preg_match('{<sourcedid>.*?<id>(.+?)</id>.*?</sourcedid>}is', $tagcontents, $matches)) {
$group->coursecode = trim($matches[1]);
}
if (preg_match('{<description>.*?<short>(.*?)</short>.*?</description>}is', $tagcontents, $matches)) {
if (preg_match('{<description>.*?<long>(.*?)</long>.*?</description>}is', $tagcontents, $matches)){
$group->description = trim($matches[1]);
}
if (preg_match('{<description>.*?<short>(.*?)</short>.*?</description>}is', $tagcontents, $matches)) {
$group->shortName = trim($matches[1]);
}
if (preg_match('{<org>.*?<orgunit>(.*?)</orgunit>.*?</org>}is', $tagcontents, $matches)) {
$group->category = trim($matches[1]);
}
@@ -355,11 +358,25 @@ function process_group_tag($tagcontents) {
if (!$createnewcourses) {
$this->log_line("Course $coursecode not found in Moodle's course idnumbers.");
} else {
// Set shortname to description or description to shortname if one is set but not the other.
$nodescription = !isset($group->description);
$noshortname = !isset($group->shortName);
if ( $nodescription && $noshortname) {
// If neither short nor long description are set let if fail
$this->log_line("Neither long nor short name are set for $coursecode");
} else if ($nodescription) {
// If short and ID exist, then give the long short's value, then give short the ID's value
$group->description = $group->shortName;
$group->shortName = $coursecode;
} else if ($noshortname) {
// If long and ID exist, then map long to long, then give short the ID's value.
$group->shortName = $coursecode;
}
// Create the (hidden) course(s) if not found
$courseconfig = get_config('moodlecourse'); // Load Moodle Course shell defaults
$course = new stdClass();
$course->fullname = $group->description;
$course->shortname = $coursecode;
$course->shortname = $group->shortName;;
$course->idnumber = $coursecode;
$course->format = $courseconfig->format;
$course->visible = $courseconfig->visible;
@@ -403,6 +420,10 @@ function process_group_tag($tagcontents) {
$courseid = $DB->insert_record('course', $course);
// Setup default enrolment plugins
$course->id = $courseid;
enrol_course_updated(true, $course, null);
// Setup the blocks
$course = $DB->get_record('course', array('id' => $courseid));
blocks_add_default_course_blocks($course);
+6 -9
View File
@@ -98,7 +98,6 @@ if ($canconfig and $action and confirm_sesskey()) {
if ($confirm) {
$plugin->delete_instance($instance);
$context->mark_dirty(); // invalidate all enrol caches
redirect($PAGE->url);
}
@@ -113,19 +112,17 @@ if ($canconfig and $action and confirm_sesskey()) {
} else if ($action === 'disable') {
$instance = $instances[$instanceid];
if ($instance->status == ENROL_INSTANCE_ENABLED) {
$instance->status = ENROL_INSTANCE_DISABLED;
$DB->update_record('enrol', $instance);
$context->mark_dirty(); // invalidate all enrol caches
$plugin = $plugins[$instance->enrol];
if ($instance->status != ENROL_INSTANCE_DISABLED) {
$plugin->update_status($instance, ENROL_INSTANCE_DISABLED);
redirect($PAGE->url);
}
} else if ($action === 'enable') {
$instance = $instances[$instanceid];
if ($instance->status == ENROL_INSTANCE_DISABLED) {
$instance->status = ENROL_INSTANCE_ENABLED;
$DB->update_record('enrol', $instance);
$context->mark_dirty(); // invalidate all enrol caches
$plugin = $plugins[$instance->enrol];
if ($instance->status != ENROL_INSTANCE_ENABLED) {
$plugin->update_status($instance, ENROL_INSTANCE_ENABLED);
redirect($PAGE->url);
}
}
+21 -3
View File
@@ -885,16 +885,34 @@ class enrol_ldap_plugin extends enrol_plugin {
require_once("$CFG->dirroot/course/lib.php");
// Override defaults with template course
$course = new stdClass();
$template = false;
if ($this->get_config('template')) {
if($template = $DB->get_record('course', array('shortname'=>$this->get_config('template')))) {
if ($template = $DB->get_record('course', array('shortname'=>$this->get_config('template')))) {
unset($template->id); // So we are clear to reinsert the record
unset($template->fullname);
unset($template->shortname);
unset($template->idnumber);
$course = $template;
}
}
if (!$template) {
$courseconfig = get_config('moodlecourse');
$template = new stdClass();
$template->summary = '';
$template->summaryformat = FORMAT_HTML;
$template->format = $courseconfig->format;
$template->numsections = $courseconfig->numsections;
$template->hiddensections = $courseconfig->hiddensections;
$template->newsitems = $courseconfig->newsitems;
$template->showgrades = $courseconfig->showgrades;
$template->showreports = $courseconfig->showreports;
$template->maxbytes = $courseconfig->maxbytes;
$template->groupmode = $courseconfig->groupmode;
$template->groupmodeforce = $courseconfig->groupmodeforce;
$template->visible = $courseconfig->visible;
$template->lang = $courseconfig->lang;
$template->groupmodeforce = $courseconfig->groupmodeforce;
}
$course = $template;
$course->category = $this->get_config('category');
if (!$DB->record_exists('course_categories', array('id'=>$this->get_config('category')))) {
+1 -1
View File
@@ -56,7 +56,7 @@ if ($ADMIN->fulltree) {
//--- role mapping settings ---
$settings->add(new admin_setting_heading('enrol_ldap_roles', get_string('roles', 'enrol_ldap'), ''));
if (!during_initial_install()) {
$settings->add(new admin_setting_ldap_rolemapping('enrol_ldap/role_mapping', get_string ('role_mapping_key', 'enrol_ldap', $role->name), get_string ('role_mapping', 'enrol_ldap'), ''));
$settings->add(new admin_setting_ldap_rolemapping('enrol_ldap/role_mapping', get_string ('role_mapping_key', 'enrol_ldap'), get_string ('role_mapping', 'enrol_ldap'), ''));
}
$options = $yesno;
$settings->add(new admin_setting_configselect('enrol_ldap/course_search_sub', get_string('course_search_sub_key', 'enrol_ldap'), get_string('course_search_sub', 'enrol_ldap'), 0, $options));
+1 -1
View File
@@ -506,7 +506,7 @@ class course_enrolment_manager {
public function unenrol_user($ue) {
global $DB;
list ($instance, $plugin) = $this->get_user_enrolment_components($ue);
if ($instance && $plugin && $plugin->allow_unenrol($instance) && has_capability("enrol/$instance->enrol:unenrol", $this->context)) {
if ($instance && $plugin && $plugin->allow_unenrol_user($instance, $ue) && has_capability("enrol/$instance->enrol:unenrol", $this->context)) {
$plugin->unenrol_user($instance, $ue->userid);
return true;
}
+5 -3
View File
@@ -79,7 +79,8 @@ class enrol_manual_plugin extends enrol_plugin {
*
* By defaults looks for manage.php file and tests for manage capability.
*
* @param object $instance
* @param navigation_node $instancesnode
* @param stdClass $instance
* @return moodle_url;
*/
public function add_course_navigation($instancesnode, stdClass $instance) {
@@ -263,8 +264,8 @@ class enrol_manual_plugin extends enrol_plugin {
$instance = $ue->enrolmentinstance;
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
if ($this->allow_unenrol($instance) && has_capability("enrol/manual:unenrol", $context)) {
$url = new moodle_url('/enrol/manual/unenroluser.php', $params);
if ($this->allow_unenrol_user($instance, $ue) && has_capability("enrol/manual:unenrol", $context)) {
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', ''), get_string('unenrol', 'enrol'), $url, array('class'=>'unenrollink', 'rel'=>$ue->id));
}
if ($this->allow_manage($instance) && has_capability("enrol/manual:manage", $context)) {
@@ -276,6 +277,7 @@ class enrol_manual_plugin extends enrol_plugin {
/**
* The manual plugin has several bulk operations that can be performed
* @param course_enrolment_manager $manager
* @return array
*/
public function get_bulk_operations(course_enrolment_manager $manager) {
+1 -1
View File
@@ -348,7 +348,7 @@ class enrol_manual_deleteselectedusers_operation extends enrol_bulk_enrolment_op
foreach ($user->enrolments as $enrolment) {
$plugin = $enrolment->enrolmentplugin;
$instance = $enrolment->enrolmentinstance;
if ($plugin->allow_unenrol($instance)) {
if ($plugin->allow_unenrol_user($instance, $enrolment)) {
$plugin->unenrol_user($instance, $user->id);
}
}
-96
View File
@@ -1,96 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unenrol a user who was enrolled through a manual enrolment.
*
* Please note when unenrolling a user all of their grades are removed as well.
*
* @package enrol
* @subpackage manual
* @copyright 2011 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../config.php');
require_once("$CFG->dirroot/enrol/locallib.php");
require_once("$CFG->dirroot/enrol/renderer.php");
$ueid = required_param('ue', PARAM_INT); // user enrolment id
$filter = optional_param('ifilter', 0, PARAM_INT);
$confirm = optional_param('confirm', false, PARAM_BOOL);
// Get the user enrolment object
$ue = $DB->get_record('user_enrolments', array('id' => $ueid), '*', MUST_EXIST);
// Get the user for whom the enrolment is
$user = $DB->get_record('user', array('id'=>$ue->userid), '*', MUST_EXIST);
// Get the course the enrolment is to
list($ctxsql, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$sql = "SELECT c.* $ctxsql
FROM {course} c
LEFT JOIN {enrol} e ON e.courseid = c.id
$ctxjoin
WHERE e.id = :enrolid";
$params = array('enrolid' => $ue->enrolid);
$course = $DB->get_record_sql($sql, $params, MUST_EXIST);
context_instance_preload($course);
if ($course->id == SITEID) {
redirect(new moodle_url('/'));
}
require_login($course);
require_capability("enrol/manual:unenrol", get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST));
$manager = new course_enrolment_manager($PAGE, $course, $filter);
$table = new course_enrolment_users_table($manager, $PAGE);
// The URL of the enrolled users page for the course.
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
// The URl to return the user too after this screen.
$returnurl = new moodle_url($usersurl, $manager->get_url_params()+$table->get_url_params());
// The URL of this page
$url = new moodle_url('/enrol/manual/unenroluser.php', $returnurl->params());
$url->param('ue', $ueid);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($usersurl);
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if (!$plugin->allow_unenrol($instance) || $instance->enrol != 'manual' || !($plugin instanceof enrol_manual_plugin)) {
print_error('erroreditenrolment', 'enrol');
}
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
if ($confirm && confirm_sesskey() && $manager->unenrol_user($ue)) {
redirect($returnurl);
}
$yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey()));
$message = get_string('unenroluser', 'enrol_manual', array('user'=>fullname($user, true), 'course'=>format_string($course->fullname)));
$fullname = fullname($user);
$title = get_string('unenrol', 'enrol_manual');
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->navbar->add($title);
$PAGE->navbar->add($fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($fullname);
echo $OUTPUT->confirm($message, $yesurl, $returnurl);
echo $OUTPUT->footer();
+3
View File
@@ -39,5 +39,8 @@ function xmldb_enrol_mnet_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+3
View File
@@ -62,5 +62,8 @@ function xmldb_enrol_paypal_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+1 -1
View File
@@ -363,7 +363,7 @@ class enrol_self_plugin extends enrol_plugin {
$params = $manager->get_moodlepage()->url->params();
$params['ue'] = $ue->id;
if ($this->allow_unenrol($instance) && has_capability("enrol/self:unenrol", $context)) {
$url = new moodle_url('/enrol/self/unenroluser.php', $params);
$url = new moodle_url('/enrol/unenroluser.php', $params);
$actions[] = new user_enrolment_action(new pix_icon('t/delete', ''), get_string('unenrol', 'enrol'), $url, array('class'=>'unenrollink', 'rel'=>$ue->id));
}
if ($this->allow_manage($instance) && has_capability("enrol/self:manage", $context)) {
-101
View File
@@ -1,101 +0,0 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Unenrol a user who was enrolled through a self enrolment.
*
* @package enrol
* @subpackage self
* @copyright 2011 Sam Hemelryk
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../../config.php');
require_once("$CFG->dirroot/enrol/locallib.php");
require_once("$CFG->dirroot/enrol/renderer.php");
$ueid = required_param('ue', PARAM_INT); // user enrolment id
$filter = optional_param('ifilter', 0, PARAM_INT);
$confirm = optional_param('confirm', false, PARAM_BOOL);
// Get the user enrolment object
$ue = $DB->get_record('user_enrolments', array('id' => $ueid), '*', MUST_EXIST);
// Get the user for whom the enrolment is
$user = $DB->get_record('user', array('id'=>$ue->userid), '*', MUST_EXIST);
// Get the course the enrolment is to
list($ctxsql, $ctxjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');
$sql = "SELECT c.* $ctxsql
FROM {course} c
LEFT JOIN {enrol} e ON e.courseid = c.id
$ctxjoin
WHERE e.id = :enrolid";
$params = array('enrolid' => $ue->enrolid);
$course = $DB->get_record_sql($sql, $params, MUST_EXIST);
context_instance_preload($course);
// Make sure it's not the front page
if ($course->id == SITEID) {
redirect(new moodle_url('/'));
}
// Obviously
require_login($course);
// Make sure the user can unenrol self enrolled users.
require_capability("enrol/self:unenrol", get_context_instance(CONTEXT_COURSE, $course->id));
// Get the enrolment manager for this course
$manager = new course_enrolment_manager($PAGE, $course, $filter);
// Get an enrolment users table object. Doign this will automatically retrieve the the URL params
// relating to table the user was viewing before coming here, and allows us to return the user to the
// exact page of the users screen they can from.
$table = new course_enrolment_users_table($manager, $PAGE);
// The URL of the enrolled users page for the course.
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
// The URl to return the user too after this screen.
$returnurl = new moodle_url($usersurl, $manager->get_url_params()+$table->get_url_params());
// The URL of this page
$url = new moodle_url('/enrol/self/unenroluser.php', $returnurl->params());
$url->param('ue', $ueid);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($usersurl);
list($instance, $plugin) = $manager->get_user_enrolment_components($ue);
if (!$plugin->allow_unenrol($instance) || $instance->enrol != 'self' || !($plugin instanceof enrol_self_plugin)) {
print_error('erroreditenrolment', 'enrol');
}
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
if ($confirm && confirm_sesskey() && $manager->unenrol_user($ue)) {
redirect($returnurl);
}
$yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey()));
$message = get_string('unenroluser', 'enrol_self', array('user' => fullname($user, true), 'course' => format_string($course->fullname)));
$fullname = fullname($user);
$title = get_string('unenrol', 'enrol_self');
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->navbar->add($title);
$PAGE->navbar->add($fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($fullname);
echo $OUTPUT->confirm($message, $yesurl, $returnurl);
echo $OUTPUT->footer();
+87
View File
@@ -0,0 +1,87 @@
<?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/>.
/**
* Completely unenrol a user from a course.
*
* Please note when unenrolling a user all of their grades are removed as well,
* most ppl actually expect enrolments to be suspended only...
*
* @package core
* @subpackage enrol
* @copyright 2011 Petr skoda
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require('../config.php');
require_once("$CFG->dirroot/enrol/locallib.php");
require_once("$CFG->dirroot/enrol/renderer.php");
$ueid = required_param('ue', PARAM_INT); // user enrolment id
$confirm = optional_param('confirm', false, PARAM_BOOL);
$filter = optional_param('ifilter', 0, PARAM_INT);
$ue = $DB->get_record('user_enrolments', array('id' => $ueid), '*', MUST_EXIST);
$user = $DB->get_record('user', array('id'=>$ue->userid), '*', MUST_EXIST);
$instance = $DB->get_record('enrol', array('id'=>$ue->enrolid), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST);
$context = context_course::instance($course->id);
// set up PAGE url first!
$PAGE->set_url('/enrol/unenroluser.php', array('ue'=>$ueid, 'ifilter'=>$filter));
require_login($course);
if (!enrol_is_enabled($instance->enrol)) {
print_error('erroreditenrolment', 'enrol');
}
$plugin = enrol_get_plugin($instance->enrol);
if (!$plugin->allow_unenrol_user($instance, $ue) or !has_capability("enrol/$instance->enrol:unenrol", $context)) {
print_error('erroreditenrolment', 'enrol');
}
$manager = new course_enrolment_manager($PAGE, $course, $filter);
$table = new course_enrolment_users_table($manager, $PAGE);
$returnurl = new moodle_url('/enrol/users.php', array('id' => $course->id)+$manager->get_url_params()+$table->get_url_params());
$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id));
$PAGE->set_pagelayout('admin');
navigation_node::override_active_url($usersurl);
// If the unenrolment has been confirmed and the sesskey is valid unenrol the user.
if ($confirm && confirm_sesskey()) {
$plugin->unenrol_user($instance, $ue->userid);
redirect($returnurl);
}
$yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey()));
$message = get_string('unenrolconfirm', 'core_enrol', array('user'=>fullname($user, true), 'course'=>format_string($course->fullname)));
$fullname = fullname($user);
$title = get_string('unenrol', 'core_enrol');
$PAGE->set_title($title);
$PAGE->set_heading($title);
$PAGE->navbar->add($title);
$PAGE->navbar->add($fullname);
echo $OUTPUT->header();
echo $OUTPUT->heading($fullname);
echo $OUTPUT->confirm($message, $yesurl, $returnurl);
echo $OUTPUT->footer();
+3 -2
View File
@@ -81,8 +81,9 @@ Y.extend(DIALOGUE, Y.Overlay, {
if (hidden) {
bb.setStyle('top', '-1000px').removeClass(DIALOGUE_PREFIX+'-hidden');
}
var x = Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2);
var y = Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2)+Y.one(window).get('scrollTop');
var x = Math.max(Math.round((bb.get('winWidth') - bb.get('offsetWidth'))/2), 15);
var y = Math.max(Math.round((bb.get('winHeight') - bb.get('offsetHeight'))/2), 15) + Y.one(window).get('scrollTop');
if (hidden) {
bb.addClass(DIALOGUE_PREFIX+'-hidden');
}
+3
View File
@@ -46,5 +46,8 @@ function xmldb_filter_mediaplugin_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+3
View File
@@ -41,5 +41,8 @@ function xmldb_filter_tex_upgrade($oldversion) {
// Moodle v2.1.0 release upgrade line
// Put any upgrade step following this
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+3
View File
@@ -35,5 +35,8 @@ function xmldb_gradingform_rubric_upgrade($oldversion) {
$dbman = $DB->get_manager();
// Moodle v2.2.0 release upgrade line
// Put any upgrade step following this
return true;
}
+8 -1
View File
@@ -626,6 +626,7 @@ class grade_plugin_info {
* @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
* @param string $bodytags Additional attributes that will be added to the <body> tag
* @param string $buttons Additional buttons to display on the page
* @param boolean $shownavigation should the gradebook navigation drop down (or tabs) be shown?
*
* @return string HTML code or nothing if $return == false
*/
@@ -673,7 +674,13 @@ function print_grade_page_head($courseid, $active_type, $active_plugin=null,
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
$returnval .= print_grade_plugin_selector($plugin_info, $active_type, $active_plugin, $return);
}
$returnval .= $OUTPUT->heading($heading);
if ($return) {
$returnval .= $OUTPUT->heading($heading);
} else {
echo $OUTPUT->heading($heading);
}
if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
$returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
}
+1 -1
View File
@@ -627,7 +627,7 @@ class grade_report_grader extends grade_report {
$usercell->scope = 'row';
if ($showuserimage) {
$usercell->text = $OUTPUT->container($OUTPUT->user_picture($user), 'userpic');
$usercell->text = $OUTPUT->user_picture($user);
}
$usercell->text .= html_writer::link(new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $this->course->id)), fullname($user));
+3 -7
View File
@@ -269,16 +269,12 @@ table#user-grades td.topleft {
background-color:#fff;
}
.path-grade-report-grader div.userpic {
margin-right:10px;
float:left;
}
.path-grade-report-grader div.userpic img {
.path-grade-report-grader th.user img {
border:3px double #cecece;
vertical-align:middle;
vertical-align:top;
width:2.7em;
height:2.7em;
margin-right:10px;
}
.path-grade-report-grader a.quickedit {

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