- Bugfix: you can no longer add non-existant node types. Thanks barry.
- Moved all comment related logic from node.module to comment.module.4.0.x
parent
91d1115768
commit
facd9cc517
|
@ -19,7 +19,7 @@ function comment_link($type, $node = 0, $main = 0) {
|
|||
$links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
|
||||
}
|
||||
|
||||
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 .= "<h3>". t("Edit comments") ."</h3>";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">$comment->subject</a></td><td>". format_name($comment) ."</td><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">". t("edit comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">". t("delete comment") ."</a></td></tr>";
|
||||
}
|
||||
|
||||
$output .= "</table>";
|
||||
|
||||
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'");
|
||||
|
|
|
@ -19,7 +19,7 @@ function comment_link($type, $node = 0, $main = 0) {
|
|||
$links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
|
||||
}
|
||||
|
||||
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 .= "<h3>". t("Edit comments") ."</h3>";
|
||||
$output .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">$comment->subject</a></td><td>". format_name($comment) ."</td><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">". t("edit comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">". t("delete comment") ."</a></td></tr>";
|
||||
}
|
||||
|
||||
$output .= "</table>";
|
||||
|
||||
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'");
|
||||
|
|
|
@ -227,19 +227,12 @@ function node_admin_edit($node) {
|
|||
}
|
||||
|
||||
/*
|
||||
** Edit comments:
|
||||
** Display the node form extensions:
|
||||
*/
|
||||
|
||||
$output .= "<h3>". t("Edit comments") ."</h3>";
|
||||
|
||||
$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 .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">$comment->subject</a></td><td>". format_name($comment) ."</td><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">". t("edit comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">". t("delete comment") ."</a></td></tr>";
|
||||
foreach (module_list() as $name) {
|
||||
$output .= module_invoke($name, "node_link", $node);
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
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 {
|
||||
|
|
|
@ -227,19 +227,12 @@ function node_admin_edit($node) {
|
|||
}
|
||||
|
||||
/*
|
||||
** Edit comments:
|
||||
** Display the node form extensions:
|
||||
*/
|
||||
|
||||
$output .= "<h3>". t("Edit comments") ."</h3>";
|
||||
|
||||
$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 .= "<table border=\"1\" cellpadding=\"2\" cellspacing=\"2\">";
|
||||
$output .= " <tr><th>title</th><th>author</th><th colspan=\"3\">operations</th></tr>";
|
||||
while ($comment = db_fetch_object($result)) {
|
||||
$output .= "<tr><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">$comment->subject</a></td><td>". format_name($comment) ."</td><td><a href=\"node.php?id=$node->nid&cid=$comment->cid#$comment->cid\">". t("view comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=edit&id=$comment->cid\">". t("edit comment") ."</a></td><td><a href=\"admin.php?mod=comment&op=delete&id=$comment->cid\">". t("delete comment") ."</a></td></tr>";
|
||||
foreach (module_list() as $name) {
|
||||
$output .= module_invoke($name, "node_link", $node);
|
||||
}
|
||||
$output .= "</table>";
|
||||
|
||||
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 {
|
||||
|
|
Loading…
Reference in New Issue