course categories: Fix many bugs with category editing and permissions. Clean up code.

Bugs: MDL-17479, MDL-16426, MDL-16063, MDL-16013, MDL-15658, MDL-15556, MDL-15161, MDL-14925, MDL-13742, MDL-11557.

* Simplify category editing permissions to just moodle/category:manage and moodle/category:seehiddencategories.
* Enforce those correctly. (Note MDL 17502 is still outstanding.)
* Don't screw up category sort order when you just edit name or description.
* Niceties like where redirects go when you cancel or submit forms.
* Make sure a global course creator can see the site admin block.
* Don't allow a category to be made the child of one of its children!
* General code cleanup to bring key files more in line with best pracitice.

Apologies for the fact it is one big patch, rather than a series of smaller patches. However, categoryedit.php, category.php and index.php where in pretty bad shape and needed significant cleaning up. categoryedit.php, in particular, was almost completely rewritten.

Merged from MOODLE_19_STABLE.
This commit is contained in:
tjhunt
2008-12-04 08:53:10 +00:00
parent 4faace3781
commit 8ed5dd63ee
18 changed files with 501 additions and 721 deletions
+2
View File
@@ -127,6 +127,7 @@ $string['cannotsetupcategory'] = 'Serious error! Could not set up a default cour
$string['cannotsetupcapforplugin'] = 'Could not set up the capabilities for $a';
$string['cannotsetupcapformod'] = 'Could not set up the capabilities for $a';
$string['cannotsetupsite'] = 'Serious error! Could not set up the site!';
$string['cannotshowhidecoursesincategory'] = 'Cannot show/hide the courses in category $a.';
$string['cannotunzipfile'] = 'Cannot unzip file';
$string['cannotupgradeblock'] = 'Upgrade of blocks system failed! (Could not update version in config table.)';
$string['cannotupgradecaps'] = 'Had difficulties upgrading the core capabilities for the Roles system';
@@ -211,6 +212,7 @@ $string['errorcreatingrole'] = 'Error creating role';
$string['erroronline'] = 'Error on line $a';
$string['errorreadingfile'] = 'Error reading file \"$a\"';
$string['errorunzippingfiles'] = 'Error unzipping files';
$string['errorupdatingcoursevisibility'] = 'Error updating the course visibility';
$string['errorsettinguserpref'] = 'Error setting user preference';
$string['expiredkey'] = 'Expired key';
$string['failtoloadblocks'] = 'One or more blocks are registered in the database, but they all failed to load!';