summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-11-23 23:11:59 +0000
committerDries Buytaert <dries@buytaert.net>2004-11-23 23:11:59 +0000
commit30110a87701149dd23f250354266159ea3e07c35 (patch)
tree775143b1e81d7ca56df00f29a576e90218545f56
parent9574766ad8f8810baf42a81ae105984254f0fc0a (diff)
downloadbrdo-30110a87701149dd23f250354266159ea3e07c35.tar.gz
brdo-30110a87701149dd23f250354266159ea3e07c35.tar.bz2
- Patch #6166 by Moshe: node preview should not display links. Push the links to the theme instead of the theme having to pull them in using node_link().
TODO: 1. Update theme upgrade instructions in the handbook: node_link() is gone. 2. Remove page_link() just like we removed node_link().
-rw-r--r--includes/common.inc9
-rw-r--r--includes/theme.inc4
-rw-r--r--modules/node.module13
-rw-r--r--modules/node/node.module13
-rw-r--r--modules/poll.module2
-rw-r--r--modules/poll/poll.module2
-rw-r--r--modules/statistics.module3
-rw-r--r--modules/statistics/statistics.module3
-rw-r--r--scripts/prefix.sh2
-rw-r--r--themes/chameleon/chameleon.theme4
-rw-r--r--themes/engines/xtemplate/xtemplate.engine4
11 files changed, 29 insertions, 30 deletions
diff --git a/includes/common.inc b/includes/common.inc
index 31f3f426d..d65ebe7a2 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1596,15 +1596,6 @@ function link_page() {
}
/**
- * Fetch a set of links to display after a given node.
- *
- * The links are gathered by calls to hook_link('node') in each module.
- */
-function link_node($node, $main = 0) {
- return module_invoke_all('link', 'node', $node, $main);
-}
-
-/**
* Perform end-of-request tasks.
*
* This function sets the page cache if appropriate, and allows modules to
diff --git a/includes/theme.inc b/includes/theme.inc
index f22a775c0..8a32f389d 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -519,8 +519,8 @@ function theme_node($node, $teaser = FALSE, $page = FALSE) {
$output .= $node->body;
}
- if ($links = link_node($node, $teaser)) {
- $output .= '<div class="links">'. theme('links', $links) .'</div>';
+ if ($node->links) {
+ $output .= '<div class="links">'. theme('links', $node->links) .'</div>';
}
return $output;
diff --git a/modules/node.module b/modules/node.module
index 741a946f0..718e34ac2 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -507,11 +507,13 @@ function node_save($node) {
* Whether to display only the teaser for the node.
* @param $page
* Whether the node is being displayed by itself as a page.
+ * @param $links
+ * Whether or not to display node links. Links are omitted for node previews.
*
* @return
* An HTML representation of the themed node.
*/
-function node_view($node, $teaser = FALSE, $page = FALSE) {
+function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
$node = array2object($node);
// Remove the delimiter (if any) that separates the teaser from the body.
@@ -528,6 +530,9 @@ function node_view($node, $teaser = FALSE, $page = FALSE) {
}
// Allow modules to change $node->body before viewing.
node_invoke_nodeapi($node, 'view', $teaser, $page);
+ if ($links) {
+ $node->links = module_invoke_all('link', 'node', $node, !$page);
+ }
return theme('node', $node, $teaser, $page);
}
@@ -1354,13 +1359,13 @@ function node_preview($node) {
// Display a preview of the node:
if ($node->teaser && $node->teaser != $node->body) {
$output = '<h3>'. t('Preview trimmed version') .'</h3>';
- $output .= node_view($node, 1);
+ $output .= node_view($node, 1, FALSE, 0);
$output .= '<p><em>'. 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 "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
$output .= '<h3>'. t('Preview full version') .'</h3>';
- $output .= node_view($node, 0);
+ $output .= node_view($node, 0, FALSE, 0);
}
else {
- $output .= node_view($node, 0);
+ $output .= node_view($node, 0, FALSE, 0);
}
$output .= node_form($node);
diff --git a/modules/node/node.module b/modules/node/node.module
index 741a946f0..718e34ac2 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -507,11 +507,13 @@ function node_save($node) {
* Whether to display only the teaser for the node.
* @param $page
* Whether the node is being displayed by itself as a page.
+ * @param $links
+ * Whether or not to display node links. Links are omitted for node previews.
*
* @return
* An HTML representation of the themed node.
*/
-function node_view($node, $teaser = FALSE, $page = FALSE) {
+function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) {
$node = array2object($node);
// Remove the delimiter (if any) that separates the teaser from the body.
@@ -528,6 +530,9 @@ function node_view($node, $teaser = FALSE, $page = FALSE) {
}
// Allow modules to change $node->body before viewing.
node_invoke_nodeapi($node, 'view', $teaser, $page);
+ if ($links) {
+ $node->links = module_invoke_all('link', 'node', $node, !$page);
+ }
return theme('node', $node, $teaser, $page);
}
@@ -1354,13 +1359,13 @@ function node_preview($node) {
// Display a preview of the node:
if ($node->teaser && $node->teaser != $node->body) {
$output = '<h3>'. t('Preview trimmed version') .'</h3>';
- $output .= node_view($node, 1);
+ $output .= node_view($node, 1, FALSE, 0);
$output .= '<p><em>'. 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 "&lt;!--break--&gt;" (without the quotes) to fine-tune where your post gets split.') .'</em></p>';
$output .= '<h3>'. t('Preview full version') .'</h3>';
- $output .= node_view($node, 0);
+ $output .= node_view($node, 0, FALSE, 0);
}
else {
- $output .= node_view($node, 0);
+ $output .= node_view($node, 0, FALSE, 0);
}
$output .= node_form($node);
diff --git a/modules/poll.module b/modules/poll.module
index 2c078f629..f55cacabf 100644
--- a/modules/poll.module
+++ b/modules/poll.module
@@ -435,7 +435,7 @@ function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
// No 'read more' link
$node->body = $node->teaser = '';
- $links = link_node($node, $main);
+ $links = module_invoke_all('link', 'node', $node, 0);
$links[] = l(t('older polls'), 'poll', array('title' => t('View the list of polls on this site.')));
if ($node->allowvotes && $block) {
$links[] = l(t('results'), 'node/'. $node->nid .'/results', array('title' => t('View the current poll results.')));
diff --git a/modules/poll/poll.module b/modules/poll/poll.module
index 2c078f629..f55cacabf 100644
--- a/modules/poll/poll.module
+++ b/modules/poll/poll.module
@@ -435,7 +435,7 @@ function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) {
// No 'read more' link
$node->body = $node->teaser = '';
- $links = link_node($node, $main);
+ $links = module_invoke_all('link', 'node', $node, 0);
$links[] = l(t('older polls'), 'poll', array('title' => t('View the list of polls on this site.')));
if ($node->allowvotes && $block) {
$links[] = l(t('results'), 'node/'. $node->nid .'/results', array('title' => t('View the current poll results.')));
diff --git a/modules/statistics.module b/modules/statistics.module
index 568ee805b..40791bc19 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -629,7 +629,6 @@ function statistics_summary($dbfield, $dbrows) {
$result = db_query_range('SELECT n.nid, n.title FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid ORDER BY %s DESC', $dbfield, 0, $dbrows);
while ($nid = db_fetch_array($result)) {
$content = node_load(array('nid' => $nid['nid']));
- $links = link_node($content, 1);
// Filter and prepare node teaser
if (node_hook($content, 'view')) {
@@ -641,7 +640,7 @@ function statistics_summary($dbfield, $dbrows) {
$output .= '<tr><td><strong>'. l($nid['title'], 'node/'. $nid['nid'], array('title' => t('View this posting.'))) .'</strong></td><td style="text-align: right;"><small>'. t('Submitted by %a on %b', array('%a' => format_name($content), '%b' => format_date($content->created, 'large'))) .'</small></td></tr>';
$output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. $content->teaser .'</div></td></tr>';
- $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $links) .' ]<br /><br /></td></tr>';
+ $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $content->links) .' ]<br /><br /></td></tr>';
}
return $output;
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index 568ee805b..40791bc19 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -629,7 +629,6 @@ function statistics_summary($dbfield, $dbrows) {
$result = db_query_range('SELECT n.nid, n.title FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid ORDER BY %s DESC', $dbfield, 0, $dbrows);
while ($nid = db_fetch_array($result)) {
$content = node_load(array('nid' => $nid['nid']));
- $links = link_node($content, 1);
// Filter and prepare node teaser
if (node_hook($content, 'view')) {
@@ -641,7 +640,7 @@ function statistics_summary($dbfield, $dbrows) {
$output .= '<tr><td><strong>'. l($nid['title'], 'node/'. $nid['nid'], array('title' => t('View this posting.'))) .'</strong></td><td style="text-align: right;"><small>'. t('Submitted by %a on %b', array('%a' => format_name($content), '%b' => format_date($content->created, 'large'))) .'</small></td></tr>';
$output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. $content->teaser .'</div></td></tr>';
- $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $links) .' ]<br /><br /></td></tr>';
+ $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $content->links) .' ]<br /><br /></td></tr>';
}
return $output;
diff --git a/scripts/prefix.sh b/scripts/prefix.sh
index 00793a8a5..8c7f93655 100644
--- a/scripts/prefix.sh
+++ b/scripts/prefix.sh
@@ -1,7 +1,7 @@
#!/bin/sh
if [ $# != 2 ]; then
- cat >&2 << EOH
+ cat >&2 << EOH
This is Drupal database prefixer.
Usage:
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme
index d81ed752e..b6c979311 100644
--- a/themes/chameleon/chameleon.theme
+++ b/themes/chameleon/chameleon.theme
@@ -136,8 +136,8 @@ function chameleon_node($node, $main = 0, $page = 0) {
$terms = taxonomy_link("taxonomy terms", $node);
}
- if ($links = link_node($node, $main)) {
- $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $terms, $links)) ."</div>\n";
+ if ($node->links) {
+ $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $terms, $node->links)) ."</div>\n";
}
$output .= "</div>\n";
diff --git a/themes/engines/xtemplate/xtemplate.engine b/themes/engines/xtemplate/xtemplate.engine
index 691b1e8d0..253e3e85a 100644
--- a/themes/engines/xtemplate/xtemplate.engine
+++ b/themes/engines/xtemplate/xtemplate.engine
@@ -63,8 +63,8 @@ function xtemplate_node($node, $main = 0, $page = 0) {
$xtemplate->template->parse("node.taxonomy");
}
- if ($links = link_node($node, $main)) {
- $xtemplate->template->assign("links", theme_links($links));
+ if ($node->links) {
+ $xtemplate->template->assign("links", theme_links($node->links));
$xtemplate->template->parse("node.links");
}