Commit c06ba055 authored by sun's avatar sun

#320559 by markus_petrux, sun: Added confirmation form to delete profiles.

parent eb714832
......@@ -6,6 +6,7 @@ Wysiwyg x.x-x.x, xxxx-xx-xx
Wysiwyg 6.x-x.x, xxxx-xx-xx
---------------------------
#320559 by markus_petrux, sun: Added confirmation form to delete profiles.
Wysiwyg 6.x-0.4, 2008-10-14
......
......@@ -28,10 +28,7 @@ function wysiwyg_admin($arg = '', $name = '') {
return drupal_get_form('wysiwyg_profile_form', wysiwyg_load_profile($name));
case 'delete':
wysiwyg_profile_delete($name);
drupal_set_message(t('Wysiwyg profile %name has been deleted.', array('%name' => $name)));
drupal_goto('admin/settings/wysiwyg/profile');
break;
return drupal_get_form('wysiwyg_profile_delete_confirm', $name);
default:
return wysiwyg_profile_overview();
......@@ -472,13 +469,15 @@ function wysiwyg_profile_overview() {
$profiles = wysiwyg_load_profile();
if ($profiles) {
$roles = user_roles(FALSE, 'access wysiwyg editor');
$header = array(t('Profile'), t('Editor'), t('Roles'), t('Operations'));
$header = array(t('Profile'), t('Editor'), t('Roles'), array('data' => t('Operations'), 'colspan' => 2));
foreach ($profiles as $p) {
$rows[] = array(
array('data' => $p->name, 'valign' => 'top'),
array('data' => $editors[$p->settings['editor']]['title'], 'valign' => 'top'),
array('data' => implode("<br />\n", $p->rids)),
array('data' => l(t('Edit'), 'admin/settings/wysiwyg/profile/edit/'. urlencode($p->name)) .' '. l(t('Delete'), 'admin/settings/wysiwyg/profile/delete/'. urlencode($p->name)), 'valign' => 'top'));
array('data' => l(t('Edit'), 'admin/settings/wysiwyg/profile/edit/'. urlencode($p->name)), 'valign' => 'top'),
array('data' => l(t('Delete'), 'admin/settings/wysiwyg/profile/delete/'. urlencode($p->name)), 'valign' => 'top'),
);
}
$output .= theme('table', $header, $rows);
}
......@@ -487,6 +486,34 @@ function wysiwyg_profile_overview() {
return $output;
}
/**
* Delete editor profile confirmation form.
*/
function wysiwyg_profile_delete_confirm(&$form_state, $name) {
$form = array();
$form['name'] = array(
'#type' => 'value',
'#value' => $name,
);
return confirm_form(
$form,
t('Are you sure you want to delete the editor profile %name?', array('%name' => $name)),
'admin/settings/wysiwyg/profile',
t('This action cannot be undone.'), t('Delete'), t('Cancel')
);
}
/**
* Submit callback for Wysiwyg profile delete form.
*
* @see wysiwyg_profile_delete_confirm()
*/
function wysiwyg_profile_delete_confirm_submit($form, &$form_state) {
wysiwyg_profile_delete($form_state['values']['name']);
drupal_set_message(t('Wysiwyg profile %name has been deleted.', array('%name' => $form_state['values']['name'])));
$form_state['redirect'] = 'admin/settings/wysiwyg/profile';
}
/**
* Remove a profile from the database.
*/
......
......@@ -37,8 +37,11 @@ function wysiwyg_help($path, $arg) {
switch ($path) {
case 'admin/settings/wysiwyg/profile':
case 'admin/help#wysiwyg':
$output = '<p>'. t('Profiles can be defined based on user roles. A Wysiwyg Editor profile can define which pages receive this Wysiwyg Editor capability, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor functions. Lastly, only users with the %permission <a href="!url">user permission</a> are able to use Wysiwyg Editor.', array('%permission' => 'access wysiwyg editor', '!url' => url('admin/user/permissions'))) .'</p>';
return $output;
if (empty($arg[4])) {
$output = '<p>'. t('Profiles can be defined based on user roles. A Wysiwyg Editor profile can define which pages receive this Wysiwyg Editor capability, what buttons or themes are enabled for the editor, how the editor is displayed, and a few other editor functions. Lastly, only users with the %permission <a href="!url">user permission</a> are able to use Wysiwyg Editor.', array('%permission' => 'access wysiwyg editor', '!url' => url('admin/user/permissions'))) .'</p>';
return $output;
}
break;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment