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

%RED%Note%ENDCOLOR%, the use of hardcoded rights in REDDOT{grant="..."}
in the "format" section below
as long as the TWiki.RedDotPlugin does not support Main.TWikiGroups natively. Replace
it with your main BlogAuthor or remove the =grant="..."= completely to allow
guests to get reddots to their comments.

see also: RenderDocNavigation

---++ Parameters
   * NAME: BlogComment topic name

---++ Implementation
---+++ Main
<verbatim>
%STARTINCLUDE%
%~~ DBCALL{"RenderDocNavigation" 
~~~   NAME="%NAME%" 
~~~   WHERE="BlogRef='%DBQUERY{topic="%NAME%" format="$formfield(BlogRef)"}%'"
~~~   ORDER="created"
~~~ }%
%~~ DBQUERY{topic="%NAME%" 
~~~  format="
*~~     <div class=\"blogRef\">
~~~     %STOPALIASAREA%$n<noautolink>
~~~        <h3>On 
~~~            <a href=\"$percntSCRIPTURLPATH{\"view\"}$percnt/$web/$expand(BaseRef)\" 
~~~              title=\"link to <nop>$expand(BaseRef)\">
~~~              \"$expand(@BaseRef.Headline or BaseRef)\"
~~~              <span class=\"blogDate\">
~~~                ($formatTime(@BaseRef.createdate, '$day, $mon $year'))
~~~              </span>
~~~            </a>
~~~        </h3>
~~~     </noautolink>$n%STARTALIASAREA%$n
~~~     </div>
~~~     <div class=\"blogComment\">
~~~     %DBCALL{"%TOPIC%" section="format"}%
~~~     </div>"
~~~ }% 
%~~ DBCALL{"RenderDocNavigation" 
~~~   NAME="%NAME%" 
~~~   WHERE="BlogRef='%DBQUERY{topic="%NAME%" format="$formfield(BlogRef)"}%'"
~~~   ORDER="created"
~~~ }%
%STOPINCLUDE%
</verbatim>

<!--
-->

---+++ Format
<verbatim>
%STARTSECTION{"format"}%
*~~ <h3 style=\"margin-bottom:0px;padding-bottom:0px\">
~~~   <a name=\"$topic\"></a><a name=\"$expand(Nr)\"></a>
~~~   <span class=\"blogCommentNr\">$expand(Nr)</span>
~~~   $percntIFDEFINEDTHEN{\"$expand(Url)\"}$percnt
~~~     [[$test][$expand(Name)]] 
~~~     <a href=\"$percntSCRIPTURLPATH{\"view\"}$percnt/$web/$topic\"
~~~        title=\"link to <nop>$topic\">
~~~   $percntELSEDEFINED$percnt
~~~      $percntCALC{
~~~        \"$dollarIF($dollarEXISTS(%MAINWEB%.$expand(Name)),
~~~          [[%MAINWEB%.$expand(Name)][$expand(Name)]] 
~~~          <a href=\\"$percntSCRIPTURLPATH{\"view\"}$percnt/$web/$topic\\"
~~~             title=\\"link to <nop>$topic\">,
~~~          <a href=\\"$percntSCRIPTURLPATH{\"view\"}$percnt/$web/$topic\\"
~~~             title=\\"link to <nop>$topic\\">$expand(Name))\"
~~~      }$percnt
~~~   $percntFIDEFINED$percnt
~~~   <span class=\"blogDate\">
~~~     replied
~~~     $percntTIMESINCE{
~~~        from=\"$expand(@BaseRef.createdate)\"
~~~        to=\"$expand(createdate)\"
~~~        format=\"$time after the incident\"
~~~        null=\"immediately\"
~~~      }$percnt
~~~   </span></a>
*~~   $percntREDDOT{\"$web.$topic\" grant=\"MichaelDaum\"}$percnt 
~~~ </h3>$n
~~~ <noautolink>$n
~~~    $percntIFDEFINEDTHEN{\"$expand(Headline)\" glue=\"off\"}$percnt$n
~~~       <h4>$test</h4>$n
~~~    $percntFIDEFINED$percnt$n
~~~ %STARTALIASAREA%$n
~~~ <div class=\"blogCommentText\">$n
~~~    $expand(Text)
~~~    &#8230;&nbsp;
*~~   <a href=\"$percntSCRIPTURLPATH{\"view\"}$percnt/$web/$topic#bottomComment\"
~~~      title=\"comment on <nop>$topic\">reply</a>
~~~ </div>$n
~~~ %STOPALIASAREA%$n
~~~ </noautolink>
*~~ 
%ENDSECTION{"format"}%
</verbatim>

---++ Test
<div class="alt">
%DBCALL{"%TOPIC%" NAME="BlogComment0"}%
</div>

%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="Render a single BlogComment"}%
