#** 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) #showMetaDescription() #showAnalyticsTrackingCode($weblog) #showWeblogEntriesPager($pager) #showNextPrevEntriesControl($pager) #showMobileNextPrevEntriesControl($pager) #showWeblogEntryComments($entry) #showMobileWeblogEntryComments($entry) #showWeblogEntryCommentForm($entry) #showWeblogEntryLinksList($entries) #showBookmarkLinksList($folderObj) #showWeblogCategoryLinksList() #showMobileCategoryLinksList() #showAtomFeedsList($weblog) #showRSSFeedsList($weblog) #showWeblogEntryCalendar($weblog $category) #showPageMenu($weblog) #showAuthorMenu($vertical) #showWeblogSearchForm($weblog) #showMobileSearchForm($weblog) #showWeblogSearchAgainForm($weblog) #showMobileSearchAgainForm($weblog) #showNextPrevSearchControl($pager) #showMobileNextPrevSearchControl($pager) #showMobilePopupDialog($id $header $message) #_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.getTemplateByName($pageName)) #if ($pageArg) #set($pageId = $pageArg.id+'|'+$model.deviceType) #parse($pageId) #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 #** Adds a meta description tag, suitable for use in HTML header sections. This tag is frequently used by search engines to provide a short description for links returned. The description value will set to the weblog's tagline if on a multiple blog entry page or the weblog entry search description if on a single blog entry (permalink) page. If the relevant description value has not been configured no meta tag will be created. *# #macro(showMetaDescription) #if ($model.permalink) #if ($utils.isNotEmpty($model.weblogEntry.searchDescription)) #end #elseif ($utils.isNotEmpty($model.weblog.about)) #end #end #** Adds a tracking code for website analytics (e.g. Google Analytics). Will use the blog-defined tracking code if defined and permitted by the installation, else the server-defined tracking code if defined will be used. *# #macro(showAnalyticsTrackingCode $weblog) #if ($config.analyticsOverrideAllowed && $utils.isNotEmpty($weblog.analyticsCode)) $weblog.analyticsCode #elseif ($utils.isNotEmpty($config.defaultAnalyticsTrackingCode)) $config.defaultAnalyticsTrackingCode #end #end #** Shows weblog entries pager via default day template *# #macro(showWeblogEntriesPager $pager) #set($dayPage = $model.weblog.getTemplateByName("_day")) #set($map = $pager.getEntries()) #foreach($day in $map.keySet()) #set($entries = $map.get($day)) #set($pageId = $dayPage.id+'|'+$model.deviceType) #parse($pageId) #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 ## Mobile Version #macro(showMobileNextPrevEntriesControl $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 || $nextLink)
#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 ## Mobile Version #macro(showMobileWeblogEntryComments $entry) #if($model.commentForm.preview) #set($comments = [$model.commentForm.previewComment]) #set( $heading = $text.get( "macro.weblog.preview" )) #else #set($comments = $entry.getComments(true, true)) #set( $heading = $text.get( "macro.weblog.comments" )) #end #if($comments.size() > 0) #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) #end #** Show weblog's categories in specified parent category. *# #macro(showWeblogCategoryLinksList) #end ## Mobile version #macro(showMobileCategoryLinksList)

Categories

    #if ($model.weblogCategory || $model.permalink)
  • $text.get("generic.all")
  • #else
  • $text.get("generic.all")
  • #end #set($active = $text.get("generic.all")) #set($cats = $model.weblog.getWeblogCategories()) #foreach($cat in $cats) #if ($model.weblogCategory && $model.weblogCategory.name == $cat.name || ($model.permalink && $model.weblogEntry.category.name == $cat.name))
  • $cat.name
  • #set($active = $cat.name) #else
  • $cat.name
  • #end #end
Categories - $active #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()) #end

#end ## Mobile Version #macro(showMobileSearchForm $weblog $showCatChooser)

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

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

#set( $cats = $model.weblog.getWeblogCategories()) #if(!$site && $cats && $cats.size() > 1) #end
$text.get( "macro.weblog.searchgoogle", [$model.term, $url.absoluteSite, $url.site, ${weblog.handle}] )
#end ## Mobile Version #macro(showMobileSearchAgainForm $weblog)
$text.get( "macro.weblog.searchhits", [$model.term, $model.hits])
#set($cats = $model.weblog.getWeblogCategories()) #if(!$site && $cats && $cats.size() > 1) #end
#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 ## Mobile Version #macro(showMobileNextPrevSearchControl $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 ## Show the pager #if ($prevLink || $nextLink)
#end #end #** Show mobile alert popup. *# #macro(showMobilePopupDialog $id $header $message)

$header

$message

OK
#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