Merge branch 'MDL-47069-master-plugin-dependency' of git://github.com/mudrd8mz/moodle

This commit is contained in:
Dan Poltawski 2014-09-29 12:46:11 +01:00
commit 190ceae64b
2 changed files with 23 additions and 12 deletions

View File

@ -1039,19 +1039,28 @@ class core_admin_renderer extends plugin_renderer_base {
}
foreach ($plugin->get_other_required_plugins() as $component => $requiredversion) {
$ok = true;
$otherplugin = $pluginman->get_plugin_info($component);
$actions = array();
if (is_null($otherplugin)) {
$ok = false;
} else if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
$ok = false;
}
// The required plugin is not installed.
$class = 'requires-failed requires-missing';
$installurl = new moodle_url('https://moodle.org/plugins/view.php', array('plugin' => $component));
$uploadurl = new moodle_url('/admin/tool/installaddon/');
$actions[] = html_writer::link($installurl, get_string('dependencyinstall', 'core_plugin'));
$actions[] = html_writer::link($uploadurl, get_string('dependencyupload', 'core_plugin'));
} else if ($requiredversion != ANY_VERSION and $otherplugin->versiondisk < $requiredversion) {
// The required plugin is installed but needs to be updated.
$class = 'requires-failed requires-outdated';
if (!$otherplugin->is_standard()) {
$updateurl = new moodle_url($this->page->url, array('sesskey' => sesskey(), 'fetchupdates' => 1));
$actions[] = html_writer::link($updateurl, get_string('checkforupdates', 'core_plugin'));
}
if ($ok) {
$class = 'requires-ok';
} else {
$class = 'requires-failed';
// Already installed plugin with sufficient version.
$class = 'requires-ok';
}
if ($requiredversion != ANY_VERSION) {
@ -1059,11 +1068,11 @@ class core_admin_renderer extends plugin_renderer_base {
} else {
$str = 'otherplugin';
}
$componenturl = new moodle_url('https://moodle.org/plugins/view.php?plugin='.$component);
$componenturl = html_writer::tag('a', $component, array('href' => $componenturl->out()));
$requires[] = html_writer::tag('li',
get_string($str, 'core_plugin',
array('component' => $componenturl, 'version' => $requiredversion)),
html_writer::div(get_string($str, 'core_plugin',
array('component' => $component, 'version' => $requiredversion)), 'component').
html_writer::div(implode(' | ', $actions), 'actions'),
array('class' => $class));
}

View File

@ -30,6 +30,8 @@ $string['availability'] = 'Availability';
$string['checkforupdates'] = 'Check for available updates';
$string['checkforupdateslast'] = 'Last check done on {$a}';
$string['detectedmisplacedplugin'] = 'Plugin "{$a->component}" is installed in incorrect location "{$a->current}", expected location is "{$a->expected}"';
$string['dependencyinstall'] = 'Install';
$string['dependencyupload'] = 'Upload';
$string['displayname'] = 'Plugin name';
$string['err_response_curl'] = 'Unable to fetch available updates data - unexpected cURL error.';
$string['err_response_format_version'] = 'Unexpected version of the response format. Please try to re-check for available updates.';