-
Notifications
You must be signed in to change notification settings - Fork 2
/
RenderCategory.txt
119 lines (108 loc) · 4.43 KB
/
RenderCategory.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
%META:TOPICINFO{author="micha" comment="reprev" date="1402086723" format="1.1" reprev="21" version="21"}%
%META:TOPICPARENT{name="TopicFunction"}%
%TOC{depth="2"}%
---++ Documentation
%STARTSECTION{name="documentation" type="section"}%
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
%ENDSECTION{name="documentation" type="section"}%
---++ Implementation
<verbatim class="tml">
%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="title"
format="($trunctitle);$topic;$origweb$n"
}%"
cols="%IF{"defined CLASSIFICATIONPLUGIN_NRCOLS" then="%CLASSIFICATIONPLUGIN_NRCOLS%" else="3"}%"
split="\n"
pattern="\((.*)\);(.*);(.*)"
sort="off"
%IF{"'%SHOWGROUPS{default="off"}%'!='on'" then="group=\"\""}%
format="$percntDBCALL{\"$3.$2->RenderIndexItem\" TITLE=\"$1\" THEWEB=\"%BASEWEB%\"}$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%
</verbatim>
<verbatim class="tml">
%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="%IF{"defined KEYWORDS" then="%KEYWORDS%"}%"}%"
header="AND"
format=" uc(all) =~ uc('$1') "
separator="AND"
}%
"
web="%BASEWEB%"
hidenull="on"
format="$expand(TopicTitle or topic);$topic;$web"
separator="$n"
}%"
cols="%IF{"defined CLASSIFICATIONPLUGIN_NRCOLS" then="%CLASSIFICATIONPLUGIN_NRCOLS%" else="3"}%"
split="\n"
pattern="(.*);(.*);(.*)"
sort="nocase"
%IF{"'%SHOWHEADER%'='on'" then="header=\"$anchors\""}%
format="$percntDBCALL{\"$3.$2->RenderIndexItem\"}$percnt"
}%<!-- -->
<!-- -->%ENDSECTION{"topicindex"}%%
</verbatim>
---++ Toolbar
<verbatim class="tml">
%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"}%
</verbatim>
---++ Test
%DBCALL{"%TOPIC%"}%
%DBCALL{"Applications.RenderFunctionCallers"}%
---++ Copyright
© 2006-2014 Michael Daum http://michaeldaumconsulting.com
%DBCALL{"Applications.GnuGeneralPublicLicense" section="notice"}%
%META:FORM{name="Applications.ApplicationTopic"}%
%META:FIELD{name="TopicType" title="TopicType" value="DocuTopic, TopicFunction"}%
%META:FIELD{name="TopicTitle" attributes="" title="<nop>TopicTitle" value=""}%
%META:FIELD{name="Summary" attributes="c" title="Summary" value="Render tools to handle categories"}%
%META:FIELD{name="WikiApplication" attributes="" title="WikiApplication" value="ClassificationApp"}%