#** Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. For additional information regarding copyright in this work, please see the NOTICE file in the top level directory of this distribution. *# #** Set of essential macros needed in Roller velocity templates. These are the documented macros in order defined in this file: #includeTemplate($weblog $pageName) #showAutodiscoveryLinks($weblog) #showTrackbackAutodiscovery($entry) #showWeblogEntriesPager($pager) #showNextPrevEntriesControl($pager) #showWeblogEntryComments($entry) #showWeblogEntryCommentForm($entry) #showWeblogEntryLinksList($entries) #showBookmarkLinksList($folderObj $expanding $subfolders) #showWeblogCategoryLinksList($categoryObj $expanding $subcats) #showReferrersList($weblog) #showAtomFeedsList($weblog) #showRSSFeedsList($weblog) #showWeblogEntryCalendar($weblog $category) #showPageMenu($weblog) #showAuthorMenu($vertical) #showWeblogSearchForm($weblog) #showWeblogSearchAgainForm($weblog) #showNextPrevSearchControl($pager) #_showCommonJavaScript() #showEntryTags($entry) *# #** Parse and include page template from weblog. *# #macro(includeTemplate $weblog $pageName) #set($pageArg = false)## This is required for such constructs; see Velocity docs and ROL-689 #set($pageArg = $weblog.getPageByName($pageName)) #if ($pageArg) #parse($pageArg.id) #end #end #** Show RSS, Atom and RSD auto-discovery links as HTML link elements. *# #macro(showAutodiscoveryLinks $weblog) #if ($weblog.enableBloggerApi) #end ## main feed urls are always available #if (!$model.searchResults) #if ($model.tags) #elseif ($model.weblogCategory) #end #else #end #if ($site) #else #end #end #** * Display a trackback auto-discovery RDF comment for a WeblogEntry, but only * if trackbacks are enabled and comments are allowed for the entry. **# #macro( showTrackbackAutodiscovery $entry ) #if($config.trackbacksEnabled && $model.weblog.allowComments && $entry.commentsStillAllowed) #end #end #** Shows weblog entries pager via default day template *# #macro(showWeblogEntriesPager $pager) #set($dayPage = $model.weblog.getPageByName("_day")) #set($map = $pager.getEntries()) #foreach($day in $map.keySet()) #set($entries = $map.get($day)) #parse($dayPage.id) #end #end #** Show next/prev control for specified pager *# #macro(showNextPrevEntriesControl $pager) #set($prevLink = false) #set($nextLink = false) #if ($pager.prevLink) #set($prevLink = $pager.prevLink) #set($prevName = $pager.prevName) #elseif ($pager.prevCollectionLink) #set($prevLink = $pager.prevCollectionLink) #set($prevName = $pager.prevCollectionName) #end #if ($pager.nextLink) #set($nextLink = $pager.nextLink) #set($nextName = $pager.nextName) #elseif ($pager.nextCollectionLink) #set($nextLink = $pager.nextCollectionLink) #set($nextName = $pager.nextCollectionName) #end #if ($prevLink) « $prevName | #end #if ($prevLink || $nextLink) $pager.getHomeName() #end #if ($nextLink) | $nextName » #end #end #** Show comments for weblog entry according to Roller configuration. *# #macro(showWeblogEntryComments $entry)
#if($model.commentForm.preview) #set($comments = [$model.commentForm.previewComment])
$text.get( "macro.weblog.preview" ):
#else
$text.get( "macro.weblog.comments" ):
#set($comments = $entry.getComments(true, true)) #end
#foreach( $comment in $comments ) #if($comment.approved || $model.commentForm.preview)
$comment.content

$text.get("macro.weblog.postedby") #if (!$utils.isEmpty($comment.name) && !$utils.isEmpty($comment.url)) $comment.name #elseif (!$utils.isEmpty($comment.name)) $comment.name #elseif ($comment.remoteHost) $comment.remoteHost #else $text.get("macro.weblog.comment.unknown") #end $text.get("macro.weblog.on") $utils.formatDate($comment.postTime, $text.get( "macro.weblog.datepattern" )) #

#end #end
#end #** Show comments form for weblog entry. *# #macro(showWeblogEntryCommentForm $entry) #set($cform = $model.getCommentForm())
$text.get("macro.weblog.postcommentHeader")
#if( $entry.commentsStillAllowed ) #if( $cform.error ) $cform.message #elseif( !$cform.error && !$utils.isEmpty($cform.message) ) $cform.message #end
#else $text.get( "comments.disabled" ) #end
#end #** Show entries as a HTML ul list. *# #macro(showWeblogEntryLinksList $entriesList) #end #** Show bookmarks as a HTML ul list. *# #macro(showBookmarkLinksList $folderObject $subfolders $expanding ) #end #** Recursively display a bookmark folder and children as HTML ul list (undocumented). *# #macro(_showBookmarkLinksList $folderObject $subfolders $expanding ) #if ($expanding) #_showCommonJavascript() #end #set($bookmarks = $folderObject.getBookmarks()) #set($folders = $folderObject.getFolders()) #set($divId = $utils.replace($folderObject.name, " ", "_" )) #if ($folderObject.name != "root" && $expanding && $subfolders && ($folderObject.getBookmarks().size() > 0 || $folderObject.getFolders().size() > 0))
  • +$folderObject.Name
  • #end #end #** Show weblog's categories in specified parent category. *# #macro(showWeblogCategoryLinksList $categoryObject $subcats $expanding ) #if ($expanding) #_showCommonJavascript() #end #if(!$expanding && !$subcats) #else #end #end #** Recursively display a bookmark folder and children as HTML ul list (undocumented). *# #macro(_showWeblogCategoryLinksList $categoryObject $subcats $expanding ) #if ($categoryObject.name != "root") #if ($expanding && $subcats && $categoryObject.weblogCategories.size() > 0) #set($divId = "div_$categoryObject.name")
  • +$categoryObject.name
  • #end #end #** * Display list of referrers. *# #macro(showReferrersList $refs $max $maxWidth $includeHits) #end #** * Show list of all RSS feeds available for weblog. *# #macro(showAtomFeedsList $weblog) #end #** * Show list of all Atom feeds available for weblog. *# #macro(showRSSFeedsList $weblog) #end #** * Show Roller Page Navigation Bar, includes links to all pages. *# #macro(showPageMenu $weblog) #end #** Show weblog entry calendar, with optional category restriction. *# #macro(showWeblogEntryCalendar $weblog $category) $calendarModel.showWeblogEntryCalendar($weblog, $category) #end #** Show large format weblog entry calendar, with optional category restriction. *# #macro(showWeblogEntryCalendarBig $weblog $category) $calendarModel.showWeblogEntryCalendarBig($weblog, $category) #end #** Show weblog author menu with vertical or horizontal orientation. *# #macro(showAuthorMenu $vertical) #set( $authorMenu = $menuModel.authorMenu ) #if( $authorMenu ) #if( $vertical ) #foreach( $menu in $authorMenu.tabs ) #end #else #set( $menuCnt = 0 ) #foreach( $menu in $authorMenu.tabs ) #foreach( $item in $menu.items ) #if ($menuCnt > 0) | #end $text.get( $menu.key ):$text.get( $item.key ) #set($menuCnt = $menuCnt + 1) #end #end #end #end #end #** Show weblog author menu with vertical or horizontal orientation. *# #macro(showAdminMenu $vertical) #set( $adminMenu = $menuModel.adminMenu ) #if( $adminMenu ) #if( $vertical ) #foreach( $menu in $adminMenu.tabs ) #end #else #set( $menuCnt = 0 ) #foreach( $menu in $adminMenu.tabs ) #foreach( $item in $menu.items ) #if ($menuCnt > 0) | #end $text.get( $menu.key ):$text.get( $item.key ) #set($menuCnt = $menuCnt + 1) #end #end #end #end #end #** Show search form for a weblog. *# #macro(showWeblogSearchForm $weblog $showCatChooser)

    #if( $showCatChooser ) #set( $cats = $model.weblog.getWeblogCategories("nil") ) #end

    #end #** Show search again form for a weblog. *# #macro(showWeblogSearchAgainForm $weblog)
    $text.get( "macro.weblog.searchdictionary", [$model.term, $model.term, $model.term] ) $text.get( "macro.weblog.searchhits", [$model.hits])

    #set( $cats = $model.weblog.getWeblogCategories("nil") )
    $text.get( "macro.weblog.searchgoogle", [$model.term, $url.absoluteSite, $url.site, ${website.handle}] )
    #end #** Show next/prev pager for search results. *# #macro(showNextPrevSearchControl $pager) #set( $min = $model.offset + 1 ) #set( $max = $model.offset + $model.limit ) #if( $max > $model.hits )#set( $max = $model.hits )#end

    $text.get("searchSummary.text", [$min, $max, $model.hits])

    #set($prevLink = false) #set($nextLink = false) #if ($pager.prevLink) #set($prevLink = $pager.prevLink) #set($prevName = $pager.prevName) #end #if ($pager.nextLink) #set($nextLink = $pager.nextLink) #set($nextName = $pager.nextName) #end #if ($prevLink) « $prevName | #end #if ($prevLink || $nextLink) $pager.getHomeName() #end #if ($nextLink) | $nextName » #end #end #** Include Javascript code needed for expanding folder macros (undocumented). *# #macro(_showCommonJavascript) #if (!$zzz__incudedCommonJavaScript__zzz) #set($zzz__incudedCommonJavaScript__zzz = true) #end #end #** Display a list of tag urls for the tags on a given entry. *# #macro(showEntryTags $entry) #set ( $tags = $entry.tags ) #foreach($tag in $tags) #end #end #macro(_Jave $type) #end