Difference between revisions of "Template:Generate concept formlinks from SMW import page"

From TDWG Terms Wiki
Jump to: navigation, search
m (plain text)
m (+ check for type)
Line 23: Line 23:
 
   -->| Type = <!--  
 
   -->| Type = <!--  
  
 +
 
 
     Property pages
 
     Property pages
     -->[[{{ns:property}}:{{{ns prefix|}}}:{{#explode: §|!|0}}|{{#explode: §|!|0}}]]&#32;{{#formlink:  
+
     -->{{#vardefine: thisFullPageName|{{ns:property}}:{{{ns prefix|}}}:{{#explode: §|!|0}}}}<!--
 +
    -->{{#vardefine: thisPrefixedVocab|{{{ns prefix|}}}:{{#explode: §|!|0}}}}<!--
 +
    -->{{#vardefine: thisVocabNoPrefix|{{#explode: §|!|0}}}}<!--
 +
    -->{{#vardefine: thisHasTypeImport|{{#replace:{{#explode: §|!|1}}|Type:|}}}}<!--
 +
    -->{{#vardefine: thisHasType|{{#ask: [[{{#var: thisFullPageName}}]] | mainlabel=-|link=none|?Has type#=|format=list}}}}<!--
 +
 
 +
    page link always
 +
  -->[[{{#var: thisFullPageName}}|{{#var: thisVocabNoPrefix}}]]&#32;<!--
 +
 
 +
    check Has type (create a warning if mismatch) and existance (use different icons)
 +
  -->{{#ifexist: {{#var: thisFullPageName}}<!--
 +
   
 +
  then-->|{{#formlink:  
 
     form=Property setting<!--   
 
     form=Property setting<!--   
 
     -->|link text=[[File:Pencil.png|x16px|link=]]<!--   
 
     -->|link text=[[File:Pencil.png|x16px|link=]]<!--   
 
     -->|query string=<!--  
 
     -->|query string=<!--  
       -->Property setting[imported from]={{{ns prefix|}}}:{{#explode: §|!|0}}<!--  
+
       -->Property setting[imported from]={{#var: thisPrefixedVocab}}<!--  
 
       -->&Property setting[has type]={{#replace:{{#explode: §|!|1}}|Type:|}}<!--  
 
       -->&Property setting[has type]={{#replace:{{#explode: §|!|1}}|Type:|}}<!--  
 
       -->{{#if: {{{title|}}} |&Property setting[title]={{{title|}}}}}<!--   
 
       -->{{#if: {{{title|}}} |&Property setting[title]={{{title|}}}}}<!--   
     -->|target=Property:{{{ns prefix|}}}:{{#explode: §|!|0}}<!--   
+
     -->|target={{#var: thisFullPageName}}<!-- 
     -->|tooltip=Create/Edit this property page<!--   
+
    -->|tooltip=Edit this property page<!-- 
     -->}}<!--  
+
    -->}}<!--
 +
   
 +
      check Has type (create a warning if mismatch)
 +
    -->{{#ifeq: {{#var: thisHasType}}|{{#var: thisHasTypeImport}}|<!-- then-->|<!-- else-->{{#info: message=“Type:{{#var: thisHasTypeImport}}” on import page [[MediaWiki:Smw_import_{{{ns prefix|}}}]] does not match “Has type:{{#var: thisHasType}}” on page “{{#var: thisFullPageName}}”!}}}}<!--
 +
   
 +
  else-->|{{#formlink:
 +
    form=Property setting<!-- 
 +
    -->|link text=[[File:Pencil add.png|x16px|link=]]<!-- 
 +
    -->|query string=<!--
 +
      -->Property setting[imported from]={{#var: thisPrefixedVocab}}<!--
 +
      -->&Property setting[has type]={{#replace:{{#explode: §|!|1}}|Type:|}}<!--
 +
      -->{{#if: {{{title|}}} |&Property setting[title]={{{title|}}}}}<!-- 
 +
    -->|target={{#var: thisFullPageName}}<!--   
 +
     -->|tooltip=Create this property page<!--   
 +
     -->}}<!--
 +
  -->}}<!-- ifexist end
 +
   
 
      
 
      
 
     Category pages
 
     Category pages
 
   -->| Category | Class | #default = <!-- Category pages
 
   -->| Category | Class | #default = <!-- Category pages
     -->[[File:Folder-silk.png|Class|link=]]&nbsp;[[:{{ns:category}}:{{{ns prefix|}}}:{{#explode: §|!|0}}|{{#explode: §|!|0}}]]&#32;{{#formlink:  
+
     -->{{#vardefine: thisFullPageName|{{ns:category}}:{{{ns prefix|}}}:{{#explode: §|!|0}}}}<!--
 +
    -->{{#vardefine: thisPrefixedVocab|{{{ns prefix|}}}:{{#explode: §|!|0}}}}<!--
 +
    -->{{#vardefine: thisVocabNoPrefix|{{#explode: §|!|0}}}}<!--
 +
   
 +
    --><span title="A class">[[File:Folder-silk.png|link=]]</span>&nbsp;<!--
 +
    -->[[:{{#var: thisFullPageName}}|{{#var: thisVocabNoPrefix}}]]&#32;<!--
 +
   
 +
    -->{{#ifexist: {{#var: thisFullPageName}}<!--
 +
  then-->|{{#formlink:  
 
     form=Concept collection<!--   
 
     form=Concept collection<!--   
 
     -->|link text=[[File:Pencil.png|x16px|link=]]<!--   
 
     -->|link text=[[File:Pencil.png|x16px|link=]]<!--   
 
     -->|query string=<!--  
 
     -->|query string=<!--  
         -->Concept collection[imported from]={{{ns prefix|}}}:{{#explode: §|!|0}}<!--   
+
         -->Concept collection[imported from]={{#var: thisPrefixedVocab}}<!--   
 
       -->{{#if: {{{title|}}} |&Concept collection[title]={{{title|}}}}}<!--   
 
       -->{{#if: {{{title|}}} |&Concept collection[title]={{{title|}}}}}<!--   
     -->|target={{ns:category}}:{{{ns prefix|}}}:{{#explode: §|!|0}}<!--   
+
     -->|target={{#var: thisFullPageName}}<!--   
     -->|tooltip=Create/Edit this {{lc:{{ns:category}}}} page<!--   
+
     -->|tooltip=Edit this {{lc:{{ns:category}}}} page<!--   
 
     -->}}<!--
 
     -->}}<!--
   -->}}<!--
+
  else-->|{{#formlink:
 +
    form=Concept collection<!-- 
 +
    -->|link text=[[File:Pencil add.png|x16px|link=]]<!-- 
 +
    -->|query string=<!--
 +
        -->Concept collection[imported from]={{#var: thisPrefixedVocab}}<!-- 
 +
      -->{{#if: {{{title|}}} |&Concept collection[title]={{{title|}}}}}<!-- 
 +
    -->|target={{#var: thisFullPageName}}<!-- 
 +
    -->|tooltip=Create this {{lc:{{ns:category}}}} page<!-- 
 +
    -->}}}}<!--
 +
   -->}}<!-- switch Type or Category
 
-->}}<!--  
 
-->}}<!--  
  
 
   output delimiter
 
   output delimiter
-->|&#32;│&#32;<!--
+
-->│&#32;<!--
-->}}<!--  
+
-->}}<!-- arraymap
  
 
ELSE -->|''The name space prefix “{{{ns prefix|}}}” has no corresponding page [[MediaWiki:Smw import {{{ns prefix|}}}]] yet.''<!--  
 
ELSE -->|''The name space prefix “{{{ns prefix|}}}” has no corresponding page [[MediaWiki:Smw import {{{ns prefix|}}}]] yet.''<!--  
 
  -->}}</includeonly><noinclude>{{Documentation}}</noinclude>
 
  -->}}</includeonly><noinclude>{{Documentation}}</noinclude>

Revision as of 12:59, 26 September 2012

[edit] [purge] Template-info.svg Template documentation

Template “Generate concept formlinks from SMW import page” generates a list of formlinks based on a “MediaWiki:Smw_import-ns-prefix”-page

Usage

This template has the following parameter:

{{Generate concept formlinks from SMW import page
|ns prefix=    e.g. "dwc" or "rdf" etc.
|title=        optional title of the target page
|query string= form_name[field]=value&form_name[field2]=value3 “form_name” must be given, it will be replaced by an appropriate form
}}

Technical documentation

Dependencies: