RenderCategory
Render tools to handle categories

Documentation

This function is called in Category topics.

See the CategoryTemplate.
Parameters
  • CAT: category to be rendered, defaults to URLPARM{"catname" default="BASETOPIC"}
  • KEYWORDS: keywords to filter for
  • TAG: tags to be searching for in this category
  • EXCLUDE: categories to be excluded from the list
  • SHOWHEADER: switch on/off display anchors, defaults to off
  • SHOWTOPICS: switch on/off display of topics in this category; defaults to on
  • SHOWGROUPS: switch on/off alphabetic headers; defaults to off

Implementation

%STARTINCLUDE%<noautolink><div class='clsMakeIndexWrapper'>
%MAKEINDEX{
  "%HIERARCHY{
     web="%BASEWEB%"
     top="%CAT{default="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%"
     exclude="%CAT{default="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%%IF{"defined EXCLUDE" then="|%EXCLUDE%"}%"
     depth="2"
     sort="on"
     format="($title);$topic;$origweb$n"
   }%"
  cols="%CLASSIFICATIONPLUGIN_NRCOLS{default="3"}%"
  split="\n"
  pattern="\((.*)\);(.*);(.*)"
  sort="off"
  %IF{"'%SHOWGROUPS{default="off"}%'!='on'" then="group=\"\""}%
  format="$percntDBCALL{\"Applications.ClassificationApp.CategoryRenderIndexItem\" TITLE=\"$1\" THEWEB=\"%BASEWEB%\" OBJECT=\"$2\"}$percnt"
}%<!-- -->
%IF{"'%SHOWTOPICS{default="%IF{"'%CAT{default="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%'='TopCategory'" then="off" else="on"}%"}%'='on'"
   then="$percntDBCALL{\"%WEB%.%TOPIC%\" 
      section=\"topicindex\"
      TAG=\"%TAG%\"
      KEYWORDS=\"%KEYWORDS%\"
   }$percnt"
}%<!-- -->
</div></noautolink>
<!-- -->%STOPINCLUDE%

%STARTSECTION{"topicindex"}%<!-- -->
%MAKEINDEX{
  "%DBQUERY{
    "!(TopicType=~'\bCategory\b') AND 
      ('%IF{"defined CAT" then="%CAT%" else="%URLPARAM{"catname" default="%BASETOPIC%"}%"}%' DISTANCE topic) = 1
      %FORMATLIST{"%URLPARAM{"tag" default="%IF{"defined TAG" then="%TAG%"}%"}%" 
         header="AND" 
         format=" Tag=~'\b$1\b' "
         separator="AND"
       }%
      %FORMATLIST{"%URLPARAM{"search" default="%KEYWORDS{default=""}%"}%"
         header="AND" 
         format=" uc(all) =~ uc('$1') "
         separator="AND"
      }%
    "
    web="%BASEWEB%"
    hidenull="on"
    format="($expand(TopicTitle or topic));$topic;$web"
    separator="$n"
  }%"
  cols="%CLASSIFICATIONPLUGIN_NRCOLS{default="3"}%"
  split="\n"
  pattern="\((.*)\);(.*);(.*)"
  sort="nocase"
  %IF{"'%SHOWHEADER%'='on'" then="header=\"$anchors\""}%
  format="$percntDBCALL{\"$3.$2->RenderIndexItem\"}$percnt"
}%<!-- -->
<!--  -->%ENDSECTION{"topicindex"}%%

Toolbar

%STARTSECTION{"toolbar"}%<!-- -->
<div class="toolbar">
%BUTTON{"New Topic" href="%SCRIPTURLPATH{view}%/%BASEWEB%/ClassifiedTopic?cat=%URLPARAM{"catname" default="%BASETOPIC%"}%%IF{
  "defined TEMPLATE" 
  then=";tmpl=%TEMPLATE%" 
  else="$percntIF{\"istopic '%BASEWEB%.%URLPARAM{"catname" default="%BASETOPIC%"}%Template'\"
    then=\";tmpl=%BASEWEB%.%URLPARAM{"catname" default="%BASETOPIC%"}%Template\"
    else=\"\"
    }$percnt"
  }%" 
  title="Create a new topic in %CATINFO{cat="%BASEWEB%.%URLPARAM{"catname" default="%BASETOPIC%"}%" format="<nop>$title"}%"
}%
%IF'%USERSWEB%.AdminGroup' allows 'change'"
  then="%BUTTON{"Manage" href="%SCRIPTURLPATH{view}%/%BASEWEB%/Category" title="Manage categories"}%  
        %BUTTON{"Browse" href="%SCRIPTURLPATH{view}%/%BASEWEB%/CategoryBrowser" title="Browse the hierarchy"}%"
}%
</div>
%CLEAR%%ENDSECTION{"toolbar"}%

Test

Calls to 'RenderCategory'

Copyright

© 2006-2013 Michael Daum http://michaeldaumconsulting.com

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.
Das Urheberrecht © liegt bei den mitwirkenden Autoren. Alle Inhalte dieser Kollaborations-Plattform sind Eigentum der Autoren.