GetTopicTypes
returns a list of TopicTypes known in the base web

%REVINFO{ " $date - $hour:$min " rev=" IF{ "%NATMAXREV%!=%CURREV%" then="%CURREV%" }: Syntax error in '%NATMAXREV%!=%CURREV%' at '%NATMAXREV%!=%CURREV%' " topic="Applications.GetTopicTypes" }% | Version 1 |

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)

Implementation

%STARTINCLUDE%none, %FORMATLIST{
  "TopicType, %IF{"defined ADDITION" then="%ADDITION%, "}% %FORMATLIST{
    "%WEBS{default="%BASEWEB%"}%"
    format="$percntDBQUERY{\"TopicType=~'\bTopicType\b' OR@Target.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%

Test

none, DataForm, DataFormAttribute, DocuTopic, FooBar, TopicFunction, TopicStub, TopicTemplate, TopicType, TopicView, WebTool, WikiApplication, WikiTopic

none, ApplicationLicense, ApplicationTopic, DataForm, DataFormAttribute, DocuTopic, TopicFunction, TopicStub, TopicTemplate, TopicType, TopicView, WebTool, WikiApplication, WikiTopic

Copyright

© 2006-2019 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.
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback