Difference between revisions of "CreateTopicTemplate"

From OPENRESEARCH th copy Wiki
Jump to navigation Jump to search
 
(14 intermediate revisions by the same user not shown)
Line 7: Line 7:
 
|since=2021/02/14
 
|since=2021/02/14
 
|text=<pre>
 
|text=<pre>
{% set pagetitle = ""%}
+
{% set pagetitle = "" %}
 
{% set pagetitle_prefix = "Template:"%}
 
{% set pagetitle_prefix = "Template:"%}
 
+
{%- set property_properties = [] -%}
{% set property_properties = []%}
+
{% for p in smw.query("[[Concept:Property]][[Property topic::Concept:Property]]|?Property name = name").values() %}
{% for p in smw.query("[[Property topic::" + row.Topic +"]]|?Property sortPos = sortPos|sort= Property sortPos").values() %}
+
{%- set dump = property_properties.append(p["name"]) -%}
  {% set property_properties = property_properties.append(p.name) %}
+
{%- endfor %}
{% endfor %}
+
{%- set topic_properties = [] -%}
 
+
{% for p in smw.query("[[Property topic::" + row.Topic + "]]|?Property name = name").values() %}
{% set topic_properties = []%}
+
{%- set dump = topic_properties.append(p["name"]) -%}
{% for p in smw.query("[[Property topic::Concept:Topic]]|?Property name = name").values() %}
+
{%- endfor %}
  {% set topic_properties = topic_properties.append(p.name) %}
 
{% endfor %}
 
 
<noinclude>
 
<noinclude>
 
    
 
    
Line 24: Line 22:
 
<includeonly>
 
<includeonly>
 
   {% raw %}
 
   {% raw %}
  {{#switch:{{{storemode|}}}
+
{{#switch:{{{storemode|}}}
 
   {% endraw %}
 
   {% endraw %}
 
     |none=
 
     |none=
Line 45: Line 43:
  
 
   {% raw %}
 
   {% raw %}
  {{#switch: {{{viewmode|}}}
+
{{#switch: {{{viewmode|}}}
 
   {% endraw %}
 
   {% endraw %}
 
     |hidden=
 
     |hidden=
 
     |masterdetail=
 
     |masterdetail=
      = properties =
+
= properties =
       {{ '{{' }}#ask:[[Concept:Property]][[Property topic::{{FULLPAGENAME}}]]
+
       {{ '{{' }}#ask:[[Concept:Property]][[Property topic::{{row.Topic}}]]
 
       {% for p in property_properties%}
 
       {% for p in property_properties%}
       | ?Property {{ p.name }} = {{ p.name }}
+
       |?Property {{ p }} = {{ p }}
       {% endfor %}
+
       {%- endfor %}
 
         |sort=Property name
 
         |sort=Property name
 
         |order=ascending
 
         |order=ascending
Line 59: Line 57:
 
     |tableheader={{ '{{{!}}' }} class='wikitable'
 
     |tableheader={{ '{{{!}}' }} class='wikitable'
 
       {% for p in topic_properties%}
 
       {% for p in topic_properties%}
         !{{ p.name }}!
+
         !{{ p }}!
       {% endfor %}
+
       {%- endfor %}
 
       {{ '{{!}}-' }}
 
       {{ '{{!}}-' }}
 
     |tablerow=
 
     |tablerow=
 
       {% for p in topic_properties%}
 
       {% for p in topic_properties%}
         {{ '{{!}}{{{' }}{{p.name}}{{ '|}}}{{!}}' }}
+
         {{ '{{!}}{{{' }}{{p}}{{ '|}}}{{!}}' }}
       {% endfor %}
+
       {%- endfor %}
 
       -
 
       -
 
     |tablefooter={{ '{{!}}}' }}
 
     |tablefooter={{ '{{!}}}' }}
 
     |labelfield=
 
     |labelfield=
 
       {% for p in topic_properties%}
 
       {% for p in topic_properties%}
         {{ p.name }}={{ '={{#if:{{{' }}{{ p.name }}{{ '|}}}|{{{' }}{{ p.name }}{{ '|}}}|}}<br>' }}
+
         {{ p }}={{ '={{#if:{{{' }}{{ p }}{{ '|}}}|{{{' }}{{ p }}{{ '|}}}|}}<br>' }}
       {% endfor %}
+
       {%- endfor %}
 
     |#default=
 
     |#default=
 
       {{ '{{{!}} ' }}class='wikitable'
 
       {{ '{{{!}} ' }}class='wikitable'
 
         ! colspan='2' {{ '{{!}}' }}{{row.name}}
 
         ! colspan='2' {{ '{{!}}' }}{{row.name}}
 
         {{ '{{!}}' }}-
 
         {{ '{{!}}' }}-
         {{#switch:{{{storemode|}}}
+
         {{ '{{#switch:{{{storemode|}}}' }}
 
           |property=
 
           |property=
 
             ! colspan='2' style='text-align:left' {{ '{{!}}' }} {{ '{{' }}Icon|name=edit|size=24{{ '}}' }}{{ '{{' }}Link|target=Special:FormEdit/{{ row.name }}/{{ '{{FULLPAGENAME}}' }}|title=edit{{ '}}' }}
 
             ! colspan='2' style='text-align:left' {{ '{{!}}' }} {{ '{{' }}Icon|name=edit|size=24{{ '}}' }}{{ '{{' }}Link|target=Special:FormEdit/{{ row.name }}/{{ '{{FULLPAGENAME}}' }}|title=edit{{ '}}' }}
 
             {{ '{{!}}' }}-
 
             {{ '{{!}}' }}-
         }}
+
         {{ '}}' }}
 
         {% for p in topic_properties%}
 
         {% for p in topic_properties%}
           !{{ p.name }}
+
           !{{ p }}
 
           {{ '{{!}}' }}
 
           {{ '{{!}}' }}
             {{ '&nbsp;{{#if:{{{' }}{{ p.name }}{{ '|}}}|{{{' }}{{ p.name }}{{ '|}}}|}}' }}
+
             {{ '&nbsp;{{#if:{{{' }}{{ p }}{{ '|}}}|{{{' }}{{ p }}{{ '|}}}|}}' }}
 
             {{ '{{!}}-' }}
 
             {{ '{{!}}-' }}
 
         {% endfor %}
 
         {% endfor %}
 
       {{ '{{!}}}' }}
 
       {{ '{{!}}}' }}
   {{ '}}' '}}
+
   {{ '}}' }}
  
 
</includeonly>
 
</includeonly>

Latest revision as of 17:21, 14 February 2021

Sourcecode

Sourcecode
edit
id  CreateTopicTemplate
lang  jinja
author  Tim Holzheim
since  2021/02/14
test  
'"`UNIQ--pre-00000000-QINU`"'
url  

Freitext