Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_List.php |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | |
20 | 20 | protected $mSep = ''; |
21 | 21 | protected $mTemplate = ''; |
| 22 | + protected $mUserParam = ''; |
22 | 23 | |
23 | 24 | protected function readParameters($params,$outputmode) { |
24 | 25 | SMWResultPrinter::readParameters($params,$outputmode); |
— | — | @@ -31,6 +32,9 @@ |
32 | 33 | if (array_key_exists('template', $params)) { |
33 | 34 | $this->mTemplate = trim($params['template']); |
34 | 35 | } |
| 36 | + if (array_key_exists('userparam', $params)) { |
| 37 | + $this->mUserParam = trim($params['userparam']); |
| 38 | + } |
35 | 39 | } |
36 | 40 | |
37 | 41 | protected function getResultText($res,$outputmode) { |
— | — | @@ -84,7 +88,7 @@ |
85 | 89 | |
86 | 90 | $first_col = true; |
87 | 91 | if ($usetemplate) { // build template code |
88 | | - $wikitext = ''; |
| 92 | + $wikitext = ($this->mUserParam)?"|userparam=$this->mUserParam":''; |
89 | 93 | $i = 1; // explicitly number parameters for more robust parsing (values may contain "=") |
90 | 94 | foreach ($row as $field) { |
91 | 95 | $wikitext .= '|' . $i++ . '='; |
Index: trunk/extensions/SemanticMediaWiki/includes/SMW_QP_Template.php |
— | — | @@ -13,6 +13,7 @@ |
14 | 14 | class SMWTemplateResultPrinter extends SMWResultPrinter { |
15 | 15 | |
16 | 16 | protected $m_template; |
| 17 | + protected $m_userparam; |
17 | 18 | |
18 | 19 | protected function readParameters($params,$outputmode) { |
19 | 20 | SMWResultPrinter::readParameters($params,$outputmode); |
— | — | @@ -22,6 +23,12 @@ |
23 | 24 | } else { |
24 | 25 | $this->m_template = false; |
25 | 26 | } |
| 27 | + |
| 28 | + if (array_key_exists('userparam', $params)) { |
| 29 | + $this->m_userparam = trim($params['userparam']); |
| 30 | + } else { |
| 31 | + $this->m_userparam = false; |
| 32 | + } |
26 | 33 | } |
27 | 34 | |
28 | 35 | protected function getResultText($res, $outputmode) { |
— | — | @@ -41,14 +48,14 @@ |
42 | 49 | $parserinput = $this->mIntro; |
43 | 50 | while ( $row = $res->getNext() ) { |
44 | 51 | $i = 1; // explicitly number parameters for more robust parsing (values may contain "=") |
45 | | - $wikitext = ''; |
| 52 | + $wikitext = ($this->m_userparam)?"|userparam=$this->m_userparam":''; |
46 | 53 | $firstcol = true; |
47 | 54 | foreach ($row as $field) { |
48 | 55 | $wikitext .= '|' . $i++ . '='; |
49 | 56 | $first = true; |
50 | 57 | while ( ($text = $field->getNextText(SMW_OUTPUT_WIKI, $this->getLinker($firstcol))) !== false ) { |
51 | 58 | if ($first) { |
52 | | - $first = false; |
| 59 | + $first = false; |
53 | 60 | } else { |
54 | 61 | $wikitext .= ', '; |
55 | 62 | } |