Index: trunk/extensions/intersection/DynamicPageList.i18n.php |
— | — | @@ -13,7 +13,6 @@ |
14 | 14 | 'intersection_toomanycats' => 'Error: Too many categories!', |
15 | 15 | 'intersection_noresults' => 'Error: No results!', |
16 | 16 | 'intersection_noincludecats' => 'Error: You need to include at least one category, or specify a namespace!', |
17 | | - 'intersection_inline_delimiter' => ', ' //probably don't need to translate |
18 | 17 | ); |
19 | 18 | |
20 | 19 | /** Message documentation (Message documentation) |
— | — | @@ -21,7 +20,6 @@ |
22 | 21 | */ |
23 | 22 | $messages['qqq'] = array( |
24 | 23 | 'intersection-desc' => 'Short description of the Intersection extension, shown in [[Special:Version]]. Do not translate or change links.', |
25 | | - 'intersection_inline_delimiter' => 'Seperator when used in inline mode. Probably should not translate.', |
26 | 24 | ); |
27 | 25 | |
28 | 26 | /** Afrikaans (Afrikaans) |
Index: trunk/extensions/intersection/DynamicPageList.php |
— | — | @@ -73,7 +73,7 @@ |
74 | 74 | $sEndList = '</ul>'; |
75 | 75 | $sStartItem = '<li>'; |
76 | 76 | $sEndItem = '</li>'; |
77 | | - $bDoNotEndLastItem = false; // control putting $sEndItem after last item |
| 77 | + $bInlineMode = false; |
78 | 78 | |
79 | 79 | $bUseGallery = false; |
80 | 80 | $bGalleryFileSize = false; |
— | — | @@ -178,22 +178,21 @@ |
179 | 179 | $sEndList = ''; |
180 | 180 | $sStartItem = ''; |
181 | 181 | $sEndItem = '<br />'; |
182 | | - $bDoNotEndLastItem = false; |
| 182 | + $bInlineMode = false; |
183 | 183 | break; |
184 | 184 | case 'ordered': |
185 | 185 | $sStartList = '<ol>'; |
186 | 186 | $sEndList = '</ol>'; |
187 | 187 | $sStartItem = '<li>'; |
188 | 188 | $sEndItem = '</li>'; |
189 | | - $bDoNotEndLastItem = false; |
| 189 | + $bInlineMode = false; |
190 | 190 | break; |
191 | 191 | case 'inline': |
192 | 192 | //aka comma seperated list |
193 | 193 | $sStartList = ''; |
194 | 194 | $sEndList = ''; |
195 | 195 | $sStartItem = ''; |
196 | | - $sEndItem = wfMsgHtml('intersection_inline_delimiter'); |
197 | | - $bDoNotEndLastItem = true; |
| 196 | + $bInlineMode = true; |
198 | 197 | break; |
199 | 198 | case 'unordered': |
200 | 199 | default: |
— | — | @@ -201,7 +200,7 @@ |
202 | 201 | $sEndList = '</ul>'; |
203 | 202 | $sStartItem = '<li>'; |
204 | 203 | $sEndItem = '</li>'; |
205 | | - $bDoNotEndLastItem = false; |
| 204 | + $bInlineMode = false; |
206 | 205 | break; |
207 | 206 | } |
208 | 207 | break; |
— | — | @@ -543,11 +542,9 @@ |
544 | 543 | |
545 | 544 | //process results of query, outputing equivalent of <li>[[Article]]</li> for each result, |
546 | 545 | //or something similar if the list uses other startlist/endlist |
547 | | - $rowCount = $dbr->numRows( $res ); |
| 546 | + $articleList = Array(); |
548 | 547 | while ($row = $dbr->fetchObject( $res ) ) { |
549 | | - $rowCount--; |
550 | 548 | $title = Title::makeTitle( $row->page_namespace, $row->page_title); |
551 | | - $output .= $sStartItem; |
552 | 549 | if ( true == $bAddFirstCategoryDate ) { |
553 | 550 | if ( $sDateFormat != '' ) { |
554 | 551 | # this is a tad ugly |
— | — | @@ -588,11 +585,8 @@ |
589 | 586 | # would come from the dateformatter <span>. |
590 | 587 | $gallery->add( $title, $categoryDate ); |
591 | 588 | } else { |
592 | | - $output .= $categoryDate; |
593 | | - $output .= $sk->link( $title, htmlspecialchars( $titleText ), $aLinkOptions, $query, array( 'forcearticlepath', 'known' ) ); |
594 | | - if (!($bDoNotEndLastItem && $rowCount === 0)) { |
595 | | - $output .= $sEndItem . "\n"; |
596 | | - } |
| 589 | + $articleList[] = $categoryDate |
| 590 | + . $sk->link( $title, htmlspecialchars( $titleText ), $aLinkOptions, $query, array( 'forcearticlepath', 'known' ) ); |
597 | 591 | } |
598 | 592 | } |
599 | 593 | |
— | — | @@ -611,6 +605,13 @@ |
612 | 606 | $gallery->setCaption( $sGalleryCaption ); # gallery class escapes string |
613 | 607 | $output = $gallery->toHtml(); |
614 | 608 | } else { |
| 609 | + $output .= $sStartItem; |
| 610 | + if ( $bInlineMode ) { |
| 611 | + $output .= $wgContLang->commaList( $articleList ); |
| 612 | + } else { |
| 613 | + $output .= implode( "$sEndItem \n $sStartItem", $articleList ); |
| 614 | + } |
| 615 | + $output .= $sEndItem; |
615 | 616 | $output .= $sEndList . "\n"; |
616 | 617 | } |
617 | 618 | return $output; |