diff --git a/modules/dashboard/dashboard.js b/modules/dashboard/dashboard.js index ebecbf6..bc6af8c 100644 --- a/modules/dashboard/dashboard.js +++ b/modules/dashboard/dashboard.js @@ -207,7 +207,9 @@ Drupal.behaviors.dashboard = { var region = $(this).parent().attr('id').replace(/-/g, '_'); var blocks = $(this).sortable('toArray'); $.each(blocks, function() { - order.push(region + '[]=' + this); + var block_module = $('#' + this).attr('class').match(/\bmodule-(\S+)\b/)[1]; + var block_delta = $('#' + this).attr('class').match(/\bdelta-(\S+)\b/)[1]; + order.push(region + '[]=' + block_module + ':' + block_delta); }); }); order = order.join('&'); diff --git a/modules/dashboard/dashboard.module b/modules/dashboard/dashboard.module index 7d5d749..9d27049 100644 --- a/modules/dashboard/dashboard.module +++ b/modules/dashboard/dashboard.module @@ -420,6 +420,19 @@ function template_preprocess_dashboard_admin_display_form(&$variables) { } /** + * Implements template_preprocess_block(). + */ +function dashboard_preprocess_block(&$variables) { + if (dashboard_is_visible()) { + // Since the transformations performed by drupal_html_id() are irreversible, + // rendering it impossible to use the CSS id to identify individual blocks, + // we add two classes to aid in identification. + $variables['classes_array'][] = 'module-' . $variables['block']->module; + $variables['classes_array'][] = 'delta-' . $variables['block']->delta; + } +} + +/** * Determines if the dashboard should be displayed on the current page. * * This function checks if the user is currently viewing the dashboard and has @@ -548,7 +561,7 @@ function dashboard_update() { } foreach ($blocks as $weight => $block_string) { // Parse the query string to determine the block's module and delta. - preg_match('/block-([^-]+)-(.+)/', $block_string, $matches); + preg_match('/([^:]+):(.+)/', $block_string, $matches); $block = new stdClass(); $block->module = $matches[1]; $block->delta = $matches[2];