TopicType
TopicType of all TopicTypes

%REVINFO{ " $date - $hour:$min " rev=" IF{ "%NATMAXREV%!=%CURREV%" then="%CURREV%" }: Syntax error in '%NATMAXREV%!=%CURREV%' at '%NATMAXREV%!=%CURREV%' " topic="Applications.TopicType" }% | Version 1 |
Icon:
Editor: Applications.TopicTypeEditTemplate
Template: Applications.TopicTypeTemplate
Topic Naming Mode: default

Install TopicType

Target web:

Select a web where to deploy this component.

Documentation

The TopicType is the root of the type system of the WikiWorbench. Every WikiTopic has got one or more TopicTypes. TopicTypes always define a DataForm, where a type indicates the properties and use of the form being attached to a topic.

TopicTypes overcome Foswiki's limitation to only allow one form to be attached to a topic. If you'd like to attach a second form to a topic, create a new DataForm that mixes two others and indicate this by merging the resulting TopicType properties. This procedure is the recommended way to derive new TopicTypes from existing ones building on top of them, e.g. by augmenting a CategorizedTopic with additional formfields.

TopicTypes have a special property that you might use to indicate a special way of derivation by means of inheritance. There is no real inheritance in Foswiki but the way of thinking when dealing with objects and types can be clarified this way.

When you start writing a WikiApplication, first think of the data objects you will need and create TopicTypes for each.

Topics of type 'TopicType'

Create a new TopicType

Title:

Summary:

Short description of the role of this topic

Topic index TopicTitle Icon WikiApplication Editor Changed

TopicType form

Name: Type: Size: Values:Sorted ascending Description: Attributes: Default:
TopicTitle text 75        
Summary text 75   Short description of the role of this topic c  
Topic Name Template text 80   a template for the name of topics being created, e.g. ProjectAUTOINC0    
Topic Name Source text 80   jQuery selector of input elements to construct the topic name from   [name=TopicTitle]
Topic Name Prefix text 30   string to be prefixed to the topic name    
Topic Name Suffix text 30   string to be appended to the topic name    
WikiApplication wikiapp 1   Application this topic belongs to    
Icon icon 30 cat="fonticon" icon to be displayed in the topic creator    
Topic Naming Mode radio 3 default, template, derived     default
TopicType label 1 TopicType, DataForm, DocuTopic, ApplicationTopic, WikiTopic topic type   TopicType, DataForm, DocuTopic, ApplicationTopic, WikiTopic
Editor topic+values 30 url="/bin/view/Applications/TopicType?baseWeb=Applications&section=editors&skin=text&contenttype=application/json&t=1711647957" editor for this topic type    
Template topic+values 30 url="/bin/view/Applications/TopicType?baseWeb=Applications&section=templates&skin=text&contenttype=application/json&t=1711647957" topic template to be used for this topic type    
Topic Name Transliterate radio+values 2 yes=true, no=false flag indicating character transliteration to a unicode safe subset   true

editors

%STARTSECTION{"editors"}%<literal>%DBQUERY{
   "TopicType=~'\bTopicView\b' AND topic~'EditTemplate$' AND %FORMATLIST{
      "%IF{
        "'%URLPARAM{"q"}%'=''" 
        then="." 
        else="%URLPARAM{"q"}%"
      }%" 
      split="\s+" 
      format="lc(topic)=~lc('$1')" 
      separator=" AND "
   }%"
   web="%URLPARAM{"baseWeb"}%" 
   skip="%CALCULATE{"$EVAL(%URLPARAM{"limit" default="10"}%*(%URLPARAM{"page" default="1"}%-1))"}%"
   limit="%URLPARAM{"limit" default="10"}%"
   format="  {
      \"id\":\"$web.$topic\",
      \"text\":\"$topic\"
   }"
   separator=",$n"
   header="{\"results\":[$n"
   footer="$n], \"total\":$count}"
}%</literal>%ENDSECTION{"editors"}%

templates

%STARTSECTION{"templates"}%<literal>%DBQUERY{
   "TopicType=~'\bTopicTemplate\b' AND %FORMATLIST{
      "%IF{
        "'%URLPARAM{"q"}%'=''" 
        then="." 
        else="%URLPARAM{"q"}%"
      }%" 
      split="\s+" 
      format="lc(topic)=~lc('$1')" 
      separator=" AND "
   }%"
   web="%URLPARAM{"baseWeb"}%" 
   skip="%CALCULATE{"$EVAL(%URLPARAM{"limit" default="10"}%*(%URLPARAM{"page" default="1"}%-1))"}%"
   limit="%URLPARAM{"limit" default="10"}%"
   format="  {
      \"id\":\"$web.$topic\",
      \"text\":\"$topic\"
   }"
   separator=",$n"
   header="{\"results\":[$n"
   footer="$n], \"total\":$count}"
}%</literal>%ENDSECTION{"templates"}%
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