I added the 'workbench information' to the panels 'Node template' page, it doesn't show anything.

When I disabled the 'Node template' page, the node can show the workbench information normally.

Thanks

Comments

rogical’s picture

StatusFileSize
new119.26 KB

--

rogical’s picture

StatusFileSize
new119.26 KB

Also, I can't retrieve workbench information on views,

This is the views SQL:

SELECT node.title AS node_title, users_node.picture AS users_node_picture, users_node.uid AS users_node_uid, users_node.name AS users_node_name, users_node.mail AS users_node_mail, node.created AS node_created, node.nid AS nid, node.changed AS node_changed, workbench_moderation_node_history.current AS workbench_moderation_node_history_current, 'node' AS field_data_body_node_entity_type, 'node' AS field_data_field_himg_node_entity_type, 'node' AS field_data_field_hpflow_node_entity_type, 'node' AS field_data_field_helps_node_entity_type, 'node' AS field_data_field_htags_node_entity_type
FROM 
{node} node
LEFT JOIN {users} users_node ON node.uid = users_node.uid
LEFT JOIN {node_revision} node_revision ON node.vid = node_revision.vid
INNER JOIN {workbench_moderation_node_history} workbench_moderation_node_history ON node_revision.vid = workbench_moderation_node_history.vid
WHERE (( (node.status = '1') AND (node.nid = '18' ) ))
ORDER BY node_created DESC

It returns no result, while the node is moderated.

stevector’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

I know there can be issues with Panels on node/%node when there isn't a full node content pane. Please try that. The results will help debug.

rogical’s picture

Yes, the 'Workbench Moderation: Current' can display now, but it displays all values -- Yes and No, two rows.

rogical’s picture

Status: Postponed (maintainer needs more info) » Active
stevector’s picture

Status: Active » Postponed (maintainer needs more info)

Can you post a screenshot of what's displaying now?

rogical’s picture

Priority: Normal » Major
Status: Postponed (maintainer needs more info) » Active
StatusFileSize
new49 KB

sorry for a bit late, let's ignore the views first.

I'm always using Panels on node/%node, but 'workbench information' just can't display, that's very sadding.

Can you help with this? As I must use panels and workbench together.

Thanks very much!
sad

rogical’s picture

Project: Workbench Moderation » Workbench

As 'Workbench information' is defined in Workbench.

Hope someone helps!

lsolesen’s picture

This bug makes it hard to use workbench together with panels, as it is hard for the admin user to see the current state of the node. Is there any progress - or will it not work together? What needs to be done? Related to #1462724: Workbench information block is not shown when added in panels node_view

agentrickard’s picture

This behavior is actually defined in the individual modules. In Workbench Access, for instance, the block hook is:

  if ($node = menu_get_object()) {

Workbench Moderation is a little more strict:

  if (node_is_page($node) && $view_mode == 'full' && empty($node->in_preview)) {

In theory, the function workbench_block_view() could try to derive the $node object and pass that to the hook, but that's an API change. At the least, we should standardize how each module decides the page is a node.

There is also no intention to support multiple nodes on a page with that hook.

What can be done depends largely on how Panels internals work when it rewrites the path node/%. If Panels breaks menu_get_object(), then someone needs to suggest a safer lookup function.

Otherwise, I'd call it a nasty Panels bug for breaking core.

liquidcms’s picture

i added like this:

- create 2 custom re-usable content panes

$node = node_load(arg(1));
echo workbench_moderation_messages('view', $node);
$node = node_load(arg(1));
$current_node = workbench_moderation_node_current_load($node);
echo workbench_moderation_messages('view', $current_node);

and then set visibility rule for each based on "string url" = node/*/draft (set Reverse for Current)

works like a charm.. :)

agentrickard’s picture

arg() is never a good solution.

liquidcms’s picture

lol.. ok.. why is that?

agentrickard’s picture

Taxoman’s picture

Version: 7.x-1.1 » 7.x-1.x-dev

(If this is also a problem in 2.x, it should be moved to that queue.)

alexkb’s picture

When using panels, the node_is_page() still returns the correct result. One problem however is that the $view_mode argument is set to "page_manager" when it gets to workbench_moderation_node_view().

The other problem is that the hook_node_view() (which sets the static $messages variable for workbench_moderation) is called after hook_block_view(), so when hook_block_view() runs, it doesn't have any message data to show.

alexkb’s picture

agentrickard, would you say it's ok to use the node id provided in the $args variable passed to ctools content type pane's? I've just created one to solve this problem, and it seems to work ok.

function workbench_display_render($subtype, $conf, $args, $context) {
  $block = new stdClass();

  if (isset($context->data)) {
    if (isset($context->data->nid) && is_numeric($context->data->nid)&& isset($context->data->vid) && is_numeric($context->data->vid)) {
      $node = node_load($context->data->nid, $context->data->vid); // should be cached.
      if (node_is_page($node) && empty($node->in_preview)) {
        workbench_moderation_messages('view', $node);
        $workbench_block = workbench_block_view();
        
        $block->content = $workbench_block['content'];
      }
    }
  }

  return $block;
}
agentrickard’s picture

I don't know what that code is for.

alexkb’s picture

Sorry, it's the main component of a ctools plugin, that will give you a new content pane for workbench, that will actually work without patching workbench or panels. I'll create a sandbox module to make things easier if you like.

agentrickard’s picture

No, its fine as a patch, though the specific call to workbench_moderation_messages() should be removed.

timwood’s picture

I just discovered a work-around to get the workbench information area to appear in a panel. When I add the "Node > Node links" object to my panel, the default workbench information area appears. You don't even have to add the "Workbench information" object. Actually if you do add the "Workbench information" object it will appear twice.

I'm using workbench 7.x-1.2, workbench moderation 7.x-1.3, ctools 7.x-1.3 and panels 7.x-3.3+36-dev.

agentrickard’s picture

Priority: Major » Normal

That sounds like a proper fix rather than a workaround. The issue here is that Panels doesn't load the node object for other processes to read.

timwood’s picture

Just to follow up on my post above. When I remove the "Workbench information" block from the Drupal blocks system for my theme and try to place the "Workbench information" object in my panel, it will only display if certain node objects (Node links, Node content (Full Content)) come BEFORE it in the same pane or in any order in a different pane. The Node title object does not have the same effect.

agentrickard’s picture

Yeah. that's a Panels issue. I'm very tempted to won't fix this.

becw’s picture

Status: Active » Needs review
StatusFileSize
new2.2 KB

I agree that this is in part a panels issue, but it is also partly due to the fact that workbench moderation relies on replacing the default node view callback.

Pragmatically, it might make sense to just provide a panels pane for the workbench info, which can be used instead of the workbench info block when the info needs to be displayed inside a panel. Even though the issue is related to workbench moderation, it's workbench that provides the info block (since the info block is used by workbench access, too)--so yes, this pane does belong here in workbench.

Patch attached. This is based on alexkb's work above--thanks!

Status: Needs review » Needs work

The last submitted patch, 1357788-25-workbench-info-pane.patch, failed testing.

raystuart’s picture

Status: Needs work » Needs review
StatusFileSize
new2.13 KB

Re-rolling the same patch from 7.x-1.x branch.

afoster’s picture

Confirming #27 worked for me on 7.x-1.2

Note that makes a new workbench > Workbench content status pane...
Place that one,
NOT the Miscellaneous > Workbench Infomation (Block)

sgdev’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Related issues: +#1462724: Workbench information block is not shown when added in panels node_view

We have no need (or interest) to add "Node > Node links" in to our pages. Restating the comment I made on issue #1462724, which I considered directly interconnected to this issue:

-----------

I think both this patch (#27) and the one in #1462724 are of value. It really depends on what you need to accomplish.

This patch is a more modular solution in that it creates a new panel pane rather than relying on a panels-enabled block. If you want to be able to configure and move the pane in page manager, this is the way to go.

The other patch in #1462724 allows for the block to be configured outside of Panels. We want staff to be have the ability to move, add, and replace panel panes, but Workbench Information is one that we do not want them to remove or move.

By configuring it above the content area in the Blocks, and limiting access to the block configuration, it meets our needs.

I'm marking both of these as reviewed.

agentrickard’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.