Skip to content

Commit

Permalink
MDL-20565 When editing is off, hiding blocks whose sub-system is disa…
Browse files Browse the repository at this point in the history
…bled at site level. When editing is on, printing a "[subsytem] is disabled" message.
  • Loading branch information
nicolasconnault committed Oct 15, 2009
1 parent 1488bf1 commit b58961a
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 9 deletions.
12 changes: 5 additions & 7 deletions blocks/blog_menu/block_blog_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,12 @@ function get_content() {

$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;
}

Expand Down
10 changes: 9 additions & 1 deletion blocks/comments/block_comments.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ function instance_allow_multiple() {
}

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;
}
Expand All @@ -37,7 +45,7 @@ function get_content() {
$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);
Expand Down
6 changes: 5 additions & 1 deletion blocks/messages/block_messages.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ function get_content() {
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) {
Expand Down
8 changes: 8 additions & 0 deletions blocks/rss_client/block_rss_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ function get_content() {
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 = '';
Expand Down
3 changes: 3 additions & 0 deletions blocks/tags/block_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function get_content() {

if (empty($CFG->usetags)) {
$this->content->text = '';
if ($this->page->user_is_editing()) {
$this->content->text = get_string('disabledtags', 'block_tags');
}
return $this->content;
}

Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/block_rss_client.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
$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';
Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/block_tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
$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.';
Expand Down
1 change: 1 addition & 0 deletions lang/en_utf8/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@
$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';
Expand Down

0 comments on commit b58961a

Please sign in to comment.