/
GetTopicTypes.txt
64 lines (53 loc) · 2.26 KB
/
GetTopicTypes.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
%META:TOPICINFO{author="ProjectContributor" comment="" date="1418752972" format="1.1" version="1"}%
%META:TOPICPARENT{name="TopicFunction"}%
%TOC{depth="2"}%
---++ Documentation
%STARTSECTION{"documentation"}%
This is a "getter" TopicFunction that returns a list of known TopicTypes
in a given web. Use it to create a selection in DataForms for the !TopicType formfield.
It adds the "none" type so that you can have (temporarily) un-typed topics. The
type "TopicType" is added _hardcoded_ so that you don't have to rely on that type
being present in your web and to allow bootstrapping a type system in a web from
scratch on as you will be able to create an initial !TopicType !TopicType this way.
---+++++ Parameters
* WEBS: list of webs to search for TopicTypes, defaults to BASEWEB
* EXCLUDE: expression to exclude types (optional)
* ADDITION: types that are listed additionally (optional)
%ENDSECTION{"documentation"}%
---++ Implementation
<verbatim class="tml">
%STARTINCLUDE%none, %FORMATLIST{
"TopicType, %IF{"defined ADDITION" then="%ADDITION%, "}% %FORMATLIST{
"%IF{"defined WEBS" then="%WEBS%" else="%BASEWEB%"}%"
format="$percntDBQUERY{\"TopicType=~'\bTopicType\b'\"
web=\"$1\"
hidenull=\"on\"
separator=\", \"
format=\"$dollartopic\"
}$percnt"
}%"
%IF{"defined EXCLUDE" then="exclude=\"%EXCLUDE%\""}%
format="$1"
separator=", "
sort="on"
unique="on"
}%%STOPINCLUDE%
</verbatim>
---++ Test
<noautolink>
<div class="alt">
%DBCALL{"%TOPIC%" ADDITION="FooBar" EXCLUDE="Application.*"}%
</div>
<div class="alt">
%DBCALL{"%TOPIC%" WEBS="Applications.ClassificationApp, %BASEWEB%"}%
</div>
</noautolink>
%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="returns a list of TopicTypes known in the base web"}%
%META:FIELD{name="WikiApplication" attributes="" title="WikiApplication" value="WikiWorkbench"}%