MDL-24939 block mnet_hosts now displays error message if the dependencies test fails

The site must be switch at least to DEBUG_NORMAL level and
$CFG->debugdisplay must be turned on. It helps administrators to detect
the problems in their MNet setups.
This commit is contained in:
David Mudrak 2010-11-29 13:44:28 +00:00
parent 0b5549de93
commit 95840a8e7b
3 changed files with 36 additions and 10 deletions

View File

@ -29,18 +29,39 @@ class block_mnet_hosts extends block_list {
// remote users can't on-jump
// so don't show this block to them
if (is_mnet_remote_user($USER)) {
return '';
if (debugging() and !empty($CFG->debugdisplay)) {
$this->content = new stdClass();
$this->content->footer = html_writer::tag('span',
get_string('error_localusersonly', 'block_mnet_hosts'),
array('class' => 'error'));
return $this->content;
} else {
return '';
}
}
if (!is_enabled_auth('mnet')) {
// no need to query anything remote related
debugging( 'mnet authentication plugin is not enabled', DEBUG_ALL );
return '';
if (debugging() and !empty($CFG->debugdisplay)) {
$this->content = new stdClass();
$this->content->footer = html_writer::tag('span',
get_string('error_authmnetneeded', 'block_mnet_hosts'),
array('class' => 'error'));
return $this->content;
} else {
return '';
}
}
// check for outgoing roaming permission first
if (!has_capability('moodle/site:mnetlogintoremote', get_context_instance(CONTEXT_SYSTEM), NULL, false)) {
return '';
if (debugging() and !empty($CFG->debugdisplay)) {
$this->content = new stdClass();
$this->content->footer = html_writer::tag('span',
get_string('error_roamcapabilityneeded', 'block_mnet_hosts'),
array('class' => 'error'));
return $this->content;
} else {
return '';
}
}
if ($this->content !== NULL) {
@ -81,7 +102,7 @@ class block_mnet_hosts extends block_list {
$hosts = $DB->get_records_sql($sql, array($CFG->mnet_localhost_id));
$this->content = new stdClass;
$this->content = new stdClass();
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
@ -104,5 +125,3 @@ class block_mnet_hosts extends block_list {
return $this->content;
}
}

View File

@ -23,5 +23,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['error_authmnetneeded'] = 'MNet authentication plugin must be enabled to see the list of MNet network servers';
$string['error_localusersonly'] = 'Remote users can not jump to other MNet network servers from this host';
$string['error_roamcapabilityneeded'] = 'Users need the capability \'Roam to a remote application via MNet\' to see the list of MNet network servers';
$string['pluginname'] = 'Network servers';
$string['server'] = 'Server';

View File

@ -15,4 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
$plugin->version = 2007101509;
/**
* Network servers block version is defined in this file
*/
$plugin->version = 2010112900;