Hello, I have tested out the dashboard. A View created called ‘list-all-nodes’ was dragged from the right sidebar region to the main dashboard region and gave an error:

Notice: Undefined index: list-all-nodes-block-1 in dashboard_page_build() (line 188 of C:\xampp\htdocs\modules\dashboard\dashboard.module).

Testing with Drupal 7.8 with Views 7.x-3.x-dev and Domain Access 2.15. Thanks.

Comments

sheetzam’s picture

Getting this error with two different views, having nothing to do with where they are.
Edit - may be related to moving the views. Can also reproduce by removing a block.

jgsantos’s picture

+1

djmy’s picture

+1

willvincent’s picture

Project: Drupal core » Views (for Drupal 7)
Version: 7.8 » 7.x-3.x-dev
Component: dashboard.module » Code

The cause of this is that dashboard is looking for 'list-all-nodes-block-1' when the delta for this block produced by views would be 'list_all_nodes-block-1'

The reason dashboard isn't respecting the proper block delta is that it's trying to get that delta from the classes, which are all dashed, no underscores.

I suspect the solution here would be to update views so that it uses dashed block deltas instead of underscores.

Reassigning to the views issue queue.

dawehner’s picture

I'm not really sure that this isn't a bug of dashboard module.

If you fix this in views i bet you have to create a shitstorm of new problems because of changing the id's of the block, which causes
problems in context, features, etc.

willvincent’s picture

I could see that being a problem.

Here's what my research last night found.

the dashboard.js is building new block deltas based off of the class names on the blocks that are rendered in the dashboard when you drag them around. Because the class names are all something like block-views-something-something-block when it creates the new delta, it's all dashed, instead of underscored and dashed the way views creates block deltas.

You might be right, the better solution might be to fix dashboard so it properly respects the deltas of blocks, regardless of how they're named, but that will likely involve a significant rework of the dashboard module.

I was attempting to add a rel attribute that would contain the properly formatted block delta, but couldn't figure out quite where to do that since it looks like blocks are already rendered by the time they hit the couple of theme functions within the dashboard module.

As such, it could be that the block module is actually more at fault here than anything else, but even so changes would have to be made to dashboard's js so that the delta value is pulled from the correct place.

From what I can tell, the piece of code that is responsible for this in dashboard.js is lines 164-184:


      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'
      );
cindyr’s picture

I think there's more at stake than just what you mentioned. I have the same problem, so I figured I'd just drop that custom views block from the dashboard entirely to at least remove the error. I tried dragging it off the dashboard screen (in customize dashboard), but that didn't work, so I went into the dashboard configuration page that lets you rearrange all blocks with the drop-down menu. I removed that block entirely so it's no longer in any active area of the dashboard, cleared the caches, and yet I continue to get the same error about the block (that's not displaying on the dashboard) now:

Notice: Undefined index: comments-to-moderate-block-2 in dashboard_page_build() (line 188 of /usr.../modules/dashboard/dashboard.module).

cindyr’s picture

The patch here: http://drupal.org/node/936798 fixed the problem with the blocks not being saved in the customize dashboard screen, and also fixed the problem with the underscores and hyphens. For anyone who still has the error showing, deleting the view didn't fix my problem, but going into the database and manually removing the block from the block table fixed it.

dawehner’s picture

Status: Active » Closed (duplicate)

The core issue #936798: Dashboard uses unreliable method for identifying blocks. is the right way to fix the problem, so let's mark it as duplicate.

clemens.tolboom’s picture