A set of updates to the "_link" system:
- Made the /comment links/ jump to the comments instead of to the top of the page. - Replaced the "Add comment"-button by a "add new comment"-link. (This should make UnConeD jump up and down of wild excitement.) - Moved all comment related logic from theme.inc and node.module to comment.inc and comment.module (where they belong). - Added some links to ease the site's usability/navigation.4.0.x
parent
3c7f5559a9
commit
42ecb27802
|
@ -45,6 +45,8 @@ function comment_settings($mode, $order, $threshold) {
|
|||
function comment_form($edit) {
|
||||
global $user;
|
||||
|
||||
$form .= "<a name=\"comment\"></a>\n";
|
||||
|
||||
// name field:
|
||||
$form .= form_item(t("Your name"), format_name($user));
|
||||
|
||||
|
@ -293,6 +295,7 @@ function comment_render($lid, $cid) {
|
|||
$threshold = $user->uid ? $user->threshold : variable_get(default_comment_threshold, 3);
|
||||
}
|
||||
|
||||
print "<a name=\"comment\"></a>\n";
|
||||
print "<form method=\"post\" action=\"$REQUEST_URI\">\n";
|
||||
|
||||
/*
|
||||
|
|
|
@ -79,15 +79,7 @@ class BaseTheme {
|
|||
|
||||
|
||||
function comment_controls($threshold = 1, $mode = 3, $order = 1) {
|
||||
global $user, $id;
|
||||
|
||||
$output .= form_item(t("Comment viewing options"), comment_mode($mode) . comment_order($order) . comment_threshold($threshold) ." <input type=\"submit\" name=\"op\" value=\"". t("Update settings") ."\" />", t("Select your prefered way to display the comments and click 'Update settings' to active your changes."));
|
||||
|
||||
if (user_access("post comment")) {
|
||||
$output .= form_item(t("Add a comment"), "<input type=\"submit\" name=\"op\" value=\"". t("Add comment") ."\" />", t("Click 'Add comment' to start a new thread in the discussion."));
|
||||
}
|
||||
|
||||
return $output;
|
||||
return form_item(t("Comment viewing options"), comment_mode($mode) . comment_order($order) . comment_threshold($threshold) ." <input type=\"submit\" name=\"op\" value=\"". t("Update settings") ."\" />", t("Select your prefered way to display the comments and click 'Update settings' to active your changes."));
|
||||
}
|
||||
|
||||
function comment($comment, $link = 0) {
|
||||
|
|
|
@ -14,11 +14,35 @@ function comment_perm() {
|
|||
return array("access comments", "post comments", "administer comments");
|
||||
}
|
||||
|
||||
function comment_link($type) {
|
||||
function comment_link($type, $node = 0, $main = 0) {
|
||||
if ($type == "admin" and user_access("administer comments")) {
|
||||
$links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
|
||||
}
|
||||
|
||||
if ($node->comment) {
|
||||
|
||||
if ($main) {
|
||||
|
||||
/*
|
||||
** Main page: display the number of comments that have been posted.
|
||||
*/
|
||||
|
||||
if (user_access("access comments")) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid#comment\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</a>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
** Node page: add a "post comment" link if the user is allowed to
|
||||
** post comments.
|
||||
*/
|
||||
|
||||
if (user_access("post comments")) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid&op=comment#comment\">". t("add new comment") ."</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,11 +14,35 @@ function comment_perm() {
|
|||
return array("access comments", "post comments", "administer comments");
|
||||
}
|
||||
|
||||
function comment_link($type) {
|
||||
function comment_link($type, $node = 0, $main = 0) {
|
||||
if ($type == "admin" and user_access("administer comments")) {
|
||||
$links[] = "<a href=\"admin.php?mod=comment\">comments</a>";
|
||||
}
|
||||
|
||||
if ($node->comment) {
|
||||
|
||||
if ($main) {
|
||||
|
||||
/*
|
||||
** Main page: display the number of comments that have been posted.
|
||||
*/
|
||||
|
||||
if (user_access("access comments")) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid#comment\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</a>";
|
||||
}
|
||||
}
|
||||
else {
|
||||
/*
|
||||
** Node page: add a "post comment" link if the user is allowed to
|
||||
** post comments.
|
||||
*/
|
||||
|
||||
if (user_access("post comments")) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid&op=comment#comment\">". t("add new comment") ."</a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $links ? $links : array();
|
||||
}
|
||||
|
||||
|
|
|
@ -143,16 +143,16 @@ function node_link($type, $node = 0, $main = 0) {
|
|||
$links = $node->links;
|
||||
}
|
||||
|
||||
if ($node->teaser != $node->body && $main) {
|
||||
$links[] = "<a href=\"node.php?id=". $node->nid ."\">". t("read more") ."</a>";
|
||||
if ($main && $node->teaser != $node->body) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid\">". t("read more") ."</a>";
|
||||
}
|
||||
|
||||
if ($node->comment) {
|
||||
$links[] = "<a href=\"node.php?id=". $node->nid ."\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</a>";
|
||||
if (module_invoke($node->type, "access", "update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$node->nid\">". t("edit") ."</a>";
|
||||
}
|
||||
|
||||
|
||||
if (user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=edit&id=". $node->nid ."\">". t("edit") ."</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("administer") ."</a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -143,16 +143,16 @@ function node_link($type, $node = 0, $main = 0) {
|
|||
$links = $node->links;
|
||||
}
|
||||
|
||||
if ($node->teaser != $node->body && $main) {
|
||||
$links[] = "<a href=\"node.php?id=". $node->nid ."\">". t("read more") ."</a>";
|
||||
if ($main && $node->teaser != $node->body) {
|
||||
$links[] = "<a href=\"node.php?id=$node->nid\">". t("read more") ."</a>";
|
||||
}
|
||||
|
||||
if ($node->comment) {
|
||||
$links[] = "<a href=\"node.php?id=". $node->nid ."\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</a>";
|
||||
if (module_invoke($node->type, "access", "update", $node)) {
|
||||
$links[] = "<a href=\"module.php?mod=node&op=edit&id=$node->nid\">". t("edit") ."</a>";
|
||||
}
|
||||
|
||||
|
||||
if (user_access("administer nodes")) {
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=edit&id=". $node->nid ."\">". t("edit") ."</a>";
|
||||
$links[] = "<a href=\"admin.php?mod=node&op=edit&id=$node->nid\">". t("administer") ."</a>";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue