Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.715
diff -u -p -r1.715 common.inc
--- includes/common.inc 16 Nov 2007 15:35:24 -0000 1.715
+++ includes/common.inc 20 Nov 2007 01:28:33 -0000
@@ -1411,6 +1411,14 @@ function l($text, $path, $options = arra
$options['attributes']['title'] = strip_tags($options['attributes']['title']);
}
+ if( isset($options['popup']) ) {
+ drupal_add_js('misc/jquery.form.js');
+ drupal_add_js('misc/dialogs.js');
+ drupal_add_basepath();
+ $options['attributes']['popup'] = $options['popup'];
+ }
+
+
return ''. ($options['html'] ? $text : check_plain($text)) .'';
}
@@ -2039,6 +2047,18 @@ function drupal_add_tabledrag($table_id,
drupal_add_js($settings, 'setting');
}
+/*
+ * Provide base_path for javascript. Needed for many Ajax calls
+ */
+function drupal_add_basepath() {
+ static $bathpath_added = FALSE;
+ if (!$bathpath_added) {
+ drupal_add_js( array( 'base_path' => base_path() ), 'setting' );
+ $bathpath_added = TRUE;
+ }
+}
+
+
/**
* Aggregate JS files, putting them in the files directory.
*
Index: misc/drupal.js
===================================================================
RCS file: /cvs/drupal/drupal/misc/drupal.js,v
retrieving revision 1.40
diff -u -p -r1.40 drupal.js
--- misc/drupal.js 5 Oct 2007 09:35:08 -0000 1.40
+++ misc/drupal.js 19 Nov 2007 23:45:24 -0000
@@ -273,3 +273,17 @@ Drupal.theme.prototype = {
return '' + Drupal.checkPlain(str) + '';
}
};
+
+/*
+ * Called when there is unsaved data on the page
+ * Warn users when the click links that they could lose their changes
+ *
+ * @param submit_id
+ * the id of the submit button to page the page
+ */
+Drupal.markPageUnsaved = function(submit_id) {
+ dialog = new Drupal.dialog();
+ $('a[href!=#]').addClass('unsaved-warning');
+ $('a[href!=#]').click( function(){ return dialog.open_unsaved(this, submit_id); } );
+};
+
Index: modules/block/block.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.admin.inc,v
retrieving revision 1.11
diff -u -p -r1.11 block.admin.inc
--- modules/block/block.admin.inc 14 Nov 2007 09:49:30 -0000 1.11
+++ modules/block/block.admin.inc 19 Nov 2007 19:18:05 -0000
@@ -74,7 +74,7 @@ function block_admin_display_form(&$form
if ($throttle) {
$form[$key]['throttle'] = array('#type' => 'checkbox', '#default_value' => isset($block['throttle']) ? $block['throttle'] : FALSE);
}
- $form[$key]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta']));
+ $form[$key]['configure'] = array('#value' => l(t('configure'), 'admin/build/block/configure/'. $block['module'] .'/'. $block['delta'], array( 'popup' => true )));
if ($block['module'] == 'block') {
$form[$key]['delete'] = array('#value' => l(t('delete'), 'admin/build/block/delete/'. $block['delta']));
}
Index: modules/block/block.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/block/block.js,v
retrieving revision 1.1
diff -u -p -r1.1 block.js
--- modules/block/block.js 14 Nov 2007 09:49:30 -0000 1.1
+++ modules/block/block.js 20 Nov 2007 01:03:52 -0000
@@ -17,6 +17,7 @@ Drupal.behaviors.blockDrag = function(co
// A custom message for the blocks page specifically.
Drupal.theme.tableDragChangedWarning = function () {
+ Drupal.markPageUnsaved('edit-submit'); //add warning popup to all links
return '
' + Drupal.theme('tableDragChangedMarker') + ' ' + Drupal.t("The changes to these blocks will not be saved until the Save blocks button is clicked.") + '