mirror of
https://github.com/moodle/moodle.git
synced 2025-07-09 16:36:28 +02:00
MDL-26784 Improved plugins check screen and the new plugins management screen
This patch introduces new lib/pluginlib.php library that provides unified access meta-information about all present plugin types. The library defines plugin_manager singleton that in turn gathers information about all present plugins and their status. The list of plugins can be rendered either as plugins check table or plugins control panel. This makes print_plugins_table() function obsolete and because it is not expected to be called by any contrib plugin, the function is removed. CSS for the legacy table generated by print_plugins_table() is cleaned up.
This commit is contained in:
@ -48,6 +48,7 @@ $id = optional_param('id', '', PARAM_TEXT);
|
||||
$confirmupgrade = optional_param('confirmupgrade', 0, PARAM_BOOL);
|
||||
$confirmrelease = optional_param('confirmrelease', 0, PARAM_BOOL);
|
||||
$confirmplugins = optional_param('confirmplugincheck', 0, PARAM_BOOL);
|
||||
$showallplugins = optional_param('showallplugins', 0, PARAM_BOOL);
|
||||
$agreelicense = optional_param('agreelicense', 0, PARAM_BOOL);
|
||||
|
||||
// Check some PHP server settings
|
||||
@ -255,17 +256,19 @@ if ($version > $CFG->version) { // upgrade
|
||||
$PAGE->set_title($strplugincheck);
|
||||
$PAGE->set_heading($strplugincheck);
|
||||
$PAGE->set_cacheable(false);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strplugincheck);
|
||||
echo $OUTPUT->box_start('generalbox', 'notice');
|
||||
print_string('pluginchecknotice');
|
||||
echo $OUTPUT->box_end();
|
||||
print_plugin_tables();
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
|
||||
echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
|
||||
echo $output->box_end();
|
||||
print_upgrade_reload('index.php?confirmupgrade=1&confirmrelease=1');
|
||||
$button = new single_button(new moodle_url('index.php', array('confirmupgrade'=>1, 'confirmrelease'=>1, 'confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
|
||||
$button->class = 'continuebutton';
|
||||
echo $OUTPUT->render($button);
|
||||
echo $OUTPUT->footer();
|
||||
echo $output->render($button);
|
||||
echo $output->footer();
|
||||
die();
|
||||
|
||||
} else {
|
||||
@ -293,17 +296,19 @@ if (moodle_needs_upgrading()) {
|
||||
$PAGE->set_title($strplugincheck);
|
||||
$PAGE->set_heading($strplugincheck);
|
||||
$PAGE->set_cacheable(false);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading($strplugincheck);
|
||||
echo $OUTPUT->box_start('generalbox', 'notice');
|
||||
print_string('pluginchecknotice');
|
||||
echo $OUTPUT->box_end();
|
||||
print_plugin_tables();
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->container(get_string('pluginchecknotice', 'core_plugin'), 'generalbox', 'notice');
|
||||
echo $output->plugins_check($pluginman->get_plugins(), array('full' => $showallplugins));
|
||||
echo $output->box_end();
|
||||
print_upgrade_reload('index.php');
|
||||
$button = new single_button(new moodle_url('index.php', array('confirmplugincheck'=>1)), get_string('upgradestart', 'admin'), 'get');
|
||||
$button->class = 'continuebutton';
|
||||
echo $OUTPUT->render($button);
|
||||
echo $OUTPUT->footer();
|
||||
echo $output->render($button);
|
||||
echo $output->footer();
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
41
admin/plugins.php
Normal file
41
admin/plugins.php
Normal file
@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* UI for general plugins management
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @copyright 2011 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
require_once(dirname(dirname(__FILE__)) . '/config.php');
|
||||
require_once($CFG->libdir . '/adminlib.php');
|
||||
require_once($CFG->libdir . '/pluginlib.php');
|
||||
|
||||
require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
|
||||
admin_externalpage_setup('pluginsoverview');
|
||||
$output = $PAGE->get_renderer('core', 'admin');
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
echo $output->header();
|
||||
echo $output->heading(get_string('pluginsoverview', 'core_admin'));
|
||||
echo $output->box_start('generalbox');
|
||||
echo $output->plugins_control_panel($pluginman->get_plugins());
|
||||
echo $output->box_end();
|
||||
echo $output->footer();
|
296
admin/renderer.php
Normal file
296
admin/renderer.php
Normal file
@ -0,0 +1,296 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* Renderer for core_admin subsystem
|
||||
*
|
||||
* @package core
|
||||
* @subpackage admin
|
||||
* @copyright 2011 David Mudrak <david@moodle.com>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
require_once($CFG->libdir . '/pluginlib.php');
|
||||
|
||||
/**
|
||||
* Standard HTML output renderer for core_admin subsystem
|
||||
*/
|
||||
class core_admin_renderer extends plugin_renderer_base {
|
||||
|
||||
/**
|
||||
* Displays all known plugins and information about their installation or upgrade
|
||||
*
|
||||
* This default implementation renders all plugins into one big table. The rendering
|
||||
* options support:
|
||||
* (bool)full = false: whether to display up-to-date plugins, too
|
||||
*
|
||||
* @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
|
||||
* @param array $options rendering options
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_check(array $plugininfo, array $options = null) {
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (empty($options)) {
|
||||
$options = array(
|
||||
'full' => false,
|
||||
);
|
||||
}
|
||||
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'plugins-check';
|
||||
$table->head = array(
|
||||
get_string('displayname', 'core_plugin'),
|
||||
get_string('rootdir', 'core_plugin'),
|
||||
get_string('source', 'core_plugin'),
|
||||
get_string('versiondb', 'core_plugin'),
|
||||
get_string('versiondisk', 'core_plugin'),
|
||||
get_string('status', 'core_plugin'),
|
||||
);
|
||||
$table->colclasses = array(
|
||||
'displayname', 'rootdir', 'source', 'versiondb', 'versiondisk', 'status',
|
||||
);
|
||||
$table->data = array();
|
||||
|
||||
$numofhighlighted = array(); // number of highlighted rows per this subsection
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
|
||||
$header = new html_table_cell($pluginman->plugintype_name_plural($type));
|
||||
$header->header = true;
|
||||
$header->colspan = count($table->head);
|
||||
$header = new html_table_row(array($header));
|
||||
$header->attributes['class'] = 'plugintypeheader type-' . $type;
|
||||
|
||||
$numofhighlighted[$type] = 0;
|
||||
|
||||
if (empty($plugins) and $options['full']) {
|
||||
$msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
|
||||
$msg->colspan = count($table->head);
|
||||
$row = new html_table_row(array($msg));
|
||||
$row->attributes['class'] .= 'msg msg-noneinstalled';
|
||||
$table->data[] = $header;
|
||||
$table->data[] = $row;
|
||||
continue;
|
||||
}
|
||||
|
||||
$plugintyperows = array();
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$row = new html_table_row();
|
||||
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
|
||||
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
|
||||
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
|
||||
} else {
|
||||
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'smallicon pluginicon noicon'));
|
||||
}
|
||||
$displayname = $icon . ' ' . $plugin->displayname;
|
||||
$displayname = new html_table_cell($displayname);
|
||||
|
||||
$rootdir = new html_table_cell($plugin->get_dir());
|
||||
|
||||
if ($isstandard = $plugin->is_standard()) {
|
||||
$row->attributes['class'] .= ' standard';
|
||||
$source = new html_table_cell(get_string('sourcestd', 'core_plugin'));
|
||||
} else {
|
||||
$row->attributes['class'] .= ' extension';
|
||||
$source = new html_table_cell(get_string('sourceext', 'core_plugin'));
|
||||
}
|
||||
|
||||
$versiondb = new html_table_cell($plugin->versiondb);
|
||||
$versiondisk = new html_table_cell($plugin->versiondisk);
|
||||
|
||||
$statuscode = $plugin->get_status();
|
||||
$row->attributes['class'] .= ' status-' . $statuscode;
|
||||
|
||||
$status = new html_table_cell(get_string('status_' . $statuscode, 'core_plugin'));
|
||||
|
||||
if ($isstandard and in_array($statuscode, array(plugin_manager::PLUGIN_STATUS_NODB, plugin_manager::PLUGIN_STATUS_UPTODATE))) {
|
||||
if (empty($options['full'])) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
$numofhighlighted[$type]++;
|
||||
}
|
||||
|
||||
$row->cells = array($displayname, $rootdir, $source, $versiondb, $versiondisk, $status);
|
||||
$plugintyperows[] = $row;
|
||||
}
|
||||
|
||||
if (empty($numofhighlighted[$type]) and empty($options['full'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$table->data[] = $header;
|
||||
$table->data = array_merge($table->data, $plugintyperows);
|
||||
}
|
||||
|
||||
$sumofhighlighted = array_sum($numofhighlighted);
|
||||
|
||||
if ($sumofhighlighted == 0) {
|
||||
$out = $this->output->container_start('nonehighlighted', 'plugins-check-info');
|
||||
$out .= $this->output->heading(get_string('nonehighlighted', 'core_plugin'));
|
||||
if (empty($options['full'])) {
|
||||
$out .= html_writer::link(new moodle_url('/admin/index.php',
|
||||
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1)),
|
||||
get_string('nonehighlightedinfo', 'core_plugin'));
|
||||
}
|
||||
$out .= $this->output->container_end();
|
||||
|
||||
} else {
|
||||
$out = $this->output->container_start('somehighlighted', 'plugins-check-info');
|
||||
$out .= $this->output->heading(get_string('somehighlighted', 'core_plugin', $sumofhighlighted));
|
||||
if (empty($options['full'])) {
|
||||
$out .= html_writer::link(new moodle_url('/admin/index.php',
|
||||
array('confirmupgrade' => 1, 'confirmrelease' => 1, 'showallplugins' => 1)),
|
||||
get_string('somehighlightedinfo', 'core_plugin'));
|
||||
}
|
||||
$out .= $this->output->container_end();
|
||||
}
|
||||
|
||||
if ($sumofhighlighted > 0 or $options['full']) {
|
||||
$out .= html_writer::table($table);
|
||||
}
|
||||
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays all known plugins and links to manage them
|
||||
*
|
||||
* This default implementation renders all plugins into one big table.
|
||||
*
|
||||
* @param array $plugininfo as returned by {@see plugin_manager::get_plugins()}
|
||||
* @return string HTML code
|
||||
*/
|
||||
public function plugins_control_panel(array $plugininfo) {
|
||||
|
||||
if (empty($plugininfo)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$pluginman = plugin_manager::instance();
|
||||
|
||||
$table = new html_table();
|
||||
$table->id = 'plugins-control-panel';
|
||||
$table->head = array(
|
||||
get_string('displayname', 'core_plugin'),
|
||||
get_string('systemname', 'core_plugin'),
|
||||
get_string('source', 'core_plugin'),
|
||||
get_string('version', 'core_plugin'),
|
||||
get_string('availability', 'core_plugin'),
|
||||
get_string('settings', 'core_plugin'),
|
||||
get_string('uninstall','core_plugin'),
|
||||
);
|
||||
$table->colclasses = array(
|
||||
'displayname', 'systemname', 'source', 'version', 'availability', 'settings', 'uninstall',
|
||||
);
|
||||
|
||||
foreach ($plugininfo as $type => $plugins) {
|
||||
|
||||
$header = new html_table_cell($pluginman->plugintype_name_plural($type));
|
||||
$header->header = true;
|
||||
$header->colspan = count($table->head);
|
||||
$header = new html_table_row(array($header));
|
||||
$header->attributes['class'] = 'plugintypeheader type-' . $type;
|
||||
$table->data[] = $header;
|
||||
|
||||
if (empty($plugins)) {
|
||||
$msg = new html_table_cell(get_string('noneinstalled', 'core_plugin'));
|
||||
$msg->colspan = count($table->head);
|
||||
$row = new html_table_row(array($msg));
|
||||
$row->attributes['class'] .= 'msg msg-noneinstalled';
|
||||
$table->data[] = $row;
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($plugins as $name => $plugin) {
|
||||
$row = new html_table_row();
|
||||
$row->attributes['class'] = 'type-' . $plugin->type . ' name-' . $plugin->type . '_' . $plugin->name;
|
||||
|
||||
if ($this->page->theme->resolve_image_location('icon', $plugin->type . '_' . $plugin->name)) {
|
||||
$icon = $this->output->pix_icon('icon', '', $plugin->type . '_' . $plugin->name, array('class' => 'smallicon pluginicon'));
|
||||
} else {
|
||||
$icon = $this->output->pix_icon('spacer', '', 'moodle', array('class' => 'smallicon pluginicon noicon'));
|
||||
}
|
||||
if ($plugin->get_status() === plugin_manager::PLUGIN_STATUS_MISSING) {
|
||||
$msg = html_writer::tag('span', get_string('status_missing', 'core_plugin'), array('class' => 'notifyproblem'));
|
||||
$row->attributes['class'] .= ' missingfromdisk';
|
||||
} else {
|
||||
$msg = '';
|
||||
}
|
||||
$displayname = $icon . ' ' . $plugin->displayname . ' ' . $msg;
|
||||
$displayname = new html_table_cell($displayname);
|
||||
|
||||
$systemname = new html_table_cell($plugin->type . '_' . $plugin->name);
|
||||
|
||||
if ($plugin->is_standard()) {
|
||||
$row->attributes['class'] .= ' standard';
|
||||
$source = new html_table_cell(get_string('sourcestd', 'core_plugin'));
|
||||
} else {
|
||||
$row->attributes['class'] .= ' extension';
|
||||
$source = new html_table_cell(get_string('sourceext', 'core_plugin'));
|
||||
}
|
||||
|
||||
$version = new html_table_cell($plugin->versiondb);
|
||||
|
||||
$isenabled = $plugin->is_enabled();
|
||||
if (is_null($isenabled)) {
|
||||
$availability = new html_table_cell('');
|
||||
} else if ($isenabled) {
|
||||
$row->attributes['class'] .= ' enabled';
|
||||
$icon = $this->output->pix_icon('i/hide', get_string('pluginenabled', 'core_plugin'));
|
||||
$availability = new html_table_cell($icon . ' ' . get_string('pluginenabled', 'core_plugin'));
|
||||
} else {
|
||||
$row->attributes['class'] .= ' disabled';
|
||||
$icon = $this->output->pix_icon('i/show', get_string('plugindisabled', 'core_plugin'));
|
||||
$availability = new html_table_cell($icon . ' ' . get_string('plugindisabled', 'core_plugin'));
|
||||
}
|
||||
|
||||
$settingsurl = $plugin->get_settings_url();
|
||||
if (is_null($settingsurl)) {
|
||||
$settings = new html_table_cell('');
|
||||
} else {
|
||||
$settings = html_writer::link($settingsurl, get_string('settings', 'core_plugin'));
|
||||
$settings = new html_table_cell($settings);
|
||||
}
|
||||
|
||||
$uninstallurl = $plugin->get_uninstall_url();
|
||||
if (is_null($uninstallurl)) {
|
||||
$uninstall = new html_table_cell('');
|
||||
} else {
|
||||
$uninstall = html_writer::link($uninstallurl, get_string('uninstall', 'core_plugin'));
|
||||
$uninstall = new html_table_cell($uninstall);
|
||||
}
|
||||
|
||||
$row->cells = array(
|
||||
$displayname, $systemname, $source, $version, $availability, $settings, $uninstall
|
||||
);
|
||||
$table->data[] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
return html_writer::table($table);
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@
|
||||
*/
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$ADMIN->add('modules', new admin_page_pluginsoverview());
|
||||
$ADMIN->add('modules', new admin_category('modsettings', get_string('activitymodules')));
|
||||
$ADMIN->add('modsettings', new admin_page_managemods());
|
||||
$modules = $DB->get_records('modules', array(), "name ASC");
|
||||
|
@ -800,6 +800,7 @@ $string['pleaserefreshregistration'] = 'Your site has been registered with moodl
|
||||
$string['pleaseregister'] = 'Please register your site to remove this button';
|
||||
$string['plugin'] = 'Plugin';
|
||||
$string['plugins'] = 'Plugins';
|
||||
$string['pluginsoverview'] = 'Plugins overview';
|
||||
$string['profilecategory'] = 'Category';
|
||||
$string['profilecategoryname'] = 'Category name (must be unique)';
|
||||
$string['profilecategorynamenotunique'] = 'This category name is already in use';
|
||||
|
203
lib/adminlib.php
203
lib/adminlib.php
@ -4586,6 +4586,21 @@ class admin_setting_special_registerauth extends admin_setting_configselect {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* General plugins manager
|
||||
*/
|
||||
class admin_page_pluginsoverview extends admin_externalpage {
|
||||
|
||||
/**
|
||||
* Sets basic information about the external page
|
||||
*/
|
||||
public function __construct() {
|
||||
global $CFG;
|
||||
parent::__construct('pluginsoverview', get_string('pluginsoverview', 'core_admin'),
|
||||
"$CFG->wwwroot/$CFG->admin/plugins.php");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Module manage page
|
||||
*
|
||||
@ -6116,194 +6131,6 @@ function db_replace($search, $replace) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints tables of detected plugins, one table per plugin type,
|
||||
* and prints whether they are part of the standard Moodle
|
||||
* distribution or not.
|
||||
*/
|
||||
function print_plugin_tables() {
|
||||
global $DB;
|
||||
$plugins_standard = array();
|
||||
$plugins_standard['mod'] = array('assignment',
|
||||
'chat',
|
||||
'choice',
|
||||
'data',
|
||||
'feedback',
|
||||
'folder',
|
||||
'forum',
|
||||
'glossary',
|
||||
'imscp',
|
||||
'label',
|
||||
'lesson',
|
||||
'page',
|
||||
'quiz',
|
||||
'resource',
|
||||
'scorm',
|
||||
'survey',
|
||||
'url',
|
||||
'wiki',
|
||||
'workshop');
|
||||
|
||||
$plugins_standard['blocks'] = array('activity_modules',
|
||||
'admin_bookmarks',
|
||||
'blog_menu',
|
||||
'blog_recent',
|
||||
'blog_tags',
|
||||
'calendar_month',
|
||||
'calendar_upcoming',
|
||||
'comments',
|
||||
'community',
|
||||
'completionstatus',
|
||||
'course_list',
|
||||
'course_overview',
|
||||
'course_summary',
|
||||
'feedback',
|
||||
'glossary_random',
|
||||
'html',
|
||||
'login',
|
||||
'mentees',
|
||||
'messages',
|
||||
'mnet_hosts',
|
||||
'myprofile',
|
||||
'navigation',
|
||||
'news_items',
|
||||
'online_users',
|
||||
'participants',
|
||||
'private_files',
|
||||
'quiz_results',
|
||||
'recent_activity',
|
||||
'rss_client',
|
||||
'search',
|
||||
'search_forums',
|
||||
'section_links',
|
||||
'selfcompletion',
|
||||
'settings',
|
||||
'site_main_menu',
|
||||
'social_activities',
|
||||
'tag_flickr',
|
||||
'tag_youtube',
|
||||
'tags');
|
||||
|
||||
$plugins_standard['filter'] = array('activitynames',
|
||||
'algebra',
|
||||
'censor',
|
||||
'emailprotect',
|
||||
'emoticon',
|
||||
'filter',
|
||||
'mediaplugin',
|
||||
'multilang',
|
||||
'tex',
|
||||
'tidy',
|
||||
'urltolink');
|
||||
|
||||
$plugins_installed = array();
|
||||
$installed_mods = $DB->get_records('modules', null, 'name');
|
||||
$installed_blocks = $DB->get_records('block', null, 'name');
|
||||
|
||||
foreach($installed_mods as $mod) {
|
||||
$plugins_installed['mod'][] = $mod->name;
|
||||
}
|
||||
|
||||
foreach($installed_blocks as $block) {
|
||||
$plugins_installed['blocks'][] = $block->name;
|
||||
}
|
||||
$plugins_installed['filter'] = array();
|
||||
|
||||
$plugins_ondisk = array();
|
||||
$plugins_ondisk['mod'] = array_keys(get_plugin_list('mod'));
|
||||
$plugins_ondisk['blocks'] = array_keys(get_plugin_list('block'));
|
||||
$plugins_ondisk['filter'] = array_keys(get_plugin_list('filter'));
|
||||
|
||||
$strstandard = get_string('standard');
|
||||
$strnonstandard = get_string('nonstandard');
|
||||
$strmissingfromdisk = '(' . get_string('missingfromdisk') . ')';
|
||||
$strabouttobeinstalled = '(' . get_string('abouttobeinstalled') . ')';
|
||||
|
||||
$html = '';
|
||||
|
||||
$html .= '<table class="generaltable plugincheckwrapper" cellspacing="4" cellpadding="1"><tr valign="top">';
|
||||
|
||||
foreach ($plugins_ondisk as $cat => $list_ondisk) {
|
||||
if ($cat == 'mod') {
|
||||
$strcaption = get_string('activitymodule');
|
||||
} elseif ($cat == 'filter') {
|
||||
$strcaption = get_string('managefilters');
|
||||
} else {
|
||||
$strcaption = get_string($cat);
|
||||
}
|
||||
|
||||
$html .= '<td><table class="plugincompattable generaltable boxaligncenter" cellspacing="1" cellpadding="5" '
|
||||
. 'id="' . $cat . 'compattable" summary="compatibility table"><caption>' . $strcaption . '</caption>' . "\n";
|
||||
$html .= '<tr class="r0"><th class="header c0">' . get_string('directory') . "</th>\n"
|
||||
. '<th class="header c1">' . get_string('name') . "</th>\n"
|
||||
. '<th class="header c2">' . get_string('status') . "</th>\n</tr>\n";
|
||||
|
||||
$row = 1;
|
||||
|
||||
foreach ($list_ondisk as $k => $plugin) {
|
||||
$status = 'ok';
|
||||
$standard = 'standard';
|
||||
$note = '';
|
||||
|
||||
if (!in_array($plugin, $plugins_standard[$cat])) {
|
||||
$standard = 'nonstandard';
|
||||
$status = 'warning';
|
||||
}
|
||||
|
||||
// Get real name and full path of plugin
|
||||
$plugin_name = "[[$plugin]]";
|
||||
|
||||
$plugin_path = "$cat/$plugin";
|
||||
|
||||
$plugin_name = get_plugin_name($plugin, $cat);
|
||||
|
||||
// Determine if the plugin is about to be installed
|
||||
if ($cat != 'filter' && !in_array($plugin, $plugins_installed[$cat])) {
|
||||
$note = $strabouttobeinstalled;
|
||||
$plugin_name = $plugin;
|
||||
}
|
||||
|
||||
$html .= "<tr class=\"r$row\">\n"
|
||||
. "<td class=\"cell c0\">$plugin_path</td>\n"
|
||||
. "<td class=\"cell c1\">$plugin_name</td>\n"
|
||||
. "<td class=\"$standard $status cell c2\">" . ${'str' . $standard} . " $note</td>\n</tr>\n";
|
||||
$row++;
|
||||
|
||||
// If the plugin was both on disk and in the db, unset the value from the installed plugins list
|
||||
if ($key = array_search($plugin, $plugins_installed[$cat])) {
|
||||
unset($plugins_installed[$cat][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// If there are plugins left in the plugins_installed list, it means they are missing from disk
|
||||
foreach ($plugins_installed[$cat] as $k => $missing_plugin) {
|
||||
// Make sure the plugin really is missing from disk
|
||||
if (!in_array($missing_plugin, $plugins_ondisk[$cat])) {
|
||||
$standard = 'standard';
|
||||
$status = 'warning';
|
||||
|
||||
if (!in_array($missing_plugin, $plugins_standard[$cat])) {
|
||||
$standard = 'nonstandard';
|
||||
}
|
||||
|
||||
$plugin_name = $missing_plugin;
|
||||
$html .= "<tr class=\"r$row\">\n"
|
||||
. "<td class=\"cell c0\">?</td>\n"
|
||||
. "<td class=\"cell c1\">$plugin_name</td>\n"
|
||||
. "<td class=\"$standard $status cell c2\">" . ${'str' . $standard} . " $strmissingfromdisk</td>\n</tr>\n";
|
||||
$row++;
|
||||
}
|
||||
}
|
||||
|
||||
$html .= '</table></td>';
|
||||
}
|
||||
|
||||
$html .= '</tr></table><br />';
|
||||
|
||||
echo $html;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Manage repository settings
|
||||
*
|
||||
|
@ -9659,41 +9659,6 @@ function object_array_unique($array, $keep_key_assoc = true) {
|
||||
return $keep_key_assoc ? $array : array_values($array);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language string for the given plugin.
|
||||
*
|
||||
* @param string $plugin the plugin code name
|
||||
* @param string $type the type of plugin (mod, block, filter)
|
||||
* @return string The plugin language string
|
||||
*/
|
||||
function get_plugin_name($plugin, $type='mod') {
|
||||
$plugin_name = '';
|
||||
|
||||
switch ($type) {
|
||||
case 'mod':
|
||||
$plugin_name = get_string('modulename', $plugin);
|
||||
break;
|
||||
case 'blocks':
|
||||
$plugin_name = get_string('pluginname', "block_$plugin");
|
||||
if (empty($plugin_name) || $plugin_name == '[[pluginname]]') {
|
||||
if (($block = block_instance($plugin)) !== false) {
|
||||
$plugin_name = $block->get_title();
|
||||
} else {
|
||||
$plugin_name = "[[$plugin]]";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'filter':
|
||||
$plugin_name = filter_get_name('filter/' . $plugin);
|
||||
break;
|
||||
default:
|
||||
$plugin_name = $plugin;
|
||||
break;
|
||||
}
|
||||
|
||||
return $plugin_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a userid the primary administrator?
|
||||
*
|
||||
|
@ -847,13 +847,13 @@ class page_requirements_manager {
|
||||
* passed in $module.
|
||||
*
|
||||
* <code>
|
||||
* $PAGE->strings_for_js(Array('one', 'two', 'three'), 'mymod', Array('a', null, 3));
|
||||
* $PAGE->requires->strings_for_js(array('one', 'two', 'three'), 'mymod', array('a', null, 3));
|
||||
*
|
||||
* // The above is identitical to calling
|
||||
*
|
||||
* $PAGE->string_for_js('one', 'mymod', 'a');
|
||||
* $PAGE->string_for_js('two', 'mymod');
|
||||
* $PAGE->string_for_js('three', 'mymod', 3);
|
||||
* $PAGE->requires->string_for_js('one', 'mymod', 'a');
|
||||
* $PAGE->requires->string_for_js('two', 'mymod');
|
||||
* $PAGE->requires->string_for_js('three', 'mymod', 3);
|
||||
* </code>
|
||||
*
|
||||
* @param array $identifiers An array of desired strings
|
||||
|
1483
lib/pluginlib.php
Normal file
1483
lib/pluginlib.php
Normal file
File diff suppressed because it is too large
Load Diff
@ -121,8 +121,6 @@ html, body {background-color:#C8C9C7;}
|
||||
.group .r1 .cell,
|
||||
.admin table .r1 .cell {background-color:#EEE;}
|
||||
|
||||
.admin .plugincompattable .r1 .cell {background-color:#FFF;}
|
||||
|
||||
.singlebutton,
|
||||
.buttons {text-align:center;margin:20px;}
|
||||
.buttons form {display:inline;}
|
||||
@ -222,4 +220,4 @@ html, body {background-color:#C8C9C7;}
|
||||
|
||||
/** Overide for RTL layout **/
|
||||
.dir-rtl #page-header .navbar .breadcrumb {float:right;}
|
||||
.dir-rtl #page-header .navbar .navbutton {float:left;}
|
||||
.dir-rtl #page-header .navbar .navbutton {float:left;}
|
||||
|
@ -3,11 +3,6 @@
|
||||
**/
|
||||
.formtable tbody th {font-weight: normal;text-align: right;}
|
||||
|
||||
.plugincompattable td.nonstandard,
|
||||
.plugincompattable td.missingplugin {font-weight: bold;}
|
||||
.plugincompattable td.standard,
|
||||
.plugincompattable td.warning {font-style: normal;}
|
||||
|
||||
.path-admin .manageauthtable {width:100%;}
|
||||
|
||||
#page-admin-index .c0 {vertical-align: top;}
|
||||
@ -174,3 +169,26 @@
|
||||
.dir-rtl #adminsettings .form-item .form-setting,
|
||||
.dir-rtl #adminsettings .form-item .form-label,
|
||||
.dir-rtl #adminsettings .form-item .form-description { float: right;text-align: right}
|
||||
|
||||
/** Plugins check */
|
||||
#page-admin-index #plugins-check-info {text-align:center;margin:1em;}
|
||||
#page-admin-index #plugins-check {margin-left:auto; margin-right:auto;}
|
||||
#page-admin-index #plugins-check .displayname .pluginicon {width:16px;}
|
||||
#page-admin-index #plugins-check .missingfromdisk .displayname {background-color:#ffd3d9;}
|
||||
#page-admin-index #plugins-check .standard .source {color:#999;}
|
||||
#page-admin-index #plugins-check .extension .source {background-color:#f3f2aa;}
|
||||
#page-admin-index #plugins-check .msg td {text-align:center;}
|
||||
#page-admin-index #plugins-check .status-downgrade .status {background-color:#ffd3d9;}
|
||||
#page-admin-index #plugins-check .status-missing .status {background-color:#ffd3d9;}
|
||||
#page-admin-index #plugins-check .status-new .status {background-color:#e7f1c3;}
|
||||
#page-admin-index #plugins-check .status-nodb .status {color:#999;}
|
||||
#page-admin-index #plugins-check .status-upgrade .status {background-color:#d2ebff;}
|
||||
#page-admin-index #plugins-check .status-uptodate .status {color:#999;}
|
||||
|
||||
/** Plugins management */
|
||||
#page-admin-plugins #plugins-control-panel {margin-left:auto; margin-right:auto;}
|
||||
#page-admin-plugins #plugins-control-panel .displayname .pluginicon {width:16px;}
|
||||
#page-admin-plugins #plugins-control-panel .missingfromdisk .displayname {background-color:#ffd3d9;}
|
||||
#page-admin-plugins #plugins-control-panel .disabled .availability {background-color:#eee;}
|
||||
#page-admin-plugins #plugins-control-panel .extension .source {background-color:#f3f2aa;}
|
||||
#page-admin-plugins #plugins-control-panel .msg td {text-align:center;}
|
||||
|
@ -110,15 +110,10 @@
|
||||
}
|
||||
|
||||
.plugincheckwrapper {text-align: center;}
|
||||
.plugincompattable {font-size: 70%;text-align: left;}
|
||||
.plugincompattable caption {text-align: center;width: 100%;font-weight: bold;font-size: 130%;}
|
||||
.plugincompattable td.ok {color: #008000;}
|
||||
.plugincompattable td.warning {color: #DF7800;}
|
||||
.plugincompattable td.error {color: #DF0000;}
|
||||
|
||||
/**
|
||||
* Web services
|
||||
*/
|
||||
#page-admin-webservice-service_users .missingcaps {color: #ff6600;font-size: 90%;}
|
||||
#page-admin-setting-webservicetokens .missingcaps {color: #ff6600;font-size: 90%;}
|
||||
#page-admin-webservice-service_functions .functiondesc {font-size: 90%;}
|
||||
#page-admin-webservice-service_functions .functiondesc {font-size: 90%;}
|
||||
|
@ -6,8 +6,6 @@
|
||||
#page-admin-course-category .generalbox td,
|
||||
#attempts th,
|
||||
#attempts td,
|
||||
.plugincompattable th,
|
||||
.plugincompattable td,
|
||||
.environmenttable th,
|
||||
.environmenttable td,
|
||||
.forumheaderlist td,
|
||||
@ -22,9 +20,8 @@
|
||||
.results .header,
|
||||
#attempts .header,
|
||||
.generaltable .header,
|
||||
.plugincompattable th,
|
||||
.environmenttable th,
|
||||
.forumheaderlist th {
|
||||
background: #f3f3f3;
|
||||
border-bottom-width: 2px;
|
||||
}
|
||||
}
|
||||
|
@ -173,13 +173,6 @@ input[type="radio"] {
|
||||
margin-left: 21%;
|
||||
}
|
||||
|
||||
/* Admin management
|
||||
-----------------------*/
|
||||
.plugincompattable {
|
||||
font-size: 100%;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* User
|
||||
-----------------------*/
|
||||
|
||||
@ -540,4 +533,4 @@ padding: 0
|
||||
/**
|
||||
* Redirect
|
||||
*/
|
||||
.pagelayout-redirect #content {text-align:center;margin-top:10%;margin-bottom:10%;}
|
||||
.pagelayout-redirect #content {text-align:center;margin-top:10%;margin-bottom:10%;}
|
||||
|
@ -57,8 +57,6 @@ h1.headerheading {margin:14px 11px 8px 11px;float:left;font-size:2em;z-index:1;}
|
||||
#page-admin-course-category .generalbox td,
|
||||
#attempts th,
|
||||
#attempts td,
|
||||
.plugincompattable th,
|
||||
.plugincompattable td,
|
||||
.environmenttable th,
|
||||
.environmenttable td,
|
||||
.forumheaderlist td,
|
||||
@ -113,4 +111,4 @@ ul.topics .section span.commands {margin-left:2em;} /* distanza dei comandi dagl
|
||||
#page-footer .moodledocs {text-align:center;background-color:#EFEFEF;padding:0.7em 0 0.8em 0;}
|
||||
|
||||
/** Custom CSS **/
|
||||
[[setting:customcss]]
|
||||
[[setting:customcss]]
|
||||
|
@ -38,11 +38,6 @@
|
||||
#page-admin-report-questioninstances-index #settingsform p {margin-bottom: 0;}
|
||||
|
||||
.plugincheckwrapper {text-align: center;}
|
||||
.plugincompattable {font-size: 70%;text-align: left;}
|
||||
.plugincompattable caption {text-align: center;width: 100%;font-weight: bold;font-size: 130%;}
|
||||
.plugincompattable td.ok {color: #008000;}
|
||||
.plugincompattable td.warning {color: #DF7800;}
|
||||
.plugincompattable td.error {color: #DF0000;}
|
||||
|
||||
#page-admin-index .explanation,
|
||||
.path-admin-roles .cell.c1,
|
||||
|
Reference in New Issue
Block a user