]> git.mjollnir.org Git - moodle.git/commitdiff
"MDL-17747, add max category depth setting, merged from 1.9"
authordongsheng <dongsheng>
Wed, 14 Jan 2009 04:48:22 +0000 (04:48 +0000)
committerdongsheng <dongsheng>
Wed, 14 Jan 2009 04:48:22 +0000 (04:48 +0000)
admin/settings/frontpage.php
course/lib.php
lang/en_utf8/admin.php

index aafd5e64b6af9e470f942b405620d19c49b8a10f..7376ce19a05334060a1a83383a1f8416c07b4fa7 100644 (file)
@@ -28,10 +28,11 @@ if (get_site()) { //do not use during installation
         $temp->add(new admin_setting_courselist_frontpage(true)); // loggedin version of the setting
         
         $options = array();
+        $options[] = get_string('unlimited');
         for ($i=1; $i<100; $i++) {
             $options[$i] = $i;
         }
-        $temp->add(new admin_setting_configselect('max_category_depth', get_string('sitemaxcategorydepth','admin'), get_string('sitemaxcategorydepthhelp','admin'), 50, $options));
+        $temp->add(new admin_setting_configselect('maxcategorydepth', get_string('configsitemaxcategorydepth','admin'), get_string('configsitemaxcategorydepthhelp','admin'), 0, $options));
         
         $temp->add(new admin_setting_sitesetcheckbox('numsections', get_string('sitesection'), get_string('sitesectionhelp','admin'), 1));
         $temp->add(new admin_setting_sitesetselect('newsitems', get_string('newsitemsnumber'), '', 3,
index 905613b8b0e1a4e6fc498dc1aab976eabf7baf3e..f89e297fd4a8fa3ae406b91c283b9f98f8237484 100644 (file)
@@ -1943,7 +1943,8 @@ function make_categories_list(&$list, &$parents, $requiredcapability = '',
 function print_whole_category_list($category=NULL, $displaylist=NULL, $parentslist=NULL, $depth=-1, $showcourses = true) {
     global $CFG;
 
-    if (isset($CFG->max_category_depth) && ($depth >= $CFG->max_category_depth)) {
+    // maxcategorydepth == 0 meant no limit
+    if (!empty($CFG->maxcategorydepth) && $depth >= $CFG->maxcategorydepth) {
         return;
     }
 
@@ -2043,7 +2044,12 @@ function print_category_info($category, $depth, $showcourses = false) {
         echo '<td class="category info">&nbsp;</td>';
         echo '</tr>';
 
-        if ($courses && !(isset($CFG->max_category_depth)&&($depth>=$CFG->max_category_depth-1))) {
+        // does the depth exceed maxcategorydepth
+        // maxcategorydepth == 0 or unset meant no limit
+
+        $limit = !(isset($CFG->maxcategorydepth) && ($depth >= $CFG->maxcategorydepth-1));
+
+        if ($courses && ($limit || $CFG->maxcategorydepth == 0)) {
             foreach ($courses as $course) {
                 $linkcss = $course->visible ? '' : ' class="dimmed" ';
                 echo '<tr><td valign="top">&nbsp;';
index 25c2c126160296feb9f1b0e073e3570ca65430e1..2b10a1af3aa48eaec9d93e57cb13d7401f95aeac 100644 (file)
@@ -172,8 +172,8 @@ $string['configlongtimenosee'] = 'If students haven\'t logged in for a very long
 $string['configlookahead'] = 'Days to look ahead';
 $string['configmailnewline'] = 'Newline characters used in mail messages. CRLF is required according to RFC 822bis, some mail servers do automatic conversion from LF to CRLF, other mail servers do incorrect conversion from CRLF to CRCRLF, yet others reject mails with bare LF (qmail for example). Try changing this setting if you are having problems with undelivered emails or double newlines.';
 $string['configmaxbytes'] = 'This specifies a maximum size that uploaded files can be throughout the whole site. This setting is limited by the PHP settings post_max_size and upload_max_filesize, as well as the Apache setting LimitRequestBody. In turn, maxbytes limits the range of sizes that can be chosen at course level or module level. If \'Server Limit\' is chosen, the server maximum allowed by the server will be used.';
-$string['sitemaxcategorydepth'] = 'Maximum Category Depth';
-$string['sitemaxcategorydepthhelp'] = 'This specifies the maximum number of child categories shown';
+$string['configsitemaxcategorydepth'] = 'Maximum Category Depth';
+$string['configsitemaxcategorydepthhelp'] = 'This specifies the maximum depth of child categories shown';
 $string['configmaxeditingtime'] = 'This specifies the amount of time people have to re-edit forum postings, glossary comments etc.  Usually 30 minutes is a good value.';
 $string['configmaxevents'] = 'Events to Lookahead';
 $string['configmemcachedhosts'] = 'For memcached. Comma-separated list of hosts that are running the memcached daemon. Use IP addresses to avoid DNS latency. memcached does not behave well if you add/remove hosts on a running setup.';