Threaded Discussions

Function: RenderListOfDiscussions

Render a list of discussions

Documentation

List all discussions with the given properties

Parameters
  • STATE: either open or close, defaults to both
  • CAT: extract discussions in the given Category, defaults to all
  • THEWEB: search in the given web, defaults to BASEWEB
  • REVERSE: on/off - sorting order, defaults to off
  • LIMIT: max nr of discussions to show, defaults to all

Implementation

%STARTINCLUDE%
~~~ <noautolink>
%~~ TABLE{
~~~     sort="on" 
~~~     initsort="6" 
~~~     initdirection="%IFDEFINED{"%REVERSE%" as="on" then="up" else="down" glue="off"}%"
~~~     tablewidth="100%"
~~~   }%
%~~ DBSTATS{"
~~~   ((TopicType=~'\bComment\b' %IFDEFINED{"%STATE%" then="AND @BaseRef.State='%STATE%'" glue="off"}%)
~~~     OR 
~~~    (TopicType=~'\bDiscussion\b'  %IFDEFINED{"%STATE%" then="AND State='%STATE%'" glue="off"}%)
~~~   )
~~~   %IFDEFINED{"%CAT%" then="AND @BaseCategory=~'\b%CAT\b'" glue="off"}%
~~~   "
~~~   %IFDEFINED{"%LIMIT%" then="limit=\"%LIMIT%\"" glue="off"}%
~~~   field="BaseRef"
~~~   web="%IFDEFINED{"%THEWEB%" then="%THEWEB%" else="%BASEWEB%"}%"
~~~   header="| *Nr*
~~~           | *Subject* 
~~~           | *Replies*
~~~           | *Created*
~~~           | *By*
~~~           | *Last reply*
~~~           | *By*
~~~           |  *Feed*  |$n"
~~~   footer="$n<!-- end of table -->"
~~~   format="| <span name=\"counter\"></span>
~~~           $percntDBQUERY{topic=\"$web.$key\" 
~~~             format=\"
~~~              | [[$web.$key][$formfield(Summary)]]
~~~              |  $percntCALC{\"$EVAL($count-1)\"}$percnt  |
~~~                <nobr>$formatTime(Timestamp)</nobr>
~~~              | <nobr>[[%MAINWEB%.$formfield(Name)][$dollarpercntSPACEOUT{\\"$formfield(Name)\\"}$dollarpercnt]]</nobr>
~~~                  \"
~~~           }$percnt
~~~           $percntDBQUERY{topics=\"$topics\" 
~~~             order=\"Timestamp\" 
~~~             reverse=\"on\" 
~~~             limit=\"1\"
~~~             format=\"
~~~               | <nobr>$formatTime(Timestamp)</nobr>
~~~               | <nobr>[[%MAINWEB%.$formfield(Name)][$dollarpercntSPACEOUT{\\"$formfield(Name)\\"}$dollarpercnt]]</nobr>
~~~             \"
~~~           }$percnt
~~~           |  <a title=\"RSS feed for this discussion\"
~~~                 href=\"%SCRIPTURLPATH{"view"}%/Applications.DiscussionApp/WebRssDiscussion?theweb=$web&thetopic=$key\">
*~~                <img border=\"0\" src=\"%PUBURLPATH%/%TWIKIWEB%/NatSkin/feed-icon-12x12.png\" />
*~~              </a>  |"
~~~ }%
~~~ <script type="text/javascript">
~~~ var elems = document.getElementsByName("counter");
~~~ for (var i=0; i < elems.length; i++) {
~~~    var elem = elems[i];
~~~    elem.innerHTML = i+1;
~~~ }
~~~ </script>
~~~ </noautolink>
%STOPINCLUDE%

Test

Nr Subject Replies Created By Last reply By Feed

Calls to 'RenderListOfDiscussions'

Copyright

© 2006-2007 Michael Daum http://wikiring.de

This file is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. For more details read the LICENSE.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Applications.ApplicationTopic
TopicType: DocuTopic, TopicFunction
Summary: Render a list of discussions
TWikiApplication: DiscussionApp
r0 - 20 Jul 2007 - 04:14:51 - TWikiContributor
© giant orange extension cord that reeks hip-hop, funk & soul