#** 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. *# #** macros for use with SitePageModel Contents #showEnriesPager($pager) #showWeblogProfile($weblog) #showWeblogDirectory() #showUserProfile($user) #showUserDirectory() #showCommentsPager($pager) *# #** Show pager and next/prev control for site-wide or planet entries. *# #macro(showSiteEntriesPager $pager) #if($pager.items.size() > 0) #set($entryCount = $pager.items.size() - 1) #set($startDate = $pager.items.get(0).pubTime) #set($endDate = $entries.get($entryCount).pubTime) #end #foreach($entry in $pager.items) #if($velocityCount < $maxResults)

$utils.truncateNicely($utils.removeHTML($entry.title), 50, 50, "...")
$entry.website.name #if($entry.category.name)| $entry.category.name #end #if($entry.pubTime)| $utils.formatDate($entry.pubTime, $text.get("macro.weblog.date.toStringFormat")) #end #if($entry.creator.userName)| By $entry.creator.userName #end

#if(!$utils.isEmpty($entry.summary)) $utils.truncateNicely($utils.removeHTML($entry.transformedSummary), 240, 260, "...") #else $utils.truncateNicely($utils.removeHTML($entry.transformedText), 240, 260, "...") #end

#end #end
#if($pager.nextLink) < $pager.nextName #end #if($pager.nextLink && $pager.prevLink)  |  #end #if($pager.prevLink) $pager.prevName > #end
#end #** Show weblog profile for specified weblog *# #macro(showWeblogProfile $weblog)

Weblog: $weblog.name

Handle $weblog.handle
Description $weblog.description
Created by <$weblog.creator.fullName/td>
Last modified $weblog.lastModified
Locale $!weblog.locale
Timezone $weblog.timeZone

Weblog users

#set($users = $site.getWeblogsUsers($weblog.handle)) #foreach($user in $users) #end
Username Full name
$user.userName $user.fullName

Recent posts

#set($entriesPager = $site.getWeblogEntriesPager($weblog, $null, $null, 90, 5)) #if($entriesPager.items.size() > 0) #foreach($entry in $entriesPager.items) #end
User Pub. time Title
$entry.creator.userName $utils.formatDate($entry.pubTime, $text.get("macro.weblog.date.toStringFormat")) $utils.removeHTML($entry.title)
#else No posts in past 90 days #end #end #** Show weblog directory, sensitive to letter specified in request. *# #macro(showWeblogDirectory $pageLength) #if($model.getRequestParameter("letter")) #set($chosenLetter = $model.getRequestParameter("letter")) #end #set($weblogLetterMap = $site.getWeblogHandleLetterMap())

#set($firstLetterDone = 0) #foreach($letter in $weblogLetterMap.keySet()) #if($firstLetterDone == 1) - #end #set($firstLetterDone = 1) #set($letterCount = $weblogLetterMap.get($letter)) #if($letter == $chosenLetter)#end #if($letterCount > 0) $letter #else $letter #end #if($letter == $chosenLetter)#end #end

#if($chosenLetter)

Weblogs starting with $chosenLetter

#else

All weblogs

#end #set($weblogsPager = $site.getWeblogsByLetterPager($chosenLetter, -1, $pageLength)) #foreach($weblog in $weblogsPager.items) #end
Blog Name Description
$weblog.handle $weblog.name
#end #** Show user profile of specified user. *# #macro(showUserProfile $user)

User: $user.fullName

Username $user.userName
Created $user.dateCreated
Locale $user.locale
Timezone $user.timeZone

User's weblogs

#set($weblogs = $site.getUsersWeblogs($user.userName)) #if($perms.size() > 0) #foreach($weblog in $weblogs) #end
Handle Name
$weblog.handle $weblog.name
#else User does not belong to any weblogs #end

User's recent posts

#set($entriesPager = $site.getWeblogEntriesPager($null, $user, $null, 90, 5)) #if($entriesPager.items.size() > 0) #foreach($entry in $entriesPager.items) #end
Blog Pub. time Title
$entry.website.handle $utils.formatDate($entry.pubTime, $text.get("macro.weblog.date.toStringFormat")) $utils.removeHTML($entry.title)
#else No posts in past 90 days #end #end #** Show user directory, sensitive to letter specified in request. *# #macro(showUserDirectory $pageLength) #if($model.getRequestParameter("letter")) #set($chosenLetter = $model.getRequestParameter("letter")) #end #set($userLetterMap = $site.getUserNameLetterMap())
#foreach($letter in $userLetterMap.keySet()) #if($firstLetterDone == 1) - #end #set($firstLetterDone = 1) #set($letterCount = $userLetterMap.get($letter)) #if($letter == $chosenLetter)#end #if($letterCount > 0) $letter #else $letter #end #end
#if($chosenLetter)

Users starting with $chosenLetter

#else

All users

#end #set($usersPager= $site.getUsersByLetterPager($chosenLetter, -1, $pageLength)) #foreach($u in $usersPager.items) #end
Username Profile Full name
$u.userName Profile $u.fullName
#end #** Show pager and next/prev control for a collection of comments *# #macro(showCommentsPager $commentsPager) #if($commentsPager.items.size() > 0) #set($commentCount = $commentsPager.items.size() - 1) #set($startDate = $commentsPager.items.get(0).postTime) #set($endDate = $commentsPager.items.get($commentCount).postTime) #end #foreach($comment in $commentsPager.items)
Re: $utils.removeHTML($comment.weblogEntry.title)
Posted on $utils.removeHTML($comment.weblogEntry.website.name) #if($comment.name) | Posted by $comment.name #end | $comment.postTime
#set($content = $utils.removeHTML($comment.content)) $utils.truncateNicely($content, 240, 260, "...")
#end
#if($commentsPager.prevLink) < $commentsPager.prevName #end #if($commentsPager.nextLink && $commentsPager.prevLink)  |  #end #if($commentsPager.nextLink) $commentsPager.nextName > #end
#end