Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-30170 MNet peers administration - various usability improvements

While fixing MDL-30170, the following tiny usability details were
improved along the way:

* the maximum length of the peer site title and the hostname is now
  validated (this was actually a real bug as the default value is pre-loaded
  from the peer) so the admin gets a nice validation error instead of
  the database write exception when trying to register a host with a
  longer site title.
* hard-coded English string 'All Hosts' is now localized
* the hostname link in the list of MNet peers leads to the peer itself
  • Loading branch information...
commit 06f9aecbcf4f985ca0f654764a158c07fe36eda6 1 parent cac3efc
@mudrd8mz mudrd8mz authored stronk7 committed
View
9 admin/mnet/peer_forms.php
@@ -38,9 +38,10 @@ function definition() {
$mform = $this->_form;
- $mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
+ $mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
$mform->setType('wwwroot', PARAM_URL);
$mform->addRule('wwwroot', null, 'required', null, 'client');
+ $mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$mform->addElement('select', 'applicationid', get_string('applicationtype', 'mnet'),
$DB->get_records_menu('mnet_application', array(), 'id,display_name'));
@@ -81,11 +82,13 @@ function definition() {
$mform->addElement('hidden', 'applicationid');
$mform->addElement('hidden', 'oldpublickey');
- $mform->addElement('text', 'name', get_string('site'));
+ $mform->addElement('text', 'name', get_string('site'), array('maxlength' => 80, 'size' => 50));
$mform->setType('name', PARAM_NOTAGS);
+ $mform->addRule('name', get_string('maximumchars', '', 80), 'maxlength', 80, 'client');
- $mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'));
+ $mform->addElement('text', 'wwwroot', get_string('hostname', 'mnet'), array('maxlength' => 255, 'size' => 50));
$mform->setType('wwwroot', PARAM_URL);
+ $mform->addRule('wwwroot', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
$themes = array('' => get_string('forceno'));
foreach (array_keys(get_plugin_list('theme')) as $themename) {
View
7 admin/mnet/peers.php
@@ -240,7 +240,8 @@
}
// process all hosts first since it's the easiest
if ($host->id == $CFG->mnet_all_hosts_id) {
- $table->data[] = array(html_writer::tag('a', $host->name, array('href'=>$hosturl)), '', '', '');
+ $table->data[] = array(html_writer::link($hosturl, get_string('allhosts', 'core_mnet')), '*', '', '');
+ continue;
}
// populate the list of deleted hosts
@@ -252,11 +253,11 @@
if ($host->last_connect_time == 0) {
$last_connect = get_string('never');
} else {
- $last_connect = date('H:i:s d/m/Y', $host->last_connect_time);
+ $last_connect = userdate($host->last_connect_time, get_string('strftimedatetime', 'core_langconfig'));
}
$table->data[] = array(
html_writer::link($hosturl, $host->name),
- html_writer::link($hosturl, $host->wwwroot),
+ html_writer::link($host->wwwroot, $host->wwwroot),
$last_connect,
$OUTPUT->single_button(new moodle_url('/admin/mnet/delete.php', array('hostid' => $host->id)), get_string('delete'))
);
View
3  admin/settings/mnet.php
@@ -22,6 +22,9 @@
$hosts = mnet_get_hosts();
foreach ($hosts as $host) {
+ if ($host->id == $CFG->mnet_all_hosts_id) {
+ $host->name = get_string('allhosts', 'core_mnet');
+ }
$ADMIN->add('mnetpeercat',
new admin_externalpage(
'mnetpeer' . $host->id,
View
3  lang/en/mnet.php
@@ -28,6 +28,7 @@
$string['addhost'] = 'Add host';
$string['addnewhost'] = 'Add a new host';
$string['addtoacl'] = 'Add to access control';
+$string['allhosts'] = 'All hosts';
$string['allhosts_no_options'] = 'No options are available when viewing multiple hosts';
$string['allow'] = 'Allow';
$string['applicationtype'] = 'Application type';
@@ -79,7 +80,7 @@
$string['hideremote'] = 'Hide remote users';
$string['host'] = 'host';
$string['hostcoursenotfound'] = 'Host or course not found';
-$string['hostdeleted'] = 'Ok - host deleted';
+$string['hostdeleted'] = 'Host deleted';
$string['hostexists'] = 'A record already exists for a host with that hostname (it may be deleted). <a href="{$a}">click here</a> to edit that record.';
$string['hostlist'] = 'List of networked hosts';
$string['hostname'] = 'Hostname';
Please sign in to comment.
Something went wrong with that request. Please try again.