Index: trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_List.php |
— | — | @@ -97,9 +97,8 @@ |
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | | - // Print header |
102 | | - $result = $header; |
103 | | - |
| 101 | + // Initialise more values |
| 102 | + $result = ''; |
104 | 103 | $column_width = 0; |
105 | 104 | |
106 | 105 | // Set up floating divs, if there's more than one column |
— | — | @@ -109,6 +108,9 @@ |
110 | 109 | $rows_per_column = ceil( $res->getCount() / $this->mColumns ); |
111 | 110 | $rows_in_cur_column = 0; |
112 | 111 | } |
| 112 | + |
| 113 | + $result .= "\t\t\t\t$header\n"; |
| 114 | + |
113 | 115 | |
114 | 116 | if ( $this->mIntroTemplate != '' ) { |
115 | 117 | $result .= "{{" . $this->mIntroTemplate . "}}"; |
— | — | @@ -117,8 +119,10 @@ |
118 | 120 | // Now print each row |
119 | 121 | $rownum = -1; |
120 | 122 | while ( $row = $res->getNext() ) { |
121 | | - $this->printRow( $row, $rownum, $rows_in_cur_column, $rows_in_cur_column, $plainlist, |
122 | | - $header, $footer, $rowstart, $rowend, $result, $column_width, $res, $listsep, $finallistsep ); |
| 123 | + $this->printRow( $row, $rownum, $rows_in_cur_column, |
| 124 | + $rows_per_column, $this->mFormat, $plainlist, |
| 125 | + $header, $footer, $rowstart, $rowend, $result, |
| 126 | + $column_width, $res, $listsep, $finallistsep ); |
123 | 127 | } |
124 | 128 | |
125 | 129 | if ( $this->mOutroTemplate != '' ) { |
— | — | @@ -129,13 +133,13 @@ |
130 | 134 | if ( $this->linkFurtherResults( $res ) && ( ( $this->mFormat != 'ol' ) || ( $this->getSearchLabel( SMW_OUTPUT_WIKI ) ) ) ) { |
131 | 135 | $this->showFurtherResults( $result, $res, $rowstart, $rowend ); |
132 | 136 | } |
| 137 | + |
| 138 | + // Print footer |
| 139 | + $result .= "\t\t\t\t$footer\n"; |
133 | 140 | |
134 | 141 | if ( $this->mColumns > 1 ) { |
135 | | - $result .= '</div>' . "\n"; |
| 142 | + $result .= "\t\t\t\t</div>\n"; |
136 | 143 | } |
137 | | - |
138 | | - // Print footer |
139 | | - $result .= $footer; |
140 | 144 | |
141 | 145 | if ( $this->mColumns > 1 ) { |
142 | 146 | $result .= '<br style="clear: both">' . "\n"; |
— | — | @@ -144,20 +148,39 @@ |
145 | 149 | return $result; |
146 | 150 | } |
147 | 151 | |
148 | | - protected function printRow( $row, &$rownum, &$rows_in_cur_column, $rows_per_column, |
149 | | - $plainlist, $header, $footer, $rowstart, $rowend, &$result, $column_width, $res, $listsep, $finallistsep ) { |
| 152 | + protected function printRow( $row, &$rownum, &$rows_in_cur_column, |
| 153 | + $rows_per_column, $format, $plainlist, $header, $footer, |
| 154 | + $rowstart, $rowend, &$result, $column_width, $res, $listsep, |
| 155 | + $finallistsep ) { |
| 156 | + |
150 | 157 | $rownum++; |
151 | 158 | |
152 | 159 | if ( $this->mColumns > 1 ) { |
153 | 160 | if ( $rows_in_cur_column == $rows_per_column ) { |
154 | | - $result .= "\n</div>"; |
155 | | - $result .= '<div style="float: left; width: ' . $column_width . '%">' . "\n"; |
| 161 | + // If it's a numbered list, and it's split |
| 162 | + // into columns, add in the 'start=' |
| 163 | + // attribute so that each additional column |
| 164 | + // starts at the right place. This attribute |
| 165 | + // is actually deprecated, but it appears to |
| 166 | + // still be supported by the major browsers... |
| 167 | + if ( $format == 'ol' ) { |
| 168 | + $header = "<ol start=\"" . ( $rownum + 1 ) . "\">"; |
| 169 | + } |
| 170 | + $result .= <<<END |
| 171 | + |
| 172 | + $footer |
| 173 | + </div> |
| 174 | + <div style="float: left; width: $column_width%"> |
| 175 | + $header |
| 176 | + |
| 177 | +END; |
156 | 178 | $rows_in_cur_column = 0; |
157 | 179 | } |
158 | 180 | |
159 | 181 | $rows_in_cur_column++; |
160 | 182 | } |
161 | 183 | |
| 184 | + $result .= "\t\t\t\t\t"; |
162 | 185 | if ( $rownum > 0 && $plainlist ) { |
163 | 186 | $result .= ( $rownum <= $res->getCount() ) ? $listsep : $finallistsep; // the comma between "rows" other than the last one |
164 | 187 | } else { |
— | — | @@ -265,7 +288,7 @@ |
266 | 289 | $link->setParameter( $this->mOutroTemplate, 'outrotemplate' ); |
267 | 290 | } |
268 | 291 | |
269 | | - $result .= $rowstart . $link->getText( SMW_OUTPUT_WIKI, $this->mLinker ) . $rowend . "\n"; |
| 292 | + $result .= "\t\t\t\t" . $rowstart . $link->getText( SMW_OUTPUT_WIKI, $this->mLinker ) . $rowend . "\n"; |
270 | 293 | } |
271 | 294 | |
272 | 295 | public function getParameters() { |