⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comments.vm

📁 这个weblogging 设计得比较精巧
💻 VM
📖 第 1 页 / 共 2 页
字号:
#** * Comment page links and comment forms. *##** * Display the pop-up comments link for a weblog entry. * Use the URL for the href attribute for those who have disabled * javascript or who desire to open the comments window in another (Mozilla) tab. * @param entry WeblogEntryData object for which link is to be displayed. *##macro( showCommentsLink $entry )    #set( $commentCount = $pageModel.getCommentCount($entry.Id) )    #if (($entry.commentsStillAllowed && $website.allowComments) || $commentCount > 0)        #set( $link = "$ctxPath/comments/$userName/$page.link/$utilities.encode($entry.anchor)?popup=true#comments" )        <a href="$link " onclick="window.open('$link', 'comments',            'width=480,height=480,scrollbars=yes,status=yes,resizable'); return false;"            class="entrycommentslink">$text.get( "macro.weblog.comments" ) [$commentCount]</a>    #end#end#** * Display the in-page comments link for a weblog entry. * @param entry WeblogEntryData object for which link is to be displayed. *##macro( showCommentsPageLink $entry )    #set( $commentCount = $pageModel.getCommentCount($entry.Id) )    #if (($entry.commentsStillAllowed && $website.allowComments) || $commentCount > 0)        #set( $link = "$ctxPath/comments/$userName/$page.link/$utilities.encode($entry.anchor)#comments" )        <a href="$link" class="entrycommentslink">$text.get( "macro.weblog.comments" ) [$commentCount]</a>    #end#end#** * Display link for comments that renders a dynamically (DHTML) generated * comments form - Matt Raible's "twisty comments" style. * @param entry WeblogEntryData object for which link is to be displayed. *##macro( showCommentsDiv $entry )    #set( $commentCount = $pageModel.getCommentCount($entry.Id) )    #if (($entry.commentsStillAllowed && $website.allowComments) || $commentCount > 0)        <div class="comments" id="comments">            <div id="commentTwisty$entry.Id" class="commentTwisty"                onclick="toggleComments('$entry.Id', '$ctxPath/page/$userName'); return false;">            <a href="$ctxPath/comments/$userName/$page.link/$utilities.encode($entry.anchor)" class="plain">            #if($commentCount == 0)                $text.get( "macro.weblog.addcomment" )            #elseif($commentCount == 1)                $commentCount $text.get( "macro.weblog.comment" )            #else                $commentCount $text.get( "macro.weblog.comments" )            #end</a></div>        </div>    #end#end#** * PRIVATE. Macro for displaying Comment details (not content).**##macro( showCommentDetails $comment $showPermalink )    $dateFormatter.applyPattern($text.get( "macro.weblog.datepattern" ))    #set($email = $utilities.hexEncode($comment.email))    <p class="comment-details">    $text.get("macro.weblog.postedby")    #if (!$stringUtils.isEmpty($comment.name) && !$stringUtils.isEmpty($email) && !$stringUtils.isEmpty($comment.remoteHost))        <a href="mailto:$email" title="$comment.remoteHost">$comment.name</a>    #elseif (!$stringUtils.isEmpty($comment.name) && !$stringUtils.isEmpty($email))        <a href="mailto:$email">$comment.name</a>    #elseif (!$stringUtils.isEmpty($email) && !$stringUtils.isEmpty($comment.remoteHost))        <a href="mailto:$email">$comment.remoteHost</a>    #elseif (!$stringUtils.isEmpty($comment.name) && !$stringUtils.isEmpty($comment.remoteHost))        <b>$comment.name</b> ($comment.remoteHost)    #elseif (!$stringUtils.isEmpty($comment.name))        <b>$comment.name</b>    #elseif (!$stringUtils.isEmpty($comment.remoteHost))        <b>$comment.remoteHost</b>    #end    $text.get("macro.weblog.on") $dateFormatter.format($comment.postTime)    #if( $stringUtils.isNotEmpty($comment.url) )        $text.get( "macro.weblog.postedbywebsite", [$comment.url, $comment.url] )    #end    #if( $showPermalink )    <a href="${ctxPath}/comments/${userName}/${page.link}/${entry.anchor}#comment${velocityCount}"       class="entrypermalink"       title="$text.get( "macro.weblog.commentpermalink.title" )">#</a>    #end    </p>#end#** * Display all comments comments for an entry. * @param entry WeblogEntryData object for which comments are to be displayed. *##macro( showComments $entry )    <div class="comments" id="comments">    #if( $previewComments )        #set( $comments = $previewComments )        <div class="comments-head">$text.get( "macro.weblog.preview" ):</div>    #else        <div class="comments-head">$text.get( "macro.weblog.comments" ):</div>        #set( $comments = $entry.comments )    #end    <br/>    #foreach( $comment in $comments )        #set($content = $utilities.encodeEmail($comment.content))        #if($escapeHtml)            #set($content = $utilities.escapeHTML($content))        #end        #if($autoformat)            #set($content = $utilities.autoformat($content))        #end        #set($content = $utilities.addNofollow($content))        <div class="comment" id="comment${velocityCount}">        ${content}        #showCommentDetails($comment true)        </div>    #end    </div>#end#** * Display recent comments for whole blog (not just one entry). * @param numComments Maximum number of comments to be displayed**##macro( showRecentComments $numComments )    #if( !$numComments ) #set( $numComments = 20 ) #end    #if( $numComments > 100 ) #set( $numComments = 50 ) #end    #set( $comments = $pageModel.getRecentComments($numComments) )    <div class="comments" id="comments">    #foreach( $comment in $comments )        #set($content = $utilities.encodeEmail($comment.content))        #if($escapeHtml)            #set($content = $utilities.escapeHTML($content))        #end        #if($autoformat)            #set($content = $stringUtils.replace($content,"\n","<br />"))        #end        #set($content = $utilities.addNofollow($content))        <div class="comment" style="border: 1px solid #dadada; padding-left: 3px; padding-right: 5px;" >        <p>Commenting on <a class="entrypermalink"            href="${ctxPath}${comment.weblogEntry.permaLink}">${comment.weblogEntry.title}</a>:</p>        ${content}        #showCommentDetails($comment false)        </div>    #end    </div>#end#** * Display list of most recent comments for a blog. * @param numComments Max number of comments to show. * @param maxWidth    Limit width of comment text to this number of characters**##macro( showRecentCommentsListWidth $numComments $maxWidth )    #if( !$numComments ) #set( $numComments = 20 ) #end    #if( $numComments > 100 ) #set( $numComments = 100 ) #end    #set( $minWidth = $maxWidth - 5 )    #set( $comments = $pageModel.getRecentComments($numComments) )    <ul class="commentsList">Recent Comments    #foreach( $comment in $comments )        #set($content = $utilities.encodeEmail($comment.content))        #set($content = $utilities.addNofollow($content))        <li class="commentsListItem"><a           href="${ctxPath}/comments/${userName}/${page.link}/${comment.weblogEntry.anchor}#comments"           class="entrypermalink"           title="$text.get( "macro.weblog.commentpermalink.title" ) to               '$utilities.removeHTML($comment.weblogEntry.title)'"           >$utilities.truncateNicely($utilities.removeHTML($content), $minWidth, $maxWidth, "...")</a>        </li>    #end    </ul>#end#** * Display list of most recent comments for a blog (with maxWidth = 25) * @param numComments Max number of comments to show.**##macro( showRecentCommentsList $numComments )#showRecentCommentsListWidth( $numComments 25 )#end#** * Display comment form for a weblog entry. * @param entry WeblogEntry object for which form is to be shown. *##macro( showCommentForm $entry )    <div class="comments-form">    <div class="comments-head">$text.get("macro.weblog.postcommentHeader")</div><br/>    <form method="post" action="$ctxPath/comments" focus="name"        name="form" onsubmit="fixURL(this); return validateComments(this)">                #if($requestParameters.popup)        <input type="hidden" name="popup" value="true" />        #end        <!-- is this a post or a preview -->        <input type="hidden" name="method" value="post" />        <input type="hidden" name="entryid" value="$entry.id" />

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -