You are here: Foswiki>Applications Web>TopicType (14 Apr 2017, IvicaPetrinic)Edit Attach

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

14 Apr 2017 - 12:31 | Version 4 |

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,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    
TopicTitle text 75        
Summary text 75   Short description of the role of this topic c  
Icon icon 30 include="^fa\-" 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=1542808442" editor for this topic type    
Template topic+values 30 url="/Applications/TopicType?baseWeb=Applications&section=templates&skin=text&contenttype=application/json&t=1542808442" topic template to be used for this topic type    
Topic Naming text 30   a template for the name of topics being created, e.g. ProjectAUTOINC0    
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"}%
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