Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_List.php |
— | — | @@ -31,21 +31,26 @@ |
32 | 32 | if ( array_key_exists( 'sep', $params ) ) { |
33 | 33 | $this->mSep = str_replace( '_', ' ', $params['sep'] ); |
34 | 34 | } |
| 35 | + |
35 | 36 | if ( array_key_exists( 'template', $params ) ) { |
36 | 37 | $this->mTemplate = trim( $params['template'] ); |
37 | 38 | } |
| 39 | + |
38 | 40 | if ( array_key_exists( 'userparam', $params ) ) { |
39 | 41 | $this->mUserParam = trim( $params['userparam'] ); |
40 | 42 | } |
| 43 | + |
41 | 44 | if ( array_key_exists( 'columns', $params ) ) { |
42 | 45 | $columns = trim( $params['columns'] ); |
43 | 46 | if ( $columns > 1 && $columns <= 10 ) { // allow a maximum of 10 columns |
44 | 47 | $this->mColumns = (int)$columns; |
45 | 48 | } |
46 | 49 | } |
| 50 | + |
47 | 51 | if ( array_key_exists( 'introtemplate', $params ) ) { |
48 | 52 | $this->mIntroTemplate = $params['introtemplate']; |
49 | 53 | } |
| 54 | + |
50 | 55 | if ( array_key_exists( 'outrotemplate', $params ) ) { |
51 | 56 | $this->mOutroTemplate = $params['outrotemplate']; |
52 | 57 | } |
— | — | @@ -62,6 +67,7 @@ |
63 | 68 | $res->addErrors( array( wfMsgForContent( 'smw_notemplategiven' ) ) ); |
64 | 69 | return ''; |
65 | 70 | } |
| 71 | + |
66 | 72 | // Determine mark-up strings used around list items: |
67 | 73 | if ( ( $this->mFormat == 'ul' ) || ( $this->mFormat == 'ol' ) ) { |
68 | 74 | $header = '<' . $this->mFormat . '>'; |
— | — | @@ -75,6 +81,7 @@ |
76 | 82 | $rowstart = ''; |
77 | 83 | $rowend = ''; |
78 | 84 | $plainlist = true; |
| 85 | + |
79 | 86 | if ( $this->mSep != '' ) { // always respect custom separator |
80 | 87 | $listsep = $this->mSep; |
81 | 88 | $finallistsep = $listsep; |
— | — | @@ -87,6 +94,7 @@ |
88 | 95 | $finallistsep = ''; |
89 | 96 | } |
90 | 97 | } |
| 98 | + |
91 | 99 | // Print header |
92 | 100 | $result = $header; |
93 | 101 | |
— | — | @@ -97,6 +105,7 @@ |
98 | 106 | $rows_per_column = ceil( $res->getCount() / $this->mColumns ); |
99 | 107 | $rows_in_cur_column = 0; |
100 | 108 | } |
| 109 | + |
101 | 110 | if ( $this->mIntroTemplate != '' ) { |
102 | 111 | $result .= "{{" . $this->mIntroTemplate . "}}"; |
103 | 112 | } |
— | — | @@ -123,6 +132,7 @@ |
124 | 133 | |
125 | 134 | // Print footer |
126 | 135 | $result .= $footer; |
| 136 | + |
127 | 137 | if ( $this->mColumns > 1 ) { |
128 | 138 | $result .= '<br style="clear: both">' . "\n"; |
129 | 139 | } |
— | — | @@ -219,7 +229,7 @@ |
220 | 230 | } |
221 | 231 | |
222 | 232 | $link->setParameter( $this->mFormat, 'format' ); |
223 | | - |
| 233 | + |
224 | 234 | if ( $this->mTemplate != '' ) { |
225 | 235 | $link->setParameter( $this->mTemplate, 'template' ); |
226 | 236 | if ( array_key_exists( 'link', $this->m_params ) ) { // linking may interfere with templates |
— | — | @@ -269,6 +279,7 @@ |
270 | 280 | if ( ! $plainlist ) { |
271 | 281 | $params[] = array( 'name' => 'columns', 'type' => 'int', 'description' => wfMsg( 'smw_paramdesc_columns', 1 ) ); |
272 | 282 | } |
| 283 | + |
273 | 284 | $params[] = array( 'name' => 'userparam', 'type' => 'string', 'description' => wfMsg( 'smw_paramdesc_userparam' ) ); |
274 | 285 | $params[] = array( 'name' => 'introtemplate', 'type' => 'string', 'description' => wfMsg( 'smw_paramdesc_introtemplate' ) ); |
275 | 286 | $params[] = array( 'name' => 'outrotemplate', 'type' => 'string', 'description' => wfMsg( 'smw_paramdesc_outrotemplate' ) ); |