? .completion.db ? drnr.tmproj ? files ? mw.patch ? sites/all/modules ? sites/default/files ? themes/garland/mw.patch Index: includes/theme.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/theme.inc,v retrieving revision 1.453 diff -u -F^f -p -r1.453 theme.inc --- includes/theme.inc 23 Nov 2008 16:54:47 -0000 1.453 +++ includes/theme.inc 27 Nov 2008 19:11:53 -0000 @@ -1966,29 +1966,29 @@ function template_preprocess_page(&$vari */ function template_preprocess_node(&$variables) { $node = $variables['node']; - if (module_exists('taxonomy')) { - $variables['taxonomy'] = taxonomy_link('taxonomy terms', $node); - } - else { - $variables['taxonomy'] = array(); - } - - if ($variables['teaser'] && $node->teaser) { - $variables['content'] = $node->teaser; - } - elseif (isset($node->body)) { - $variables['content'] = $node->body; - } - else { - $variables['content'] = ''; - } $variables['date'] = format_date($node->created); - $variables['links'] = !empty($node->links) ? theme('links', $node->links, array('class' => 'links inline')) : ''; $variables['name'] = theme('username', $node); $variables['node_url'] = url('node/' . $node->nid); - $variables['terms'] = theme('links', $variables['taxonomy'], array('class' => 'links inline')); $variables['title'] = check_plain($node->title); + + if (isset($node->preview)) { + unset($node->content['links']); + } + + // Render taxonomy links separately. + $variables['terms'] = !empty($node->taxonomy) ? drupal_render($node->content['links']['terms']) : ''; + + // Render all remaining node links. + $variables['links'] = !empty($node->content['links']) ? drupal_render($node->content['links']) : ''; + + // Render the rest of the node into $content. + if (!empty($node->content['teaser'])) { + $variables['content'] = drupal_render($node->content['teaser']); + } + else { + $variables['content'] = drupal_render($node->content); + } // Flatten the node object's member fields. $variables = array_merge((array)$node, $variables); Index: modules/comment/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment/comment.module,v retrieving revision 1.666 diff -u -F^f -p -r1.666 comment.module --- modules/comment/comment.module 23 Nov 2008 16:04:41 -0000 1.666 +++ modules/comment/comment.module 27 Nov 2008 19:11:54 -0000 @@ -412,16 +412,16 @@ function theme_comment_block() { } /** - * Implementation of hook_link(). + * An implementation of hook_nodeapi_view(). */ -function comment_link($type, $node = NULL, $teaser = FALSE) { +function comment_nodeapi_view($node, $teaser, $page) { $links = array(); - if ($type == 'node' && $node->comment) { + if ($node->comment) { if ($teaser) { // Main page: display the number of comments that have been posted. if (user_access('access comments')) { - if ($node->comment_count) { + if (!empty($node->comment_count)) { $links['comment_comments'] = array( 'title' => format_plural($node->comment_count, '1 comment', '@count comments'), 'href' => "node/$node->nid", @@ -476,17 +476,16 @@ function comment_link($type, $node = NUL } } } - } - - if ($type == 'comment') { - $links = comment_links($node, $teaser); - } + + if (isset($links['comment_forbidden'])) { + $links['comment_forbidden']['html'] = TRUE; + } - if (isset($links['comment_forbidden'])) { - $links['comment_forbidden']['html'] = TRUE; + $node->content['links']['comment'] = array( + '#type' => 'node_links', + '#value' => $links, + ); } - - return $links; } /** @@ -843,6 +842,14 @@ function comment_save($edit) { } } +// An implementation of hook_link(). +function comment_link($type, $object, $teaser) { + if ($type == 'comment') { + $links = comment_links($object, FALSE); + return $links; + } +} + /** * Build command links for a comment (e.g.\ edit, reply, delete) with respect to the current user's access permissions. * @@ -970,7 +977,7 @@ function comment_links($comment, $return * spoil the reverse ordering, "ORDER BY thread ASC" -- here, we do not need * to consider the trailing "/" so we use a substring only. */ -function comment_render($node, $cid = 0) { +function comment_render($node) { global $user; $output = ''; @@ -984,14 +991,14 @@ function comment_render($node, $cid = 0) $mode = _comment_get_display_setting('mode', $node); $comments_per_page = _comment_get_display_setting('comments_per_page', $node); - if ($cid && is_numeric($cid)) { + if (!empty($node->cid)) { // Single comment view. $query = db_select('comments', 'c'); $query->fields('c', array('cid', 'nid', 'pid', 'comment', 'subject', 'format', 'timestamp', 'name', 'mail', 'homepage', 'status') ); $query->fields('u', array( 'uid', 'signature', 'picture', 'data', 'status') ); $query->addField('u', 'name', 'registered_name'); $query->innerJoin('users', 'u', 'c.uid = u.uid'); - $query->condition('c.cid', $cid); + $query->condition('c.cid', $node->cid); if (!user_access('administer comments')) { $query->condition('c.status', COMMENT_PUBLISHED); Index: modules/node/node.module =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.module,v retrieving revision 1.998 diff -u -F^f -p -r1.998 node.module --- modules/node/node.module 22 Nov 2008 14:09:41 -0000 1.998 +++ modules/node/node.module 27 Nov 2008 19:11:54 -0000 @@ -138,6 +138,9 @@ function node_theme() { 'node_admin_overview' => array( 'arguments' => array('name' => NULL, 'type' => NULL), ), + 'node_links' => array( + 'arguments' => array('element' => NULL), + ), ); } @@ -1050,31 +1053,11 @@ function node_delete($nid) { * @return * An HTML representation of the themed node. */ -function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) { +function node_view($node, $teaser = FALSE, $page = FALSE) { $node = (object)$node; $node = node_build_content($node, $teaser, $page); - if ($links) { - $node->links = module_invoke_all('link', 'node', $node, $teaser); - drupal_alter('link', $node->links, $node); - } - - // Set the proper node part, then unset unused $node part so that a bad - // theme can not open a security hole. - $content = drupal_render($node->content); - if ($teaser) { - $node->teaser = $content; - unset($node->body); - } - else { - $node->body = $content; - unset($node->teaser); - } - - // Allow modules to modify the fully-built node. - node_invoke_nodeapi($node, 'alter', $teaser, $page); - return theme('node', $node, $teaser, $page); } @@ -1137,6 +1120,9 @@ function node_build_content($node, $teas // Allow modules to make their own additions to the node. node_invoke_nodeapi($node, 'view', $teaser, $page); + + // Allow modules to modify the structured node. + drupal_alter('node_view', $node, $teaser, $page); return $node; } @@ -1148,6 +1134,7 @@ function node_show($node, $cid, $message if ($message) { drupal_set_title(t('Revision of %title from %date', array('%title' => $node->title, '%date' => format_date($node->revision_timestamp))), PASS_THROUGH); } + $node->cid = $cid; $output = node_view($node, FALSE, TRUE); if (function_exists('comment_render') && $node->comment) { @@ -2922,3 +2909,27 @@ function node_list_permissions($type) { return $perms; } + +/** + * Implementation of hook_elements(). + */ +function node_elements() { + $type['node_links'] = array(); + + return $type; +} + +/** + * Format a set of node links. + * + * @param $element + * An associative array containing the properties of the element. + * Properties used: value + * @return + * A themed HTML string representing the links. + * + * @ingroup themeable + */ +function theme_node_links($element) { + return theme('links', $element['#value'], array('class' => 'links inline')); +} \ No newline at end of file Index: modules/node/node.pages.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/node/node.pages.inc,v retrieving revision 1.45 diff -u -F^f -p -r1.45 node.pages.inc --- modules/node/node.pages.inc 13 Oct 2008 00:33:03 -0000 1.45 +++ modules/node/node.pages.inc 27 Nov 2008 19:11:54 -0000 @@ -415,12 +415,12 @@ function theme_node_preview($node) { if ($preview_trimmed_version) { drupal_set_message(t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.')); $output .= '
" . l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) . "
\n"; $output .= "