diff --git a/modules/comment.module b/modules/comment.module index 093054e82d3..1008244593c 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -19,7 +19,7 @@ function comment_link($type, $node = 0, $main = 0) { $links[] = "comments"; } - if ($node->comment) { + if ($type == "node" && $node->comment) { if ($main) { @@ -46,6 +46,25 @@ function comment_link($type, $node = 0, $main = 0) { return $links ? $links : array(); } +function comment_node_link($node) { + + /* + ** Edit comments: + */ + + $result = db_query("SELECT c.cid, c.subject, u.uid, u.name FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE lid = '$node->nid' ORDER BY c.timestamp"); + $output .= "

". t("Edit comments") ."

"; + $output .= ""; + $output .= " "; + while ($comment = db_fetch_object($result)) { + $output .= ""; + } + + $output .= "
titleauthoroperations
nid&cid=$comment->cid#$comment->cid\">$comment->subject". format_name($comment) ."nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."cid\">". t("edit comment") ."cid\">". t("delete comment") ."
"; + + return $output; +} + function comment_edit($id) { $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$id'"); diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 093054e82d3..1008244593c 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -19,7 +19,7 @@ function comment_link($type, $node = 0, $main = 0) { $links[] = "comments"; } - if ($node->comment) { + if ($type == "node" && $node->comment) { if ($main) { @@ -46,6 +46,25 @@ function comment_link($type, $node = 0, $main = 0) { return $links ? $links : array(); } +function comment_node_link($node) { + + /* + ** Edit comments: + */ + + $result = db_query("SELECT c.cid, c.subject, u.uid, u.name FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE lid = '$node->nid' ORDER BY c.timestamp"); + $output .= "

". t("Edit comments") ."

"; + $output .= ""; + $output .= " "; + while ($comment = db_fetch_object($result)) { + $output .= ""; + } + + $output .= "
titleauthoroperations
nid&cid=$comment->cid#$comment->cid\">$comment->subject". format_name($comment) ."nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."cid\">". t("edit comment") ."cid\">". t("delete comment") ."
"; + + return $output; +} + function comment_edit($id) { $result = db_query("SELECT c.*, u.name, u.uid FROM comments c LEFT JOIN users u ON c.uid = u.uid WHERE c.cid = '$id'"); diff --git a/modules/node.module b/modules/node.module index fc0743677e8..012211b83b7 100644 --- a/modules/node.module +++ b/modules/node.module @@ -227,19 +227,12 @@ function node_admin_edit($node) { } /* - ** Edit comments: + ** Display the node form extensions: */ - $output .= "

". t("Edit comments") ."

"; - - $result = db_query("SELECT c.cid, c.subject, u.uid, u.name FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE lid = '$node->nid' ORDER BY c.timestamp"); - - $output .= ""; - $output .= " "; - while ($comment = db_fetch_object($result)) { - $output .= ""; + foreach (module_list() as $name) { + $output .= module_invoke($name, "node_link", $node); } - $output .= "
titleauthoroperations
nid&cid=$comment->cid#$comment->cid\">$comment->subject". format_name($comment) ."nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."cid\">". t("edit comment") ."cid\">". t("delete comment") ."
"; return $output; @@ -658,7 +651,12 @@ function node_form($edit) { function node_add($type) { global $user; - if ($type) { + /* + ** If a node type has been specified, validate it existence. If no + ** (valid) node type has been provied, display a node type overview. + */ + + if (module_hook($type, "node")) { $output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type)); } else { diff --git a/modules/node/node.module b/modules/node/node.module index fc0743677e8..012211b83b7 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -227,19 +227,12 @@ function node_admin_edit($node) { } /* - ** Edit comments: + ** Display the node form extensions: */ - $output .= "

". t("Edit comments") ."

"; - - $result = db_query("SELECT c.cid, c.subject, u.uid, u.name FROM comments c LEFT JOIN users u ON u.uid = c.uid WHERE lid = '$node->nid' ORDER BY c.timestamp"); - - $output .= ""; - $output .= " "; - while ($comment = db_fetch_object($result)) { - $output .= ""; + foreach (module_list() as $name) { + $output .= module_invoke($name, "node_link", $node); } - $output .= "
titleauthoroperations
nid&cid=$comment->cid#$comment->cid\">$comment->subject". format_name($comment) ."nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."cid\">". t("edit comment") ."cid\">". t("delete comment") ."
"; return $output; @@ -658,7 +651,12 @@ function node_form($edit) { function node_add($type) { global $user; - if ($type) { + /* + ** If a node type has been specified, validate it existence. If no + ** (valid) node type has been provied, display a node type overview. + */ + + if (module_hook($type, "node")) { $output = node_form(array("uid" => $user->uid, "name" => $user->name, "type" => $type)); } else {