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

From TDWG Terms Wiki
Jump to: navigation, search
m (fix don't include categories)
m (removed wrong usage of #formlink of Concept collection and replaced it by #formlink with Concept scheme class)
 
(35 intermediate revisions by the same user not shown)
Line 11: Line 11:
 
  -->|{{!}}|!}}<!--  
 
  -->|{{!}}|!}}<!--  
 
  -->}}
 
  -->}}
'''The [[MediaWiki:Smw import {{{ns prefix|}}}|{{abbr|SMW}}-import-page]] defines a name space prefix “{{{ns prefix|}}}” {{#if: {{{title|}}} | (={{{title|}}})&#32;}}and the following concepts:'''<br/><!--
+
The {{abbr|SMW}}-import-page ([[MediaWiki:Smw import {{{ns prefix|}}}]]) defines a name space prefix “{{{ns prefix|}}}” {{#if: {{{title|}}} | (={{{title|}}})&#32;}}and the following pages (=concepts or concept collections “[[File:Folder-silk.png|link=]]”):<br/><!--
 
-->{{#arraymap: {{#var: smwimport}}<!--
 
-->{{#arraymap: {{#var: smwimport}}<!--
  -->|<nowiki></nowiki>
+
-->|<nowiki></nowiki>
  <nowiki></nowiki>|§|<!--
+
<nowiki></nowiki>|§|<!--  
  -->{{#switch: {{#explode: §|:|0}}<!--
+
      exclude if it is a category or class
+
    -->|[[Category|[[Class=<!--
+
    -->|#default=<!--  
+
  
      extract import definition
+
  extract import definition, skip […] and [[…]]
    -->{{#switch: {{#explode: {{#explode: {{#explode: §|!|1}} |:|0}} }} <!--
+
-->{{#if: {{#pos:§|[}} <!-- empty, if [ is not found
      -->| Type = <!--  
+
  then-->|<!-- [ was found → nothing
 +
  else-->|<!--
 +
  -->{{#switch: {{#explode: {{#explode: {{#explode: §|!|1}} |:|0}} }} <!--
 +
  -->| Type = <!--  
  
        Property pages
+
 
        -->{{#formlink:  
+
    Property pages
        form=Property setting<!-- 
+
    -->{{#vardefine: thisFullPageName|{{ns:property}}:{{{ns prefix|}}}:{{#explode: §|!|0}}}}<!--  
        -->|link text={{#explode: §|!|0}}<!-- 
+
    -->{{#vardefine: thisPrefixedVocab|{{{ns prefix|}}}:{{#explode: §|!|0}}}}<!--  
        -->|query string=<!--
+
    -->{{#vardefine: thisVocabNoPrefix|{{#explode: §|!|0}}}}<!--  
          -->Property setting[imported from]={{{ns prefix|}}}:{{#explode: §|!|0}}<!--
+
    -->{{#vardefine: thisHasTypeImport|{{#replace:{{#explode: §|!|1}}|Type:|}}}}<!--  
          -->&Property setting[has type]={{#replace:{{#explode: §|!|1}}|Type:|}}<!--  
+
    -->{{#vardefine: thisHasType|{{#ask: [[{{#var: thisFullPageName}}]] | mainlabel=-|link=none|?Has type#=|format=list}}}}<!--  
          -->{{#if: {{{title|}}} |&Property setting[title]={{{title|}}}}}<!-- 
+
        -->|target=Property:{{{ns prefix|}}}:{{#explode: §|!|0}}<!-- 
+
        -->}}<!--  
+
       
+
        Category pages
+
      -->| Category | Class | #default = <span style="display:none">{{#explode: {{#explode: {{#explode: §|!|1}} |:|0}} }}</span><!-- Category pages
+
        -->[[File:Folder-silk.png|link=]]&nbsp;{{#formlink:  
+
        form=Concept collection<!-- 
+
        -->|link text={{#explode: §|!|0}}<!-- 
+
        -->|query string=<!--
+
            -->Concept collection[imported from]={{{ns prefix|}}}:{{#explode: §|!|0}}<!--
+
          -->{{#if: {{{title|}}} |&Concept collection[title]={{{title|}}}}}<!-
+
        -->|target={{ns:category}}:{{{ns prefix|}}}:{{#explode: §|!|0}}<!-- 
+
        -->}}<!--
+
    -->}}<!-- switch end
+
  
   -->}}|<!--
+
    check Has type (create a warning if mismatch) and existance (use different icons)
      output delimiter
+
   -->{{#ifexist: {{#var: thisFullPageName}}<!--
   -->&#32;&#32;<!--
+
   
 +
   then-->|[[{{#var: thisFullPageName}}|{{#var: thisVocabNoPrefix}}]]&nbsp;<!--
 +
   
 +
      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:''{{#if: {{#var: thisHasType}}|{{#var: thisHasType}}|<span class="error">missing value</span>}}'' on page {{#ifeq: {{FULLPAGENAME}}|{{#var: thisFullPageName}}|this page|[[{{#var: thisFullPageName}}]]}}!{{#switch: {{lc:{{#var: thisHasTypeImport}}}}<!--
 +
-->| uri = &#32;You probably mean “Type:URL”.<!--
 +
-->| page = &#32;“Type:Page” is most suited for reused concepts. To be resolved correctly point always to “Property:myns:myimportedconcept”.<!--
 +
-->}}<!-- end switch
 +
-->|icon=warning}}}}<!--
 +
 
 +
    -->{{#formlink:
 +
    form=Property setting<!-- 
 +
    -->|link text=[[File:Pencil.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|}}}}}<!-- 
 +
      -->{{#if: {{{query string|}}} |&{{#replace: {{{query string|}}}|form_name|Property setting}}}}<!-- 
 +
    -->|target={{#var: thisFullPageName}}<!-- 
 +
    -->|tooltip=Edit this property page<!-- 
 +
    -->}}<!--
 +
   
 +
  else-->|{{#var: thisVocabNoPrefix}}&nbsp;{{#formlink:
 +
    form=Property setting<!-- 
 +
    -->|link text=[[File:Add.png|x13px|link=]]<!-- 
 +
    -->|query string=<!--
 +
      -->Property setting[imported from]={{#var: thisPrefixedVocab}}<!--
 +
      -->&Property setting[has type]={{#replace:{{#explode: §|!|1}}|Type:|}}<!--
 +
      -->{{#if: {{{title|}}} |&Property setting[title]={{{title|}}}}}<!-- 
 +
      -->{{#if: {{{query string|}}} |&{{#replace: {{{query string|}}}|form_name|Property setting}}}}<!-- 
 +
    -->|target={{#var: thisFullPageName}}<!-- 
 +
    -->|tooltip=Create this property page<!-- 
 +
    -->}}<!--
 +
  -->}}<!-- ifexist end
 +
   
 +
   
 +
    Category pages
 +
  -->| Category | Class | #default = <!-- Category pages
 +
    -->{{#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;<!--
 +
   
 +
    -->{{#ifexist: {{#var: thisFullPageName}}<!--
 +
  then-->|[[:{{#var: thisFullPageName}}|{{#var: thisVocabNoPrefix}}]]&nbsp;{{#formlink:
 +
    form=Concept scheme class<!-- 
 +
    -->|link text=[[File:Pencil.png|x16px|link=]]<!-- 
 +
    -->|query string=<!--
 +
        -->Concept scheme class[imported from]={{#var: thisPrefixedVocab}}<!-- 
 +
      -->{{#if: {{{query string|}}} |&{{#replace: {{{query string|}}}|form_name|Concept scheme class}}}}<!-- 
 +
    -->|target={{#var: thisFullPageName}}<!-- 
 +
    -->|tooltip=Edit this {{lc:{{ns:category}}}} page<!-- 
 +
    -->}}<!--
 +
  else-->|{{#var: thisVocabNoPrefix}}&nbsp;{{#formlink:
 +
    form=Concept scheme class<!-- 
 +
    -->|link text=[[File:Add.png|x13px|link=]]<!-- 
 +
    -->|query string=<!--
 +
        -->Concept scheme class[imported from]={{#var: thisPrefixedVocab}}<!-- 
 +
      -->{{#if: {{{query string|}}} |&{{#replace: {{{query string|}}}|form_name|Concept scheme class}}}}<!-- 
 +
    -->|target={{#var: thisFullPageName}}<!-- 
 +
    -->|tooltip=Create this {{lc:{{ns:category}}}} page<!-- 
 +
    -->}}}}<!--
 +
  -->}}<!-- switch Type or Category
 
-->}}<!--  
 
-->}}<!--  
 +
 +
  output delimiter
 +
-->|&nbsp;&#x2502;&#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>

Latest revision as of 16:17, 7 January 2013

[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: