MDL-20565 When editing is off, hiding blocks whose sub-system is disabled at site...
authornicolasconnault <nicolasconnault>
Thu, 15 Oct 2009 01:36:50 +0000 (01:36 +0000)
committernicolasconnault <nicolasconnault>
Thu, 15 Oct 2009 01:36:50 +0000 (01:36 +0000)
blocks/blog_menu/block_blog_menu.php
blocks/comments/block_comments.php
blocks/messages/block_messages.php
blocks/rss_client/block_rss_client.php
blocks/tags/block_tags.php
lang/en_utf8/block_rss_client.php
lang/en_utf8/block_tags.php
lang/en_utf8/moodle.php

index e0ffa01f66030ca54696574008d69bc409a749b1..32e59226f013a7f639fd3f1d8fe78324f095e7e4 100755 (executable)
@@ -56,14 +56,12 @@ class block_blog_menu extends block_base {
 
         $context = $PAGE->get_context();
 
-        if (empty($CFG->bloglevel)) {
-            $this->content->text = get_string('blogdisable', 'blog');
-            return $this->content;
-        }
-
         // don't display menu block if block is set at site level, and user is not logged in
-        if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL && !(isloggedin() && !isguestuser())) {
-            $this->content->text = get_string('blogdisable', 'blog');
+        if (empty($CFG->bloglevel) || ($CFG->bloglevel < BLOG_GLOBAL_LEVEL && !(isloggedin() && !isguestuser()))) {
+            $this->content->text = '';
+            if ($this->page->user_is_editing()) {
+                $this->content->text = get_string('blogdisable', 'blog');
+            }
             return $this->content;
         }
 
index 8f107b695cd6c16ce75567eb80632480f49877d8..25d3e9a26a7bd1a13acb6d4845771e393f038ec3 100644 (file)
@@ -22,6 +22,14 @@ class block_comments extends block_base {
     }
 
     function get_content() {
+        global $CFG;
+        if (!$CFG->usecomments) {
+            $this->content->text = '';
+            if ($this->page->user_is_editing()) {
+                $this->content->text = get_string('disabledcomments');
+            }
+            return $this->content;
+        }
         if ($this->content !== NULL) {
             return $this->content;
         }
@@ -37,7 +45,7 @@ class block_comments extends block_base {
             $cmt->itemid    = $this->instance->id;
             $cmt->course    = $this->page->course;
             // this is a hack to adjust commenting UI
-            // in block_comments 
+            // in block_comments
             $cmt->env       = 'block_comments';
             $cmt->linktext  = get_string('showcomments');
             $comment = new comment($cmt);
index 3172a107732c8b9efddd4e822f4a2b87ebfe1975..6668c29f35221febb387611eb1e61062171b3f0b 100644 (file)
@@ -10,7 +10,11 @@ class block_messages extends block_base {
         global $USER, $CFG, $DB, $OUTPUT;
 
         if (!$CFG->messaging) {
-            return ''; 
+            $this->content->text = '';
+            if ($this->page->user_is_editing()) {
+                $this->content->text = get_string('disabled', 'message');
+            }
+            return $this->content; 
         }
 
         if ($this->content !== NULL) {
index 55c4e642d4e48fad5f32ee8800358ffc25b6aae5..bf4c1ad4618af3ffc6c527c03e2d03e4b8f30d9c 100644 (file)
             return $this->content;
         }
 
+        if (!$CFG->enablerssfeeds) {
+            $this->content->text = '';
+            if ($this->page->user_is_editing()) {
+                $this->content->text = get_string('disabledrssfeeds', 'block_rss_client');
+            }
+            return $this->content;
+        }
+
         // initalise block content object
         $this->content = new stdClass;
         $this->content->text   = '';
index f53203f2c80c2b8df4245808cc6cc60a9dd7a835..4a7f867f4dba29dfc995f89f9e92b8eea632fec7 100644 (file)
@@ -42,6 +42,9 @@ class block_tags extends block_base {
 
         if (empty($CFG->usetags)) {
             $this->content->text = '';
+            if ($this->page->user_is_editing()) {
+                $this->content->text = get_string('disabledtags', 'block_tags');
+            }
             return $this->content;
         }
 
index a8e6c1e72abef89cebc8103d39f2d59bd1641348..70f7f64b8abf4293c8a3aee6870881800c94e0fa 100644 (file)
@@ -17,6 +17,7 @@ $string['configblock'] = 'Configure this block';
 $string['couldnotfindfeed'] = 'Could not find feed with id';
 $string['customtitlelabel'] = 'Custom title (leave blank to use title supplied by feed):';
 $string['deletefeedconfirm'] = 'Are you sure you want to delete this feed?';
+$string['disabledrssfeeds'] = 'RSS feeds are disabled';
 $string['displaydescriptionlabel'] = 'Display each link\'s description?';
 $string['editafeed'] = 'Edit a feed';
 $string['editfeeds'] = 'Edit, subscribe or unsubsribe from RSS/Atom news feeds';
index 559fdf1cd5a7f3394f28267610109a8876306020..be8a85741b5bef3517fde194cb527c59e4b74a06 100644 (file)
@@ -14,6 +14,7 @@ $string['communitytags2'] = 'Show all user created course tags';
 $string['coursetags'] = 'Course tags:';
 $string['coursetags1'] = 'course tags';
 $string['coursetags2'] = 'Show tags for this course';
+$string['disabledtags'] = 'Tags are disabled';
 $string['edit'] = 'edit...';
 $string['editdeletemytag'] = 'Delete tag from this course:';
 $string['editmytags'] = 'My tags - shortcuts to all your tagged courses.';
index 9c16329e67c7f32b0fbcf0af3953807e8f9eaf32..a516f0aea5435f239603ca88e5a8f903e4d9bd2e 100644 (file)
@@ -445,6 +445,7 @@ $string['detailedmore'] = 'More detailed';
 $string['directory'] = 'Directory';
 $string['directorypaths'] = 'Directory Paths';
 $string['disable'] = 'Disable';
+$string['disabledcomments'] = 'Comments are disabled';
 $string['displayingfirst'] = 'Only the first $a->count $a->things are displayed';
 $string['displayingrecords'] = 'Displaying $a records';
 $string['displayingusers'] = 'Displaying users $a->start to $a->end';