Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3256
Modified Files:
serendipity_functions.inc.php
Log Message:
fixed display of comment's id (will be like 1, 2, 3, 4.1, 4.2, 4.2.1, ...)
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.281
retrieving revision 1.282
diff -u -d -r1.281 -r1.282
--- serendipity_functions.inc.php 7 Jun 2004 17:37:23 -0000 1.281
+++ serendipity_functions.inc.php 7 Jun 2004 17:47:31 -0000 1.282
@@ -1381,7 +1381,7 @@
return $comments;
}
-function serendipity_generateCommentList($id, $comments = NULL, $selected = 0, $parent = 0, $level = 0) {
+function serendipity_generateCommentList($id, $comments = NULL, $selected = 0, $parent = 0, $level = 0, $indent = '') {
global $serendipity;
if ( !is_array($comments) ) {
@@ -1389,10 +1389,12 @@
}
$retval = $parent ? '' : '<select id="serendipity[replyTo]" name="serendipity[replyTo]"><option value="0">[ ' . TOP_LEVEL . ' ]</option>';
+ $i = 0;
foreach ($comments as $comment) {
if ($comment['parent_id'] == $parent) {
- $retval .= '<option value="' . $comment['id'] . '"'. ($selected == $comment['id'] || (isset($serendipity['POST']['replyTo']) && $comment['id'] == $serendipity['POST']['replyTo']) ? ' selected="selected"' : '') .'>' . str_repeat(' ', $level * 2) . '#' . $comment['id'] . ': ' . (empty($comment['author']) ? ANONYMOUS : $comment['author']) . ' ' . ON . ' ' . ucfirst(strftime('%b %e %Y, %H:%M', $comment['timestamp'])) . "</option>\n";
- $retval .= serendipity_generateCommentList($id, $comments, $selected, $comment['id'], $level + 1);
+ $i++;
+ $retval .= '<option value="' . $comment['id'] . '"'. ($selected == $comment['id'] || (isset($serendipity['POST']['replyTo']) && $comment['id'] == $serendipity['POST']['replyTo']) ? ' selected="selected"' : '') .'>' . str_repeat(' ', $level * 2) . '#' . $indent . $i . ': ' . (empty($comment['author']) ? ANONYMOUS : $comment['author']) . ' ' . ON . ' ' . ucfirst(strftime('%b %e %Y, %H:%M', $comment['timestamp'])) . "</option>\n";
+ $retval .= serendipity_generateCommentList($id, $comments, $selected, $comment['id'], $level + 1, $i . '.');
}
}
$retval .= $parent ? '' : '</select>';
@@ -1400,7 +1402,7 @@
return $retval;
}
-function serendipity_printComments($comments, $allow_comments = true, $show_admin = true, $parentid = 0)
+function serendipity_printComments($comments, $allow_comments = true, $show_admin = true, $parentid = 0, $indent = '')
{
global $serendipity;
?>
@@ -1412,7 +1414,10 @@
<?php
}
+ $i = 0;
foreach ($comments as $comment) {
+ $i++;
+
if (!isset($comment['parent_id']) || $comment['parent_id'] == $parentid) {
$comment['comment'] = htmlspecialchars(strip_tags($comment['body']));
@@ -1435,7 +1440,7 @@
<?php echo $body; ?><br />
<div class="serendipity_comment_source">
- <a href="#c<?php echo $comment['id']; ?>" title="<?php echo LINK_TO_COMMENT . $comment['id']; ?>">#<?php echo $comment['id'] ; ?></a>
+ <a href="#c<?php echo $comment['id']; ?>" title="<?php echo LINK_TO_COMMENT . $indent . $i; ?>">#<?php echo $indent . $i; ?></a>
<?php
/* Link to the user's email */
if (!empty($comment['email'])) {
@@ -1461,7 +1466,7 @@
?>
</div>
- <?php serendipity_printComments($comments, $allow_comments, $show_admin, $comment['id']); ?>
+ <?php serendipity_printComments($comments, $allow_comments, $show_admin, $comment['id'], $i . '.'); ?>
</div>
<br />
<?php
|