  
                    





          
          
  




<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh" xml:lang="zh">
  <head>
                    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
                                    <title>BROPEN - Macros for the Blog application (Blog.BlogCode)</title>
                        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
                <link rel="shortcut icon" href="/xwiki/resources/favicon.ico" />
        <link rel="icon" href="/xwiki/resources/favicon16.png" type="image/png" />
                <link rel="apple-touch-icon" href="/xwiki/resources/favicon144.png" />
                <meta http-equiv="Content-Script-Type" content="text/javascript" />
                        <meta http-equiv="imagetoolbar" content="no"/>
                                <link rel="canonical" href="xwiki.Blog.BlogCode.html" />
                            <meta name="document" content="Blog.BlogCode"/>
    <meta name="wiki" content="xwiki"/>
    <meta name="space" content="Blog"/>
    <meta name="page" content="BlogCode"/>
    <meta name="version" content="2.1"/>
    <meta name="restURL" content="/xwiki/rest/wikis/xwiki/spaces/Blog/pages/BlogCode"/>
    <meta name="form_token" content="M0RTFnbukPMxqk7kGFYj2A"/>
                <meta name="gwt:property" content="locale=zh" />
                <meta name="revisit-after" content="7 days" />
<meta name="description" content="Macros for the Blog application" />
<meta name="keywords" content="wiki" />
<meta name="distribution" content="GLOBAL" />
<meta name="rating" content="General" />
<meta name="author" content="Administrator" />
<meta http-equiv="reply-to" content="" />
<meta name="language" content="zh" />
<link rel="alternate" type="application/rss+xml" title="Wiki Feed RSS" href="https://www.bropen.com.cn/xwiki/bin/view/Main/WebRss?xpage=rdf" />
<link rel="alternate" type="application/rss+xml" title="Blog RSS Feed" href="https://www.bropen.com.cn/xwiki/bin/view/Blog/GlobalBlogRss?xpage=plain" />

                <!-- com.xpn.xwiki.plugin.skinx.LinkExtensionPlugin -->
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
<link href="skins/colibri/style.css?colorTheme=ColorThemes.Dusk" rel="stylesheet" type="text/css" media="all" />
<link href="skins/colibri/print.css?colorTheme=ColorThemes.Dusk" rel="stylesheet" type="text/css" media="print" />
        <!--[if IE]>
  <link href="skins/colibri/ie-all.css?colorTheme=ColorThemes.Dusk" rel="stylesheet" type="text/css" />
<![endif]-->
    <!-- com.xpn.xwiki.plugin.skinx.CssResourceSkinExtensionPlugin -->
  <!-- com.xpn.xwiki.plugin.skinx.CssSkinExtensionPlugin -->
  <!-- com.xpn.xwiki.plugin.skinx.CssSkinFileExtensionPlugin -->

    



  
  
                                                                                                                                                                                                                      
    
      <!-- com.xpn.xwiki.plugin.skinx.JsResourceSkinExtensionPlugin -->
    <!-- com.xpn.xwiki.plugin.skinx.JsSkinFileExtensionPlugin -->
    <!-- com.xpn.xwiki.plugin.skinx.JsSkinExtensionPlugin -->

<script type="text/javascript" src="resources/js/xwiki/compatibility.js" defer="defer"></script>
<script type="text/javascript" src="resources/js/xwiki/markerScript.js" defer="defer"></script>
<script type="text/javascript">
// <![CDATA[
require.config({
  baseUrl: '/',
    paths: { 'jquery': "resources/js/amd/jquery" },
  map: {
    '*': { 'jquery': 'jQueryNoConflict' },
    'jQueryNoConflict': { 'jquery': 'jquery' }
  }
});
define('jQueryNoConflict', ['jquery'], function($) { $.noConflict(); return $; });
XWiki.webapppath = "xwiki/";
XWiki.servletpath = "bin/";
XWiki.contextPath = "/xwiki";
XWiki.mainWiki = "xwiki";
XWiki.currentWiki = "xwiki";
XWiki.currentSpace = "Blog";
XWiki.currentPage = "BlogCode";
XWiki.editor = "";
XWiki.viewer = "";
XWiki.contextaction = "export";
XWiki.docisnew = false;
XWiki.docsyntax = "xwiki/2.1";
XWiki.docvariant = "";
XWiki.blacklistedSpaces = [ "Import","Panels","Scheduler","Stats","XAppClasses","XAppSheets","XAppTemplates","XWiki","WatchCode","WatchSheets","XApp","WatchAdmin","Watch","ColorThemes","AnnotationCode" ];
XWiki.hasEdit = false;
XWiki.hasProgramming = false;
XWiki.hasBackupPackImportRights = false;
XWiki.hasRenderer = true;
window.docviewurl = "xwiki.Blog.BlogCode.html";
window.docediturl = "";
window.docsaveurl = "";
window.docgeturl = "";
// ]]>
</script>

		<script>var o = {
			name: 'XWikiGuest',
			username:'XWikiGuest',
			ip:'216.73.216.176, ::1',
															j:'98A5484EF53CE6C3F74E6F527F35D2B9'}</script>
  </head>
  <body id="body" class="wiki-xwiki space-Blog viewbody  doc-Blog_BlogCode admin_false">
<div id="xwikimaincontainer">
<div id="xwikimaincontainerinner">

  <div id="menuview">
    <div id="mainmenu" class="layoutsubsection actionmenu">
<div class="gradientfilterIE"></div>
<div class="componentcontainer">
<strong id="xwikimenutitle" class="hidden">一般动作</strong>
<div class="rightmenu">
      <div id="tmLogin" class="tmLogin topmenuentry ">
   <a class="tme" href=""><strong>登录</strong></a>
  </div>
  </div>
<div class="leftmenu">
            <div id="tmWiki" class="tmWiki topmenuentry dropdownmenuentry dropdownnolink hasIcon" onmouseover="showsubmenu(this);" onmouseout="hidesubmenu(this);">
<span class="tme-extensible">
              <span class="tmetype">Wiki: </span><a class="tme hastype" href=""><strong>BROPEN</strong></a>
         <span class="menuarrow">&#9660;</span><span class="hidden menucolon">: </span>
</span><span class="submenu hidden">
                        <span class="submenuitem "><a href="" id="tmWikiDocumentIndex" class="tmWikiDocumentIndex">Document Index</a></span>
            </span></div>
  <div class="topmenuentry"><span class="separator">&raquo;</span></div>
  <div id="tmSpace" class="tmSpace topmenuentry dropdownmenuentry dropdownnolink hasIcon" onmouseover="showsubmenu(this);" onmouseout="hidesubmenu(this);">
<span class="tme-extensible">
              <span class="tmetype">Space: </span><a class="tme hastype" href=""><strong>Blog</strong></a>
         <span class="menuarrow">&#9660;</span><span class="hidden menucolon">: </span>
</span><span class="submenu hidden">
              <span class="submenuitem "><a href="" id="tmSpaceDocumentIndex" class="tmSpaceDocumentIndex">Document Index</a></span>
      </span></div>
<div class="topmenuentry"><span class="separator">&raquo;</span></div>
  <div id="tmPage" class="tmPage topmenuentry hasIcon">
              <span class="tmetype">Page: </span><a class="tme hastype" href="xwiki.Blog.BlogCode.html"><strong>BlogCode</strong></a>
       </div>
</div>
</div>
</div>

  </div>
 <div id="headerglobal" class="layoutsection">
<div class="minwidthd"></div>
  <div id="company">
  <div id="companylogo">
    <a href="" title="Home" rel="home">
    <img src="/xwiki/resources/logo_bropen.png" alt="Wiki Logo"/>
    </a>
  </div>   </div>   <div id="globallinks">
        <form action="">
      <div class="globalsearch">
        <label class="hidden" for="headerglobalsearchinput">搜索</label><input class="globalsearchinput withTip" id="headerglobalsearchinput" type="text" name="text" value="查找中......" size="15"/><input class="button" type="image" value="查找" alt="查找" src="resources/icons/xwiki/search.png"/>
      </div>
    </form>
      <span class="glink" id="headerlanguages">
            <a href="xwiki.Blog.BlogCode.html" class="language-default language-current">default</a>
      </span>
  </div>   <div class="clearfloats"></div>
  </div> 

<div class="content" id="contentcontainer">
<div id="contentcontainerinner">
<div class="leftsidecolumns">
  <div id="contentcolumn"> 
        <div class="main layoutsubsection">
      <div id="contentmenu" class="actionmenu">
    <div class="gradientfilterIE"></div>
<div class="componentcontainer">
<strong id="xwikicontentmenutitle" class="hidden">页面动作</strong>
<div class="rightmenu">
</div>
<div class="leftmenu">
  <div id="tmExport" class="tmExport topmenuentry dropdownmenuentry dropdownnolink " onmouseover="showsubmenu(this);" onmouseout="hidesubmenu(this);">
<span class="tme-extensible">
   <a class="tme"><strong>导出</strong></a>
    <span class="menuarrow">&#9660;</span><span class="hidden menucolon">: </span>
</span><span class="submenu hidden">
    <span class="submenuitem "><a href="xwiki.Blog.BlogCode.html" id="tmExportPdf" class="tmExportPdf">以PDF格式导出</a></span>
    <span class="submenuitem "><a href="" id="tmExportRtf" class="tmExportRtf">以RTF格式导出</a></span>
  <span class="submenuitem "><a href="" id="tmExportHtml" class="tmExportHtml">以HTML格式导出</a></span>
    </span></div>
  <div id="tmMoreActions" class="tmMoreActions topmenuentry dropdownmenuentry dropdownnolink " onmouseover="showsubmenu(this);" onmouseout="hidesubmenu(this);">
<span class="tme-extensible">
   <a class="tme"><strong>更多动作</strong></a>
    <span class="menuarrow">&#9660;</span><span class="hidden menucolon">: </span>
</span><span class="submenu hidden">
  <span class="submenuitem "><a href="xwiki.Blog.BlogCode.html" id="tmPrintPreview" class="tmPrintPreview">打印预览</a></span>
  <span class="submenuitem "><a href="xwiki.Blog.BlogCode.html" id="tmViewSource" class="tmViewSource">察看源码</a></span>
  </span></div>
  </div>
</div>
    </div>
    <div id="mainContentArea">
  
   <div id="hierarchy">
                                          <a href=''>欢迎进入Wiki</a> <span class='separator'>&#187;</span> <a href=''>The Wiki Blog</a> <span class='separator'>&#187;</span> <span class='current'>Macros for the Blog application</span>
                      </div>

      <div id="document-title"><h1>Wiki源代码<a href="xwiki.Blog.BlogCode.html">Macros for the Blog application</a></h1></div>
                        <div id="document-info">
    <div class="xdocLastModification">       在2013-10-09 15:03上被<span class="wikilink"><a href="">Administrator</a></span>修改
    </div>
    <div>
                      <span id="commentsshortcut"><a href="xwiki.Blog.BlogCode.html">评论</a> <span class="itemCount">(0)</span></span>
               <span class="separator">&#183;</span>         <span id="attachmentsshortcut"><a href="xwiki.Blog.BlogCode.html">附件</a> <span class="itemCount">(0)</span></span>
               <span class="separator">&#183;</span>         <span id="historyshortcut"><a href="xwiki.Blog.BlogCode.html">记录</a></span>
               <span class="separator">&#183;</span>         <span id="informationshortcut"><a href="xwiki.Blog.BlogCode.html">信息</a></span>
          </div>
    <div class="clearfloats"></div>
  </div>

<div>
  <a href="xwiki.Blog.BlogCode.html" id="toggleLineNumbers">显示行号</a>
  <textarea readonly="readonly" class="wiki-code" rows="25" cols="80">{{include document=&quot;Blog.BlogParameters&quot;/}}

{{velocity output=&quot;false&quot;}}
##
##
##
## Import the blog skin and javascripts.
$!xwiki.ssx.use($blogStyleDocumentName)##
$!xwiki.jsx.use($blogScriptsDocumentName)##
##
##
##
#**
 * Prints a blog. This is the main macro used in the BlogSheet.
 * 
 * @param blogDoc the XDocument holding the blog definition object.
 *###
#macro(printBlog $blogDoc)
  {{include document='Blog.CreatePost'/}}
  #getBlogEntries($blogDoc $entries)
  #displayBlog($entries 'index' true true)
  #displayNavigationLinks($blogDoc)
#end
##
##
##
#**
 * Shows blog information. In view mode, the description is printed. In edit mode, allows changing blog settings: title,
 * description, blog type (global or in-space), index display type (fixed size pagination, weekly index, monthly index,
 * all entries).
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 *###
#macro(showBlogInfo $blogDoc)
  #if($blogDoc.getObject($blogClassname))
    ## Keep testing for inline action for backward compatibility with older blogs.
    #if($xcontext.action == 'edit' || $xcontext.action == 'inline')
      #macro(displayProperty $blogDoc $propname)
        ; #displayPropName($xwiki.getClass($blogClassname).get($propname)):
        : $blogDoc.display($propname)
      #end
      #displayProperty($blogDoc 'title')
      #displayProperty($blogDoc 'description')
      #displayProperty($blogDoc 'blogType')
      #displayProperty($blogDoc 'displayType')
      #displayProperty($blogDoc 'itemsPerPage')
    #else
      $blogDoc.display('description')
    #end
  #elseif($doc.fullName == $blogSheet)
= $services.localization.render('xe.blog.code.blogsheet') =
    {{translation key='xe.blog.code.sheetexplanation'/}}
  #else
    {{warning}}{{translation key='xe.blog.code.notblog'/}}{{/warning}}
  #end
#end
##
##
##
#**
 * Retrieve the blog document, which usually is either &lt;tt&gt;&amp;lt;Space&amp;gt;.WebHome&lt;/tt&gt; for whole-spaces blogs, or
 * &lt;tt&gt;&amp;lt;Space&amp;gt;.Blog&lt;/tt&gt; for in-space blogs. If none of these documents contains a blog object, then the first
 * (alphabetically) document in the target space that contains one is returned. Finally, if no document in the current
 * space contains a blog object, then &lt;tt&gt;Blog.WebHome&lt;/tt&gt; is returned as the default blog.
 * 
 * @param space A &lt;tt&gt;String&lt;/tt&gt;, the name of the space where to search.
 * @param blogDoc The resulting XDocument.
 *###
#macro(getBlogDocument $space $blogDoc)
  ## First, try the Space.WebHome, for a whole-space blog
  #set($result = $xwiki.getDocument(&quot;${space}.WebHome&quot;))
  #if(!$result.getObject($blogClassname))
    ## Second, try the Space.Blog document
    #set($result = $xwiki.getDocument(&quot;${space}.Blog&quot;))
    #if(!$result.getObject($blogClassname))
      ## Third, try searching for a blog document in the current space
      #set($blogDocs = $services.query.hql(&quot;, BaseObject obj where doc.space = ? and obj.name = doc.fullName and obj.className = '$blogClassname' order by doc.name&quot;).setLimit(1).setOffset(0).bindValues([${space}]).execute())
      #if($blogDocs.size() &gt; 0)
        #set($result = $xwiki.getDocument($blogDocs.get(0)))
      #else
        ## Last, fallback to Blog.WebHome, the default blog
        #set($result = $xwiki.getDocument('Blog.WebHome'))
      #end
    #end
  #end
  #set ($blogDoc = $NULL)
  #setVariable (&quot;$blogDoc&quot; $result)
#end
##
##
##
#**
 * Retrieve the blog title.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;tt&gt; object with the &lt;tt&gt;title&lt;/tt&gt; property set.
 * @param title The resulting title.
 *###
#macro(getBlogTitle $blogDoc $title)
  #getBlogProperty($blogDoc 'title' $!blogDoc.displayTitle $result)
  #set ($title = $NULL)
  #setVariable (&quot;$title&quot; $result)
#end
##
##
##
#**
 * Retrieve the blog description.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object with the &lt;tt&gt;description&lt;/tt&gt;
 *        property set.
 * @param description The resulting description.
 *###
#macro(getBlogDescription $blogDoc $description)
  #getBlogProperty($blogDoc 'description' '' $result)
  #set ($description = $NULL)
  #setVariable (&quot;$description&quot; $result)
#end
##
##
##
#**
 * Retrieves a list of entries to be displayed. The entries are either part of the blog's space, or have the blog
 * document set as a parent. The number and range of entries returned (from all those belonging to this blog) depends on
 * the blog display type: paginated (fixed number of entries), weekly (all entries in a week), monthly (all entries in a
 * month), or all.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 * @param entries The resulting list of entries to display, a list of XDocument names.
 *###
#macro(getBlogEntries $blogDoc $entries)
  #if (!$entries)
    #setVariable (&quot;$entries&quot; [])
  #end
  #getBlogEntriesBaseQuery($query)
  #isBlogGlobal($blogDoc $isGlobal)
  #if(!$isGlobal)
    #set($query = &quot;${query} and (doc.space = '${blogDoc.space}' or doc.parent = '${blogDoc.fullName}')&quot;)
  #end
  #getBlogDisplayType($blogDoc $displayType)
  #if($displayType == 'weekly')
    #getWeeklyBlogEntries($blogDoc $query $entries)
  #elseif($displayType == 'monthly')
    #getMonthlyBlogEntries($blogDoc $query $entries)
  #elseif($displayType == 'all')
    #getAllBlogEntries($blogDoc $query $entries)
  #else
    #getPagedBlogEntries($blogDoc $query $entries)
  #end
#end
##
##
##
#**
 * Retrieves a list of entries to be displayed. The entries are taken from a &quot;page&quot; of the blog, a sequence of documents
 * defined by the request parameters &lt;tt&gt;ipp&lt;/tt&gt; (items per page) and &lt;tt&gt;page&lt;/tt&gt; (the current page). Initially the
 * first page is displayed, with the number of entries defined in the blog object in the &lt;tt&gt;itemsPerPage&lt;/tt&gt; property 
 * (10 if not defined).
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 * @param query The base query for selecting entries. Apart from the base query that selects entries, it can further be
 *        refined to restrict to a given space, or to a given search criteria, etc.
 * @param entries The resulting list of entries to display, a list of XDocument names.
 *###
#macro(getPagedBlogEntries $blogDoc $query $entries)
  #if (!$entries)
    #setVariable (&quot;$entries&quot; [])
  #end
  #set($totalEntries = $services.query.hql($query).count())
  #getBlogProperty($blogDoc 'itemsPerPage' '10' $defaultItemsPerPage)
  #set($defaultItemsPerPage = $mathtool.toInteger($defaultItemsPerPage))
  ## This macro is defined in the default macros.vm library. It also sets $itemsPerPage and $startAt.
  #preparePagedViewParams($totalEntries $defaultItemsPerPage)
  #set($discard = $entries.addAll($services.query.hql(&quot;${query} order by publishDate.value desc&quot;).setLimit($itemsPerPage).setOffset($startAt).execute()))
#end
##
##
##
#**
 * Retrieves a list of entries to be displayed. The entries are taken from a week of the blog. The target week is
 * defined by the request parameters &lt;tt&gt;week&lt;/tt&gt; (the week number in the year, from 1 to 52) and &lt;tt&gt;year&lt;/tt&gt; (4 
 * digit year). Initially the current week is displayed.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 * @param query The base query for selecting entries. Apart from the base query that selects entries, it can further be
 *        refined to restrict to a given space, or to a given search criteria, etc.
 * @param entries The resulting list of entries to display, a list of XDocument names.
 *###
#macro(getWeeklyBlogEntries $blogDoc $query $entries)
  #if (!$entries)
    #setVariable (&quot;$entries&quot; [])
  #end
  #getRequestedWeek($weekDate)
  #set($dateFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern('yyyy-MM-dd'))
  #set($minDay = $dateFormatter.print($weekDate.toMutableDateTime().weekOfWeekyear().roundFloor()))
  #set($maxDay = $dateFormatter.print($weekDate.toMutableDateTime().weekOfWeekyear().roundCeiling()))
  #set($query = &quot;${query} and publishDate.value &gt;= '$minDay' and publishDate.value &lt; '$maxDay'&quot;)
  #set($totalEntries = $services.query.hql($query).count())
  #set($discard = $entries.addAll($services.query.hql(&quot;${query} order by publishDate.value desc&quot;).execute()))
#end
##
##
##
#**
 * Retrieves a list of entries to be displayed. The entries are taken from a month of the blog. The target month is
 * defined by the request parameters &lt;tt&gt;month&lt;/tt&gt; (the month number, from 1 to 12) and &lt;tt&gt;year&lt;/tt&gt; (4 
 * digit year). Initially the current month is displayed.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 * @param query The base query for selecting entries. Apart from the base query that selects entries, it can further be
 *        refined to restrict to a given space, or to a given search criteria, etc.
 * @param entries The resulting list of entries to display, a list of XDocument names.
 *###
#macro(getMonthlyBlogEntries $blogDoc $query $entries)
  #if (!$entries)
    #setVariable (&quot;$entries&quot; [])
  #end
  #getRequestedMonth($monthDate)
  #set($dateFormatter = $xwiki.jodatime.getDateTimeFormatterForPattern('yyyy-MM-dd'))
  #set($minDay = $dateFormatter.print($monthDate.toMutableDateTime().monthOfYear().roundFloor()))
  #set($maxDay = $dateFormatter.print($monthDate.toMutableDateTime().monthOfYear().roundCeiling()))
  #set($query = &quot;${query} and publishDate.value &gt;= '$minDay' and publishDate.value &lt; '$maxDay'&quot;)
  #set($totalEntries = $services.query.hql($query).count())
  #set($discard = $entries.addAll($services.query.hql(&quot;${query} order by publishDate.value desc&quot;).execute()))
#end
##
##
##
#**
 * Retrieves a list of entries to be displayed. All entries belonging to the current blog are returned.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 * @param query The base query for selecting entries. Apart from the base query that selects entries, it can further be
 *        refined to restrict to a given space, or to a given search criteria, etc.
 * @param entries The resulting list of entries to display, a list of XDocument names.
 *###
#macro(getAllBlogEntries $blogDoc $query $entries)
  #if (!$entries)
    #setVariable (&quot;$entries&quot; [])
  #end
  #set($totalEntries = $services.query.hql($query).count())
  #set($discard = $entries.addAll($services.query.hql(&quot;${query} order by publishDate.value desc&quot;).execute()))
#end
##
##
##
#**
 * Retrieves a list of entries to be displayed. Only (and all) unpublished entries are returned.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 * @param query The base query for selecting entries. Apart from the base query that selects entries, it can further be
 *        refined to restrict to a given space, or to a given search criteria, etc.
 * @param entries The resulting list of entries to display, a list of XDocument names.
 *###
#macro(getUnpublishedBlogEntries $blogDoc $query $entries)
  #if (!$entries)
    #setVariable (&quot;$entries&quot; [])
  #end
  #set($query = &quot;${query} and isPublished.value = 0&quot;)
  #set($totalEntries = $services.query.hql($query).count())
  #set($discard = $entries.addAll($services.query.hql(&quot;${query} order by publishDate.value desc&quot;).execute()))
#end
##
##
##
#**
 * Retrieves a list of entries to be displayed. The entries are taken from all the wiki, and not from a specific blog.
 * 
 * @param entries The resulting list of entries to display, a list of XDocument names.
 *###
#macro(getGlobalBlogEntries $entries)
  #if (!$entries)
    #setVariable (&quot;$entries&quot; [])
  #end
  #getBlogEntriesBaseQuery($query)
  #set($totalEntries = $services.query.hql($query).count())
  #set($defaultItemsPerPage = 20)
  ## This macro is defined in the default macros.vm library. It also sets $itemsPerPage and $startAt.
  #preparePagedViewParams($totalEntries $defaultItemsPerPage)
  #set($discard = $entries.addAll($services.query.hql(&quot;${query} order by publishDate.value desc&quot;).setLimit($itemsPerPage).setOffset($startAt).execute()))
#end
##
##
##
#**
 * Return the base query for selecting blog entries. It filters only visible entries, but does not bind to a specific
 * blog, nor specify a range or an ordering criteria.
 * 
 * @param query The basic query for selecting blog entries.
 *###
#macro(getBlogEntriesBaseQuery $query)
  #set ($query = $NULL)
  #setVariable (&quot;$query&quot; &quot;, BaseObject obj, IntegerProperty isPublished, IntegerProperty hidden, DateProperty publishDate 
    where doc.fullName &lt;&gt; '${blogPostTemplate}' and
      obj.name = doc.fullName and obj.className = '${blogPostClassname}' and
      publishDate.id.id = obj.id and publishDate.id.name = 'publishDate' and
      isPublished.id.id = obj.id and isPublished.id.name = 'published' and
      hidden.id.id = obj.id and hidden.id.name = 'hidden' and
      (doc.creator = '$xcontext.user' or (isPublished.value = 1 and hidden.value = 0))&quot;)
#end
##
##
##
#**
 * Checks if the provided blog is global or in-space.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object with the &lt;tt&gt;blogType&lt;/tt&gt; property set.
 * @param isGlobal The resulting boolean. If the blog object does not define anything, it is considered in-space.
 *###
#macro(isBlogGlobal $blogDoc $isGlobal)
  #getBlogProperty($blogDoc 'blogType' '' $discard)
  #set ($result = false)
  #if($discard == 'global')
    #set($result = true)
  #end
  #set ($isGlobal = $NULL)
  #setVariable (&quot;$isGlobal&quot; $result)
#end
##
##
##
#**
 * Determines how is the blog index split into pages: paginated (fixed number of entries), weekly (all entries in a
 * week), monthly (all entries in a month), or all.
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object with the &lt;tt&gt;displayType&lt;/tt&gt;
 *        property set.
 * @param displayType The resulting string. If the blog object does not define anything, it is considered paginated.
 *###
#macro(getBlogDisplayType $blogDoc $displayType)
  #getBlogProperty($blogDoc 'displayType' 'paginated' $result)
  #set ($displayType = $NULL)
  #setVariable (&quot;$displayType&quot; $result)
#end
##
##
##
#**
 * Displays a list of entries.
 * 
 * @param entries The entries to display, a list of XDocument names.
 * @param displaying What exactly is displayed: blog index, a single blog entry, a blog category, search results,
 *        unpublished entries, etc. This will be used as the classname(s) for the container div (hfeed). Currently
 *        used values: index, single, category, search, unpublished, hidden.
 * @param onlyExtract If &lt;tt&gt;true&lt;/tt&gt;, only display the extract of articles where available, otherwise display the full content.
 * @param shouldDisplayTitles If &lt;tt&gt;true&lt;/tt&gt;, display the blog title (blog posts shouldn't display the title when they're
 *        displayed alone on their page since it's the page title which is used in this case)
 *###
#macro(displayBlog $entries $displaying $onlyExtract $shouldDisplayTitles)
  #set($blogDay = '')
  (% class=&quot;hfeed $!{displaying}&quot; %)(((
  (% class=&quot;blogDay&quot; %)(((
  #foreach ($entryDoc in $xwiki.wrapDocs($entries))
    #getEntryObject($entryDoc $entryObj)
    ## Although all entries should have one of the two objects, better check to be sure.
    #if(&quot;$!{entryObj}&quot; != '')
      #getEntryDate($entryDoc $entryObj $entryDate)
      ## Display a &quot;calendar sheet&quot; for each day. All entries posted on the same day share one such sheet.
      #set($entryDateStr = $xwiki.formatDate($entryDate, 'yyyyMMMMdd'))
      #if($blogDay != $entryDateStr)
        #if($blogDay != '')
          )))
          (% class=&quot;blogDay&quot; %)(((
        #end
        #displayBlogDate($entryDate)
        #set ($blogDay = $entryDateStr)
      #end
      ## Finally, display the entry.
      #displayEntry($entryDoc $entryObj $onlyExtract $shouldDisplayTitles)
    #end
  #end
  )))## blogDay
  )))## hfeed
#end
##
##
##
#**
 * Get the entry object, either a new BlogPost or an old Article.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The resulting xobject of the blog post.
 *###
#macro(getEntryObject $entryDoc $entryObj)
  #set($result = $entryDoc.getObject(&quot;${blogPostClassname}&quot;))
  #if(!$result)
    #set($result = $entryDoc.getObject(&quot;${oldArticleClassname}&quot;))
  #end
  #set ($entryObj = $NULL)
  #setVariable (&quot;$entryObj&quot; $result)
#end
##
##
##
#**
 * Gets the date associated with a blog entry. This is the publication date. For unpublished entries, initially this is
 * the document creation date, but can be edited by the user.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 * @param result The resulting date, an instance of &lt;tt&gt;java.util.Date&lt;/tt&gt;.
 *###
#macro(getEntryDate $entryDoc $entryObj $result)
  #set ($result = $NULL)
  #setVariable (&quot;$result&quot; $entryObj.getProperty('publishDate').value)
#end
##
##
##
#**
 * Displays a date, nicely formatted as a calendar page.
 * 
 * @param date The date to display, an instance of &lt;tt&gt;java.util.Date&lt;/tt&gt;.
 *###
#macro(displayBlogDate $date)
  #set($year = $xwiki.formatDate($date, 'yyyy'))
  ## 3 letter month name, like Jan, Dec.
  #set($month = $xwiki.formatDate($date, 'MMM'))
  ## Uncomment to get a full length month name, like January, December.
  ## TODO: this could be defined somewhere in the blog style.
  ## #set($month = $xwiki.formatDate($date, 'MMMM'))
  #set($day = $xwiki.formatDate($date, 'dd'))
  (% class=&quot;blogdate&quot; %)
  == (% class=&quot;month&quot; %)$month(%%) (% class=&quot;day&quot; %)$day(%%) (% class=&quot;year&quot; %)$year(%%) ==
#end
##
##
##
#**
 * Displays a blog article: management tools, header, content, footer.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 * @param onlyExtract If &lt;tt&gt;true&lt;/tt&gt;, try to display only a summary of the entry, instead of the full content.
 * @param shouldDisplayTitle If &lt;tt&gt;true&lt;/tt&gt;, display the blog title (blog posts shouldn't display the title 
 *        when they're displayed alone on their page since it's the page title which is used in this case)
 *###
#macro(displayEntry $entryDoc $entryObj $onlyExtract $shouldDisplayTitle)
  ## Only articles with an explicit hidden setting or an explicit unpublished setting are hidden
  #isPublished($entryObj $isPublished)
  #isHidden($entryObj $isHidden)
  #if($doc.fullName == $entryDoc.fullName)
    (% class=&quot;hentry single-article&quot; %)(((
  #else
    (% class=&quot;hentry#if(!$isPublished) unpublished-article#elseif($isHidden) hidden-article#end&quot; %)(((
  #end
  #displayEntryTools($entryDoc $entryObj)
  #if($shouldDisplayTitle)
    #displayEntryTitle($entryDoc $entryObj)
  #end
  #if($doc.fullName == $entryDoc.fullName)
    #if(!$isPublished)
      {{warning}}{{translation key='xe.blog.code.published'/}}{{/warning}}
    #elseif($isHidden)
      {{warning}}{{translation key='xe.blog.code.hidden'/}}{{/warning}}
    #end
  #end
  #displayEntryContent($entryDoc $entryObj $onlyExtract)
  #displayEntryFooter($entryDoc $entryObj)
  )))## hentry
#end
##
##
##
#**
 * Checks if the provided blog is published or not.
 * 
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 * @param isPublished The resulting boolean, true if the entry is considered published.
 *###
#macro(isPublished $entryObj $isPublished)
  #set ($isPublished = $NULL)
  ## This should work for both old articles, which don't have the 'published' property at all, and
  ## are considered published by default, and new entries, that should have 1 if published.
  #if (&quot;$!{entryObj.getProperty('published').value}&quot; != '0')
    #setVariable (&quot;$isPublished&quot; true)
  #else
    #setVariable (&quot;$isPublished&quot; false)
  #end
#end
##
##
##
#**
 * Checks if the provided blog is hidden or not.
 * 
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;tt&gt; xclass.
 * @param isHiddel The resulting boolean, true if the entry is considered hidden.
 *###
#macro(isHidden $entryObj $isHidden)
  #set ($isHidden = $NULL)
  ## This should work for both old articles, which don't have the 'hidden' property at all, and
  ## are considered visible by default, and new entries, that should have 1 if hidden.
  #if (&quot;$!{entryObj.getProperty('hidden').value}&quot; == '1')
    #setVariable (&quot;$isHidden&quot; true)
  #else
    #setVariable (&quot;$isHidden&quot; false)
  #end
#end
##
##
##
#**
 * Displays several &quot;tools&quot; for manipulating blog posts: hide/show, publish, edit.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 *###
#macro(displayEntryTools $entryDoc $entryObj)
  #if($xcontext.action == 'view')
    (% class=&quot;blog-entry-toolbox&quot; %)(((
    #displayPublishButton($entryDoc $entryObj)
    #displayHideShowButton($entryDoc $entryObj)
    #displayEditButton($entryDoc $entryObj)
    #displayDeleteButton($entryDoc $entryObj)
    )))
  #end
#end
##
##
##
#**
 * Displays the publish button to the entry &lt;strong&gt;creator&lt;/strong&gt;, if the article is not published yet.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 * @todo AJAX calls.
 *###
#macro(displayPublishButton $entryDoc $entryObj)
  #isPublished($entryObj $isPublished)
  #if(!$isPublished &amp;&amp; $entryDoc.creator == $xcontext.user &amp;&amp; $xwiki.hasAccessLevel('edit', $xcontext.user, $entryDoc.fullName))
    [[{{html clean=&quot;false&quot;}}#toolImage('page_white_world' 'publish '){{/html}}&gt;&gt;path:$blogPublisher.getURL('view', &quot;entryName=${escapetool.url($entryDoc.fullName)}&amp;xredirect=${escapetool.url($thisURL)}&amp;form_token=$!{services.csrf.getToken()}&quot;)||title=&quot;${escapetool.xml($services.localization.render('xe.blog.code.notpublished'))}&quot;]]##
  #end
#end
##
##
##
#**
 * Displays the hide or show button to the entry &lt;strong&gt;creator&lt;/strong&gt;, if the article is already published.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 *###
#macro(displayHideShowButton $entryDoc $entryObj)
  #isPublished($entryObj $isPublished)
  #isHidden($entryObj $isHidden)
  ## Only published articles can be hidden. Unpublished articles are considered already hidden.
  #if($isPublished &amp;&amp; $entryDoc.creator == $xcontext.user &amp;&amp; $xwiki.hasAccessLevel('edit', $xcontext.user, $entryDoc.fullName))
    #if ($isHidden)
      [[{{html clean=&quot;false&quot;}}#toolImage('lock_open', 'show '){{/html}}&gt;&gt;path:$entryDoc.getURL('save', &quot;${entryObj.getxWikiClass().getName()}_${entryObj.number}_hidden=0&amp;comment=${escapetool.url($services.localization.render('xe.blog.code.madevisible'))}&amp;xredirect=${escapetool.url($thisURL)}&amp;form_token=$!{services.csrf.getToken()}&quot;)||class=&quot;blog-tool-show&quot; title=&quot;${escapetool.xml($services.localization.render('xe.blog.code.makevisible'))}&quot;]]##
    #else
      [[{{html clean=&quot;false&quot;}}#toolImage('lock', 'hide '){{/html}}&gt;&gt;path:$entryDoc.getURL('save', &quot;${entryObj.getxWikiClass().getName()}_${entryObj.number}_hidden=1&amp;comment=${escapetool.url($services.localization.render('xe.blog.code.hid'))}&amp;xredirect=${escapetool.url($thisURL)}&amp;form_token=$!{services.csrf.getToken()}&quot;)||class=&quot;blog-tool-hide&quot; title=&quot;${escapetool.xml($services.localization.render('xe.blog.code.hide'))}&quot;]]##
    #end
  #end
#end
##
##
##
#**
 * Displays the edit button to those that can edit the article.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 *###
#macro(displayEditButton $entryDoc $entryObj)
  #if($xwiki.hasAccessLevel('edit', $xcontext.user, $entryDoc.fullName))
    ## Call getDefaultEditMode() for backward compatibility with older blog posts.
    [[{{html clean=&quot;false&quot;}}#toolImage('pencil' 'edit '){{/html}}&gt;&gt;path:$entryDoc.getURL('edit')||title=&quot;${escapetool.xml($services.localization.render('xe.blog.code.editpost'))}&quot;]]##
  #end
#end
##
##
##
#**
 * Displays the delete button to those that can edit the article.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 * @todo AJAX calls.
 *###
#macro(displayDeleteButton $entryDoc $entryObj)
  #if($xwiki.hasAccessLevel('delete', $xcontext.user, $entryDoc.fullName))
    [[{{html clean=&quot;false&quot;}}#toolImage('cross' 'delete '){{/html}}&gt;&gt;path:$entryDoc.getURL('delete')||title=&quot;${escapetool.xml($services.localization.render('xe.blog.code.deletepost'))}&quot;]]##
  #end
#end
##
##
##
#**
 * Displays the title of the entry.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 *###
#macro(displayEntryTitle $entryDoc $entryObj)
  #if($doc.fullName == $entryDoc.fullName)
    (% class=&quot;entry-title&quot; %)
    = $entryDoc.display('title', 'view', $entryObj) =
  #else
    (% class=&quot;entry-title&quot; %)
    === [[$entryDoc.display('title', 'view', $entryObj)&gt;&gt;doc:$entryDoc]] ===
  #end
#end
##
##
##
#**
 * Displays the body of the entry.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 * @param onlyExtract If &lt;tt&gt;true&lt;/tt&gt;, try to display only a summary of the entry, instead of the full content.
 *###
#macro(displayEntryContent $entryDoc $entryObj $onlyExtract)
  (% class=&quot;#if($onlyExtract)entry-summary#{else}entry-content#end&quot; %)(((
  #getEntryContent($entryDoc $entryObj $onlyExtract $entryContent)
  {{html wiki=&quot;false&quot;}}$entryDoc.getRenderedContent($entryContent, $entryDoc.syntax.toIdString()){{/html}}
  ))) ## entry-content
#end
##
##
##
#**
 * Extracts the body of the entry that should be displayed. If &lt;tt&gt;onlyExtract&lt;/tt&gt; is &lt;tt&gt;true&lt;/tt&gt;, display the content
 * of the &lt;tt&gt;extract&lt;/tt&gt; field (if not empty).
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 * @param onlyExtract If &lt;tt&gt;true&lt;/tt&gt;, try to display only a summary of the entry, instead of the full content.
 * @param entryContent The resulting content.
 *###
#macro(getEntryContent $entryDoc $entryObj $onlyExtract $entryContent)
  #if ($onlyExtract)
    #set ($result = $entryObj.getProperty('extract').value)
  #end
  #if(&quot;$!result&quot; == '')
    #set($result = $entryObj.getProperty('content').value)
#* Disabled until the content can be cleanly cut.
*    #if($onlyExtract &amp;&amp; $result.length()&gt;$maxchars)
*      #set($i = $result.lastIndexOf(&quot; &quot;, $maxchars))
*      #set($i = $i + 1)
*      #set($result = &quot;${result.substring(0,$i)} *[...&gt;${entryDoc.fullName}]*&quot;)
*    #end
## *###
  #else
    #if($entryDoc.syntax.toIdString() == 'xwiki/1.0')
      #set($result = &quot;${result} &lt;a href='${entryDoc.getURL()}' title='$services.localization.render('xe.blog.code.readpost')'&gt;...&lt;/a&gt;&quot;)
    #else
      #set($result = &quot;${result} [[...&gt;&gt;${entryDoc}||title='$services.localization.render('xe.blog.code.readpost')']]&quot;)
    #end
  #end
  #set ($entryContent = $NULL)
  #setVariable (&quot;$entryContent&quot; $result)
#end
##
##
##
#**
 * Displays the footer of the entry.
 * 
 * @param entryDoc The xdocument of the blog post. Each post resides in its own document.
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 *###
#macro(displayEntryFooter $entryDoc $entryObj)
  (% class=&quot;entry-footer&quot; %)(((
  #isPublished($entryObj $isPublished)
  #if($isPublished)
    {{translation key='xe.blog.code.postedby'/}} ##
  #else
    {{translation key='xe.blog.code.createdby'/}} ##
  #end
  {{html wiki=&quot;false&quot;}}
  &lt;address class=&quot;author vcard&quot;&gt;#userfn($entryDoc.creator)&lt;/address&gt; ##
  #getEntryDate($entryDoc $entryObj $entryDate)
  #listCategories($entryObj) ##
  ## Since the publish date and update date are not set at the exact same time, there could be a small difference that
  ## we assume cannot be more than 3 seconds.
  {{/html}}
  (% class=&quot;separator&quot; %)&middot;(%%) [[{{translation key='xe.blog.code.permalink'/}}&gt;&gt;$entryDoc||rel=&quot;bookmark&quot;]] ##
  (% class=&quot;separator&quot; %)&middot;(%%) [[{{translation key='xe.blog.code.comments'/}}&gt;&gt;$entryDoc||anchor=&quot;Comments&quot;]] (% class=&quot;itemCount&quot; %)($entryDoc.comments.size())(%%) ##
  )))## entry-footer
#end
##
##
##
#**
 * List the categories an entry belongs to. Used in the footer. The categories are instances of &lt;tt&gt;Blog.CategoryClass&lt;/tt&gt;.
 * 
 * @param entryObj The xobject of the blog post, an instance of the &lt;tt&gt;Blog.BlogPostClass&lt;/tt&gt; xclass.
 *###
#macro(listCategories $entryObj)
  #if($entryObj.getxWikiClass().getName() == $blogPostClassname)
    #set($categories = $entryObj.getProperty('category').value)
    #set($first = true)
    #if($categories.size() &gt; 0)
      #foreach($category in $categories)
## Do not indent
#set($categoryDoc = $!xwiki.getDocument($category))
#if(!$categoryDoc.isNew() &amp;&amp; $categoryDoc.getObject(${blogCategoryClassname}))
#if($first)
 &lt;span class=&quot;separator&quot;&gt;&amp;#183;&lt;/span&gt; $services.localization.render('xe.blog.code.categories')
#set($first = false)
#else, #end## if first
&lt;a rel=&quot;tag&quot; href=&quot;$xwiki.getURL(${category})&quot;&gt;$!{escapetool.xml($!xwiki.getDocument($category).getObject($blogCategoryClassname).getProperty('name').value)}&lt;/a&gt;##
#end## if isNew
#end## foreach
    #end
  #end
#end
##
##
##
#**
 * Displays blog pagination links (older and newer entries).
 * 
 * @param blogDoc the XDocument holding the blog definition object.
 *###
#macro(displayNavigationLinks $blogDoc)
  (% class=&quot;clearfloats&quot; %)((()))
  #getBlogDisplayType($blogDoc $displayType)
  #if($displayType == 'weekly')
    (% class=&quot;pagingLinks&quot; %)(((
    #getRequestedWeek($weekDate)
    $weekDate.addWeeks(-1)##
    (% class=&quot;prevPage&quot; %)**[[&laquo; {{translation key='xe.blog.code.previousweek'/}}&gt;&gt;$doc.name||queryString=&quot;year=$weekDate.weekyear&amp;week=$weekDate.weekOfWeekyear&quot;]]**(%%)
    #sep()
    $weekDate.addWeeks(2)## 2 because we already subtracted 1 above
    (% class=&quot;nextPage&quot; %)**[[{{translation key='xe.blog.code.nextweek'/}} &raquo;&gt;&gt;$doc.name||queryString=&quot;year=$weekDate.weekyear&amp;week=$weekDate.weekOfWeekyear&quot;]]**(%%)
    )))
  #elseif($displayType == 'monthly')
    (% class=&quot;pagingLinks&quot; %)(((
    #getRequestedMonth($monthDate)
    $monthDate.addMonths(-1)##
    (% class=&quot;prevPage&quot; %)**[[&laquo; {{translation key='xe.blog.code.previousmonth'/}}&gt;&gt;$doc.name||queryString=&quot;year=$monthDate.year&amp;month=$monthDate.monthOfYear&quot;]]**(%%)
    #sep()
    $monthDate.addMonths(2)## 2 because we already subtracted 1 above
    (% class=&quot;nextPage&quot; %)**[[{{translation key='xe.blog.code.nextmonth'/}} &raquo;&gt;&gt;$doc.name||queryString=&quot;year=$monthDate.year&amp;month=$monthDate.monthOfYear&quot;]]**(%%)
    )))
  #elseif($displayType == 'all')
  #else
    ## Paginated
    #if(($totalPages &gt; 1))
      #set($queryString = '')
      #foreach($p in $request.getParameterNames())
        #if($p != 'page' &amp;&amp; $p != 'ipp')
          #foreach($v in $request.getParameterValues($p))
            #set($queryString = &quot;${queryString}&amp;${p}=${v}&quot;)
          #end
        #end
      #end
      (% class=&quot;pagingLinks&quot; %)(((
      #if ($currentPageNumber &lt; $totalPages)
        #set($currentPageNumber = $currentPageNumber + 1)
        (% class=&quot;prevPage&quot; %)**[[&laquo; {{translation key='xe.blog.code.olderposts'/}}&gt;&gt;$doc.name||queryString=&quot;page=${currentPageNumber}&amp;ipp=${itemsPerPage}$queryString&quot;]]**(%%)
        #set($currentPageNumber = $currentPageNumber - 1)
      #end
      #if ($currentPageNumber &gt; 1)
        #if ($currentPageNumber &lt; $totalPages)
          #sep()
        #end
        #set($currentPageNumber = $currentPageNumber - 1)
        (% class=&quot;nextPage&quot; %)**[[{{translation key='xe.blog.code.newerposts'/}} &raquo;&gt;&gt;$doc.name||queryString=&quot;page=${currentPageNumber}&amp;ipp=${itemsPerPage}$queryString&quot;]]**(%%)
        #set($currentPageNumber = $currentPageNumber + 1)
      #end
      (% class=&quot;clear&quot; %)(%%)
      )))## pagingLinks
    #end
  #end
#end
##
##
##
#**
 * Displays a message box with &quot;publish&quot; icon.
 * 
 * @param message A text message concerning blog article publishing
 *###
#macro(publishMessageBox $message)
(% class=&quot;plainmessage publish-message&quot; %)((($message)))
#end
#**
 * Displays a message box with &quot;show/hide&quot; icon.
 * 
 * @param message A text message concerning blog article hiding
 *###
#macro(hideMessageBox $message)
(% class=&quot;plainmessage hide-message&quot; %)((($message)))
#end
##
##
##
#**
 * Determine the requested week, for using in a weekly-indexed blog. The relevant request parameters are
 * &lt;tt&gt;year&lt;/tt&gt; and &lt;tt&gt;week&lt;/tt&gt;. By default, the current week is used.
 * 
 * @param monthDate The resulting week, a JODATime MutableDateTime.
 *###
#macro(getRequestedWeek $weekDate)
  #set ($weekDate = $NULL)
  #setVariable (&quot;$weekDate&quot; $xwiki.jodatime.mutableDateTime)
  #if(&quot;$!{request.year}&quot; != '')
    $weekDate.setYear($mathtool.toInteger($request.year))
  #end
  #if(&quot;$!{request.week}&quot; != '')
    $weekDate.setWeekOfWeekyear($mathtool.toInteger($request.week))
  #end
#end
##
##
##
#**
 * Determine the requested month, for using in a monthly-indexed blog. The relevant request parameters are
 * &lt;tt&gt;year&lt;/tt&gt; and &lt;tt&gt;month&lt;/tt&gt;. By default, the current month is used.
 * 
 * @param monthDate The resulting month, a JODATime MutableDateTime.
 *###
#macro(getRequestedMonth $monthDate)
  #set ($monthDate = $NULL)
  #setVariable (&quot;$monthDate&quot; $xwiki.jodatime.mutableDateTime)
  #if(&quot;$!{request.year}&quot; != '')
    $monthDate.setYear($mathtool.toInteger($request.year))
  #end
  #if(&quot;$!{request.month}&quot; != '')
    $monthDate.setMonthOfYear($mathtool.toInteger($request.month))
  #end
#end
##
##
##
#**
 * Retrieve a blog property (title, display type, etc).
 * 
 * @param blogDoc The blog document. It should contain a &lt;tt&gt;Blog.BlogClass&lt;/tt&gt; object.
 * @param propertyName The name of the property to be retrieved. One of the &lt;tt&gt;Blog.BlogClass&lt;/tt&gt;'s properties.
 * @param defaultValue The default value to use in case the blog object does not define one.
 * @param propertyValue The resulting value.
 *###
#macro(getBlogProperty $blogDoc $propertyName $defaultValue $propertyValue)
  #set($result = &quot;$!{blogDoc.getObject(${blogClassname}).getProperty($propertyName).value}&quot;)
  #if($result == '')
    #set($result = $defaultValue)
  #end
  #set ($propertyValue = $NULL)
  #setVariable (&quot;$propertyValue&quot; $result)
#end

#**
 * If an error occurs when executing an action, set a specific response status and display an error message.
 * 
 * @param status The response status.
 * @param text The user readable error to be displayed. Can be a translation key.
 * @param parameters The parameters to use when decoding the translation key.
 *###
#macro(blog__actionResponseError $status $text $parameters)
  $response.setStatus($status)
  #if($request.ajax)
    $services.localization.render($text, $!parameters)
  #else
    {{error}}$services.localization.render($text, $!parameters){{/error}}
  #end
#end
{{/velocity}}</textarea>
</div>

    <div class="clearfloats"></div>
  </div>    </div>      </div><div id="leftPanels" class="panels left">
      <div class="panel expanded RecentPostsPanel"><h1 class="xwikipaneltitle">Recent Blog Posts</h1><div class="xwikipanelcontents"></div></div>
        
        <div class="panel expanded CategoriesPanel"><h1 class="xwikipaneltitle">Blog Categories</h1><div class="xwikipanelcontents"><ul><li><span class="blog-category-level"><a href="" title="RSS"><img alt="[RSS]" class="icon-manage" src="resources/icons/silk/bullet_feed.png"></img></a> <a href="">News</a> <span class="itemCount"> (16)</span></span></li><li><span class="blog-category-level"><a href="" title="RSS"><img alt="[RSS]" class="icon-manage" src="resources/icons/silk/bullet_feed.png"></img></a> <a href="">Other</a> <span class="itemCount"> (0)</span></span></li><li><span class="blog-category-level"><a href="" title="RSS"><img alt="[RSS]" class="icon-manage" src="resources/icons/silk/bullet_feed.png"></img></a> <a href="">Personal</a> <span class="itemCount"> (0)</span></span></li></ul></div></div>
        <div class="panel expanded ArchivePanel"><h1 class="xwikipaneltitle">Blog Archive</h1><div class="xwikipanelcontents"><div class="box infomessage">当前没有文章......</div></div></div>
  </div>

  </div><div id="rightPanels" class="panels right">
      <div class="panel expanded QuickLinks"><h1 class="xwikipaneltitle">快速链接</h1><div class="xwikipanelcontents"><ul><li><span class="wikilink"><a href="">首页</a></span></li><li><span class="wikilink"><a href="">新闻动态</a></span></li><li><span class="wikilink"><a href="">FAQ</a></span></li></ul></div></div>
                
  </div>

<div class="clearfloats"></div>
  </div></div><div id="footerglobal" class="layoutsection">
<div class="minwidth"></div>
<hr/>
  <div id="xwikilicence">Copyright © 2013 北京博瑞开源软件有限公司</div>
          <div id="xwikiplatformversion">京ICP备12048974号</div>
<hr/>
</div>

</div></div></body>
</html>


