Commit ab4b29d8 authored by Nathan Phillip Brink's avatar Nathan Phillip Brink
Browse files

Issue #1092424 by Todd Nienkerk: Make text for javascript popup on navigation...

Issue #1092424 by Todd Nienkerk: Make text for javascript popup on navigation away from node edit pages configurable.
parent 4b621771
......@@ -13,7 +13,13 @@ function content_lock_admin_settings() {
'#description' => t('If you disable this, there will be no messages like “Do you really want to leave this node and lose all changes? The lock will be removed if you proceed.”. Also, disabling this will cause nodes to remain locked if the user avoids saving the node and does not use the cancel button (i.e., by clicking a menu link to navigate away from a node-edit page).'),
'#default_value' => variable_get('content_lock_unload_js', true),
);
$form['content_lock_unload_js_message'] = array(
'#type' => 'textfield',
'#title' => t('Javascript popup message text'),
'#description' => t('This option allows you to modify the text the user sees when navigating away from an edited node.'),
'#default_value' => variable_get('content_lock_unload_js_message', 'If you proceed, ALL of your changes will be lost.'),
);
$form['content_lock_admin_verbose'] = array(
'#type' => 'checkbox',
'#title' => t('Show lock / unlock messages'),
......
......@@ -15,6 +15,7 @@ function content_lock_uninstall() {
variable_del('content_lock_clear');
variable_del('content_lock_unload_js');
variable_del('content_lock_unload_js_message');
variable_del('content_lock_admin_cancelbutton');
variable_del('content_lock_admin_verbose');
variable_del('content_lock_allowed_node_types');
......
......@@ -260,7 +260,7 @@ function _content_lock_add_unload_js(&$form, $form_state) {
drupal_add_js("$m/js/onUserExit.js",'module');
drupal_add_js("$m/js/content_lock_init.js",'module');
$lock = content_lock_fetch_lock($form['#node']->nid);
drupal_add_js(array('content_lock' => array('nid' => $form['#node']->nid, 'ajax_key' => $lock->ajax_key)), 'setting');
drupal_add_js(array('content_lock' => array('nid' => $form['#node']->nid, 'ajax_key' => $lock->ajax_key, 'unload_js_message' => variable_get('content_lock_unload_js_message', 'If you proceed, ALL of your changes will be lost.'))), 'setting');
return $form;
}
......
......@@ -18,7 +18,7 @@
}
window.content_lock_confirm = function () {
return Drupal.t('Be aware, if you press "OK" now, ALL your changes will be lost!');
return Drupal.t(Drupal.settings.content_lock.unload_js_message);
}
$(document).ready(function() {
......
Supports Markdown
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