Backport of 6.x features to 5.x

dsnopek - April 9, 2008 - 11:48
Project:Wikitools
Version:5.x-1.2
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs review
Description

I was planning to hold off on submitting this until after #241583: Problems with "page does not exist" page. and #239370: Solution to "canonical URL" problem were accepted, but that seems to have stalled, so I'm posting this now because then people who are interested can pull the patch and use it now if they like.

This backports the configurable 404 page (with the new inline node create form), inline display (versus redirect) from #239370: Solution to "canonical URL" problem and the bug fixes in #241583: Problems with "page does not exist" page. and #224575: node creation links wrong for certain node types.

Everything went in pretty cleanly except for the inline dislay changes. Drupal 5.x doesn't provide as good hooks as Drupal 6.x, so I have to do some deep menu hacking. Basically, in order to get the tabs for a node to show up, hook_menu needs to be activated *after* calling menu_set_active_item(), because of the "arg(1) == 'node'" style that hook_menu uses in Drupal 5.x. So, we need a hack to force rebuilding of the non-cache-able menu items.

Then to rewrite those tabs, we have to again muck around with menu internals, because Drupal 5.x doesn't have the cool template preprocess hooks that Drupal 6.x does. So, its ugly.

But I'm hoping that this is acceptable because we already have the "perminant solution" in the form of the very pretty Drupal 6.x code. And since Drupal 5.x is not a moving target, we can probably depend on our internals mucking to not break in new versions.

Comments always welcome! Thank you!

AttachmentSize
wikitools5-backport.diff6.13 KB

#1

dsnopek - April 23, 2008 - 13:47

This patch has been updated to reflect changes to #239370: Solution to "canonical URL" problem.

To summarize quickly those changes:

  • We now redirect from "node/$node->nid" to the location on the wiki path.
  • The tab rewriting code has been removed.

Removing the tab rewriting code significantly reduces the amount of ugly menu hacking. It is now just down to the bare minimum required to display a page inline while maintaining the pages original tabs. Hopefully, this makes the patch more acceptable.

AttachmentSize
wikitools5-backport.diff 7.19 KB
 
 

Drupal is a registered trademark of Dries Buytaert.