Skip to content

Commit

Permalink
MDL-49329 admin: Improve Plugins check page
Browse files Browse the repository at this point in the history
Better inform about the number of plugins requiring attention vs total
plugins. Clean up the renderer.
  • Loading branch information
mudrd8mz committed Oct 8, 2015
1 parent 9137a89 commit 0ec7d10
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 45 deletions.
71 changes: 35 additions & 36 deletions admin/renderer.php
Expand Up @@ -881,11 +881,12 @@ public function plugins_check_table(core_plugin_manager $pluginman, $version, ar
);
$table->data = array();

// Number of displayed plugins per type (we call them 'highlighted'
// because in early version of the page, we always displayed all the
// plugins rows and highlighted were those requiring attention.
$numofhighlighted = array();

// Number of displayed plugins per type.
$numdisplayed = array();
// Number of plugins known to the plugin manager.
$sumtotal = 0;
// Number of plugins requiring attention.
$sumattention = 0;
// List of all components we can cancel installation of.
$installabortable = array();

Expand All @@ -897,7 +898,7 @@ public function plugins_check_table(core_plugin_manager $pluginman, $version, ar
$header = new html_table_row(array($header));
$header->attributes['class'] = 'plugintypeheader type-' . $type;

$numofhighlighted[$type] = 0;
$numdisplayed[$type] = 0;

if (empty($plugins) and $options['full']) {
$msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
Expand All @@ -912,6 +913,7 @@ public function plugins_check_table(core_plugin_manager $pluginman, $version, ar
$plugintyperows = array();

foreach ($plugins as $name => $plugin) {
$sumtotal++;
$row = new html_table_row();
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;

Expand Down Expand Up @@ -1002,73 +1004,70 @@ public function plugins_check_table(core_plugin_manager $pluginman, $version, ar
if (empty($options['full'])) {
continue;
}
}

// ok, the plugin should be displayed
$numofhighlighted[$type]++;
} else {
$sumattention++;
}

// The plugin should be displayed.
$numdisplayed[$type]++;
$row->cells = array($displayname, $versiondb, $versiondisk, $requires, $status);
$plugintyperows[] = $row;
}

if (empty($numofhighlighted[$type]) and empty($options['full'])) {
if (empty($numdisplayed[$type]) and empty($options['full'])) {
continue;
}

$table->data[] = $header;
$table->data = array_merge($table->data, $plugintyperows);
}

$sumofhighlighted = array_sum($numofhighlighted);
// Total number of displayed plugins.
$sumdisplayed = array_sum($numdisplayed);

if ($options['xdep']) {
// we do not want to display no heading and links in this mode
$out = '';
// At the plugins dependencies check page, display the table only.
return html_writer::table($table);
}

$out = $this->output->container_start('', 'plugins-check-info');

} else if ($sumofhighlighted == 0) {
$out = $this->output->container_start('nonehighlighted', 'plugins-check-info');
$out .= $this->output->heading(get_string('nonehighlighted', 'core_plugin'));
if ($sumdisplayed == 0) {
$out .= $this->output->heading(get_string('pluginchecknone', 'core_plugin'));
if (empty($options['full'])) {
$out .= html_writer::link(new moodle_url($this->page->url,
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1, 'cache' => 0)),
get_string('nonehighlightedinfo', 'core_plugin'));
$out .= $linkall;
}
$out .= $this->output->container_end();

} else {
$out = $this->output->container_start('somehighlighted', 'plugins-check-info');

if (empty($options['full'])) {
$out .= $this->output->heading(get_string('somehighlighted', 'core_plugin', $sumofhighlighted));
$out .= $this->output->heading(get_string('plugincheckattention', 'core_plugin'));
} else {
$out .= $this->output->heading(get_string('somehighlightedall', 'core_plugin', $sumofhighlighted));
$out .= $this->output->heading(get_string('plugincheckall', 'core_plugin'));
}

$out .= $this->output->container_start('actions');

if ($installabortable) {
$out .= $this->output->single_button(
new moodle_url($this->page->url, array('abortinstallx' => 1)),
get_string('cancelinstallall', 'core_plugin', count($installabortable)),
'post',
array('class' => 'actionbutton')
array('class' => 'singlebutton cancelinstallall')
);
}

if (empty($options['full'])) {
$out .= html_writer::link(new moodle_url($this->page->url, array('confirmupgrade' => 1, 'confirmrelease' => 1,
'cache' => 0, 'showallplugins' => 1)), get_string('somehighlightedinfo', 'core_plugin'));
} else {
$out .= html_writer::link(
new moodle_url($this->page->url, array('confirmupgrade' => 1, 'confirmrelease' => 1,
'cache' => 0, 'showallplugins' => 0)), get_string('somehighlightedonly', 'core_plugin'));
}
$out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 0)),
get_string('plugincheckattention', 'core_plugin')).' '.html_writer::span($sumattention, 'badge'));

$out .= html_writer::div(html_writer::link(new moodle_url($this->page->url, array('showallplugins' => 1)),
get_string('plugincheckall', 'core_plugin')).' '.html_writer::span($sumtotal, 'badge'));

$out .= $this->output->container_end(); // .actions
$out .= $this->output->container_end(); // #plugins-check-info .somehighlighted
}

if ($sumofhighlighted > 0 or $options['full']) {
$out .= $this->output->container_end(); // #plugins-check-info

if ($sumdisplayed > 0 or $options['full']) {
$out .= html_writer::table($table);
}

Expand Down
11 changes: 4 additions & 7 deletions lang/en/plugin.php
Expand Up @@ -56,8 +56,6 @@
$string['misdepsunavaillist'] = 'No version found to fulfill the dependency requirements: {$a}.';
$string['misdepsunknownlist'] = 'Not in the Plugins directory: <strong>{$a}</strong>.';
$string['moodleversion'] = 'Moodle {$a}';
$string['nonehighlighted'] = 'No plugins require your attention now';
$string['nonehighlightedinfo'] = 'Display the list of all installed plugins anyway';
$string['noneinstalled'] = 'No plugins of this type are installed';
$string['notes'] = 'Notes';
$string['notdownloadable'] = 'Can not download the package';
Expand All @@ -75,7 +73,10 @@
$string['otherplugin'] = '{$a->component}';
$string['otherpluginversion'] = '{$a->component} ({$a->version})';
$string['showall'] = 'Reload and show all plugins';
$string['pluginchecknotice'] = 'This page displays plugins that may require your attention during the upgrade. Highlighted items include new plugins that are about to be installed, updated plugins that are about to be upgraded and any missing plugins. Additional plugins are highlighted if there is an available update for them. It is recommended that you check whether there are more recent versions of plugins available and update their source code before continuing with this Moodle upgrade.';
$string['plugincheckall'] = 'All plugins';
$string['plugincheckattention'] = 'Plugins requiring attention';
$string['pluginchecknone'] = 'No plugins require your attention now';
$string['pluginchecknotice'] = 'This page displays plugins that may require your attention during the upgrade, such as new plugins to be installed, plugins to be upgraded, missing plugins etc. Additional plugins are displayed if there is an available update for them. It is recommended that you check whether there are more recent versions of plugins available and update their source code before continuing with this Moodle upgrade.';
$string['plugindisable'] = 'Disable';
$string['plugindisabled'] = 'Disabled';
$string['pluginenable'] = 'Enable';
Expand All @@ -85,10 +86,6 @@
$string['requires'] = 'Requires';
$string['rootdir'] = 'Directory';
$string['settings'] = 'Settings';
$string['somehighlighted'] = 'Number of plugins requiring your attention: {$a}';
$string['somehighlightedall'] = 'Number of installed plugins: {$a}';
$string['somehighlightedinfo'] = 'Display the full list of installed plugins';
$string['somehighlightedonly'] = 'Display only plugins requiring your attention';
$string['source'] = 'Source';
$string['sourceext'] = 'Additional';
$string['sourcestd'] = 'Standard';
Expand Down
5 changes: 4 additions & 1 deletion theme/bootstrapbase/less/moodle/admin.less
Expand Up @@ -604,8 +604,11 @@ img.iconsmall {
// Section before the plugins check table.
#plugins-check-info {
.actions {
.actionbutton {
> div {
display: inline-block;
margin-right: 1em;
}
.singlebutton {
margin: 5px;
padding: 0;
input {
Expand Down
2 changes: 1 addition & 1 deletion theme/bootstrapbase/style/moodle.css

Large diffs are not rendered by default.

0 comments on commit 0ec7d10

Please sign in to comment.