### Eclipse Workspace Patch 1.0
#P drupal 7
Index: modules/dashboard/dashboard.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/dashboard/dashboard.js,v
retrieving revision 1.11
diff -u -r1.11 dashboard.js
--- modules/dashboard/dashboard.js	18 May 2010 12:07:39 -0000	1.11
+++ modules/dashboard/dashboard.js	18 May 2010 13:22:37 -0000
@@ -1,217 +1,244 @@
-// $Id: dashboard.js,v 1.11 2010/05/18 12:07:39 dries Exp $
+// $Id: dashboard.js,v 1.10 2010/05/14 11:28:19 dries Exp $
 (function ($) {
 
 /**
- * Implementation of Drupal.behaviors for dashboard.
+ * Attaches dashboard behavior.
  */
 Drupal.behaviors.dashboard = {
-  attach: function () {
-    $('#dashboard').prepend('<div class="customize"><ul class="action-links"><li><a href="#">' + Drupal.t('Customize dashboard') + '</a></li></ul><div class="canvas"></div></div>');
-    $('#dashboard .customize .action-links a').click(Drupal.behaviors.dashboard.enterCustomizeMode);
-    Drupal.behaviors.dashboard.addPlaceholders();
-    if (Drupal.settings.dashboard.launchCustomize) {
-      Drupal.behaviors.dashboard.enterCustomizeMode();
-    }
-  },
-
-  addPlaceholders: function() {
-    $('#dashboard .dashboard-region .region').each(function () {
-      var empty_text = "";
-      // If the region is empty
-      if ($('.block', this).length == 0) {
-        // Check if we are in customize mode and grab the correct empty text
-        if ($('#dashboard').hasClass('customize-mode')) {
-          empty_text = Drupal.settings.dashboard.emptyRegionTextActive;
-        } else {
-          empty_text = Drupal.settings.dashboard.emptyRegionTextInactive;
-        }
-        // We need a placeholder.
-        if ($('.placeholder', this).length == 0) {
-          $(this).append('<div class="placeholder"></div>');
-        }
-        $('.placeholder', this).html(empty_text);
-      }
-      else {
-        $('.placeholder', this).remove();
-      }
+  attach: function (context, settings) {
+    $('.dashboard', context).once('dashboard', function () {
+      $(this).data("drupal-dashboard", new Drupal.dashboard(this, settings.dashboard));
     });
-  },
+  }
+};
 
-  /**
-   * Enter "customize" mode by displaying disabled blocks.
-   */
-  enterCustomizeMode: function () {
-    $('#dashboard').addClass('customize-mode customize-inactive');
-    Drupal.behaviors.dashboard.addPlaceholders();
-    // Hide the customize link
-    $('#dashboard .customize .action-links').hide();
-    // Load up the disabled blocks
-    $('div.customize .canvas').load(Drupal.settings.dashboard.drawer, Drupal.behaviors.dashboard.setupDrawer);
-  },
-
-  /**
-   * Exit "customize" mode by simply forcing a page refresh.
-   */
-  exitCustomizeMode: function () {
-    $('#dashboard').removeClass('customize-mode customize-inactive');
-    Drupal.behaviors.dashboard.addPlaceholders();
-    location.href = Drupal.settings.dashboard.dashboard;
-  },
-
-  /**
-   * Helper for enterCustomizeMode; sets up drag-and-drop and close button.
-   */
-  setupDrawer: function () {
-    $('div.customize .canvas-content input').click(Drupal.behaviors.dashboard.exitCustomizeMode);
-    $('div.customize .canvas-content').append('<a class="button" href="' + Drupal.settings.dashboard.dashboard + '">' + Drupal.t('Done') + '</a>');
-
-    // Initialize drag-and-drop.
-    var regions = $('#dashboard div.region');
-    regions.sortable({
-      connectWith: regions,
-      cursor: 'move',
-      cursorAt: {top:0},
-      dropOnEmpty: true,
-      items: '> div.block, > div.disabled-block',
-      placeholder: 'block-placeholder clearfix',
-      tolerance: 'pointer',
-      start: Drupal.behaviors.dashboard.start,
-      over: Drupal.behaviors.dashboard.over,
-      sort: Drupal.behaviors.dashboard.sort,
-      update: Drupal.behaviors.dashboard.update
-    });
-  },
+/**
+ * Constructor for the dashboard object.
+ *
+ * @param dashboard
+ *   DOM object to apply dashboard functionality to.
+ */
+Drupal.dashboard = function (dashboard, settings) {
+  this.settings = settings;
 
-  /**
-   * While dragging, make the block appear as a disabled block
-   *
-   * This function is called on the jQuery UI Sortable "start" event.
-   *
-   * @param event
-   *  The event that triggered this callback.
-   * @param ui
-   *  An object containing information about the item that is being dragged.
-   */
-  start: function (event, ui) {
-    $('#dashboard').removeClass('customize-inactive');
-    var item = $(ui.item);
-
-    // If the block is already in disabled state, don't do anything.
-    if (!item.hasClass('disabled-block')) {
-      item.css({height: 'auto'});
-    }
-  },
+  this.dashboard = $(dashboard);
+
+  this.actionLinks = $('<ul class="dashboard-action-links action-links"/>')
+    .prependTo(dashboard);
+  this.actionLinkCustomize = $('<a href="#">' + Drupal.t('Customize dashboard') + '</a>')
+    .click($.proxy(this, 'enterCustomizeMode'))
+    .wrap('<li></li>').parent()
+    .appendTo(this.actionLinks);
+
+  this.canvasWrapper = $('<div class="dashboard-canvas-wrapper clearfix"/>')
+    .insertAfter(this.actionLinks);
+
+  this.addPlaceholders();
+  if (this.settings.launchCustomize) {
+    this.enterCustomizeMode();
+  }
+};
+
+/**
+ * Adds placeholders to empty regions.
+ */
+Drupal.dashboard.prototype.addPlaceholders = function() {
+  var empty_text = '';
+  // Check if we are in customize mode and grab the correct empty text
+  if (this.dashboard.hasClass('dashboard-customize-mode')) {
+    empty_text = this.settings.emptyRegionTextActive;
+  } else {
+    empty_text = this.settings.emptyRegionTextInactive;
+  }
 
-  /**
-   * While dragging, adapt block's width to the width of the region it is moved
-   * into.
-   *
-   * This function is called on the jQuery UI Sortable "over" event.
-   *
-   * @param event
-   *  The event that triggered this callback.
-   * @param ui
-   *  An object containing information about the item that is being dragged.
-   */
-  over: function (event, ui) {
-    var item = $(ui.item);
-
-    // If the block is in disabled state, remove width.
-    if ($(this).closest('#disabled-blocks').length) {
-      item.css('width', '');
+  this.dashboard.find('.dashboard-region > .region').each(function () {
+    // If the region is empty.
+    if ($('.block', this).length == 0) {
+      // We need a placeholder.
+      if ($('.dashboard-region-placeholder', this).length == 0) {
+        $(this).append('<div class="dashboard-region-placeholder"></div>');
+      }
+      $('.dashboard-region-placeholder', this).html(empty_text);
     }
     else {
-      item.css('width', $(this).width());
+      $('.dashboard-region-placeholder', this).remove();
     }
-  },
+  });
+};
 
-  /**
-   * While dragging, adapt block's position to stay connected with the position
-   * of the mouse pointer.
-   *
-   * This function is called on the jQuery UI Sortable "sort" event.
-   *
-   * @param event
-   *  The event that triggered this callback.
-   * @param ui
-   *  An object containing information about the item that is being dragged.
-   */
-  sort: function (event, ui) {
-    var item = $(ui.item);
+/**
+ * Enter "customize" mode by displaying disabled blocks.
+ */
+Drupal.dashboard.prototype.enterCustomizeMode = function () {
+  this.dashboard.addClass('dashboard-customize-mode dashboard-customize-inactive');
+  this.addPlaceholders();
+  // Load up the disabled blocks.
+  this.canvasWrapper.load(this.settings.drawer, $.proxy(this, 'setupCanvas'));
+};
 
-    if (event.pageX > ui.offset.left + item.width()) {
-      item.css('left', event.pageX);
-    }
-  },
+/**
+ * Exit "customize" mode by simply forcing a page refresh.
+ */
+Drupal.dashboard.prototype.exitCustomizeMode = function () {
+  this.dashboard.removeClass('dashboard-customize-mode dashboard-customize-inactive');
+  this.addPlaceholders();
+  location.href = this.settings.dashboard;
+};
 
-  /**
-   * Send block order to the server, and expand previously disabled blocks.
-   *
-   * This function is called on the jQuery UI Sortable "update" event.
-   *
-   * @param event
-   *   The event that triggered this callback.
-   * @param ui
-   *   An object containing information about the item that was just dropped.
-   */
-  update: function (event, ui) {
-    $('#dashboard').addClass('customize-inactive');
-    var item = $(ui.item);
-
-    // If the user dragged a disabled block, load the block contents.
-    if (item.hasClass('disabled-block')) {
-      var module, delta, itemClass;
-      itemClass = item.attr('class');
-      // Determine the block module and delta.
-      module = itemClass.match(/\bmodule-(\S+)\b/)[1];
-      delta = itemClass.match(/\bdelta-(\S+)\b/)[1];
-
-      // Load the newly enabled block's content.
-      $.get(Drupal.settings.dashboard.blockContent + '/' + module + '/' + delta, {},
-        function (block) {
-          if (block) {
-            item.html(block);
-          }
-
-          if (item.find('div.content').is(':empty')) {
-            item.find('div.content').html(Drupal.settings.dashboard.emptyBlockText);
-          }
-
-          Drupal.attachBehaviors(item);
-        },
-        'html'
-      );
-      // Remove the "disabled-block" class, so we don't reload its content the
-      // next time it's dragged.
-      item.removeClass("disabled-block");
-    }
+/**
+ * Helper for enterCustomizeMode; sets up drag-and-drop and close button.
+ */
+Drupal.dashboard.prototype.setupCanvas = function () {
+  this.canvasWrapper.find('.dashboard-canvas input').click(this.exitCustomizeMode);
+  this.canvasWrapper.append('<a class="button" href="' + this.settings.dashboard + '">' + Drupal.t('Done') + '</a>');
+
+  // Initialize drag-and-drop.
+  var regions = this.dashboard.find('.dashboard-canvas > .region, .dashboard-region > .region');
+  regions.sortable({
+    connectWith: regions,
+    cursor: 'move',
+    cursorAt: { top: 0 },
+    dropOnEmpty: true,
+    items: '> .block',
+    // Class that gets applied to the otherwise white space.
+    placeholder: 'dashboard-block-placeholder clearfix',
+    tolerance: 'pointer',
+    start: $.proxy(this, 'eventhandlerSortStart'),
+    over: $.proxy(this, 'eventhandlerSortOver'),
+    sort: $.proxy(this, 'eventhandlerSort'),
+    update: $.proxy(this, 'eventhandlerSortUpdate')
+  });
+};
 
-    Drupal.behaviors.dashboard.addPlaceholders();
+/**
+ * While dragging, make the block appear as a disabled block
+ *
+ * This function is called on the jQuery UI Sortable "start" event.
+ *
+ * @param event
+ *  The event that triggered this callback.
+ * @param ui
+ *  An object containing information about the item that is being dragged.
+ */
+Drupal.dashboard.prototype.eventhandlerSortStart = function (event, ui) {
+  this.dashboard.removeClass('dashboard-customize-inactive');
+  var item = $(ui.item);
+
+  // If the block is already in disabled state, don't do anything.
+  if (!item.hasClass('dashboard-disabled-block')) {
+    item.css({ height: 'auto' });
+  }
+};
 
-    // Let the server know what the new block order is.
-    $.post(Drupal.settings.dashboard.updatePath, {
-        'form_token': Drupal.settings.dashboard.formToken,
-        'regions': Drupal.behaviors.dashboard.getOrder
-      }
+/**
+ * While dragging, adapt block's width to the width of the region it is moved
+ * into.
+ *
+ * This function is called on the jQuery UI Sortable "over" event.
+ *
+ * @param event
+ *  The event that triggered this callback.
+ * @param ui
+ *  An object containing information about the item that is being dragged.
+ */
+Drupal.dashboard.prototype.eventhandlerSortOver = function (event, ui) {
+  var item = $(ui.item);
+
+  // If the block is in disabled state, remove width.
+  if (item.closest('.dashboard-canvas').length) {
+    item.css('width', '');
+  }
+  else {
+    item.css('width', $(event.target).width());
+  }
+};
+
+/**
+ * While dragging, adapt block's position to stay connected with the position
+ * of the mouse pointer.
+ *
+ * This function is called on the jQuery UI Sortable "sort" event.
+ *
+ * @param event
+ *  The event that triggered this callback.
+ * @param ui
+ *  An object containing information about the item that is being dragged.
+ */
+Drupal.dashboard.prototype.eventhandlerSort = function (event, ui) {
+  var item = $(ui.item);
+
+  if (event.pageX > ui.offset.left + item.width()) {
+    item.css('left', event.pageX);
+  }
+};
+
+/**
+ * Send block order to the server, and expand previously disabled blocks.
+ *
+ * This function is called on the jQuery UI Sortable "update" event.
+ *
+ * @param event
+ *   The event that triggered this callback.
+ * @param ui
+ *   An object containing information about the item that was just dropped.
+ */
+Drupal.dashboard.prototype.eventhandlerSortUpdate = function (event, ui) {
+  this.dashboard.addClass('dashboard-customize-inactive');
+  var self = this;
+  var item = $(ui.item);
+
+  // If the user dragged a disabled block, load the block contents.
+  if (item.hasClass('dashboard-disabled-block')) {
+    var module, delta, itemClass;
+    itemClass = item.attr('class');
+    // Determine the block module and delta.
+    module = itemClass.match(/\bmodule-(\S+)\b/)[1];
+    delta = itemClass.match(/\bdelta-(\S+)\b/)[1];
+
+    // Load the newly enabled block's content.
+    $.get(this.settings.blockContent + '/' + module + '/' + delta, {},
+      function (block) {
+        if (block) {
+          item.html(block);
+        }
+
+        if (item.find('div.content').is(':empty')) {
+          item.find('div.content').html(self.settings.emptyBlockText);
+        }
+
+        Drupal.attachBehaviors(item);
+      },
+      'html'
     );
-  },
+    // Remove the "disabled-block" class, so we don't reload its content the
+    // next time it's dragged.
+    item.removeClass('dashboard-disabled-block');
+  }
+
+  this.addPlaceholders();
+
+  // Let the server know what the new block order is.
+  $.post(this.settings.updatePath, {
+    'form_token': this.settings.formToken,
+    'regions': $.proxy(this, 'getOrder')
+  });
+};
 
-  /**
-   * Return the current order of the blocks in each of the sortable regions,
-   * in query string format.
-   */
-  getOrder: function () {
-    var order = [];
-    $('#dashboard div.region').each(function () {
-      var region = $(this).parent().attr('id').replace(/-/g, '_');
-      var blocks = $(this).sortable('toArray');
-      $.each(blocks, function() {
-        order.push(region + '[]=' + this);
-      });
+/**
+ * Return the current order of the blocks in each of the sortable regions,
+ * in query string format.
+ */
+Drupal.dashboard.prototype.getOrder = function () {
+  var order = [];
+  this.dashboard.find('.dashboard-canvas > .region, .dashboard-region > .region').each(function () {
+    var region = $(this).parent().attr('id').replace(/-/g, '_');
+    var blocks = $(this).sortable('toArray');
+    $.each(blocks, function() {
+      order.push(region + '[]=' + this);
     });
-    order = order.join('&');
-    return order;
-  }
+  });
+  order = order.join('&');
+  return order;
 };
 
 })(jQuery);
Index: modules/dashboard/dashboard.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/dashboard/dashboard.css,v
retrieving revision 1.13
diff -u -r1.13 dashboard.css
--- modules/dashboard/dashboard.css	28 Apr 2010 20:08:38 -0000	1.13
+++ modules/dashboard/dashboard.css	18 May 2010 13:22:37 -0000
@@ -1,125 +1,112 @@
 /* $Id: dashboard.css,v 1.13 2010/04/28 20:08:38 dries Exp $ */
 
-#dashboard div.dashboard-region {
+.dashboard-region {
   float: left;
   min-height: 1px;
 }
 
-#dashboard div#dashboard_main {
+#dashboard_main {
   width: 65%;
   margin-right: 1%;
 }
 
-#dashboard div#dashboard_sidebar {
+#dashboard_sidebar {
   width: 33%;
 }
 
-#dashboard div.block {
-  margin-bottom: 20px;
+.dashboard-customize-mode .dashboard-action-links {
+  display: none;
 }
 
-#dashboard .dashboard-region .block {
-  clear: both;
+.dashboard-canvas-wrapper {
+  padding: 10px;
 }
-
-#dashboard div.block h2 {
-  float: none;
+.dashboard-canvas-wrapper a.button {
+  margin: 0 0 0 10px;
 }
 
-#dashboard #disabled-blocks .block,
-#dashboard .block-placeholder {
-  background: #e2e1dc;
-  padding: 6px 4px 6px 8px;
-  margin: 3px 3px 3px 0;
-  float: left;
-  border-radius: 4px;
-  -moz-border-radius: 4px;
-  -webkit-border-radius: 4px;
+.dashboard-canvas {
+  padding: 5px 0;
 }
 
-#dashboard .ui-sortable {
+.dashboard-canvas .region,
+.dashboard-region .region {
   border: 2px dashed #ccc;
+  margin: 5px;
   padding: 10px;
 }
 
-#dashboard .canvas-content {
-  padding: 10px;
-}
-
-#dashboard .canvas-content a {
-  color: #fff;
-  text-decoration: underline;
+.dashboard-canvas .region {
+  background-color: #E0E0D8;
+  border: #ccc 1px solid;
+  min-height: 90px;
 }
 
-#dashboard #disabled-blocks .ui-sortable {
-  padding: 0;
-  background-color: #777;
-  border: 0;
+.dashboard-canvas .region .block,
+.dashboard-region .region .block {
+  margin-bottom: 20px;
 }
-
-#dashboard .canvas-content a.button {
-  margin: 0 0 0 10px;
-  color: #5a5a5a;
-  text-decoration: none;
+.dashboard-canvas .region .block h2,
+.dashboard-region .region .block h2 {
+  float: none;
 }
 
-#dashboard .region {
-  margin: 5px;
+.dashboard-region .region .block {
+  clear: both;
 }
 
-#dashboard #disabled-blocks .region {
-  background-color: #E0E0D8;
-  border: #ccc 1px solid;
-  padding: 10px;
-  min-height: 90px;
+.dashboard-canvas .region .block,
+.dashboard-canvas .region .dashboard-block-placeholder,
+.dashboard-region .region .dashboard-block-placeholder {
+  background: #e2e1dc;
+  padding: 6px 4px 6px 8px;
+  margin: 3px 3px 3px 0;
+  float: left;
+  border-radius: 4px;
+  -moz-border-radius: 4px;
+  -webkit-border-radius: 4px;
 }
 
-#dashboard #disabled-blocks {
-  padding: 5px 0;
+.dashboard-canvas .region .block {
+  background: #444;
+  color: #fff;
 }
-
-#dashboard #disabled-blocks h2 {
+.dashboard-canvas .region .block h2 {
   display: inline;
   font-weight: normal;
   white-space: nowrap;
 }
-
-#dashboard #disabled-blocks .block {
-  background: #444;
-  color: #fff;
+.dashboard-canvas .region .block .content,
+.ui-sortable-helper .content {
+  display: none;
 }
 
-#dashboard.customize-inactive #disabled-blocks .block:hover {
-  background: #0074BD;
-}
 
-#dashboard #disabled-blocks .block .content,
-#dashboard .ui-sortable-helper .content {
-  display: none;
-}
 
-#dashboard .ui-sortable .block {
+.dashboard-customize-mode .dashboard-canvas .region .block,
+.dashboard-customize-mode .dashboard-region .region .block {
   cursor: move;
   min-height: 1px;
 }
-
-#dashboard .ui-sortable .block h2 {
+.dashboard-customize-inactive .dashboard-canvas .region .block:hover {
+  background: #0074BD;
+}
+.dashboard-customize-mode .dashboard-canvas .region .block h2,
+.dashboard-customize-mode .dashboard-region .region .block h2 {
   background: transparent url(../../misc/draggable.png) no-repeat 0px -39px;
   padding: 0 17px;
 }
-
-#dashboard.customize-inactive #disabled-blocks .block:hover h2 {
+.dashboard-customize-inactive .dashboard-canvas .block:hover h2 {
   background: #0074BD url(../../misc/draggable.png) no-repeat 0px -39px;
   color: #fff;
 }
-
-#dashboard.customize-inactive .dashboard-region .ui-sortable .block:hover h2 {
+.dashboard-customize-inactive .dashboard-region .block:hover h2 {
   background: #0074BD url(../../misc/draggable.png) no-repeat;
   background-position: 3px -36px;
   color: #fff;
 }
 
-#dashboard .dashboard-region .block-placeholder {
+.dashboard-region .region .dashboard-block-placeholder {
   margin: 0 0 20px 0;
   padding: 0;
   display: block;
@@ -127,7 +114,7 @@
   width: 100%;
 }
 
-#dashboard #disabled-blocks .block-placeholder {
+.dashboard-canvas .region .dashboard-block-placeholder {
   width: 30px;
   height: 1.6em;
 }
Index: modules/dashboard/dashboard.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/dashboard/dashboard.module,v
retrieving revision 1.29
diff -u -r1.29 dashboard.module
--- modules/dashboard/dashboard.module	18 May 2010 12:07:39 -0000	1.29
+++ modules/dashboard/dashboard.module	18 May 2010 13:22:37 -0000
@@ -335,7 +335,7 @@
   if (!empty($_REQUEST['form_token']) && drupal_valid_token($_REQUEST['form_token'], 'dashboard-update')) {
     parse_str($_REQUEST['regions'], $regions);
     foreach ($regions as $region_name => $blocks) {
-      if ($region_name == 'disabled_blocks') {
+      if ($region_name == 'dashboard_disabled_blocks') {
         $region_name = '';
       }
       foreach ($blocks as $weight => $block_string) {
@@ -387,7 +387,7 @@
 function theme_dashboard($variables) {
   extract($variables);
   drupal_add_css(drupal_get_path('module', 'dashboard') . '/dashboard.css');
-  return '<div id="dashboard">' . $element['#children'] . '</div>';
+  return '<div id="dashboard" class="dashboard">' . $element['#children'] . '</div>';
 }
 
 /**
@@ -438,12 +438,12 @@
  */
 function theme_dashboard_disabled_blocks($variables) {
   extract($variables);
-  $output = '<div class="canvas-content"><p>' . t('Drag and drop these blocks to the columns below. Changes are automatically saved.') . '</p>';
-  $output .= '<div id="disabled-blocks"><div class="region disabled-blocks clearfix">';
+  $output = '<p>' . t('Drag and drop these blocks to the columns below. Changes are automatically saved.') . '</p>';
+  $output .= '<div id="dashboard-disabled-blocks" class="dashboard-canvas"><div class="region clearfix">';
   foreach ($blocks as $block) {
     $output .= theme('dashboard_disabled_block', array('block' => $block));
   }
-  $output .= '</div></div></div>';
+  $output .= '</div></div>';
   return $output;
 }
 
@@ -461,7 +461,7 @@
   $output = "";
   if (isset($block)) {
     $output .= '<div id="block-' . $block['module'] . '-' . $block['delta']
-    . '" class="disabled-block block block-' . $block['module'] . '-' . $block['delta']
+    . '" class="dashboard-disabled-block block block-' . $block['module'] . '-' . $block['delta']
     . ' module-' . $block['module'] . ' delta-' . $block['delta'] . '">'
     . '<h2>' . (!empty($block['title']) && $block['title'] != '<none>' ? check_plain($block['title']) : check_plain($block['info'])) . '</h2>'
     . '<div class="content"></div>'
