You are here: Foswiki>Applications Web>TopicType (23 Jun 2019, IvicaPetrinic)Edit Attach

%GETTOPICTITLE{topic="Applications.TopicType" rev=""}%
TopicType of all TopicTypes

23 Jun 2019 - 07:45 | Version 5 |

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 Applications.ClassificationApp.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:

%GRID{ query="TopicType=~'\bTopicType\b' " web="Applications" columns="TopicTitle,Icon,WikiApplication,Editor,Changed" rows="20" filterbar="on" toolbar="on" rownumbers="on" pager="on" width="auto" height="auto" sort="Changed" reverse="on" WikiApplication_title="Application" TopicTitle_title="Title" Summary_title="Summary" Changed_title="Changed"

}%

TopicType form

Name: Type: Size: Values: Description: Attributes: Default:
TopicType label 1 TopicType, DataForm, DocuTopic, ApplicationTopic, WikiTopic topic type   TopicType, DataForm, DocuTopic, ApplicationTopic, WikiTopic
TopicTitle text 75        
Summary text 75   Short description of the role of this topic c  
Icon icon 30 cat="fonticon" icon to be displayed in the topic creator    
Editor topic+values 30 url="/Applications/TopicType?baseWeb=Applications&section=editors&skin=text&contenttype=application/json&t=1576440994" editor for this topic type    
Template topic+values 30 url="/Applications/TopicType?baseWeb=Applications&section=templates&skin=text&contenttype=application/json&t=1576440994" topic template to be used for this topic type    
Topic Naming Mode radio 3 default, template, derived     default
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    
Topic Name Transliterate radio+values 2 yes=true, no=false flag indicating character transliteration to a unicode safe subset   true
WikiApplication wikiapp 1   Application this topic belongs to    

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"}%

TopicType edit

TopicType TopicType, DataForm, DocuTopic, ApplicationTopic, WikiTopic
TopicTitle
Summary TopicType of all TopicTypes
Icon
Editor Applications.TopicTypeEditTemplate
Template Applications.TopicTypeTemplate
Topic Naming Mode default
Topic Name Template
Topic Name Source [name=TopicTitle]
Topic Name Prefix
Topic Name Suffix
Topic Name Transliterate yes
WikiApplication WikiWorkbench
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