| 1 |
#**
|
| 2 |
Licensed to the Apache Software Foundation (ASF) under one or more
|
| 3 |
contributor license agreements. The ASF licenses this file to You
|
| 4 |
under the Apache License, Version 2.0 (the "License"); you may not
|
| 5 |
use this file except in compliance with the License.
|
| 6 |
You may obtain a copy of the License at
|
| 7 |
|
| 8 |
http://www.apache.org/licenses/LICENSE-2.0
|
| 9 |
|
| 10 |
Unless required by applicable law or agreed to in writing, software
|
| 11 |
distributed under the License is distributed on an "AS IS" BASIS,
|
| 12 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 13 |
See the License for the specific language governing permissions and
|
| 14 |
limitations under the License. For additional information regarding
|
| 15 |
copyright in this work, please see the NOTICE file in the top level
|
| 16 |
directory of this distribution.
|
| 17 |
*#
|
| 18 |
|
| 19 |
#**
|
| 20 |
Set of essential macros needed in Roller velocity templates.
|
| 21 |
These are the documented macros in order defined in this file:
|
| 22 |
|
| 23 |
#includeTemplate($weblog $pageName)
|
| 24 |
#showAutodiscoveryLinks($weblog)
|
| 25 |
#showTrackbackAutodiscovery($entry)
|
| 26 |
|
| 27 |
#showWeblogEntriesPager($pager)
|
| 28 |
#showNextPrevEntriesControl($pager)
|
| 29 |
|
| 30 |
#showWeblogEntryComments($entry)
|
| 31 |
#showWeblogEntryCommentForm($entry)
|
| 32 |
|
| 33 |
#showWeblogEntryLinksList($entries)
|
| 34 |
#showBookmarkLinksList($folderObj $expanding $subfolders)
|
| 35 |
#showWeblogCategoryLinksList($categoryObj $expanding $subcats)
|
| 36 |
#showReferrersList($weblog)
|
| 37 |
#showAtomFeedsList($weblog)
|
| 38 |
#showRSSFeedsList($weblog)
|
| 39 |
|
| 40 |
#showWeblogEntryCalendar($weblog $category)
|
| 41 |
|
| 42 |
#showPageMenu($weblog)
|
| 43 |
#showAuthorMenu($vertical)
|
| 44 |
|
| 45 |
#showWeblogSearchForm($weblog)
|
| 46 |
#showWeblogSearchAgainForm($weblog)
|
| 47 |
#showNextPrevSearchControl($pager)
|
| 48 |
|
| 49 |
#_showCommonJavaScript()
|
| 50 |
|
| 51 |
#showEntryTags($entry)
|
| 52 |
*#
|
| 53 |
|
| 54 |
|
| 55 |
#**
|
| 56 |
Parse and include page template from weblog.
|
| 57 |
*#
|
| 58 |
#macro(includeTemplate $weblog $pageName)
|
| 59 |
#set($pageArg = false)## This is required for such constructs; see Velocity docs and ROL-689
|
| 60 |
#set($pageArg = $weblog.getPageByName($pageName))
|
| 61 |
#if ($pageArg)
|
| 62 |
#parse($pageArg.id)
|
| 63 |
#end
|
| 64 |
#end
|
| 65 |
|
| 66 |
|
| 67 |
#**
|
| 68 |
Show RSS, Atom and RSD auto-discovery links as HTML link elements.
|
| 69 |
*#
|
| 70 |
#macro(showAutodiscoveryLinks $weblog)
|
| 71 |
#if ($weblog.enableBloggerApi)
|
| 72 |
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="$url.rsd"/>
|
| 73 |
#end
|
| 74 |
|
| 75 |
## main feed urls are always available
|
| 76 |
#if (!$model.searchResults)
|
| 77 |
<link rel="alternate" type="application/atom+xml" title="Recent Entries (Atom)" href="$url.feed.entries.atom" />
|
| 78 |
<link rel="alternate" type="application/rss+xml" title="Recent Entries (RSS)" href="$url.feed.entries.rss" />
|
| 79 |
<link rel="alternate" type="application/atom+xml" title="Recent Comments (Atom)" href="$url.feed.comments.atom" />
|
| 80 |
<link rel="alternate" type="application/rss+xml" title="Recent Comments (RSS)" href="$url.feed.comments.rss" />
|
| 81 |
|
| 82 |
#if ($model.tags)
|
| 83 |
<link rel="alternate" type="application/atom+xml" title="Entries tagged $model.tags.toString() (Atom)" href="$url.feed.entries.atomByTags($model.tags, false)" />
|
| 84 |
<link rel="alternate" type="application/rss+xml" title="Entries tagged $model.tags.toString() (RSS)" href="$url.feed.entries.rssByTags($model.tags, false)" />
|
| 85 |
#elseif ($model.weblogCategory)
|
| 86 |
<link rel="alternate" type="application/atom+xml" title="Entries for category $model.weblogCategory.name (Atom)" href="$url.feed.entries.atom($model.weblogCategory.path, false)" />
|
| 87 |
<link rel="alternate" type="application/rss+xml" title="Entries for category $model.weblogCategory.name (RSS)" href="$url.feed.entries.rss($model.weblogCategory.path, false)" />
|
| 88 |
#end
|
| 89 |
|
| 90 |
#else
|
| 91 |
<link rel="alternate" type="application/rss+xml" title="Search results for '$utils.escapeHTML($model.term)'" href="$utils.escapeHTML($url.feed.entries.search($model.term,$model.weblogCategory.path))" />
|
| 92 |
#end
|
| 93 |
#if ($site)
|
| 94 |
<link rel="search"
|
| 95 |
title="OpenSearch Descriptor for $config.siteName"
|
| 96 |
type="application/opensearchdescription+xml"
|
| 97 |
href="$url.absoluteSite/roller-services/opensearch" />
|
| 98 |
#else
|
| 99 |
<link rel="search"
|
| 100 |
title="OpenSearch Descriptor for weblog $model.weblog.name"
|
| 101 |
type="application/opensearchdescription+xml"
|
| 102 |
href="$url.absoluteSite/roller-services/opensearch/$model.weblog.handle" />
|
| 103 |
#end
|
| 104 |
#end
|
| 105 |
|
| 106 |
|
| 107 |
#**
|
| 108 |
* Display a trackback auto-discovery RDF comment for a WeblogEntry, but only
|
| 109 |
* if trackbacks are enabled and comments are allowed for the entry.
|
| 110 |
**#
|
| 111 |
#macro( showTrackbackAutodiscovery $entry )
|
| 112 |
#if($config.trackbacksEnabled && $model.weblog.allowComments && $entry.commentsStillAllowed)
|
| 113 |
<!--
|
| 114 |
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
| 115 |
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
|
| 116 |
xmlns:dc="http://purl.org/dc/elements/1.1/">
|
| 117 |
<rdf:Description
|
| 118 |
rdf:about="$url.entry($entry.anchor)"
|
| 119 |
trackback:ping="$url.trackback($entry.anchor)"
|
| 120 |
dc:title="$entry.title"
|
| 121 |
dc:identifier="$url.entry($entry.anchor)"
|
| 122 |
dc:subject="$entry.category.name"
|
| 123 |
dc:description="$entry.title"
|
| 124 |
dc:creator="$entry.creator.userName"
|
| 125 |
dc:date="$entry.pubTime" />
|
| 126 |
</rdf:RDF>
|
| 127 |
-->
|
| 128 |
#end
|
| 129 |
#end
|
| 130 |
|
| 131 |
|
| 132 |
#**
|
| 133 |
Shows weblog entries pager via default day template
|
| 134 |
*#
|
| 135 |
#macro(showWeblogEntriesPager $pager)
|
| 136 |
#set($dayPage = $model.weblog.getPageByName("_day"))
|
| 137 |
#set($map = $pager.getEntries())
|
| 138 |
#foreach($day in $map.keySet())
|
| 139 |
#set($entries = $map.get($day))
|
| 140 |
#parse($dayPage.id)
|
| 141 |
#end
|
| 142 |
#end
|
| 143 |
|
| 144 |
|
| 145 |
#** Show next/prev control for specified pager *#
|
| 146 |
#macro(showNextPrevEntriesControl $pager)
|
| 147 |
#set($prevLink = false)
|
| 148 |
#set($nextLink = false)
|
| 149 |
#if ($pager.prevLink)
|
| 150 |
#set($prevLink = $pager.prevLink)
|
| 151 |
#set($prevName = $pager.prevName)
|
| 152 |
#elseif ($pager.prevCollectionLink)
|
| 153 |
#set($prevLink = $pager.prevCollectionLink)
|
| 154 |
#set($prevName = $pager.prevCollectionName)
|
| 155 |
#end
|
| 156 |
#if ($pager.nextLink)
|
| 157 |
#set($nextLink = $pager.nextLink)
|
| 158 |
#set($nextName = $pager.nextName)
|
| 159 |
#elseif ($pager.nextCollectionLink)
|
| 160 |
#set($nextLink = $pager.nextCollectionLink)
|
| 161 |
#set($nextName = $pager.nextCollectionName)
|
| 162 |
#end
|
| 163 |
#if ($prevLink)
|
| 164 |
« <a href="$prevLink">$prevName</a> |
|
| 165 |
#end
|
| 166 |
#if ($prevLink || $nextLink)
|
| 167 |
<a href="$pager.getHomeLink()">$pager.getHomeName()</a>
|
| 168 |
#end
|
| 169 |
#if ($nextLink)
|
| 170 |
| <a href="$nextLink">$nextName</a> »
|
| 171 |
#end
|
| 172 |
#end
|
| 173 |
|
| 174 |
|
| 175 |
#**
|
| 176 |
Show comments for weblog entry according to Roller configuration.
|
| 177 |
*#
|
| 178 |
#macro(showWeblogEntryComments $entry)
|
| 179 |
<a name="comments"></a>
|
| 180 |
<div class="comments" id="comments">
|
| 181 |
|
| 182 |
#if($model.commentForm.preview)
|
| 183 |
#set($comments = [$model.commentForm.previewComment])
|
| 184 |
<div class="comments-head">$text.get( "macro.weblog.preview" ):</div>
|
| 185 |
#else
|
| 186 |
<div class="comments-head">$text.get( "macro.weblog.comments" ):</div>
|
| 187 |
#set($comments = $entry.getComments(true, true))
|
| 188 |
#end
|
| 189 |
|
| 190 |
<br/>
|
| 191 |
#foreach( $comment in $comments )
|
| 192 |
#if($comment.approved || $model.commentForm.preview)
|
| 193 |
<a name="comment-$comment.timestamp" id="comment-$comment.timestamp"></a>
|
| 194 |
<div class="comment#if($velocityCount % 2 == 0) even#else odd#end" id="comment${velocityCount}">
|
| 195 |
|
| 196 |
$comment.content
|
| 197 |
|
| 198 |
<p class="comment-details">
|
| 199 |
$text.get("macro.weblog.postedby")
|
| 200 |
#if (!$utils.isEmpty($comment.name) && !$utils.isEmpty($comment.url))
|
| 201 |
<a rel="nofollow" href="$comment.url"><b>$comment.name</b></a>
|
| 202 |
#elseif (!$utils.isEmpty($comment.name))
|
| 203 |
<b>$comment.name</b>
|
| 204 |
#elseif ($comment.remoteHost)
|
| 205 |
<b>$comment.remoteHost</b>
|
| 206 |
#else
|
| 207 |
<b>$text.get("macro.weblog.comment.unknown")</b>
|
| 208 |
#end
|
| 209 |
|
| 210 |
$text.get("macro.weblog.on") $utils.formatDate($comment.postTime, $text.get( "macro.weblog.datepattern" ))
|
| 211 |
|
| 212 |
<a href="$url.comment($entry.anchor, $comment.timestamp)"
|
| 213 |
class="entrypermalink" title="$text.get( "macro.weblog.commentpermalink.title" )">#</a>
|
| 214 |
</p>
|
| 215 |
|
| 216 |
</div>
|
| 217 |
|
| 218 |
#end
|
| 219 |
#end
|
| 220 |
</div>
|
| 221 |
#end
|
| 222 |
|
| 223 |
|
| 224 |
#**
|
| 225 |
Show comments form for weblog entry.
|
| 226 |
*#
|
| 227 |
#macro(showWeblogEntryCommentForm $entry)
|
| 228 |
#set($cform = $model.getCommentForm())
|
| 229 |
|
| 230 |
<div class="comments-form">
|
| 231 |
<div class="comments-head">$text.get("macro.weblog.postcommentHeader")</div>
|
| 232 |
<a name="comment-form"></a>
|
| 233 |
|
| 234 |
#if( $entry.commentsStillAllowed )
|
| 235 |
|
| 236 |
#if( $cform.error )
|
| 237 |
<span class="error">$cform.message</span>
|
| 238 |
#elseif( !$cform.error && !$utils.isEmpty($cform.message) )
|
| 239 |
<span class="status">$cform.message</span>
|
| 240 |
#end
|
| 241 |
|
| 242 |
<form method="post" action="$url.entry($entry.anchor)" focus="name"
|
| 243 |
name="commentForm" onsubmit="fixURL(this); return validateComments(this)">
|
| 244 |
<input type="hidden" name="method" value="post" />
|
| 245 |
|
| 246 |
<ul>
|
| 247 |
<li>
|
| 248 |
<label class="desc">$text.get( "macro.weblog.name" )</label>
|
| 249 |
<input type="text" name="name" class="text large" value="$cform.name" size="50" maxlength="255" />
|
| 250 |
</li>
|
| 251 |
|
| 252 |
<li><label class="desc">$text.get( "macro.weblog.email" )</label>
|
| 253 |
<input type="text" name="email" class="text large" value="$cform.email" size="50" maxlength="255" />
|
| 254 |
</li>
|
| 255 |
|
| 256 |
<li><label class="desc">$text.get( "macro.weblog.url" )</label>
|
| 257 |
<input type="text" name="url" class="text large" value="$cform.url" size="50" maxlength="255" />
|
| 258 |
</li>
|
| 259 |
|
| 260 |
#if ($config.commentEmailNotify)
|
| 261 |
<li><input type="checkbox" class="checkbox" id="notify" name="notify" #if($cform.notify)CHECKED #end/>
|
| 262 |
<label for="notify" class="choice">$text.get( "macro.weblog.notifyMeOfComments" )</label>
|
| 263 |
</li>
|
| 264 |
#end
|
| 265 |
<li>
|
| 266 |
<input type="checkbox" class="checkbox" id="rememberInfo" name="rememberInfo" />
|
| 267 |
<label for="rememberInfo" class="choice">$text.get( "macro.weblog.rememberinfo" )</label>
|
| 268 |
</li>
|
| 269 |
<li>
|
| 270 |
<label class="desc">$text.get( "macro.weblog.yourcomment" )</label>
|
| 271 |
|
| 272 |
<textarea name="content" class="textarea large" cols="40" rows="10">$cform.content</textarea>
|
| 273 |
|
| 274 |
</li>
|
| 275 |
<li class="info">
|
| 276 |
<span class="comments-syntax-indicator">
|
| 277 |
$text.get( "macro.weblog.htmlsyntax" )
|
| 278 |
#if($config.commentEscapeHtml)
|
| 279 |
<span class="disabled">$text.get( "macro.weblog.htmldisabled" )</span>
|
| 280 |
#else
|
| 281 |
<span class="enabled">$text.get( "macro.weblog.htmlenabled" )</span>
|
| 282 |
#end
|
| 283 |
</span>
|
| 284 |
</li>
|
| 285 |
<li class="info">
|
| 286 |
<script type="text/javascript" src="$url.site/theme/scripts/clientSideInclude.js"></script>
|
| 287 |
<div id="commentAuthenticator"></div>
|
| 288 |
</li>
|
| 289 |
<li>
|
| 290 |
<input type="button" class="button" name="post" value=" $text.get("macro.weblog.postpreview" ) "
|
| 291 |
onclick="this.form.method.value='preview';this.form.submit()" />
|
| 292 |
<input type="submit" class="button" name="post" value=" $text.get( "macro.weblog.post" ) " />
|
| 293 |
</li>
|
| 294 |
</ul>
|
| 295 |
|
| 296 |
</form>
|
| 297 |
|
| 298 |
<script type="text/javascript" src="$url.site/theme/scripts/roller.js"></script>
|
| 299 |
<script type="text/javascript">
|
| 300 |
clientSideInclude('commentAuthenticator', '$url.commentAuthenticator');
|
| 301 |
|
| 302 |
var author = getCookie("commentAuthor");
|
| 303 |
var email = getCookie("commentEmail");
|
| 304 |
var url = getCookie("commentUrl");
|
| 305 |
// check each field - IE will render "null"
|
| 306 |
if (author) {
|
| 307 |
document.forms['commentForm'].name.value = author;
|
| 308 |
}
|
| 309 |
if (email) {
|
| 310 |
document.forms['commentForm'].email.value = email;
|
| 311 |
}
|
| 312 |
if (url) {
|
| 313 |
document.forms['commentForm'].url.value = url;
|
| 314 |
}
|
| 315 |
|
| 316 |
if (author || email || url) {
|
| 317 |
document.forms['commentForm'].rememberInfo.checked = true;
|
| 318 |
}
|
| 319 |
|
| 320 |
function fixURL(theForm) {
|
| 321 |
if (theForm.url.value != "" &&
|
| 322 |
theForm.url.value.indexOf("http://") == -1) { //prepend http://
|
| 323 |
theForm.url.value = "http://"+theForm.url.value;
|
| 324 |
}
|
| 325 |
saveUserInformation(theForm);
|
| 326 |
}
|
| 327 |
|
| 328 |
function saveUserInformation(theForm) {
|
| 329 |
if (theForm.rememberInfo.checked) {
|
| 330 |
rememberUser(theForm);
|
| 331 |
} else {
|
| 332 |
forgetUser(theForm);
|
| 333 |
}
|
| 334 |
}
|
| 335 |
|
| 336 |
function validateComments(theForm) {
|
| 337 |
if (theForm.content.value == "") {
|
| 338 |
alert("$text.get( "macro.weblog.commentwarning" )");
|
| 339 |
theForm.content.focus();
|
| 340 |
return false;
|
| 341 |
}
|
| 342 |
}
|
| 343 |
</script>
|
| 344 |
|
| 345 |
#else
|
| 346 |
<span class="status">$text.get( "comments.disabled" )</span>
|
| 347 |
#end
|
| 348 |
|
| 349 |
</div>
|
| 350 |
#end
|
| 351 |
|
| 352 |
|
| 353 |
#**
|
| 354 |
Show entries as a HTML ul list.
|
| 355 |
*#
|
| 356 |
#macro(showWeblogEntryLinksList $entriesList)
|
| 357 |
<ul class="rEntriesList">
|
| 358 |
#foreach ($var in $entriesList)
|
| 359 |
<li class="recentposts"><a href="$var.permalink">$var.title</a></li>
|
| 360 |
#end
|
| 361 |
</ul>
|
| 362 |
#end
|
| 363 |
|
| 364 |
|
| 365 |
#**
|
| 366 |
Show bookmarks as a HTML ul list.
|
| 367 |
*#
|
| 368 |
#macro(showBookmarkLinksList $folderObject $subfolders $expanding )
|
| 369 |
<ul class="rFolder">
|
| 370 |
#_showBookmarkLinksList($folderObject $subfolders $expanding)
|
| 371 |
</ul>
|
| 372 |
#end
|
| 373 |
|
| 374 |
|
| 375 |
#**
|
| 376 |
Recursively display a bookmark folder and children as HTML ul list (undocumented).
|
| 377 |
*#
|
| 378 |
#macro(_showBookmarkLinksList $folderObject $subfolders $expanding )
|
| 379 |
#if ($expanding) #_showCommonJavascript() #end
|
| 380 |
#set($bookmarks = $folderObject.getBookmarks())
|
| 381 |
#set($folders = $folderObject.getFolders())
|
| 382 |
#set($divId = $utils.replace($folderObject.name, " ", "_" ))
|
| 383 |
#if ($folderObject.name != "root" && $expanding && $subfolders && ($folderObject.getBookmarks().size() > 0 || $folderObject.getFolders().size() > 0))
|
| 384 |
<div class="rFolder">
|
| 385 |
<li class="rFolderItem"><a href="javascript:toggleFolder('$divId')">
|
| 386 |
<span id="i$divId">+</span></a>$folderObject.Name</li>
|
| 387 |
<ul id="$divId" class="rFolder" style="display:none">
|
| 388 |
#elseif ($folderObject.name != "root" && $subfolders && ($folderObject.getBookmarks().size() > 0 || $folderObject.getFolders().size() > 0))
|
| 389 |
<li class="rFolderItem">$folderObject.Name</li>
|
| 390 |
<ul class="rFolder">
|
| 391 |
#end
|
| 392 |
#foreach($bookmark in $bookmarks)
|
| 393 |
<li class="rFolderItem">
|
| 394 |
#if($utils.isNotEmpty($bookmark.Image))
|
| 395 |
#if( $bookmark.Image.startsWith("http://") )
|
| 396 |
<a href="$bookmark.url">
|
| 397 |
<img alt="$bookmark.description" border="0"
|
| 398 |
src="$bookmark.image" class="rBookmark" /></a>
|
| 399 |
#else
|
| 400 |
<a href="$bookmark.url">
|
| 401 |
<img alt="$bookmark.description" border="0"
|
| 402 |
src="$bookmark.image" class="rBookmark" /></a>
|
| 403 |
#end
|
| 404 |
#else
|
| 405 |
#if($utils.isNotEmpty( $bookmark.FeedUrl))
|
| 406 |
<a href="$bookmark.feedUrl"><img class="smrssbadge"
|
| 407 |
src="$url.absoluteSite/images/smrssbadge.gif"
|
| 408 |
alt="$text.get("macro.bookmark.urlFeed")"/></a>
|
| 409 |
#end
|
| 410 |
<a href="$bookmark.url"
|
| 411 |
title="$bookmark.description"
|
| 412 |
class="rBookmark$bookmark.weight">$bookmark.name</a>
|
| 413 |
#end
|
| 414 |
</li>
|
| 415 |
#end
|
| 416 |
## show sub-folders
|
| 417 |
#if ($subfolders)
|
| 418 |
#foreach($sFolder in $folders)
|
| 419 |
#_showBookmarkLinksList($sFolder $subfolders $expanding )
|
| 420 |
#end
|
| 421 |
#end
|
| 422 |
#if ($folderObject.name != "root" && $subfolders && ($folderObject.getBookmarks().size() > 0 || $folderObject.getFolders().size() > 0))
|
| 423 |
</ul>
|
| 424 |
#end
|
| 425 |
#if ($folderObject.name != "root" && $expanding && $subfolders && ($folderObject.getBookmarks().size() > 0 || $folderObject.getFolders().size() > 0))
|
| 426 |
</div>
|
| 427 |
<script type="text/javascript">
|
| 428 |
<!--
|
| 429 |
folderPreference("$divId");
|
| 430 |
// -->
|
| 431 |
</script>
|
| 432 |
#end
|
| 433 |
#end
|
| 434 |
|
| 435 |
|
| 436 |
#**
|
| 437 |
Show weblog's categories in specified parent category.
|
| 438 |
*#
|
| 439 |
#macro(showWeblogCategoryLinksList $categoryObject $subcats $expanding )
|
| 440 |
#if ($expanding) #_showCommonJavascript() #end
|
| 441 |
#if(!$expanding && !$subcats)
|
| 442 |
<ul class="rCategory">
|
| 443 |
#if ($model.weblogCategory || $model.permalink)
|
| 444 |
<li><a href="$url.category($categoryObject.path)">$text.get("macro.weblog.allcategories")</a></li>
|
| 445 |
#else
|
| 446 |
<li class="selected"><a href="$url.category($categoryObject.path)">$text.get("macro.weblog.allcategories")</a></li>
|
| 447 |
#end
|
| 448 |
#set($cats = $categoryObject.getWeblogCategories())
|
| 449 |
#foreach($cat in $cats)
|
| 450 |
#if ($model.weblogCategory && $model.weblogCategory.path == $cat.path || ($model.permalink && $model.weblogEntry.category.path == $cat.path))
|
| 451 |
<li class="selected"><a href="$url.category($cat.path)">$cat.name</a></li>
|
| 452 |
#else
|
| 453 |
<li><a href="$url.category($cat.path)">$cat.name</a></li>
|
| 454 |
#end
|
| 455 |
#end
|
| 456 |
</ul>
|
| 457 |
#else
|
| 458 |
<ul class="rCategory">
|
| 459 |
#_showWeblogCategoryLinksList($categoryObject $subcats $expanding )
|
| 460 |
</ul>
|
| 461 |
#end
|
| 462 |
#end
|
| 463 |
|
| 464 |
|
| 465 |
#**
|
| 466 |
Recursively display a bookmark folder and children as HTML ul list (undocumented).
|
| 467 |
*#
|
| 468 |
#macro(_showWeblogCategoryLinksList $categoryObject $subcats $expanding )
|
| 469 |
#if ($categoryObject.name != "root")
|
| 470 |
#if ($expanding && $subcats && $categoryObject.weblogCategories.size() > 0)
|
| 471 |
#set($divId = "div_$categoryObject.name")
|
| 472 |
<div class="rCategory">
|
| 473 |
<li><a href="javascript:toggleFolder('$divId')">
|
| 474 |
<span id="i$divId">+</span></a><a href="$url.category($categoryObject.path)">$categoryObject.name</a></li>
|
| 475 |
<ul id="$divId" class="rCategory" style="display:none">
|
| 476 |
#elseif ($subcats && $categoryObject.weblogCategories.size() > 0)
|
| 477 |
<li><a href="$url.category($categoryObject.path)">$categoryObject.name</a></li>
|
| 478 |
<ul class="rCategory">
|
| 479 |
#else
|
| 480 |
#if ($model.weblogCategory && $model.weblogCategory.path == $categoryObject.path)
|
| 481 |
<li class="selected">categoryObject.name</li>
|
| 482 |
#else
|
| 483 |
<li><a href="$url.category($categoryObject.path)">$categoryObject.name</a></li>
|
| 484 |
#end
|
| 485 |
#end
|
| 486 |
#end
|
| 487 |
#if ($subcats || $categoryObject.name == "root")
|
| 488 |
#set($cats = $categoryObject.getWeblogCategories())
|
| 489 |
#foreach($cat in $cats)
|
| 490 |
#_showWeblogCategoryLinksList($cat $subcats $expanding)
|
| 491 |
#end
|
| 492 |
#end
|
| 493 |
#if ($categoryObject.name != "root" && $subcats && $categoryObject.weblogCategories.size() > 0)
|
| 494 |
</ul>
|
| 495 |
#end
|
| 496 |
#if ($expanding && $subcats && $categoryObject.weblogCategories.size() > 0)
|
| 497 |
</div>
|
| 498 |
<script type="text/javascript">
|
| 499 |
<!--
|
| 500 |
folderPreference("$divId");
|
| 501 |
// -->
|
| 502 |
</script>
|
| 503 |
#end
|
| 504 |
#end
|
| 505 |
|
| 506 |
|
| 507 |
#**
|
| 508 |
* Display list of referrers.
|
| 509 |
*#
|
| 510 |
#macro(showReferrersList $refs $max $maxWidth $includeHits)
|
| 511 |
<ul class="rReferersList">
|
| 512 |
#foreach( $ref in $refs )
|
| 513 |
#if ($velocityCount <= $max)
|
| 514 |
<li class="rReferersListItem">
|
| 515 |
|
| 516 |
#set( $qq = '"' )
|
| 517 |
#set( $myUrl = $utils.escapeHTML( $ref.RefererUrl ) )
|
| 518 |
#set( $displayUrl = $myUrl )
|
| 519 |
#set( $restOfUrl = "" )
|
| 520 |
#set( $displayLink = "" )
|
| 521 |
#if ( $displayUrl.startsWith("http://") )
|
| 522 |
#set( $displayUrl = $displayUrl.substring( 7 ) )
|
| 523 |
#end
|
| 524 |
#if ( $displayUrl.length() > $maxWidth )
|
| 525 |
#set( $restOfUrl = "...$displayUrl.substring($maxWidth, $displayUrl.length())" )
|
| 526 |
#set( $displayUrl = $displayUrl.substring(0, $maxWidth) )
|
| 527 |
#end
|
| 528 |
#if ( $myUrl.startsWith("http://") )
|
| 529 |
#set( $displayLink = "<a rel=${qq}nofollow${qq} href=${qq}$myUrl${qq}" )
|
| 530 |
#if ( $restOfUrl )
|
| 531 |
#set( $displayLink = "$displayLink title=${qq}$restOfUrl${qq}" )
|
| 532 |
#end
|
| 533 |
#set( $displayLink = "$displayLink >" )
|
| 534 |
#end
|
| 535 |
#set( $displayLink = "$displayLink$displayUrl" )
|
| 536 |
#if ( $includeHits )
|
| 537 |
#set( $displayLink = "$displayLink ($ref.DayHits)" )
|
| 538 |
#end
|
| 539 |
#if ( $myUrl.startsWith("http://") )
|
| 540 |
#set( $displayLink = "$displayLink</a>" )
|
| 541 |
#end
|
| 542 |
$displayLink
|
| 543 |
|
| 544 |
</li>
|
| 545 |
#end
|
| 546 |
#end
|
| 547 |
</ul>
|
| 548 |
#end
|
| 549 |
|
| 550 |
|
| 551 |
#**
|
| 552 |
* Show list of all RSS feeds available for weblog.
|
| 553 |
*#
|
| 554 |
#macro(showAtomFeedsList $weblog)
|
| 555 |
<ul class="rFeeds">
|
| 556 |
<li><a href="$url.feed.entries.atom">$text.get("macro.rss.all")</a></li>
|
| 557 |
#set($categories = $weblog.weblogCategories )
|
| 558 |
#foreach( $cat in $categories )
|
| 559 |
<li><a href="$url.feed.entries.atom($cat.path, false)">$cat.path</a></li>
|
| 560 |
#end
|
| 561 |
<li><a href="$url.feed.comments.atom">Comments</a></li>
|
| 562 |
</ul>
|
| 563 |
#end
|
| 564 |
|
| 565 |
|
| 566 |
#**
|
| 567 |
* Show list of all Atom feeds available for weblog.
|
| 568 |
*#
|
| 569 |
#macro(showRSSFeedsList $weblog)
|
| 570 |
<ul class="rFeeds">
|
| 571 |
<li><a href="$url.feed.entries.rss">$text.get("macro.rss.all")</a></li>
|
| 572 |
#set($categories = $weblog.weblogCategories )
|
| 573 |
#foreach( $cat in $categories )
|
| 574 |
<li><a href="$url.feed.entries.rss($cat.path, false)">$cat.path</a></li>
|
| 575 |
#end
|
| 576 |
<li><a href="$url.feed.comments.rss">Comments</a></li>
|
| 577 |
</ul>
|
| 578 |
#end
|
| 579 |
|
| 580 |
|
| 581 |
#**
|
| 582 |
* Show Roller Page Navigation Bar, includes links to all pages.
|
| 583 |
*#
|
| 584 |
#macro(showPageMenu $weblog)
|
| 585 |
<ul class="rNavigationBar">
|
| 586 |
<li class="rNavItem">
|
| 587 |
<a href="$url.site/"><span>$config.siteShortName</span></a>
|
| 588 |
</li>
|
| 589 |
<li class="rNavItem">
|
| 590 |
<a href="$url.home"><span>Weblog</span></a>
|
| 591 |
</li>
|
| 592 |
#foreach($iPage in $weblog.pages)
|
| 593 |
#if (!$iPage.hidden && $iPage.navbar && $iPage.link != "Weblog")
|
| 594 |
#set($isSelected = false)
|
| 595 |
#if ($model.weblogPage && $iPage.Id == $model.weblogPage.Id) #set($isSelected = true) #end
|
| 596 |
#if (!$isSelected)
|
| 597 |
<li class="rNavItem"><a href="$url.page($iPage.link)"><span>$iPage.name</span></a></li>
|
| 598 |
#else
|
| 599 |
<li class="rNavItem"><span>$iPage.name</span></li>
|
| 600 |
#end
|
| 601 |
#end
|
| 602 |
#end
|
| 603 |
#if ($utils.isUserAuthorizedToAuthor($weblog))
|
| 604 |
<li class="rNavItem">
|
| 605 |
<a href="$url.createEntry"><span>$text.get("navigationBar.newEntry")</span></a>
|
| 606 |
</li>
|
| 607 |
#if($utils.isUserAuthorizedToAdmin($weblog))
|
| 608 |
<li class="rNavItem">
|
| 609 |
<a href="$url.editSettings"><span>$text.get("navigationBar.settings")</span></a>
|
| 610 |
</li>
|
| 611 |
#end
|
| 612 |
<li class="rNavItem">
|
| 613 |
<a href="$url.logout"><span>$text.get("navigationBar.logout")</span></a>
|
| 614 |
</li>
|
| 615 |
#else
|
| 616 |
#if ($utils.isUserAuthenticated())
|
| 617 |
<li class="rNavItem">
|
| 618 |
<a href="$url.logout"><span>$text.get("navigationBar.logout")</span></a>
|
| 619 |
</li>
|
| 620 |
#else
|
| 621 |
<li class="rNavItem">
|
| 622 |
<a href="$url.login"><span>$text.get("navigationBar.login")</span></a>
|
| 623 |
</li>
|
| 624 |
#end
|
| 625 |
#end
|
| 626 |
</ul>
|
| 627 |
#end
|
| 628 |
|
| 629 |
|
| 630 |
#**
|
| 631 |
Show weblog entry calendar, with optional category restriction.
|
| 632 |
*#
|
| 633 |
#macro(showWeblogEntryCalendar $weblog $category)
|
| 634 |
$calendarModel.showWeblogEntryCalendar($weblog, $category)
|
| 635 |
#end
|
| 636 |
|
| 637 |
#**
|
| 638 |
Show large format weblog entry calendar, with optional category restriction.
|
| 639 |
*#
|
| 640 |
#macro(showWeblogEntryCalendarBig $weblog $category)
|
| 641 |
$calendarModel.showWeblogEntryCalendarBig($weblog, $category)
|
| 642 |
#end
|
| 643 |
|
| 644 |
|
| 645 |
#**
|
| 646 |
Show weblog author menu with vertical or horizontal orientation.
|
| 647 |
*#
|
| 648 |
#macro(showAuthorMenu $vertical)
|
| 649 |
|
| 650 |
#set( $authorMenu = $menuModel.authorMenu )
|
| 651 |
#if( $authorMenu )
|
| 652 |
#if( $vertical )
|
| 653 |
#foreach( $menu in $authorMenu.tabs )
|
| 654 |
<ul class="rMenu">
|
| 655 |
#foreach( $item in $menu.items )
|
| 656 |
<li class="rMenuItem"><a href="$url.action($item.action, '/roller-ui/authoring')">$text.get( $menu.key ):$text.get( $item.key )</a></li>
|
| 657 |
#end
|
| 658 |
</ul>
|
| 659 |
#end
|
| 660 |
#else
|
| 661 |
#set( $menuCnt = 0 )
|
| 662 |
#foreach( $menu in $authorMenu.tabs )
|
| 663 |
#foreach( $item in $menu.items )
|
| 664 |
#if ($menuCnt > 0) | #end
|
| 665 |
<a href="$url.action($item.action, '/roller-ui/authoring')">$text.get( $menu.key ):$text.get( $item.key )</a>
|
| 666 |
#set($menuCnt = $menuCnt + 1)
|
| 667 |
#end
|
| 668 |
#end
|
| 669 |
#end
|
| 670 |
#end
|
| 671 |
|
| 672 |
#end
|
| 673 |
|
| 674 |
|
| 675 |
#**
|
| 676 |
Show weblog author menu with vertical or horizontal orientation.
|
| 677 |
*#
|
| 678 |
#macro(showAdminMenu $vertical)
|
| 679 |
|
| 680 |
#set( $adminMenu = $menuModel.adminMenu )
|
| 681 |
#if( $adminMenu )
|
| 682 |
#if( $vertical )
|
| 683 |
#foreach( $menu in $adminMenu.tabs )
|
| 684 |
<ul class="rMenu">
|
| 685 |
#foreach( $item in $menu.items )
|
| 686 |
<li class="rMenuItem"><a href="$url.action($item.action, '/roller-ui/admin')">$text.get( $menu.key ):$text.get( $item.key )</a></li>
|
| 687 |
#end
|
| 688 |
</ul>
|
| 689 |
#end
|
| 690 |
#else
|
| 691 |
#set( $menuCnt = 0 )
|
| 692 |
#foreach( $menu in $adminMenu.tabs )
|
| 693 |
#foreach( $item in $menu.items )
|
| 694 |
#if ($menuCnt > 0) | #end
|
| 695 |
<a href="$url.action($item.action, '/roller-ui/admin')">$text.get( $menu.key ):$text.get( $item.key )</a>
|
| 696 |
#set($menuCnt = $menuCnt + 1)
|
| 697 |
#end
|
| 698 |
#end
|
| 699 |
#end
|
| 700 |
#end
|
| 701 |
|
| 702 |
#end
|
| 703 |
|
| 704 |
|
| 705 |
#**
|
| 706 |
Show search form for a weblog.
|
| 707 |
*#
|
| 708 |
#macro(showWeblogSearchForm $weblog $showCatChooser)
|
| 709 |
<form id="searchForm" method="get" action="$url.search"
|
| 710 |
style="margin: 0; padding: 0" onsubmit="return validateSearch(this)">
|
| 711 |
<p>
|
| 712 |
<input type="text" id="q" name="q" size="10" class="text small"
|
| 713 |
maxlength="255" value="#if($model.term)$model.term#end" />
|
| 714 |
#if( $showCatChooser )
|
| 715 |
#set( $cats = $model.weblog.getWeblogCategories("nil") )
|
| 716 |
<select name="cat">
|
| 717 |
<option value="">- $text.get("mainPage.category") -</option>
|
| 718 |
#foreach( $cat in $cats )
|
| 719 |
<option #if($cat.name == $model.term)selected="selected"#end>$cat.name</option>
|
| 720 |
#end
|
| 721 |
</select>
|
| 722 |
#end
|
| 723 |
<input type="submit" class="button" value="$text.get( "macro.weblog.searchbutton" )" id="searchbutton" />
|
| 724 |
</p>
|
| 725 |
</form>
|
| 726 |
<script type="text/javascript">
|
| 727 |
function validateSearch(form) {
|
| 728 |
if (form.q.value == "") {
|
| 729 |
alert("$text.get("macro.weblog.searchalert")");
|
| 730 |
form.q.focus();
|
| 731 |
return false;
|
| 732 |
}
|
| 733 |
return true;
|
| 734 |
}
|
| 735 |
</script>
|
| 736 |
#end
|
| 737 |
|
| 738 |
|
| 739 |
#**
|
| 740 |
Show search again form for a weblog.
|
| 741 |
*#
|
| 742 |
#macro(showWeblogSearchAgainForm $weblog)
|
| 743 |
<div id="searchAgain">
|
| 744 |
$text.get( "macro.weblog.searchdictionary", [$model.term, $model.term, $model.term] )
|
| 745 |
$text.get( "macro.weblog.searchhits", [$model.hits])
|
| 746 |
<form method="get" action="$url.search" style="margin: 5px">
|
| 747 |
<input type="text" id="q" name="q" class="text medium"
|
| 748 |
maxlength="255" value="$model.term"
|
| 749 |
style="padding-left: 1px" />
|
| 750 |
|
| 751 |
#set( $cats = $model.weblog.getWeblogCategories("nil") )
|
| 752 |
<select name="cat" class="select">
|
| 753 |
<option value="">$text.get( "macro.searchresults.incategory" )</option>
|
| 754 |
#foreach( $cat in $cats )
|
| 755 |
<option #if($cat.name == $model.weblogCategory.name)selected="selected"#end>$cat.name</option>
|
| 756 |
#end
|
| 757 |
</select>
|
| 758 |
|
| 759 |
<input type="submit" value="$text.get( "macro.weblog.searchagain" )" class="button" />
|
| 760 |
</form>
|
| 761 |
|
| 762 |
$text.get( "macro.weblog.searchgoogle", [$model.term, $url.absoluteSite, $url.site, ${website.handle}] )
|
| 763 |
</div>
|
| 764 |
#end
|
| 765 |
|
| 766 |
|
| 767 |
#**
|
| 768 |
Show next/prev pager for search results.
|
| 769 |
*#
|
| 770 |
#macro(showNextPrevSearchControl $pager)
|
| 771 |
#set( $min = $model.offset + 1 )
|
| 772 |
#set( $max = $model.offset + $model.limit )
|
| 773 |
#if( $max > $model.hits )#set( $max = $model.hits )#end
|
| 774 |
<h3>
|
| 775 |
$text.get("searchSummary.text", [$min, $max, $model.hits])
|
| 776 |
</h3>
|
| 777 |
|
| 778 |
#set($prevLink = false)
|
| 779 |
#set($nextLink = false)
|
| 780 |
#if ($pager.prevLink)
|
| 781 |
#set($prevLink = $pager.prevLink)
|
| 782 |
#set($prevName = $pager.prevName)
|
| 783 |
#end
|
| 784 |
#if ($pager.nextLink)
|
| 785 |
#set($nextLink = $pager.nextLink)
|
| 786 |
#set($nextName = $pager.nextName)
|
| 787 |
#end
|
| 788 |
#if ($prevLink)
|
| 789 |
« <a href="$prevLink">$prevName</a> |
|
| 790 |
#end
|
| 791 |
#if ($prevLink || $nextLink)
|
| 792 |
<a href="$pager.getHomeLink()">$pager.getHomeName()</a>
|
| 793 |
#end
|
| 794 |
#if ($nextLink)
|
| 795 |
| <a href="$nextLink">$nextName</a> »
|
| 796 |
#end
|
| 797 |
#end
|
| 798 |
|
| 799 |
|
| 800 |
#**
|
| 801 |
Include Javascript code needed for expanding folder macros (undocumented).
|
| 802 |
*#
|
| 803 |
#macro(_showCommonJavascript)
|
| 804 |
#if (!$zzz__incudedCommonJavaScript__zzz)
|
| 805 |
<script type="text/javascript">
|
| 806 |
function setCookie(name,value,expires,path,domain,secure) {
|
| 807 |
document.cookie = name + "=" + escape (value) +
|
| 808 |
((expires) ? "; expires=" + expires.toGMTString() : "") +
|
| 809 |
((path) ? "; path=" + path : "") +
|
| 810 |
((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
|
| 811 |
}
|
| 812 |
function getCookie(name) {
|
| 813 |
var prefix = name + "="
|
| 814 |
var start = document.cookie.indexOf(prefix)
|
| 815 |
if (start==-1) return null;
|
| 816 |
var end = document.cookie.indexOf(";", start+prefix.length)
|
| 817 |
if (end==-1) end=document.cookie.length;
|
| 818 |
var value=document.cookie.substring(start+prefix.length, end)
|
| 819 |
return unescape(value);
|
| 820 |
}
|
| 821 |
/* The toggleFolder and togglePlusMinus functions are for expanding/contracting folders */
|
| 822 |
function toggleFolder(targetId) {
|
| 823 |
var expanded;
|
| 824 |
if (document.getElementById) {
|
| 825 |
target = document.getElementById(targetId);
|
| 826 |
if (target.style.display == "none") {
|
| 827 |
target.style.display = "";
|
| 828 |
expanded = true;
|
| 829 |
} else {
|
| 830 |
target.style.display = "none";
|
| 831 |
expanded = false;
|
| 832 |
}
|
| 833 |
togglePlusMinus("i" + targetId);
|
| 834 |
// set a cookie to remember this preference
|
| 835 |
var expires = new Date();
|
| 836 |
expires.setTime(expires.getTime() + 24 * 365 * 60 * 60 * 1000); // sets it for approx 365 days.
|
| 837 |
setCookie("rfolder-"+targetId,expanded,expires,"/");
|
| 838 |
}
|
| 839 |
}
|
| 840 |
function togglePlusMinus(targetId) {
|
| 841 |
if (document.getElementById) {
|
| 842 |
target = document.getElementById(targetId);
|
| 843 |
if (target.innerHTML == "+") {
|
| 844 |
target.innerHTML = "-";
|
| 845 |
} else {
|
| 846 |
target.innerHTML = "+";
|
| 847 |
}
|
| 848 |
}
|
| 849 |
}
|
| 850 |
function folderPreference(folderId) {
|
| 851 |
var folderCookie = getCookie("rfolder-"+folderId);
|
| 852 |
if (folderCookie != null) { // we have user's last setting
|
| 853 |
folder = document.getElementById(folderId);
|
| 854 |
plusMinus = document.getElementById("i"+folderId);
|
| 855 |
if (folderCookie == "true") { // show
|
| 856 |
folder.style.display = "";
|
| 857 |
plusMinus.innerHTML = "-";
|
| 858 |
} else { // hide
|
| 859 |
folder.style.display = "none";
|
| 860 |
plusMinus.innerHTML = "+";
|
| 861 |
}
|
| 862 |
}
|
| 863 |
}
|
| 864 |
function createXMLHttpRequestObject() {
|
| 865 |
var ro;
|
| 866 |
var browser = navigator.appName;
|
| 867 |
if (browser == "Microsoft Internet Explorer") {
|
| 868 |
ro = new ActiveXObject("Microsoft.XMLHTTP");
|
| 869 |
} else {
|
| 870 |
ro = new XMLHttpRequest();
|
| 871 |
}
|
| 872 |
return ro;
|
| 873 |
}
|
| 874 |
var http = createXMLHttpRequestObject();
|
| 875 |
var init = false;
|
| 876 |
var isBusy = false;
|
| 877 |
</script>
|
| 878 |
#set($zzz__incudedCommonJavaScript__zzz = true)
|
| 879 |
#end
|
| 880 |
#end
|
| 881 |
|
| 882 |
|
| 883 |
#**
|
| 884 |
Display a list of tag urls for the tags on a given entry.
|
| 885 |
*#
|
| 886 |
#macro(showEntryTags $entry)
|
| 887 |
|
| 888 |
#set ( $tags = $entry.tags )
|
| 889 |
#foreach($tag in $tags)
|
| 890 |
<a href="$url.tag($tag.name)" rel="tag">$tag.name</a>
|
| 891 |
#end
|
| 892 |
|
| 893 |
#end
|
| 894 |
|
| 895 |
|
| 896 |
|
| 897 |
|