--- ../uuid.orig/uuid.module 2011-06-28 17:37:14.000000000 -0400 +++ uuid/uuid.module 2011-06-28 19:06:20.000000000 -0400 @@ -21,9 +21,53 @@ function uuid_menu() { 'file' => 'uuid.admin.inc', ); + $items['uuid/%'] = array( + 'title callback' => 'uuid_lookup_title', + 'title arguments' => array(1), + 'page callback' => 'uuid_lookup_page', + 'page arguments' => array(1), + 'access callback' => 'uuid_lookup_access', + 'access arguments' => array(1), + 'type' => MENU_CALLBACK, + ); + return $items; } +function uuid_lookup($node_uuid_or_revision_uuid) { + $node = node_get_by_revision_uuid($node_uuid_or_revision_uuid); + + if (!$node) + $node = node_get_by_uuid($node_uuid_or_revision_uuid); + + return $node ? $node : MENU_NOT_FOUND; +} + +function uuid_lookup_title($uuid) { + $node = uuid_lookup($uuid); + if ($node === MENU_NOT_FOUND) + return $node; + + return $node->title; +} + +function uuid_lookup_page($uuid) { + $node = uuid_lookup($uuid); + if ($node === MENU_NOT_FOUND) + return $node; + + drupal_set_title(check_plain($node->title)); + return node_show($node, NULL); +} + +function uuid_lookup_access($uuid) { + $node = uuid_lookup($uuid); + if ($node === MENU_NOT_FOUND) + return $node; + + return node_access('view', $node); +} + /** * Implementation of hook_nodeapi(). */