#includeTemplate($model.weblog "_header") 

#set($maxResults = 25)
#set($since = 365)

    <div id="centercontent_wrap">
        <div id="centercontent">  
            <h1>$config.siteName</h1>
            <p class="subtitle">$config.siteDescription</p> 

            <table class="menuTabTable" cellspacing="0"><tbody><tr>
               <td class="menuTabSelected">
                  <div class="menu-tr">
                     <div class="menu-tl">
                        &nbsp;&nbsp;<a href="$url.home">Recent Entries</a>&nbsp;&nbsp; 
                     </div>
                  </div>
               </td>	
               <td class="menuTabSeparator"></td>
               <td class="menuTabUnselected">
                  <div class="menu-tr">
                     <div class="menu-tl">
                        &nbsp;&nbsp;<a href="$url.page("directory")">Weblog Directory</a>&nbsp;&nbsp; 
                     </div>
                  </div>
               </td>	    
               <td class="menuTabSeparator"></td>
            </tr></tbody></table>
            <table class="menuItemTable" cellspacing="0"><tbody><tr>
            <td class="padleft"></td></tr></tbody></table>

            <div id="tabContent">
                <div id="recentEntries">
                  
                    #if (!$model.results)
                        ## 1) SITE-WIDE entries (the default)
                        #set($pager = $site.getWeblogEntriesPager($since, $maxResults))

                        ## 2) PLANET-entries
                        ## set($pager = $planet.getAggregationPager($since, $maxResults))
                        ## The below pager code should work against either:

                        #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

                         #if(!$pager.nextLink)
                            #set($pinnedEntries = $site.getPinnedWeblogEntries(5))
                            #foreach($pinnedEntry in $pinnedEntries)
                                <div class="entry">
                                    <a class="entryTitle" href="$utils.escapeHTML($pinnedEntry.permalink)">
                                        $utils.truncateNicely($utils.removeHTML($pinnedEntry.title), 50, 50, "...")
                                    </a><br /> 
                                    <p class="entryDetails">
                                        <a href="$utils.escapeHTML($pinnedEntry.website.URL)">$pinnedEntry.website.name</a>
                                        #if($pinnedEntry.category.name)| $pinnedEntry.category.name #end
                                        #if($pinnedEntry.pubTime) | $utils.formatDate($pinnedEntry.pubTime, $text.get("macro.weblog.date.toStringFormat")) #end
                                        #if($pinnedEntry.creator.screenName)| By $pinnedEntry.creator.screenName #end
                                        <br/> 
                                    </p>
                                    <p class="entryDescription">                    
                                        $pinnedEntry.displayContent
                                   </p>
                                </div>
                            #end
                        #end 

                        #foreach($entry in $pager.items)
                            #if($velocityCount <= $maxResults)
                                #includeTemplate($model.weblog "_entry")
                            #end
                        #end

                        <div class="pagingcontrols">
                        #if($pager.nextLink)
                           <a href="$pager.nextLink">&lt; $pager.nextName</a>
                        #end
                        #if($pager.nextLink && $pager.prevLink)
                           &nbsp;|&nbsp;
                        #end
                        #if($pager.prevLink)
                           <a href="$pager.prevLink">$pager.prevName &gt;</a>
                        #end
                        </div>

                    #else
                        ## We've got search results to display
                        #set($pager = $model.getWeblogEntriesPager())

                        <h2>Search results</h2>
                        <div class="next-previous">
                            #showWeblogSearchAgainForm($model.weblog)
                            #if($model.hits > 0)
                                #showNextPrevSearchControl($pager)
                            #end
                        </div>
                        <br />
                        <br />

                        #set($map = $pager.getEntries())
                        #foreach($day in $map.keySet())
                            #set($entries = $map.get($day))   
                            #foreach($entry in $entries)
                                #includeTemplate($model.weblog "_entry")
                            #end
                        #end

                    #end

                </div>
            </div>
                                    
            <br />
            <a href='$url.feed.entries.rss' title='Combined RSS feed for site.'>
            <img src='$url.absoluteSite/images/rssbadge.gif' border="0" alt='Combined RSS feed for site.' />
            </a>
            Right-click, copy link and paste into your newsfeed reader

        </div> 
    </div> 

    <div id="rightcontent_wrap">
        <div id="rightcontent"> 

           <div class="searchSidebarHead">
               <div class="menu-tr">
                   <div class="menu-tl">
                      <h3>&nbsp;</h3>
                   </div>

               </div>
           </div>

           <div class="searchSidebarBody">
                <h3>Search for blogs</h3>
                #showWeblogSearchForm($model.weblog false)
            </div>

            <br />
            <div class="sidebarBodyHead">
                <div class="menu-tr">
                    <div class="menu-tl">
                       <h3>Hot blogs (today's hits)</h3>		
                    </div>
                </div>
            </div>	

            <div class="sidebarBody">  
                #set($hotblogs = $site.getHotWeblogs($since, $maxResults))
                <ul>
                   #foreach($blog in $hotblogs)
                   <li><a href="$url.site/$blog.subjectNameShort">$blog.subjectNameShort</a> | $blog.count</li>
                   #end
                </ul>   
                <br />		
            </div>
            
            #* TODO does not work on frontpage as $url.tag($tag.name) returns the url 
               of this weblog eg frontpage/tags/$tag.name and there is no page for this.
            <br />
            <div class="sidebarBodyHead">
                <div class="menu-tr">
                    <div class="menu-tl">
                       <h3>Hot Tags</h3>		
                    </div>
                </div>
            </div>	

            <div id="tagbin" class="sidebarBody">  
                #set($sitetags = $site.getPopularTags(-1, 100))
                #foreach ($tag in $sitetags)
                    #if ($tag.count > 4)
                        <a class="tag s${tag.intensity}" href="$url.tag($tag.name)"
                            title="$tag.count">$tag.name</a>
                    #end
                #end
            </div>*#
            

        </div>
    </div>

</div> <!-- wrapper -->

#includeTemplate($model.weblog "_footer")
