Index: trunk/extensions/SemanticForms/includes/SF_TemplateField.inc |
— | — | @@ -10,6 +10,7 @@ |
11 | 11 | var $field_name; |
12 | 12 | var $label; |
13 | 13 | var $semantic_field; |
| 14 | + var $semantic_field_call; |
14 | 15 | var $attr_or_rel; |
15 | 16 | var $attribute_type; |
16 | 17 | var $possible_values; |
— | — | @@ -61,7 +62,7 @@ |
62 | 63 | } |
63 | 64 | } |
64 | 65 | |
65 | | -function create_template_text($template_name, $template_fields, $category_name) { |
| 66 | +function createTemplateText($template_name, $template_fields, $category, $template_format) { |
66 | 67 | $text = "<noinclude>\n"; |
67 | 68 | $text .= wfMsgForContent('sf_template_docu', $template_name) . "\n"; |
68 | 69 | $text .= "<pre>\n"; |
— | — | @@ -78,29 +79,34 @@ |
79 | 80 | <includeonly> |
80 | 81 | |
81 | 82 | END; |
82 | | - if ($category_name != '') { |
83 | | - $text .= wfMsgForContent('sf_template_pagetype', "[[:Category:$category_name]]") . "\n"; |
| 83 | + // topmost part depends on format |
| 84 | + if ($template_format == 'infobox') { |
| 85 | + // CSS style can't be used, unfortunately, since most MediaWiki setups |
| 86 | + // don't have an 'infobox' or comparable CSS class |
| 87 | + $text .=<<<END |
| 88 | +{| style="width: 30em; font-size: 90%; border: 1px solid #aaaaaa; background-color: #f9f9f9; color: black; margin-bottom: 0.5em; margin-left: 1em; padding: 0.2em; float: right; clear: right; text-align:left;" |
| 89 | +! style="text-align: center; background-color:#ccccff;" colspan="2" |<big>{{PAGENAME}}</big> |
| 90 | +|- |
| 91 | + |
| 92 | +END; |
| 93 | + } else { |
| 94 | + $text .= "{| border=0 cellpadding=4 cellspacing=4\n"; |
84 | 95 | } |
85 | | - $text .= "{| border=0 cellpadding=4 cellspacing=4\n"; |
86 | 96 | |
87 | 97 | foreach ($template_fields as $i => $field) { |
88 | 98 | if ($i > 0) { |
89 | 99 | $text .= "|-\n"; |
90 | 100 | } |
91 | 101 | $text .= "! " . $field->label . "\n"; |
92 | | - if ($field->semantic_field == null || $field->semantic_field == '') { |
| 102 | + if ($field->semantic_field_call == null || $field->semantic_field_call == '') { |
93 | 103 | $text .= "| {{{" . $field->field_name . "|unknown}}}\n"; |
94 | 104 | } else { |
95 | | - if ($field->attr_or_rel == "attribute") { |
96 | | - $text .= "| [[" . $field->semantic_field . ":={{{" . $field->field_name . "|unknown}}}]]\n"; |
97 | | - } else { |
98 | | - $text .= "| [[" . $field->semantic_field . "::{{{" . $field->field_name . "|unknown}}}]]\n"; |
99 | | - } |
| 105 | + $text .= "| [[" . $field->semantic_field_call . "{{{" . $field->field_name . "|unknown}}}]]\n"; |
100 | 106 | } |
101 | 107 | } |
102 | 108 | $text .= "|}\n"; |
103 | | - if ($category_name != '') { |
104 | | - $text .= "\n[[Category:$category_name]]\n"; |
| 109 | + if ($category != '') { |
| 110 | + $text .= "\n[[Category:$category]]\n"; |
105 | 111 | } |
106 | 112 | $text .= "</includeonly>\n"; |
107 | 113 | |