MDL-39088 migrate tinymce plugins uninstallation to plugin_manager
This commit is contained in:
@@ -40,10 +40,6 @@ class plugininfo_tinymce extends plugininfo_base {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function get_uninstall_url() {
|
||||
return new moodle_url('/lib/editor/tinymce/subplugins.php', array('delete' => $this->name, 'sesskey' => sesskey()));
|
||||
}
|
||||
|
||||
public function get_settings_section_name() {
|
||||
return 'tinymce'.$this->name.'settings';
|
||||
}
|
||||
@@ -235,11 +231,9 @@ class tiynce_subplugins_settings extends admin_setting {
|
||||
}
|
||||
|
||||
// Add uninstall info.
|
||||
if ($version) {
|
||||
$url = new moodle_url($plugininfo->get_uninstall_url(), array('return'=>'settings'));
|
||||
$uninstall = html_writer::link($url, $struninstall);
|
||||
} else {
|
||||
$uninstall = '';
|
||||
$uninstall = '';
|
||||
if ($deleteurl = plugin_manager::instance()->get_uninstall_url('tinymce_' . $name)) {
|
||||
$uninstall = html_writer::link($deleteurl, $struninstall);
|
||||
}
|
||||
|
||||
// Add a row to the table.
|
||||
|
||||
@@ -34,7 +34,6 @@ $string['customtoolbar_desc'] = 'Each line contains a list of comma separated bu
|
||||
$string['fontselectlist'] = 'Available fonts list';
|
||||
$string['pluginname'] = 'TinyMCE HTML editor';
|
||||
$string['settings'] = 'General settings';
|
||||
$string['subplugindeleteconfirm'] = 'You are about to completely delete TinyMCE subplugin \'{$a}\'. This will completely delete everything in the database associated with this subplugin. Are you SURE you want to continue?';
|
||||
$string['subplugintype_tinymce_plural'] = 'Plugins';
|
||||
|
||||
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
require(__DIR__ . '/../../../config.php');
|
||||
require_once($CFG->libdir.'/adminlib.php');
|
||||
|
||||
$delete = optional_param('delete', '', PARAM_PLUGIN);
|
||||
$confirm = optional_param('confirm', '', PARAM_BOOL);
|
||||
$disable = optional_param('disable', '', PARAM_PLUGIN);
|
||||
$enable = optional_param('enable', '', PARAM_PLUGIN);
|
||||
$return = optional_param('return', 'overview', PARAM_ALPHA);
|
||||
@@ -44,54 +42,24 @@ if ($return === 'settings') {
|
||||
$returnurl = new moodle_url('/admin/plugins.php');
|
||||
}
|
||||
|
||||
if ($delete) {
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('pluginname', 'editor_tinymce'));
|
||||
|
||||
if (!$confirm) {
|
||||
if (get_string_manager()->string_exists('pluginname', 'tinymce_' . $delete)) {
|
||||
$strpluginname = get_string('pluginname', 'tinymce_' . $delete);
|
||||
} else {
|
||||
$strpluginname = $delete;
|
||||
}
|
||||
echo $OUTPUT->confirm(get_string('subplugindeleteconfirm', 'editor_tinymce', $strpluginname),
|
||||
new moodle_url($PAGE->url, array('delete' => $delete, 'confirm' => 1, 'return'=>$return)),
|
||||
$returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
|
||||
} else {
|
||||
uninstall_plugin('tinymce', $delete);
|
||||
$a = new stdclass();
|
||||
$a->name = $delete;
|
||||
$pluginlocation = get_plugin_types();
|
||||
$a->directory = $pluginlocation['tinymce'] . '/' . $delete;
|
||||
echo $OUTPUT->notification(get_string('plugindeletefiles', '', $a), 'notifysuccess');
|
||||
echo $OUTPUT->continue_button($returnurl);
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
|
||||
} else {
|
||||
$disabled = array();
|
||||
$disabledsubplugins = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if ($disabledsubplugins) {
|
||||
$disabledsubplugins = explode(',', $disabledsubplugins);
|
||||
foreach ($disabledsubplugins as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabled[$sp] = $sp;
|
||||
}
|
||||
$disabled = array();
|
||||
$disabledsubplugins = get_config('editor_tinymce', 'disabledsubplugins');
|
||||
if ($disabledsubplugins) {
|
||||
$disabledsubplugins = explode(',', $disabledsubplugins);
|
||||
foreach ($disabledsubplugins as $sp) {
|
||||
$sp = trim($sp);
|
||||
if ($sp !== '') {
|
||||
$disabled[$sp] = $sp;
|
||||
}
|
||||
}
|
||||
|
||||
if ($disable) {
|
||||
$disabled[$disable] = $disable;
|
||||
} else if ($enable) {
|
||||
unset($disabled[$enable]);
|
||||
}
|
||||
|
||||
set_config('disabledsubplugins', implode(',', $disabled), 'editor_tinymce');
|
||||
}
|
||||
|
||||
if ($disable) {
|
||||
$disabled[$disable] = $disable;
|
||||
} else if ($enable) {
|
||||
unset($disabled[$enable]);
|
||||
}
|
||||
|
||||
set_config('disabledsubplugins', implode(',', $disabled), 'editor_tinymce');
|
||||
|
||||
redirect($returnurl);
|
||||
|
||||
Reference in New Issue
Block a user