Hi there -

I was wondering if there was a way to retain the local menu tabs, e.g., "View, Edit, Revisions" when viewing the diff module output. In other words, I can see the menu tabs when I click on the Revisions tab, which brings me to /node/123/revisions -- but then I click the "Show diff" button to display the diff output, the local menu tabs disappear which has been confusing some users.

Looking through the code I see that the function handling the output is diff_diff_show, which in turn calls node_view. I tried setting the last argument in your call to node_view() to TRUE (the links argument?) to see if that would put back the menu tabs, but that didn't work.

Any ideas/suggestions?

Many thanks!

regards,
brian

CommentFileSizeAuthor
#14 diff-196883-14.patch4.14 KBemok
#6 diff_menu.patch3.28 KBrötzi

Comments

moonray’s picture

Status: Active » Postponed (maintainer needs more info)

The menu tabs remain for me, even when viewing individual revisions (show diff).

Perhaps it's a conflict with another module or theme?

liquidcms’s picture

Here ya go Brian,

to fix missing tabs for Diff view paste the following code under the existing $items array in the modules _menu hook

        $items[] = array(
          'path' => 'node/'. arg(1) .'/revisions/view/'.arg(4)."/".arg(5), 
          'title' => t('Revisions'),
          'callback' => 'diff_diffs',
          'access' => $revisions_access,
          'weight' => 4,
          'type' => MENU_LOCAL_TASK,
        );
liquidcms’s picture

Status: Postponed (maintainer needs more info) » Needs review
moshe weitzman’s picture

Status: Needs review » Closed (fixed)

yeah, there is no tab problem for me in latest versions. please reopen if needed.

moshe weitzman’s picture

Status: Closed (fixed) » Needs review

I think this is a workaround for some bug/limitation in the menu system. Ideally we would understand the cause a bit better before committing.

rötzi’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Category: support » feature
StatusFileSize
new3.28 KB

I did some changes to the menu to have tabs when viewing an old revision.

Also, when viewing a "diff" you see the normal tabs. This is done by setting the menu type of 'node/%node/revisions/view/%/%' to MENU_LOCAL_TASK. The problem here is that this creates two "Notice: Undefined offset" warnings (offset 4 and 5 in menu.inc on line 568). Maybe someone with better knowledge of the new menu system can fix this.

moshe weitzman’s picture

Status: Needs review » Needs work

In D6, I believe that the right way to do this is with menu_set_item() and drupal_set_breadcrumb(). We should not need new menu items. In D5, try menu_set_location() though that function was notoriously difficult/buggy.

liquidcms’s picture

or, my code above works.. :)

I believe (although haven't tried it) that in D6 there is a concept of "parent menus" (not likely the right term) which would make this work automatically (not my code, i mean the way it is coded now). I think the idea is that if it doesn't find a matching menu definition it looks for a "closest match". So i think where original code has this:

path' => 'node/'. arg(1) .'/revisions/view/'

that doesn't handle the case i added, which is other args on the end; so i added this:

path' => 'node/'. arg(1) .'/revisions/view/'.arg(4)."/".arg(5)

but in D6 i think the first case would be used if 2nd case wasn't explicitly set.

Unless of course i am just off my nut here and this isn't really an issue like others in this post are suggesting (although i think others agree this is busted). I have had to do this in a few modules (add path defs to cover all possible arg combinations) so i am fairly sure this is required. but from #6 i guess the "%" placeholder is likely a cleaner way to do this than my method.

liquidcms’s picture

just a heads up here that i noticed... this fix here is to make the tabs show on "show diff" page which has a url like:

node/1434/revisions/view/5756/5765

i have actually re-written the diff module to provide either std dual column diff display or more Word like inline diff display (did i ever contribute this??, hmmm) so i just added my fix in that module.

but i just noticed that the revision view (somewhat related but from different module) also does not have tabs showing at url like:

node/1434/revisions/5756/view

but i think this is a core module bug and not sure if there is a point in patching since it should be fixed by new menu system in Dr6 and doubt patch would be added to Dr5 at this stage.

liquidcms’s picture

i have tried Rotzi's % placeholder and i can't get it to work - i am sure it is right, but maybe some of the other pieces he is adding to $item entry are required ??

for now i'll stick with my format of using arg(n) as placeholders in path definition - it works.

drewish’s picture

Version: 6.x-1.x-dev » 6.x-2.x-dev
Category: feature » bug

i'm running into this with the 2.x code as well. viewing a diff hides the tabs and kills the navigation so i'm calling it a bug.

kelvinc’s picture

I got the same issue and the code doent work cos the version was updated.
Any idea to make the tabs show up?

scottrigby’s picture

Status: Needs work » Patch (to be ported)

+1 ...I'd also be interested in getting this to work in D6 -- but as liquidcms pointed out in #9, this would ideally also be sorted our for the revision paths as well (this is not fixed in D6 btw) -- though that's outside the scope of this patch :)

@moshe: what do you think about the explanation for the cause in #8? If that's correct (or mostly correct), then would a D6 compatible updated version of the solution in #2 be something you'd consider committing?

emok’s picture

StatusFileSize
new4.14 KB

I tried rötzis patch from #6, and I think I got it working (the patch did not apply cleanly to 6.2-dev, had set access callbacks too).
On the individual revision pages (by that I mean a single old revision or confirmation pages to revert or delete) it replaces all the usual tabs by a new set of tabs, where "View original", "Revisions" and "Compare to current" make you leave these tabs and get back the usual View|Edit|Outline|Revisions|... tabs. On the Diff-page it also uses these usual tabs (not the revision-specific tabs).

I was not totally confortable with the switching of top-level tabs, I would have expected/wanted such tabs to be on the level below the usual tabs (while Revision main tab is open). (An example of what I calll "sub-tabs" is on the theme settings page.) However, I tried to find such a solution and did not succeed (e.g. on the list of revisions there is no revision-id given in path so most sub-tabs would not make sense).
Anyway, the "Compare to current"-link makes sense as an improvement to the UI. Maybe "View original" should be called "View current"? (Though if you kept the top level tabs there would be no need for it, the View tab would be available.)
The breadcrumbs work, with the difference that when viewing a single revision the link to the current revision is not in breadcrumb but in a tab.

I did (had already done) my own solution wich does not change the top level tabs, and to avoid nonsense second level tabs it uses some tricks to avoid the second level tabs ever being shown. The breadcrumbs work and you see the Revision tab open on all revision- and Diff-pages. I also added two strings diff_help() that show on top of pages, but that is not at all necessary. To not put two issues in a patch I have not used the new access callback suggested in issue 413308.

I guess it is a matter of taste wich kind of solution you prefer. Both accomplish the breadcrumbs, but our solution regarding tabs are different.

yhahn’s picture

Status: Patch (to be ported) » Fixed

I've done a partial commit of this patch here: http://drupal.org/cvs?commit=197116

I removed the alterations of the view/revert/delete item types from the patch

+  $callbacks['node/%node/revisions/%/view']['type'] = MENU_LOCAL_TASK;
+  $callbacks['node/%node/revisions/%/revert']['type'] = MENU_LOCAL_TASK;
+  $callbacks['node/%node/revisions/%/delete']['type'] = MENU_LOCAL_TASK;

as it appears that this change can cause the menu system to call _node_revision_access() with $op = 'delete' prior to $op = 'view'. If this happens, the access callback stores a static cache of the former value which is often FALSE.

Feel free to continue work on this if anyone is interested in fighting the menu system further here but this commit should resolve the overall issue of the losing local tasks on revision pages.

gpk’s picture

Per #8, I too think there is a related core problem here since I've encountered it when viewing revisions on a 6.x site I'm working on that doesn't use diff.

#437412: Regression: tabs disappear when viewing node revisions

Status: Fixed » Closed (fixed)

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