roller-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From snoopd...@apache.org
Subject svn commit: r414838 [2/2] - in /incubator/roller/branches/roller_3.0: src/org/apache/roller/ui/rendering/model/ web/WEB-INF/ web/WEB-INF/velocity/ web/WEB-INF/velocity/deprecated/ web/themes/atlas/
Date Fri, 16 Jun 2006 14:35:49 GMT
Added: incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/site.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/site.vm?rev=414838&view=auto
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/site.vm (added)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/site.vm Fri Jun 16 07:35:48 2006
@@ -0,0 +1,351 @@
+
+# macros for use with SitePageModel
+
+##-----------------------------------------------------------------------------
+#macro( showEntry $entry )
+<div class="entry">
+    <span class="entryDetails">
+        <a href="$utilities.textToHTML($entry.permaLink)">
+        <b>$utilities.removeHTML($entry.title)</b></a><br /> 
+        $entry.website.name 
+        #if($entry.category.name)| $entry.category.name #end
+        #if($entry.pubTime)| #formatDate($text.get("macro.weblog.date.toStringFormat") $entry.pubTime) #end
+        #if($entry.creator.userName)| By $entry.creator.userName #end
+        <br/> 
+    </span>
+    <span class="entryDescription">
+        #set($content = $utilities.removeHTML($entry.text))
+        $utilities.truncateNicely($content, 240, 260, "...")
+    </span>
+</div>
+#end
+
+##-----------------------------------------------------------------------------
+#macro(showEntriesPager $entries $maxResults)
+    #if($entries.size() > 0)
+        #set($entryCount = $entries.size() - 1)
+        #set($startDate = $entries.get(0).pubTime)
+        #set($endDate = $entries.get($entryCount).pubTime)
+    #end
+    #foreach($entry in $entries)
+        #if($velocityCount < $maxResults)
+            #showEntry($entry)
+        #end
+    #end
+    <div class="nextPrev">
+    #if($offset >= $maxResults - 1)
+       #set($prevOffset = $offset - ($maxResults - 1))
+       <a href="?offset=$prevOffset">&lt; Newer</a>
+    #end
+    &nbsp;
+    #if($entries.size() > $maxResults - 1)
+       #set($nextOffset = $offset + $maxResults - 1)
+       <a href="?offset=$nextOffset">Older &gt;</a>
+    #end
+    </div>
+#end
+
+##-----------------------------------------------------------------------------
+#macro(showWeblogProfile $weblog)
+    <h2 class="pageTitle">Weblog: $weblog.name</h2> 
+    <table>
+        <tr>
+            <td>Handle</td>
+            <td>$weblog.handle</td>
+        </tr>
+        <tr>
+            <td>Description</td>
+            <td>$weblog.description</td>
+        </tr>
+        <tr>
+            <td>Created by</td>
+            <td><$weblog.creator.fullName/td>
+        </tr>
+        <tr>
+            <td>Last modified</td>
+            <td>$weblog.lastModified</td>
+        </tr>
+        <tr>
+            <td>Locale</td>
+            <td>$!weblog.locale</td>
+        </tr>
+        <tr>
+            <td>Timezone</td>
+            <td>$weblog.timeZone</td>
+        </tr>
+    </table>
+
+    <h2 class="pageTitle">Weblog users</h2>
+    #set($users = $sitePageModel.getWeblogsUsers($weblog.handle))
+    <table class="rollertable">
+        <thead>
+            <tr>
+                <th>Username</th>
+                <th>Full name</th>
+            </tr>
+        </thead>    
+        #foreach($user in $users) 
+        <tr>
+            <td>$user.userName</td>
+            <td>$user.fullName</td>
+        </tr>
+        #end
+    </table>
+
+    <h2 class="pageTitle">Recent posts</h2>
+    #set($entries = $sitePageModel.getWeblogEntries($weblog.handle, 'nil', 'nil', 90, 0, 5)) 
+    #if($entries.size() > 0)  
+        <table class="rollertable"> 
+        <thead>
+            <tr>
+                <th>User</th>
+                <th>Pub. time</th>
+                <th>Title</th>
+            </tr>
+        </thead>  
+        #foreach($entry in $entries)
+            <tr>
+                <td>$entry.creator.userName</td>
+                <td>#formatDate($text.get("macro.weblog.date.toStringFormat") $entry.pubTime)</td>
+                <td><a href="$utilities.textToHTML($entry.permaLink)">
+                    $utilities.removeHTML($entry.title)</a></td>
+            </tr>
+        #end
+        </table>
+    #else
+        No posts in past 90 days
+    #end
+
+#end
+
+
+##-----------------------------------------------------------------------------
+#macro(showWeblogDirectory)
+    #if($pageModel.getRequestParameter("letter"))
+        #set($chosenLetter = $pageModel.getRequestParameter("letter"))
+    #else
+        #set($chosenLetter = "A")
+    #end
+
+    #set($weblogLetterMap = $sitePageModel.getWeblogHandleLetterMap())
+    <div class="letterMap">
+    #foreach($letter in $weblogLetterMap.keySet())
+        #set($letterCount = $weblogLetterMap.get($letter))
+        #if($letter == $chosenLetter)<span style="font-size:120%; font-weight:bold">#end
+        #if($letterCount > 0)
+           <a href="?letter=$letter" title="$letterCount weblogs">$letter</a>         
+        #else
+           $letter
+        #end
+        #if($letter == $chosenLetter)</span>#end
+    #end
+    </div>
+
+    #if($pageModel.getRequestParameter("offset"))
+        #set($offset = $pageModel.getIntRequestParameter("offset"))
+    #else
+        #set($offset = 0)
+    #end
+
+    #if($chosenLetter)
+        <h2 class="pageTitle">Weblogs starting with $chosenLetter</h2>
+        #set($weblogs = $sitePageModel.getWeblogsByLetter($chosenLetter, $offset, $maxResults))
+        <table class="rollertable">
+            <thead>
+                <tr>
+                    <th>Handle</th>
+                    <th>Profile</th>
+                    <th>Name</th>
+                </tr>
+            </thead>
+        #foreach($weblog in $weblogs)
+            #if($velocityCount < $maxResults)
+               <tr>
+                  <td><a href="$baseURL/page/$weblog.handle">$weblog.handle</a></td>
+                  <td><a href="?weblog=$weblog.handle">Profile</a></td>
+                  <td>$weblog.name</td>
+               </tr>
+            #end
+        #end 
+        </table>
+        #if($offset >= $maxResults - 1)
+           #set($prevOffset = $offset - ($maxResults - 1))
+           <a href="?letter=$chosenLetter&offset=$prevOffset">&lt;prev</a>
+        #end
+        #if(($offset >= $maxResults - 1) && ($weblogs.size() > $maxResults - 1)) &nbsp;|&nbsp; #end
+        #if($weblogs.size() > $maxResults - 1)
+           #set($nextOffset = $offset + $maxResults - 1)
+           <a href="?letter=$chosenLetter&offset=$nextOffset">next &gt;</a>
+        #end
+    #end
+#end
+
+##-----------------------------------------------------------------------------
+#macro(showUserProfile $user)
+    <h2 class="pageTitle">User: $user.fullName</h2>
+    <table>
+        <tr>
+            <td>Username</td>
+            <td>$user.userName</td>
+        </tr>
+        <tr>
+            <td>Created</td>
+            <td>$user.dateCreated</td>
+        </tr>
+        <tr>
+            <td>Locale</td>
+            <td>$user.locale</td>
+        </tr>
+        <tr>
+            <td>Timezone</td>
+            <td>$user.timeZone</td>
+        </tr>
+    </table>
+
+    <h2 class="pageTitle">User's weblogs</h2>
+    #set($weblogs = $sitePageModel.getUsersWeblogs($user.userName))
+    #if($perms.size() > 0)
+    <table class="rollertable">
+        <thead>
+            <tr>
+                <th>Handle</th>
+                <th>Name</th>
+            </tr>
+        </thead>    
+        #foreach($weblog in $weblogs) 
+        <tr>
+            <td><a href="$baseURL/page/$weblog.handle">$weblog.handle</a></td>
+            <td>$weblog.name</td>
+        </tr>
+        #end
+    </table>
+    #else
+       User does not belong to any weblogs
+    #end
+
+    <h2 class="pageTitle">User's recent posts</h2>
+    #set($entries = $sitePageModel.getWeblogEntries('nil', $user.userName, 'nil', 90, 0, 5)) 
+    #if($entries.size() > 0)  
+        <table class="rollertable"> 
+        <thead>
+            <tr>
+                <th>Blog</th>
+                <th>Pub. time</th>
+                <th>Title</th>
+            </tr>
+        </thead>  
+        #foreach($entry in $entries)
+            <tr>
+                <td><a href="$entry.website.url">$entry.website.handle</a></td>
+                <td>#formatDate($text.get("macro.weblog.date.toStringFormat") $entry.pubTime)</td>
+                <td><a href="$utilities.textToHTML($entry.permaLink)">
+                    $utilities.removeHTML($entry.title)</a></td>
+            </tr>
+        #end
+        </table>
+    #else
+        No posts in past 90 days
+    #end
+#end
+
+##-----------------------------------------------------------------------------
+#macro(showUserDirectory)
+    #if($pageModel.getRequestParameter("letter"))
+        #set($chosenLetter = $pageModel.getRequestParameter("letter"))
+    #else
+        #set($chosenLetter = "A")
+    #end
+
+    #set($userLetterMap = $sitePageModel.getUserNameLetterMap())
+    <div class="letterMap">
+    #foreach($letter in $userLetterMap.keySet())
+        #set($letterCount = $userLetterMap.get($letter))
+        #if($letter == $chosenLetter)<span style="font-size:120%; font-weight:bold">#end
+        #if($letterCount > 0)
+           <a href="?letter=$letter" title="$letterCount users">$letter</a>
+        #else
+           $letter
+        #end
+        </span>
+    #end
+    </div>
+
+    #if($pageModel.getRequestParameter("offset"))
+        #set($offset = $pageModel.getIntRequestParameter("offset"))
+    #else
+        #set($offset = 0)
+    #end
+
+    #if($chosenLetter)
+        <h2 class="pageTitle">Users starting with $chosenLetter</h2>
+        #set($users = $sitePageModel.getUsersByLetter($chosenLetter, $offset, $maxResults))
+        <table class="rollertable">
+            <thead>
+                <tr>
+                    <th>Username</th>
+                    <th>Profile</th>
+                    <th>Full name</th>
+                </tr>
+            </thead>
+        #foreach($u in $users)
+            #if($velocityCount < $maxResults)
+               <tr>
+                  <td>$u.userName</td>
+                  <td><a href="?userName=$u.userName">Profile</a></td>
+                  <td>$u.fullName</td>
+               </tr>
+            #end
+        #end 
+        </table>
+        #if($offset >= $maxResults - 1)
+           #set($prevOffset = $offset - ($maxResults - 1))
+           <a href="?letter=$chosenLetter&offset=$prevOffset">&lt;prev</a>
+        #end
+        #if(($offset >= $maxResults - 1) && ($weblogs.size() > $maxResults - 1)) &nbsp;|&nbsp; #end
+        #if($users.size() > $maxResults - 1)
+           #set($nextOffset = $offset + $maxResults - 1)
+           <a href="?letter=$chosenLetter&offset=$nextOffset">next &gt;</a>
+        #end
+    #end
+#end
+
+##-----------------------------------------------------------------------------
+#macro(showCommentsPager $comments $maxResults)
+    #if($comments.size() > 0)
+        #set($commentCount = $comments.size() - 1)
+        #set($startDate = $comments.get(0).postTime)
+        #set($endDate = $comments.get($commentCount).postTime)
+    #end
+
+    #foreach($comment in $comments)
+        #if($velocityCount < $maxResults)
+            <div class="entry">
+                <span class="entryDetails">
+                    <a href="${baseURL}$utilities.textToHTML($comment.weblogEntry.permaLink)">
+                        <b>Re: $utilities.removeHTML($comment.weblogEntry.title)</b></a><br /> 
+                    Posted on <a href="$baseURL/$comment.weblogEntry.website.handle">
+                        $utilities.removeHTML($comment.weblogEntry.website.name)</a> 
+                    #if($comment.name) | Posted by $comment.name #end
+                    | $comment.postTime<br/> 
+                </span>
+                <span class="entryDescription">
+                    #set($content = $utilities.removeHTML($comment.content))
+                    $utilities.truncateNicely($content, 240, 260, "...")
+                </span>
+            </div>
+        #end
+    #end
+ 
+    <div class="nextPrev">
+    #if($offset >= $maxResults - 1)
+       #set($prevOffset = $offset - ($maxResults - 1))
+       <a href="?offset=$prevOffset">&lt; Newer</a>
+    #end
+    &nbsp;
+    #if($comments.size() > $maxResults - 1)
+       #set($nextOffset = $offset + $maxResults - 1)
+       <a href="?offset=$nextOffset">Older &gt;</a>
+    #end
+    </div>
+
+#end

Modified: incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm?rev=414838&r1=414837&r2=414838&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm (original)
+++ incubator/roller/branches/roller_3.0/web/WEB-INF/velocity/weblog.vm Fri Jun 16 07:35:48 2006
@@ -1,613 +1,2 @@
-#**
- * Weblog entries, comments, and related links.
- * @author Lance Lavandowska (conversion to Velocimacros)
- * @author David M Johnson (comment macros)
- *#
-
-#**
- * Shows weblog entries from specified category using specified page as a "day 
- * template" for the display of each day. The maxEntries argument is ignored
- * because now the number of entries to display is controlled by the 
- * entryDisplayCount property on the Preferences:Settings page.
- * <p>
- * This macro allows Roller to support five different types of blog displays:
- * <p>
- * Current day page<br />
- *     /page/&lt;handle&gt;/<br>
- * On the current day page, Roller will show the most recent N blog  
- * entries (not just those for the day).
- * At the end of the page, a previous link points to day page of entries  
- * before the ones shown (and the link is displayed as the day's date).  
- * This works exactly as before.
- * <p>
- * Day page<br>
- *     /page/&lt;handle&gt;/YYYYMMDD<br>
- * <p>On a day page, Roller will show all of the entries for a specific  
- * day. At the end of the page, a next/previous link allows navigation  
- * to next and previous day of entries (and the links are displayed as  
- * the day's dates). Before, day pages always showed N entries (where  
- * usually N=15), but now they'll show only a day's worth (e.g. 1-3  
- * entries).
- * <p>
- * Month page<br>
- *     /page/&lt;handle&gt;/YYYYMM<br>
- * <p>On a month page, Roller will show the most recent N blog entries in  
- * the month. At the end of the page, a previous link points to day page  
- * of entries before the ones shown. This is new; we didn't have month  
- * pages before.
- * <p>
- * Entry page<br>
- *     /page/&lt;handle&gt;?entry=&lt;anchor&gt;<br>
- * <p>On an entry page, one entry is shown. The next/prev links link to the  
- * next and previous entries (and the links are displayed as the entry  
- * titles, nicely truncated). This one also works exactly as before.
- * <p>
- * Search page<br>
- *     /page/<handle>?q=<search terms><br>
- * <p>If there are search results, then this macro will show them using the 
- * current weblog's day template.
- * <br>
- *
- * @param pageName   Page name of page to serve as day template.
- * @param maxEntries (ignored)
- * @param category   Only display weblog entries from this category.
- *#
-#macro( showWeblogEntriesInCategory $pageName $maxEntries $category)
-    #set($maxEntries = $website.entryDisplayCount)
-    #set($dayTemplateId = $pageModel.getPageIdByName($pageName))
-    #if(!$dayTemplateId ) ## if no page name, try Preview space
-        #set($dayTemplateId = $pageName)
-    #end
-    #if ($pageModel.weblogEntry)
-        <div class="top-next-prev">#showNextPreviousControl()</div>
-        #set($day = $entry.pubTime)
-        #set($entries = [$pageModel.weblogEntry])
-        #parse($dayTemplateId )
-        #if($trackbacksEnabled && $website.allowComments && $entry.commentsStillAllowed)
-           <div class="trackbackUrl">
-           $text.get("macro.weblog.trackback") #showTrackbackURL($entry)
-           </div>
-        #end
-        <div class="bottom-next-prev">#showNextPreviousControl()</div>
-        #showEntryLinkbacks($entry)
-        #showComments($entry)
-        #if($commentsEnabled && $website.allowComments && $entry.commentsStillAllowed)
-            #showCommentForm($entry)
-        #else
-            $text.get("comments.disabled")
-        #end
-    #else
-        #if($searchResults)
-            #set($map = $searchResults.results )
-            #showSearchAgainForm()
-            #showSearchSummary()
-            #foreach($day in $searchResults.results.keySet())
-                #set($entries = $searchResults.results.get($day))
-                #parse($dayTemplateId)
-            #end
-            #showSearchPager()
-        #else
-            #set($map = $pageModel.getRecentWeblogEntries($maxEntries, $category))
-            #if($map.size() == 0)
-               $text.get("macro.weblog.noEntriesForDate")
-            #else               
-               #foreach($day in $map.keySet())
-                   #set($entries = $map.get($day))
-                   #parse($dayTemplateId)
-               #end
-            #end
-            <div class="bottom-next-prev">#showNextPreviousControl()</div>
-        #end
-    #end
-#end
-
-#**
- * Shows weblog entries by calling showWeblogEntriesInCategory() and passing
- * 'nil' to indicate that all categories are to be included.
- *#
-#macro( displayWeblogEntries )
-#showWeblogEntriesInCategory("_day" 15 'nil')
-#end
-
-
-#**
- * Shows list of links to recent weblog entries in one category.
- * @param entryCount Maximum number of entry links to display
-**#
-#macro( showRecentEntriesInCategory $entryCount $catPath )
-   #set( $xmap = $pageModel.getRecentWeblogEntries($entryCount,$catPath) )
-   <ul class="recentposts">
-   #foreach( $day in $xmap.keySet() )
-       #set( $recentEntries = $xmap.get($day) )
-       #foreach ($var in $recentEntries)
-           <li class="recentposts"><a href="${ctxPath}/page/${website.handle}?entry=$utilities.encode($var.anchor)">$var.title</a></li>
-       #end
-   #end
-   </ul>
-#end
-
-#**
- * Shows list of links to recent weblog entries in one category.
- *
- * @param numEntries Maximum number of entries to display
-**#
-#macro( showRecentEntries $entryCount )
-#showRecentEntriesInCategory($entryCount "nil")
-#end
-
-
-## ======================================================================== 
-## Next / previous links macros 
-## ======================================================================== 
-
-#**
- * Displays next previous links, called by #showWeblogEntries().
- * On the today page: show prev link day before earliest entry on page.
- * On an entry page: show next/prev entry links.
- * On a day page: show next prev day links.
-**#
-#macro( showNextPreviousControl )
-    #set( $npcat = 'nil' )
-    #set( $catLink = "" )
-    #if ( $catPath && $catPath != "") 
-        #set( $npcat = $catPath )
-        #set( $catLink = "?catname=$catPath" ) 
-    #end
-    <div class="next-previous">
-    #if ($pageModel.previousEntry)
-        #showPrevWeblogLink($npcat) |
-    #end
-    #if ($pageModel.previousEntry || $pageModel.nextEntry)
-        <a href="${ctxPath}/page/${website.handle}$catLink">$page.name</a>
-    #end
-    #if ($pageModel.nextEntry)
-        | #showNextWeblogLink($npcat)
-    #end
-    </div>
-#end
-
-#**
- * Display link to chronologically previous entry or day in the
- * same category (if specified).
-**#
-#macro( showPrevWeblogLink $category)
-    <span class="previousEntry">
-    #if( $pageModel.previousEntry )
-        #set( $prev = $pageModel.previousEntry )
-        #if( $pageModel.weblogEntry )
-            #set( $prevURL = "${prev.permaLink}" )
-            <a href="$prevURL" title="Previous Entry"
-                > &laquo; $utilities.truncateNicely($prev.title, 25, 25, "...")</a>
-        #else
-            #set( $prevURL = "${ctxPath}/page/${website.handle}/#formatDate($plainFormat ${prev.pubTime})" )
-            <a href="$prevURL" title="Previous Entries"
-                > &laquo; #showEntryDate(${prev.pubTime})</a>
-        #end
-    #end
-    </span>
-#end
-
-#**
- * Display link to chronologically next entry or day in the
- * same category (if specified).
-**#
-#macro( showNextWeblogLink $category)
-    <span class="nextEntry">
-    #if( $pageModel.nextEntry )
-        #set( $next = $pageModel.nextEntry )        
-        #if( $pageModel.weblogEntry )
-            #set( $nextURL = "${next.permaLink}" )
-            <a href="$nextURL" title="Next Entry"
-                >$utilities.truncateNicely($next.title, 25, 25, "...") &raquo; </a>
-        #else
-            #set( $nextURL = "${ctxPath}/page/${website.handle}/#formatDate($plainFormat ${next.pubTime})" )
-            <a href="$nextURL" title="Next Entries"
-                >#showEntryDate(${next.pubTime}) &raquo; </a>
-        #end
-
-    #end
-    </span>
-#end
-
-
-## ======================================================================== 
-## Individual weblog entry display macros 
-## ======================================================================== 
-
-
-#**
- * Use this to show entry summary or text as appropriate on your blog pages.
- * On single-entry pages, text is prefered. Everywhere else, summary is 
- * preferred. Also, applies all plugins configured by entry.
- *#
-#macro( showEntryText $entry )
-   #if( $entryPage )
-      #parse($entryPage.id)
-   #else
-      #if( $pageModel.weblogEntry) 
-          ## on single-entry pages, we prefer text
-          #if( $utilities.isNotEmpty($entry.text) )
-              #set( $sourceText = $entry.text )
-          #else 
-              #set( $sourceText = $entry.summary )
-          #end
-      #else
-          ## on multi-entry pages, we prefer summary
-          #if( $utilities.isNotEmpty($entry.summary) )
-              #set( $sourceText = $entry.summary )
-              #if( $utilities.isNotEmpty($entry.text) )
-                 #set( $readMore = "<a class='readmore' href='$entry.permaLink'> ...</a>" )
-                 #set( $sourceText = "$sourceText$readMore")
-              #end
-          #else 
-              #set( $sourceText = $entry.text )
-          #end
-      #end
-      #if( $entry.plugins )
-         #set( $displayText = $pageHelper.renderPlugins($entry, $sourceText) )
-      #else
-         #set( $displayText = $sourceText )
-      #end
-      $utilities.textToCDATA($displayText)
-   #end
-#end
-
-
-#**
- * Roller uses this macro to display entry.summary in RSS and Atom feeds.
- *#
-#macro( showEntrySummary $entry )
-  #if( $entry.plugins)
-     #set( $displayText = $pageHelper.renderPlugins($entry, $entry.summary))
-  #else
-     #set( $displayText = $entry.summary )
-  #end
-  #if( $entryLength == -1 )
-     $utilities.textToXML($displayText)
-  #else
-     #set( $displayText = $stringUtils.left( $displayText, $entryLength ) )
-     #set( $displayText = $utilities.textToXML($utilities.removeHTML($displayText)) )
-     $displayText... [$entry.text.length() characters]
-  #end
-#end
-
-#**
- * Roller uses this macro to display entry.text in RSS and Atom feeds.
- *#
-#macro( showEntryContent $entry )
-  #if( $entry.plugins)
-     #set( $displayText = $pageHelper.renderPlugins( $entry, $entry.text))
-  #else
-     #set( $displayText = $entry.text )
-  #end
-  #if( $entryLength == -1 )
-    $utilities.textToXML($displayText)
-  #else
-    #set( $displayText = $stringUtils.left( $displayText, $entryLength ) )
-    #set( $displayText = $utilities.textToXML($utilities.removeHTML($displayText)) )
-    $displayText... [$entry.text.length() characters]
-  #end
-#end
-
-
-#**
- * Display Permalink for Date.
- * @param day Date object that specifies day (type java.util.Date).
- *#
-#macro( showDayPermalink $day )
-    <a href="${ctxPath}/page/${website.handle}/#formatDate($plainFormat $day )"><img
-        class="daypermalink"
-        src="$ctxPath/images/permalink.gif"
-        title="$text.get( "macro.weblog.daypermalink.title" )"
-        alt="#formatDate( $plainFormat $day )" /></a>
-#end
-
-
-#**
- * Display the default Date.toString for date using the 'macro.weblog.date.toStringFormat'
- * format as defined in the resource bundle.
- * @param toStringFormat Format string (see java.text.SimpleDateFormat).
- * @param day Date object that specifies day (type java.util.Date).
- *#
-#macro( showEntryDate $day )
-    #set( $format=$text.get("macro.weblog.date.toStringFormat") )
-    #formatDate( $format $day )
-    ##formatDate( $toStringFormat $day )
-#end
-
-
-#**
- * Display the timestamp for the $day using the 'macro.weblog.date.timestampFormat'
- * format as defined in the resource bundle.
- *
- * @param timestampFormat Format string (see java.text.SimpleDateFormat).
- * @param day Date object that specifies day (type java.util.Date).
- *#
-#macro( showTimestamp $day )
-    #set( $format = $text.get("macro.weblog.date.timestampFormat") )
-    #formatDate( $format $day )
-    ##formatDate( $timestampFormat $day )
-#end
-
-
-#**
- * Display the Permalink for a weblog entry.
- * @param entry WeblogEntry object.
- *#
-#macro( showEntryPermalink $entry )
-    <a href="$entry.permaLink"
-        title="$text.get( "macro.weblog.entrypermalink.title" )"
-        class="entrypermalink">Permalink</a>
-    #if ($pageHelper.isUserAuthorizedToEdit())
-        [<a href="$pageHelper.getEntryEditUrl($entry)">$text.get( "macro.weblog.entrypermalink.edit" )</a>]
-    #end
-#end
-
-
-#**
- * Display the Trackback URL for a weblog entry.
- * @param entry WeblogEntry object.
- *#
-#macro( showTrackbackURL $entry )
-$absBaseURL/trackback/${website.handle}/$page.link/$utilities.encode($entry.anchor)
-#end
-
-
-#**
- * Method to retrieve a full encoded anchor tag for a WeblogEntry.
-**#
-#macro( showAnchorTag $entry )
-    <a name="$utilities.encode($entry.anchor)" id="$utilities.encode($entry.anchor)"></a>
-#end
-
-
-#**
- * Display a trackback auto-discovery comment for a WeblogEntry.
- **#
-#macro( showTrackbackAutodiscovery $entry )
-<!--
-<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-         xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/"
-         xmlns:dc="http://purl.org/dc/elements/1.1/">
-<rdf:Description
-    rdf:about="$entry.permaLink"
-    trackback:ping="#showTrackbackURL($entry)"
-    dc:title="$entry.title"
-    dc:identifier="$entry.permaLink"
-    dc:subject="$entry.category.name"
-    dc:description="$entry.title"
-    dc:creator="$entry.creator.userName"
-    dc:date="$entry.pubTime" />
-</rdf:RDF>
--->
-#end
-
-
-## ======================================================================== 
-## Search form and results macros 
-## ======================================================================== 
-
-
-#**
- * Display search form for searching a weblog.  This is only a form, no div
- * or anything around it.
- *#
-#macro( showSearchForm )
-    <form id="searchForm" method="get" action="${ctxPath}/search/${website.handle}"
-        style="margin: 0; padding: 0" onsubmit="return validateSearch(this)">
-        <p>
-          <input type="text" id="q" name="q" size="20"
-              maxlength="255" value="#if($term)$term#end" />
-          #set( $cats = $pageModel.getWeblogCategories("nil") )
-          <select name="c">
-          <option value="">- In Category -</option>
-          #foreach( $cat in $cats )
-              <option #if($cat.name == $req.getParameter('c'))selected="selected"#end>$cat.name</option>
-          #end
-          </select>
-          <input type="submit" value="$text.get( "macro.weblog.searchbutton" )" />
-        </p>
-    </form>
-    <script type="text/javascript">
-        function validateSearch(form) {
-            if (form.q.value == "") {
-                alert("$text.get( "macro.weblog.searchalert" )");
-                form.q.focus();
-                return false;
-            }
-            return true;
-        }
-    </script>
-#end
-
-
-#**
- * Display search again form
- *#
-#macro( showSearchAgainForm )
-    <div id="searchAgain">
-        $text.get( "macro.weblog.searchdictionary", [$searchResults.term, $searchResults.term, $searchResults.term] )
-
-        $text.get( "macro.weblog.searchhits", [$searchResults.hits])
-
-        <form method="get" action="${ctxPath}/search/${website.handle}"
-            style="margin: 5px">
-            <input type="text" id="q" name="q" size="31"
-                maxlength="255" value="$searchResults.term"
-                style="padding-left: 1px" /><br />
-            #set( $cats = $pageModel.getWeblogCategories("nil") )
-            <select name="c">
-            <option value="">- Restrict By Category -</option>
-            #foreach( $cat in $cats )
-              <option #if($cat.name == $req.getParameter('c'))selected="selected"#end>$cat.name</option>
-            #end
-            </select>
-            <input type="submit" value="$text.get( "macro.weblog.searchagain" )" />
-        </form>
-
-        $text.get( "macro.weblog.searchgoogle", [$searchResults.term, $absBaseURL, $ctxPath, ${website.handle}] )
-    </div>
-    <!-- searchhi script hangs firefox, commenting it out for now -->
-    <!-- script type="text/javascript" src="$ctxPath/theme/scripts/searchhi.js"></script -->
-#end
-
-
-#**
- * Displays header like "1 - 10 of 20 found.".
-**#
-#macro( showSearchSummary )
-    #set( $min = $searchResults.offset + 1 )
-    #set( $max = $searchResults.offset + $searchResults.limit )
-    #if( $max > $searchResults.hits )#set( $max = $searchResults.hits )#end
-    <h3>
-        $min - $max of $searchResults.hits found.
-    </h3>
-#end
-
-
-#**
- * Display list of search result pages (for pagination).
-**#
-#macro( showSearchPager )
-    <h3 style="text-align:center;">
-    #set( $numPages = $searchResults.hits / $searchResults.limit )
-    #set( $remainder = $searchResults.hits % $searchResults.limit )
-    #if( $remainder > 0 )#set( $numPages = $numPages + 1 )#end
-    #if( $numPages > 1 )
-        #foreach( $pageNum in [1..$numPages] )
-            #set( $i = $pageNum - 1 )
-            #set( $start = $searchResults.limit * $i )
-            <a href="?q=${utilities.encode($searchResults.term)}&${USERNAME_KEY}=$!{username}&n=${searchResults.limit}&o=${start}"
-               >$pageNum</a>#if( $pageNum != $numPages) | #end
-        #end
-    #end
-    </h3>
-#end
-
-
-## ======================================================================== 
-## Other macros 
-## ======================================================================== 
-
-
-#**
- * Print status/error message if exists.
- * Note: "error" and "status" styles should be moved out into
- * invididual Themes' theme.css files.
- **#
-#macro( showStatusMessage )
-    #if( $errorMessage )
-        <span class="error">$errorMessage</span>
-    #end
-    #if( $statusMessage )
-        <span class="status">$statusMessage</span>
-    #end
-#end
-
-
-
-
-#**
- * Set the META tag for ContentLanguage.  We do this rather than
- * setting the Response header because the header does not get
- * cached.  So in order to maintain the ContentType we must present
- * it inside the rendered page itself.
-**#
-#macro( showContentLanguage $lang )
-    <meta http-equiv="Content-Language" content="$lang">
-#end
-
-
-#**
- * Display language form for selection a different language.  This is only a form, no div
- * or anything around it.
- *#
-#macro( showLanguageForm )
-    ## first check for errors during possible previous langauge change
-    #if ($languageError)
-        <p>$languageError</p>
-    #end
-
-    #set( $locales = $pageHelper.getSupportedLanguages() )
-    #if ($locales)
-       #foreach($locale in $locales)
-          <a class="imageLink" href="$ctxPath/language${pageHelper.getPathInfo()}?language=${locale}">
-             <img src="$ctxPath/images/flag_${locale.toString().toLowerCase()}.gif" alt="${locale.getDisplayLanguage()}" />
-          </a>
-          <br />
-       #end
-    #else
-        <p>$text.get("macro.weblog.nolanguages")</p>
-    #end
-#end
-
-
-## ======================================================================== 
-## Deprecated macros 
-## ======================================================================== 
-
-
-#**
- * (DEPRECATED) Shows list of links for recent weblog entries in one category
- * using the link field (which is no longer exposed in the editor UI).
- * You should use showRecentEntriesInCategory() instead.
- *
- * @param numEntries Maximum number of entries to display
- * @param cat        Category to be displayed 
-**#
-#macro( showRecentEntryLinksInCategory $numEntries $cat)
-   #set( $xmap = $pageModel.getRecentWeblogEntries($numEntries, $cat) )
-   <ul class="linkblog">
-   #foreach( $day in $xmap.keySet() )
-       #set( $recentEntries = $xmap.get($day) )
-       #foreach ($var in $recentEntries)
-           <li class="linkblog">
-           #if ($var.link)
-              <a href="$var.link" title="$utilities.removeAndEscapeHTML($var.text)">$var.title</a>
-           #else
-              $var.title
-           #end
-           #if ($pageHelper.isUserAuthorizedToEdit())
-              &nbsp;[<a href="$pageHelper.getEntryEditUrl($var)">$text.get( "macro.weblog.editentry" )</a>]
-           #end
-           </li>
-       #end
-   #end
-   </ul>
-#end
-
-
-#**
- * (DEPRECATED) Shows list of links for recent weblog entries in all categories
- * using the link field (which is no longer exposed in the editor UI). 
- * You should use showRecentEntries() instead.
-**#
-#macro( showRecentEntryLinks $numEntries )
-#showRecentEntryLinksInCategory($numEntries "nil")
-#end
-
-
-#**
- * (DEPRECATED) Shows weblog entries by calling showWeblogEntriesInCategory(), 
- * but passes category of 'nil' to indicate that all categories are to be 
- * included. You should use displayWeblogEntries() instead.
- * 
- * @param pageName   Page name of page to serve as day template.
- * @param maxEntries (ignored)
- *#
-#macro( showWeblogEntries $pageName $maxEntries )
-#showWeblogEntriesInCategory($pageName $maxEntries 'nil')
-#end
-
-
-#**
- * (DEPRECATED) This macro does nothing because now, next/prev links are 
- * built-into the showWeblogEntries() macro. 
- *#
-#macro( showNextPreviousLinks )
-   <!-- 
-   showNextPreviousLinks() is no longer needed as next/prev links are 
-   built-into the #showRecentEntries() macro.
-   -->
-#end
 
+# macros for use with WeblogPageModel

Modified: incubator/roller/branches/roller_3.0/web/themes/atlas/_macros.vm
URL: http://svn.apache.org/viewvc/incubator/roller/branches/roller_3.0/web/themes/atlas/_macros.vm?rev=414838&r1=414837&r2=414838&view=diff
==============================================================================
--- incubator/roller/branches/roller_3.0/web/themes/atlas/_macros.vm (original)
+++ incubator/roller/branches/roller_3.0/web/themes/atlas/_macros.vm Fri Jun 16 07:35:48 2006
@@ -32,351 +32,3 @@
 </tbody></table>
 #end 
 
-##-----------------------------------------------------------------------------
-#macro( showEntry $entry )
-<div class="entry">
-    <span class="entryDetails">
-        <a href="$utilities.textToHTML($entry.permaLink)">
-        <b>$utilities.removeHTML($entry.title)</b></a><br /> 
-        $entry.website.name 
-        #if($entry.category.name)| $entry.category.name #end
-        #if($entry.pubTime)| #formatDate($text.get("macro.weblog.date.toStringFormat") $entry.pubTime) #end
-        #if($entry.creator.userName)| By $entry.creator.userName #end
-        <br/> 
-    </span>
-    <span class="entryDescription">
-        #set($content = $utilities.removeHTML($entry.text))
-        $utilities.truncateNicely($content, 240, 260, "...")
-    </span>
-</div>
-#end
-
-##-----------------------------------------------------------------------------
-#macro(showEntriesPager $entries $maxResults)
-    #if($entries.size() > 0)
-        #set($entryCount = $entries.size() - 1)
-        #set($startDate = $entries.get(0).pubTime)
-        #set($endDate = $entries.get($entryCount).pubTime)
-    #end
-    #foreach($entry in $entries)
-        #if($velocityCount < $maxResults)
-            #showEntry($entry)
-        #end
-    #end
-    <div class="nextPrev">
-    #if($offset >= $maxResults - 1)
-       #set($prevOffset = $offset - ($maxResults - 1))
-       <a href="?offset=$prevOffset">&lt; Newer</a>
-    #end
-    &nbsp;
-    #if($entries.size() > $maxResults - 1)
-       #set($nextOffset = $offset + $maxResults - 1)
-       <a href="?offset=$nextOffset">Older &gt;</a>
-    #end
-    </div>
-#end
-
-##-----------------------------------------------------------------------------
-#macro(showWeblogProfile $weblog)
-    <h2 class="pageTitle">Weblog: $weblog.name</h2> 
-    <table>
-        <tr>
-            <td>Handle</td>
-            <td>$weblog.handle</td>
-        </tr>
-        <tr>
-            <td>Description</td>
-            <td>$weblog.description</td>
-        </tr>
-        <tr>
-            <td>Created by</td>
-            <td><$weblog.creator.fullName/td>
-        </tr>
-        <tr>
-            <td>Last modified</td>
-            <td>$weblog.lastModified</td>
-        </tr>
-        <tr>
-            <td>Locale</td>
-            <td>$!weblog.locale</td>
-        </tr>
-        <tr>
-            <td>Timezone</td>
-            <td>$weblog.timeZone</td>
-        </tr>
-    </table>
-
-    <h2 class="pageTitle">Weblog users</h2>
-    #set($users = $sitePageModel.getWeblogsUsers($weblog.handle))
-    <table class="rollertable">
-        <thead>
-            <tr>
-                <th>Username</th>
-                <th>Full name</th>
-            </tr>
-        </thead>    
-        #foreach($user in $users) 
-        <tr>
-            <td>$user.userName</td>
-            <td>$user.fullName</td>
-        </tr>
-        #end
-    </table>
-
-    <h2 class="pageTitle">Recent posts</h2>
-    #set($entries = $sitePageModel.getWeblogEntries($weblog.handle, 'nil', 'nil', 90, 0, 5)) 
-    #if($entries.size() > 0)  
-        <table class="rollertable"> 
-        <thead>
-            <tr>
-                <th>User</th>
-                <th>Pub. time</th>
-                <th>Title</th>
-            </tr>
-        </thead>  
-        #foreach($entry in $entries)
-            <tr>
-                <td>$entry.creator.userName</td>
-                <td>#formatDate($text.get("macro.weblog.date.toStringFormat") $entry.pubTime)</td>
-                <td><a href="$utilities.textToHTML($entry.permaLink)">
-                    $utilities.removeHTML($entry.title)</a></td>
-            </tr>
-        #end
-        </table>
-    #else
-        No posts in past 90 days
-    #end
-
-#end
-
-
-##-----------------------------------------------------------------------------
-#macro(showWeblogDirectory)
-    #if($pageModel.getRequestParameter("letter"))
-        #set($chosenLetter = $pageModel.getRequestParameter("letter"))
-    #else
-        #set($chosenLetter = "A")
-    #end
-
-    #set($weblogLetterMap = $sitePageModel.getWeblogHandleLetterMap())
-    <div class="letterMap">
-    #foreach($letter in $weblogLetterMap.keySet())
-        #set($letterCount = $weblogLetterMap.get($letter))
-        #if($letter == $chosenLetter)<span style="font-size:120%; font-weight:bold">#end
-        #if($letterCount > 0)
-           <a href="?letter=$letter" title="$letterCount weblogs">$letter</a>         
-        #else
-           $letter
-        #end
-        #if($letter == $chosenLetter)</span>#end
-    #end
-    </div>
-
-    #if($pageModel.getRequestParameter("offset"))
-        #set($offset = $pageModel.getIntRequestParameter("offset"))
-    #else
-        #set($offset = 0)
-    #end
-
-    #if($chosenLetter)
-        <h2 class="pageTitle">Weblogs starting with $chosenLetter</h2>
-        #set($weblogs = $sitePageModel.getWeblogsByLetter($chosenLetter, $offset, $maxResults))
-        <table class="rollertable">
-            <thead>
-                <tr>
-                    <th>Handle</th>
-                    <th>Profile</th>
-                    <th>Name</th>
-                </tr>
-            </thead>
-        #foreach($weblog in $weblogs)
-            #if($velocityCount < $maxResults)
-               <tr>
-                  <td><a href="$baseURL/page/$weblog.handle">$weblog.handle</a></td>
-                  <td><a href="?weblog=$weblog.handle">Profile</a></td>
-                  <td>$weblog.name</td>
-               </tr>
-            #end
-        #end 
-        </table>
-        #if($offset >= $maxResults - 1)
-           #set($prevOffset = $offset - ($maxResults - 1))
-           <a href="?letter=$chosenLetter&offset=$prevOffset">&lt;prev</a>
-        #end
-        #if(($offset >= $maxResults - 1) && ($weblogs.size() > $maxResults - 1)) &nbsp;|&nbsp; #end
-        #if($weblogs.size() > $maxResults - 1)
-           #set($nextOffset = $offset + $maxResults - 1)
-           <a href="?letter=$chosenLetter&offset=$nextOffset">next &gt;</a>
-        #end
-    #end
-#end
-
-##-----------------------------------------------------------------------------
-#macro(showUserProfile $user)
-    <h2 class="pageTitle">User: $user.fullName</h2>
-    <table>
-        <tr>
-            <td>Username</td>
-            <td>$user.userName</td>
-        </tr>
-        <tr>
-            <td>Created</td>
-            <td>$user.dateCreated</td>
-        </tr>
-        <tr>
-            <td>Locale</td>
-            <td>$user.locale</td>
-        </tr>
-        <tr>
-            <td>Timezone</td>
-            <td>$user.timeZone</td>
-        </tr>
-    </table>
-
-    <h2 class="pageTitle">User's weblogs</h2>
-    #set($weblogs = $sitePageModel.getUsersWeblogs($user.userName))
-    #if($perms.size() > 0)
-    <table class="rollertable">
-        <thead>
-            <tr>
-                <th>Handle</th>
-                <th>Name</th>
-            </tr>
-        </thead>    
-        #foreach($weblog in $weblogs) 
-        <tr>
-            <td><a href="$baseURL/page/$weblog.handle">$weblog.handle</a></td>
-            <td>$weblog.name</td>
-        </tr>
-        #end
-    </table>
-    #else
-       User does not belong to any weblogs
-    #end
-
-    <h2 class="pageTitle">User's recent posts</h2>
-    #set($entries = $sitePageModel.getWeblogEntries('nil', $user.userName, 'nil', 90, 0, 5)) 
-    #if($entries.size() > 0)  
-        <table class="rollertable"> 
-        <thead>
-            <tr>
-                <th>Blog</th>
-                <th>Pub. time</th>
-                <th>Title</th>
-            </tr>
-        </thead>  
-        #foreach($entry in $entries)
-            <tr>
-                <td><a href="$entry.website.url">$entry.website.handle</a></td>
-                <td>#formatDate($text.get("macro.weblog.date.toStringFormat") $entry.pubTime)</td>
-                <td><a href="$utilities.textToHTML($entry.permaLink)">
-                    $utilities.removeHTML($entry.title)</a></td>
-            </tr>
-        #end
-        </table>
-    #else
-        No posts in past 90 days
-    #end
-#end
-
-##-----------------------------------------------------------------------------
-#macro(showUserDirectory)
-    #if($pageModel.getRequestParameter("letter"))
-        #set($chosenLetter = $pageModel.getRequestParameter("letter"))
-    #else
-        #set($chosenLetter = "A")
-    #end
-
-    #set($userLetterMap = $sitePageModel.getUserNameLetterMap())
-    <div class="letterMap">
-    #foreach($letter in $userLetterMap.keySet())
-        #set($letterCount = $userLetterMap.get($letter))
-        #if($letter == $chosenLetter)<span style="font-size:120%; font-weight:bold">#end
-        #if($letterCount > 0)
-           <a href="?letter=$letter" title="$letterCount users">$letter</a>
-        #else
-           $letter
-        #end
-        </span>
-    #end
-    </div>
-
-    #if($pageModel.getRequestParameter("offset"))
-        #set($offset = $pageModel.getIntRequestParameter("offset"))
-    #else
-        #set($offset = 0)
-    #end
-
-    #if($chosenLetter)
-        <h2 class="pageTitle">Users starting with $chosenLetter</h2>
-        #set($users = $sitePageModel.getUsersByLetter($chosenLetter, $offset, $maxResults))
-        <table class="rollertable">
-            <thead>
-                <tr>
-                    <th>Username</th>
-                    <th>Profile</th>
-                    <th>Full name</th>
-                </tr>
-            </thead>
-        #foreach($u in $users)
-            #if($velocityCount < $maxResults)
-               <tr>
-                  <td>$u.userName</td>
-                  <td><a href="?userName=$u.userName">Profile</a></td>
-                  <td>$u.fullName</td>
-               </tr>
-            #end
-        #end 
-        </table>
-        #if($offset >= $maxResults - 1)
-           #set($prevOffset = $offset - ($maxResults - 1))
-           <a href="?letter=$chosenLetter&offset=$prevOffset">&lt;prev</a>
-        #end
-        #if(($offset >= $maxResults - 1) && ($weblogs.size() > $maxResults - 1)) &nbsp;|&nbsp; #end
-        #if($users.size() > $maxResults - 1)
-           #set($nextOffset = $offset + $maxResults - 1)
-           <a href="?letter=$chosenLetter&offset=$nextOffset">next &gt;</a>
-        #end
-    #end
-#end
-
-##-----------------------------------------------------------------------------
-#macro(showCommentsPager $comments $maxResults)
-    #if($comments.size() > 0)
-        #set($commentCount = $comments.size() - 1)
-        #set($startDate = $comments.get(0).postTime)
-        #set($endDate = $comments.get($commentCount).postTime)
-    #end
-
-    #foreach($comment in $comments)
-        #if($velocityCount < $maxResults)
-            <div class="entry">
-                <span class="entryDetails">
-                    <a href="${baseURL}$utilities.textToHTML($comment.weblogEntry.permaLink)">
-                        <b>Re: $utilities.removeHTML($comment.weblogEntry.title)</b></a><br /> 
-                    Posted on <a href="$baseURL/$comment.weblogEntry.website.handle">
-                        $utilities.removeHTML($comment.weblogEntry.website.name)</a> 
-                    #if($comment.name) | Posted by $comment.name #end
-                    | $comment.postTime<br/> 
-                </span>
-                <span class="entryDescription">
-                    #set($content = $utilities.removeHTML($comment.content))
-                    $utilities.truncateNicely($content, 240, 260, "...")
-                </span>
-            </div>
-        #end
-    #end
- 
-    <div class="nextPrev">
-    #if($offset >= $maxResults - 1)
-       #set($prevOffset = $offset - ($maxResults - 1))
-       <a href="?offset=$prevOffset">&lt; Newer</a>
-    #end
-    &nbsp;
-    #if($comments.size() > $maxResults - 1)
-       #set($nextOffset = $offset + $maxResults - 1)
-       <a href="?offset=$nextOffset">Older &gt;</a>
-    #end
-    </div>
-
-#end
\ No newline at end of file



Mime
View raw message