Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8600
Modified Files:
serendipity_functions.inc.php NEWS
Log Message:
Allow the user (=visitor) to toggle chronological or threaded view of comments.
(see mailinglist)
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.207
retrieving revision 1.208
diff -u -d -r1.207 -r1.208
--- NEWS 1 Sep 2004 14:15:06 -0000 1.207
+++ NEWS 2 Sep 2004 10:46:42 -0000 1.208
@@ -3,6 +3,9 @@
Version 0.7 ()
------------------------------------------------------------------------
+ * Threaded/chronological view of comments can be toggled by the
+ visitor. (garvinhicking)
+
* Plugin serendipity_event_spamblock: Will reject any double
comments, if enabled. Stub for enhancing other spam-protections
(kaptchas, spamassassin-integration, IP-Blacklists, whatever)
@@ -14,9 +17,9 @@
* Don't use the title of an entry in the RSS feed <guid></guid> tags
(tomsommer)
- * Use '-' as separator for IDs and words in our "nice" URLs, so
- Google and others can recognize 'a-nifty-word' as 'a nifty word'.
- Previously this was indexed as one single word.
+ * Use '-' as separator for IDs and words in our "nice" URLs, so
+ Google and others can recognize 'a-nifty-word' as 'a nifty word'.
+ Previously this was indexed as one single word.
(tomsommer, garvinhicking)
* Pagination now properly works for browsing months and categories.
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.412
retrieving revision 1.413
diff -u -d -r1.412 -r1.413
--- serendipity_functions.inc.php 1 Sep 2004 18:02:21 -0000 1.412
+++ serendipity_functions.inc.php 2 Sep 2004 10:46:42 -0000 1.413
@@ -1266,6 +1266,21 @@
echo $eventData['display_dat'];
if (isset($serendipity['GET']['id'])) {
+ $comm_url = serendipity_archiveURL(
+ $entry['id'],
+ $entry['title'],
+ 'baseURL',
+ false
+ );
+
+ $comment_viewmode = 'threaded';
+ $comment_viewmode_switch = 'chronological';
+ if (isset($serendipity['GET']['cview']) && $serendipity['GET']['cview'] == $comment_viewmode_switch) {
+ $temp_viewmode = $comment_viewmode;
+ $comment_viewmode = $comment_viewmode_switch;
+ $comment_viewmode_switch = $temp_viewmode;
+ }
+ $comment_viewmode_url = $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $comm_url . '&serendipity[cview]=' . $comment_viewmode_switch;
/********** MESSAGES *********/
if (defined('DATA_UNSUBSCRIBED')) {
@@ -1301,13 +1316,20 @@
serendipity_printTrackbacks(serendipity_fetchTrackbacks($entry['id']));
?>
</div>
-<?php } ?>
+<?php } ?>
<div class="serendipity_comments">
<br />
<a id="comments"></a>
- <div class="serendipity_commentsTitle"><?php echo COMMENTS; ?></div>
+ <div class="serendipity_commentsTitle"><?php echo COMMENTS; ?> (<a href="<?php echo $comment_viewmode_url; ?>"><?php echo constant('VIEWMODE_' . strtoupper($comment_viewmode_switch)); ?></a>)</div>
<?php
- serendipity_printComments(serendipity_fetchComments($entry['id']), (isset($entry['allow_comments']) ? $entry['allow_comments'] : true));
+ serendipity_printComments(
+ serendipity_fetchComments(
+ $entry['id']
+ ),
+ (isset($entry['allow_comments']) ? $entry['allow_comments'] : true),
+ true,
+ $comment_viewmode
+ );
if (!empty($serendipity['POST']['preview'])) {
serendipity_printComments(
@@ -1349,13 +1371,6 @@
<br />
<div class="serendipity_commentsTitle"><?php echo ADD_COMMENT; ?></div>
<?php
- $comm_url = serendipity_archiveURL(
- $entry['id'],
- $entry['title'],
- 'baseURL',
- false
- );
-
echo serendipity_displayCommentForm(
$entry['id'],
$serendipity['serendipityHTTPPath'] . $serendipity['indexFile'] . '?url=' . $comm_url,
@@ -1543,9 +1558,11 @@
function serendipity_printComments($comments, $allow_comments = true, $show_admin = true, $parentid = 0, $indent = '')
{
global $serendipity;
-?>
-<?php
+ if ($parentid === 'threaded') {
+ $parentid = 0;
+ }
+
if (!count($comments) && !$parentid) {
?>
<div class="serendipity_center"><?php echo NO_COMMENTS; ?></div>
@@ -1555,7 +1572,7 @@
$i = 0;
foreach ($comments as $comment) {
- if (!isset($comment['parent_id']) || $comment['parent_id'] == $parentid) {
+ if ($parentid === 'chronological' || !isset($comment['parent_id']) || $comment['parent_id'] == $parentid) {
$i++;
$comment['comment'] = htmlspecialchars(strip_tags($comment['body']));
@@ -1610,19 +1627,18 @@
/* Allow people to easily reply to this comment */
echo ' <a href="#serendipity_CommentForm" onclick="document.getElementById(\'serendipity_replyTo\').value=\'' . $comment['id'] . '\';">' . REPLY . '</a>';
?>
-
</div>
- <?php
- if ( $comment['id'] ) {
+<?php
+ if ($comment['id'] && $parentid !== 'chronological') {
serendipity_printComments($comments, $allow_comments, $show_admin, $comment['id'], $indent . $i . '.');
}
- ?>
+?>
</div>
<?php
}
}
- if ($parentid != 0) {
+ if ($parentid != 0 && $parentid !== 'chronological') {
return true;
}
@@ -2260,7 +2276,7 @@
printf(TRACKBACK_SENDING, htmlspecialchars($trackURI));
flush();
-
+
$response = serendipity_trackback_is_success(_serendipity_send($trackURI, $data));
if ($response === true) {
|