Update of /cvsroot/php-blog/serendipity/templates/default
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24677/templates/default
Modified Files:
Tag: branch-smarty
comments.tpl entries.tpl trackbacks.tpl
Log Message:
- Move recursive/threaded comments into Smarty
- Move printComment and printTrackbacks into the template, in order to use the $entry and other smarty variables within those.
- Allow the usage of sprintf, sizeof and count as a modifier in Smarty
- Remove is_cview stuff and do a more native thing in entries.tpl
- Unset large arrays to free memory
TODO: Comment preview doesn't work, yet
TODO: Annonymous comments have b0rked delete prompts
Index: comments.tpl
===================================================================
RCS file: /cvsroot/php-blog/serendipity/templates/default/Attic/comments.tpl,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- comments.tpl 9 Sep 2004 15:00:45 -0000 1.1.2.1
+++ comments.tpl 9 Oct 2004 23:16:27 -0000 1.1.2.2
@@ -1,2 +1,27 @@
-<!-- TODO: Remove recursion of serendipity_printEntries() :( -->
-{$comments_list}
\ No newline at end of file
+{foreach from=$comments item=comment}
+ <a id="c{$comment.id}"></a>
+ <div class="serendipity_comment" style="padding-left: {$comment.depth*20}px">
+ <div class="serendipity_commentBody">{$comment.body}</div>
+ <div class="serendipity_comment_source">
+ <a href="#c{$comment.id}" title="Link to comment #{$comment.trace}">#{$comment.trace}</a>
+ {if $comment.email}
+ <a href="mailto:{$comment.email}">{$comment.username|@default:$CONST.ANONYMOUS}</a>
+ {else}
+ {$comment.username|@default:$CONST.ANONYMOUS}
+ {/if}
+ {if $comment.url}
+ (<a href="{$comment.url}" title="{$comment.url|@escape}">Link</a>)
+ {/if}
+ {$CONST.ON}
+ {$comment.timestamp|@formatTime:"%b %e %Y, %H:%M"}
+ {if $entry.is_entry_owner}
+ (<a href="{$comment.link_delete}" onclick="return confirm('{$CONST.COMMENT_DELETE_CONFIRM|@sprintf:$comment.id:$comment.username}');">delete</a>)
+ {/if}
+ {if $entry.allow_comments}
+ (<a href="#serendipity_CommentForm" onclick="document.getElementById('serendipity_replyTo').value='{$comment.id}';">Reply</a>)
+ {/if}
+ </div>
+ </div>
+{foreachelse}
+ <div class="serendipity_center">{$CONST.NO_COMMENTS}</div>
+{/foreach}
Index: entries.tpl
===================================================================
RCS file: /cvsroot/php-blog/serendipity/templates/default/Attic/entries.tpl,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -u -d -r1.1.2.14 -r1.1.2.15
--- entries.tpl 5 Oct 2004 19:40:40 -0000 1.1.2.14
+++ entries.tpl 9 Oct 2004 23:16:27 -0000 1.1.2.15
@@ -105,7 +105,7 @@
<a style="font-weight: normal" href="{$serendipityBaseURL}comment.php?type=trackback&entry_id={$entry_id}" onclick="alert('{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape:htmlall}'); return false;" title="{$CONST.TRACKBACK_SPECIFIC_ON_CLICK|@escape}">{$CONST.TRACKBACK_SPECIFIC}</a>
</div>
<br />
- {$TRACKBACKS}
+ {serendipity_printTrackbacks entry=$entry.id}
</div>
{/if}
@@ -115,14 +115,14 @@
<a id="comments"></a>
<div class="serendipity_commentsTitle">{$CONST.COMMENTS}</div>
<div class="serendipity_center">{$CONST.DISPLAY_COMMENTS_AS}
- {if $is_cview_linear}
+ {if $entry.viewmode eq $CONST.VIEWMODE_LINEAR}
({$CONST.COMMENTS_VIEWMODE_LINEAR} | <a href="{$serendipityHTTPPath}{$serendipityIndexFile}?url={$entry.commURL}&serendipity[cview]={$CONST.VIEWMODE_THREADED}#comments">{$CONST.COMMENTS_VIEWMODE_THREADED}</a>)
{else}
(<a href="{$serendipityHTTPPath}{$serendipityIndexFile}?url={$entry.commURL}&serendipity[cview]={$CONST.VIEWMODE_LINEAR}#comments">{$CONST.COMMENTS_VIEWMODE_LINEAR}</a> | {$CONST.COMMENTS_VIEWMODE_THREADED})
{/if}
</div>
-
- {$COMMENTS}
+ <br />
+ {serendipity_printComments entry=$entry.id mode=$entry.viewmode}
{if $entry.is_entry_owner}
{if $entry.allow_comments}
Index: trackbacks.tpl
===================================================================
RCS file: /cvsroot/php-blog/serendipity/templates/default/Attic/trackbacks.tpl,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- trackbacks.tpl 3 Oct 2004 00:45:16 -0000 1.1.2.7
+++ trackbacks.tpl 9 Oct 2004 23:16:27 -0000 1.1.2.8
@@ -1,11 +1,13 @@
{foreach from=$trackbacks item=trackback}
<div class="serendipity_comment">
- <a href="{$trackback.url|@strip_tags}" {'blank'|@xhtml_target}>{$trackback.title}</a><br />
- {$trackback.body|@strip_tags|@escape:all}<br />
+ <div class="serendipity_commentBody">
+ <a href="{$trackback.url|@strip_tags}" {'blank'|@xhtml_target}>{$trackback.title}</a><br />
+ {$trackback.body|@strip_tags|@escape:all}
+ </div>
<div class="serendipity_comment_source">
<b>Weblog:</b> {$trackback.author|@default:$CONST.ANONYMOUS}<br />
<b>{$CONST.TRACKED}:</b> {$trackback.timestamp|@formatTime:'%b %d, %H:%M'}
- {if $is_trackbacks_owner}
+ {if $entry.is_entry_owner}
(<a href="{$serendipityBaseURL}comment.php?serendipity[delete]={$trackback.id}&serendipity[entry]={$trackback.entry_id}&serendipity[type]=trackbacks">{$CONST.DELETE}</a>)
{/if}
</div>
|