%META:TOPICINFO{author="TWikiContributor" date="1141831104" format="1.1" version="1.1"}%
%META:TOPICPARENT{name="TopicFunction"}%
---+!! Function: %TOPIC%
%FORMFIELD{"TopicDescription"}%

This TopicFunction displays the mode selector. It then renders the archive
depending on the MODE to RenderBlogArchiveChron, RenderBlogArchiveCat,
RenderBlogArchiveTag or RenderBlogArchiveLex. These in turn display their specific
means to select a search string: a tag, a category, a date or a lexical item.
If this search string is passed to the blog archive's QUERY parameter a search is
started on the blog and displayed using the RenderBlogArchiveHitList function.

---++ Parameters
   * MODE: one of the modes chron, cat, tag or lex (optional)
   * QUERY: the item to be searched for in the archive, passed throuhg to the
     modes (optional)

---++ Implementation
<verbatim>
%STARTINCLUDE%
<div class="blogArchiveModes">
<span class="blogArchiveMode blogArchiveModeChron">
~~~ <a href="%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%?mode=chron" 
~~~    title="Browse the Archive in Chronological Order"
~~~    %IFDEFINED{"%MODE%" as="chron" then="class=\"current\"" glue="off"}%>
*~~   Chron
*~~ </a>
*~~ %REDDOT{"%BASEWEB%.RenderBlogArchiveChron"}%
</span> 
<span class="blogArchiveMode blogArchiveModeCat">
~~~ <a href="%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%?mode=cat" 
~~~    title="Browse the Archive by Category"
~~~    %IFDEFINED{"%MODE%" as="cat" then="class=\"current\"" glue="off"}%>
*~~   Cat
*~~ </a>
*~~ %REDDOT{"%BASEWEB%.RenderBlogArchiveCat"}%
</span>
<span class="blogArchiveMode blogArchiveModeTag">
~~~ <a href="%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%?mode=tag" 
~~~    title="Browse the Archive by Tag"
~~~    %IFDEFINED{"%MODE%" as="tag" then="class=\"current\"" glue="off"}%>
*~~   Tag
*~~ </a>
*~~ %REDDOT{"%BASEWEB%.RenderBlogArchiveTag"}%
</span> 
<span class="blogArchiveMode blogArchiveModeLex">
~~~ <a href="%SCRIPTURLPATH{"view"}%/%BASEWEB%/%BASETOPIC%?mode=lex" 
~~~    title="Browse the Archive by Lexical Analysis"
~~~    %IFDEFINED{"%MODE%" as="lex" then="class=\"current\"" glue="off"}%>
*~~   Lex
*~~ </a>
*~~ %REDDOT{"%BASEWEB%.RenderBlogArchiveLex"}%
</span> 
</div>
%IFDEFINEDTHEN{"%MODE%" as="cat"}%
%$nopDBCALL{"RenderBlogArchiveCat" QUERY="%QUERY%"}%
%ELSIFDEFINED{"%MODE%" as="tag"}%
%$nopDBCALL{"RenderBlogArchiveTag" QUERY="%QUERY%"}%
%ELSIFDEFINED{"%MODE%" as="lex"}%
%$nopDBCALL{"RenderBlogArchiveLex" QUERY="%QUERY%"}%
%ELSEDEFINED%
%$nopDBCALL{"RenderBlogArchiveChron" QUERY="%QUERY%"}%
%FIDEFINED%
%STOPINCLUDE%
</verbatim>

<!-- interrupt glue -->

---++ Test
See BlogArchive

%DBCALL{"RenderFunctionCallers"}%

<!--
   * Set ALLOWTOPICCHANGE = %MAINWEB%.BlogAdminGroup
   * Set SIDEBAR = Admin
   * Set SIDEBARARG = TopicFunction
-->


%META:FORM{name="TopicForm"}%
%META:FIELD{name="TopicType" attributes="M" title="TopicType" value="TopicFunction"}%
%META:FIELD{name="TopicDescription" attributes="M" title="TopicDescription" value="Renders the BlogArchive"}%
