Index: branches/REL1_16/extensions/Favorites/FavParser.php |
— | — | @@ -2,58 +2,66 @@ |
3 | 3 | |
4 | 4 | class FavParser { |
5 | 5 | |
6 | | -function wfSpecialFavoritelist() { |
| 6 | + function wfSpecialFavoritelist($argv, $parser) { |
| 7 | + |
| 8 | + global $wgUser, $wgOut, $wgLang, $wgRequest; |
| 9 | + global $wgRCShowFavoritingUsers, $wgEnotifFavoritelist, $wgShowUpdatedMarker; |
| 10 | + $output = ''; |
7 | 11 | |
8 | | - global $wgUser, $wgOut, $wgLang, $wgRequest; |
9 | | - global $wgRCShowFavoritingUsers, $wgEnotifFavoritelist, $wgShowUpdatedMarker; |
10 | | - $output = ''; |
11 | | - |
12 | | - $skin = $wgUser->getSkin(); |
13 | | - $specialTitle = SpecialPage::getTitleFor( 'Favoritelist' ); |
14 | | - //$wgOut->setRobotPolicy( 'noindex,nofollow' ); |
15 | | - |
16 | | - # Anons don't get a favoritelist |
17 | | - if( $wgUser->isAnon() ) { |
18 | | - //$wgOut->setPageTitle( wfMsg( 'favoritenologin' ) ); |
19 | | - $llink = $skin->linkKnown( |
20 | | - SpecialPage::getTitleFor( 'Userlogin' ), |
21 | | - wfMsg( 'loginreqlink' ), |
22 | | - array(), |
23 | | - array( 'returnto' => $specialTitle->getPrefixedText() ) |
24 | | - ); |
25 | | - $output = wfMsgHtml( 'favoritelistanontext', $llink ) ; |
| 12 | + $skin = $wgUser->getSkin(); |
| 13 | + $specialTitle = SpecialPage::getTitleFor( 'Favoritelist' ); |
| 14 | + //$wgOut->setRobotPolicy( 'noindex,nofollow' ); |
| 15 | + |
| 16 | + # Anons don't get a favoritelist |
| 17 | + if( $wgUser->isAnon() ) { |
| 18 | + //$wgOut->setPageTitle( wfMsg( 'favoritenologin' ) ); |
| 19 | + $llink = $skin->linkKnown( |
| 20 | + SpecialPage::getTitleFor( 'Userlogin' ), |
| 21 | + wfMsg( 'loginreqlink' ), |
| 22 | + array(), |
| 23 | + array( 'returnto' => $specialTitle->getPrefixedText() ) |
| 24 | + ); |
| 25 | + $output = wfMsgHtml( 'favoritelistanontext', $llink ) ; |
| 26 | + |
| 27 | + |
| 28 | + return $output ; |
| 29 | + |
| 30 | + } |
| 31 | + |
| 32 | + $output = $this->viewFavList($wgUser, $output, $wgRequest); |
| 33 | + if ( array_key_exists('editlink', $argv) && $argv['editlink']) { |
| 34 | + # Add an edit link if you want it: |
| 35 | + $output .= "<div id='contentSub'><br>" . |
| 36 | + $skin->link( |
| 37 | + SpecialPage::getTitleFor( 'Favoritelist', 'edit' ), |
| 38 | + wfMsgHtml( "favoritelisttools-edit" ), |
| 39 | + array(), |
| 40 | + array(), |
| 41 | + array( 'known', 'noclasses' ) |
| 42 | + ) . "</div>"; |
| 43 | + } |
| 44 | + |
26 | 45 | return $output ; |
27 | | - |
28 | 46 | } |
29 | 47 | |
30 | | - |
31 | | - |
32 | 48 | |
33 | | - $output = $this->viewFavList($wgUser, $output, $wgRequest); |
34 | | - return $output ; |
35 | | -} |
36 | | - |
37 | | - |
38 | 49 | private function viewFavList ($user, $output, $request) { |
39 | | - global $wgUser, $wgOut, $wgLang, $wgRequest; |
40 | | - $uid = $wgUser->getId(); |
41 | | - $output = $this->showNormalForm( $output, $user ); |
42 | | - |
43 | | - $dbr = wfGetDB( DB_SLAVE, 'favoritelist' ); |
| 50 | + global $wgUser, $wgOut, $wgLang, $wgRequest; |
| 51 | + $uid = $wgUser->getId(); |
| 52 | + $output = $this->showNormalForm( $output, $user ); |
44 | 53 | |
45 | | - |
46 | | - $favoritelistCount = $dbr->selectField( 'favoritelist', 'COUNT(*)', |
47 | | - array( 'fl_user' => $uid ), __METHOD__ ); |
48 | | - // Adjust for page X, talk:page X, which are both stored separately, |
49 | | - // but treated together |
50 | | - $nitems = floor($favoritelistCount); |
51 | | - |
52 | | - if( $nitems == 0 ) { |
53 | | - $output = wfmsg('nofavoritelist'); |
| 54 | + $dbr = wfGetDB( DB_SLAVE, 'favoritelist' ); |
54 | 55 | |
| 56 | + $favoritelistCount = $dbr->selectField( 'favoritelist', 'COUNT(*)', |
| 57 | + array( 'fl_user' => $uid ), __METHOD__ ); |
| 58 | + $nitems = floor($favoritelistCount); |
| 59 | + |
| 60 | + if( $nitems == 0 ) { |
| 61 | + $output = wfmsg('nofavoritelist'); |
| 62 | + |
| 63 | + } |
| 64 | + return $output; |
55 | 65 | } |
56 | | - return $output; |
57 | | -} |
58 | 66 | |
59 | 67 | |
60 | 68 | /** |
— | — | @@ -193,9 +201,10 @@ |
194 | 202 | * @param $user User |
195 | 203 | */ |
196 | 204 | private function showNormalForm( $output, $user ) { |
197 | | - global $wgUser; |
| 205 | + global $wgUser, $wgOut; |
| 206 | + $skin = $wgUser->getSkin(); |
198 | 207 | if( ( $count = $this->showItemCount( $output, $user ) ) > 0 ) { |
199 | | - $form = $this->buildRemoveList( $user, $wgUser->getSkin() ); |
| 208 | + $form = $this->buildRemoveList( $user, $skin ); |
200 | 209 | $output .= $form ; |
201 | 210 | return $output; |
202 | 211 | } |
— | — | @@ -209,15 +218,14 @@ |
210 | 219 | */ |
211 | 220 | private function buildRemoveList( $user, $skin ) { |
212 | 221 | $list = ""; |
| 222 | + $list .= "<ul>\n"; |
213 | 223 | foreach( $this->getFavoritelistInfo( $user ) as $namespace => $pages ) { |
214 | | - |
215 | | - $list .= "<ul>\n"; |
216 | 224 | foreach( $pages as $dbkey => $redirect ) { |
217 | 225 | $title = Title::makeTitleSafe( $namespace, $dbkey ); |
218 | 226 | $list .= $this->buildRemoveLine( $title, $redirect, $skin ); |
219 | 227 | } |
220 | | - $list .= "</ul>\n"; |
221 | 228 | } |
| 229 | + $list .= "</ul>\n"; |
222 | 230 | return $list; |
223 | 231 | } |
224 | 232 | |
Index: branches/REL1_16/extensions/Favorites/SpecialFavoritelist.php |
— | — | @@ -449,12 +449,16 @@ |
450 | 450 | */ |
451 | 451 | private function buildRemoveLine( $title, $redirect, $skin ) { |
452 | 452 | global $wgLang; |
453 | | - |
| 453 | + # In case the user adds something unusual to their list using the raw editor |
| 454 | + # We moved the Tools array completely into the "if( $title->exists() )" section. |
| 455 | + $showlinks=false; |
454 | 456 | $link = $skin->link( $title ); |
455 | 457 | if( $redirect ) |
456 | 458 | $link = '<span class="favoritelistredir">' . $link . '</span>'; |
457 | | - $tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) ); |
| 459 | + |
458 | 460 | if( $title->exists() ) { |
| 461 | + $showlinks = true; |
| 462 | + $tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) ); |
459 | 463 | $tools[] = $skin->link( |
460 | 464 | $title, |
461 | 465 | wfMsgHtml( 'history_short' ), |
— | — | @@ -472,10 +476,15 @@ |
473 | 477 | array( 'known', 'noclasses' ) |
474 | 478 | ); |
475 | 479 | } |
476 | | - return "<li>" |
477 | | - //. Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) ) |
| 480 | + |
| 481 | + if ($showlinks) { |
| 482 | + return "<li>" |
478 | 483 | . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "</li>\n"; |
| 484 | + } else { |
| 485 | + return "<li>" |
| 486 | + . $link . "</li>\n"; |
479 | 487 | } |
| 488 | + } |
480 | 489 | |
481 | 490 | /** |
482 | 491 | * Show a form for editing the favoritelist in "raw" mode |
Index: branches/REL1_16/extensions/Favorites/favorites.i18n.php |
— | — | @@ -60,7 +60,7 @@ |
61 | 61 | 'favoritelistall2' => 'all', |
62 | 62 | |
63 | 63 | # Favoritelist editor |
64 | | -'favoritelistedit-numitems' => 'Your favorites contain {{PLURAL:$1|1 title|$1 titles}}, excluding talk pages.', |
| 64 | +'favoritelistedit-numitems' => 'Your favorites contain {{PLURAL:$1|1 title|$1 titles}}.', |
65 | 65 | 'favoritelistedit-noitems' => 'Your favorites contain no titles.', |
66 | 66 | 'favoritelistedit-normal-title' => 'Edit favorites', |
67 | 67 | 'favoritelistedit-normal-legend' => 'Remove titles from favorites', |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | 'tooltip-ca-unfavorite' => 'Entferne diese Seite von deiner Favoritenliste', |
122 | 122 | 'tooltip-favorite' => 'Füge diese Seite zu deiner Favoritenliste hinzu', |
123 | 123 | 'favoritelistall2' => 'alle', |
124 | | - 'favoritelistedit-numitems' => 'Deine Favoritenliste enthält {{PLURAL:$1|einen Eintrag |$1 Einträge}}. Die Diskussionsseiten wurden dabei nicht mitgezählt.', |
| 124 | + 'favoritelistedit-numitems' => 'Deine Favoritenliste enthält {{PLURAL:$1|einen Eintrag |$1 Einträge}}.', |
125 | 125 | 'favoritelistedit-noitems' => 'Deine Favoritenliste enthält keine Einträge.', |
126 | 126 | 'favoritelistedit-normal-title' => 'Favoritenliste bearbeiten', |
127 | 127 | 'favoritelistedit-normal-legend' => 'Einträge aus der Favoritenliste entfernen', |
— | — | @@ -158,7 +158,7 @@ |
159 | 159 | 'tooltip-ca-favorite' => 'Fügen Sie diese Seite zu Ihrer Favoritenliste hinzu', |
160 | 160 | 'tooltip-ca-unfavorite' => 'Entfernen Sie diese Seite von Ihrer Favoritenliste', |
161 | 161 | 'tooltip-favorite' => 'Fügen Sie diese Seite zu Ihrer Favoritenliste hinzu', |
162 | | - 'favoritelistedit-numitems' => 'Ihre Favoritenliste enthält {{PLURAL:$1|einen Eintrag|$1 Einträge}}. Die Diskussionsseiten wurden dabei nicht mitgezählt.', |
| 162 | + 'favoritelistedit-numitems' => 'Ihre Favoritenliste enthält {{PLURAL:$1|einen Eintrag|$1 Einträge}}.', |
163 | 163 | 'favoritelistedit-noitems' => 'Ihre Favoritenliste enthält keine Einträge.', |
164 | 164 | 'favoritelistedit-normal-explain' => 'Dies sind die Einträge Ihrer Favoritenliste. |
165 | 165 | Um Einträge zu entfernen, markieren Sie die Kästchen neben den Einträgen und klicken Sie am Ende der Seite auf „{{int:Favoritelistedit-normal-submit}}“. |
— | — | @@ -205,17 +205,69 @@ |
206 | 206 | * @author Bjankuloski06 |
207 | 207 | */ |
208 | 208 | $messages['mk'] = array( |
| 209 | + 'favorites-desc' => 'Создај список на бендисани', |
| 210 | + 'favoritethis' => 'Бендисај ја станицава', |
| 211 | + 'prefs-favoritelist' => 'Бендисани', |
| 212 | + 'prefs-favoritelist-token' => 'Жетон за бендисани:', |
| 213 | + 'prefs-advancedfavoritelist' => 'Напредни поставки', |
| 214 | + 'favoritelist' => 'Мои бендисани', |
| 215 | + 'myfavoritelist' => 'Мои бендисани', |
209 | 216 | 'favoritelistfor' => "(за '''$1''')", |
| 217 | + 'nofavoritelist' => 'Немате бендисани.', |
| 218 | + 'favoritelistanontext' => '$1 за да ги погледате или уредите бендисаните.', |
| 219 | + 'favoritenologin' => 'Не сте најавени', |
| 220 | + 'favoritenologintext' => 'Мора да сте [[Special:UserLogin|најавени]] за да можете да ги менувате бендисаните.', |
| 221 | + 'addedfavorite' => 'Додадено во бендисаните', |
| 222 | + 'addedfavoritetext' => 'Страницата „[[:$1]]“ е додадена во [[Special:Favoritelist|бендисаните]].', |
| 223 | + 'removedfavorite' => 'Отстрането од бендисаните', |
| 224 | + 'removedfavoritetext' => 'Страницата „[[:$1]]“ е отстранета од [[Special:Favoritelist|бендисаните]].', |
| 225 | + 'favorite' => 'Бендисај', |
| 226 | + 'favoritethispage' => 'Бендисај ја страницава', |
| 227 | + 'unfavorite' => 'Одбендисај', |
| 228 | + 'unfavoritethispage' => 'Одбендисај ја страницава', |
| 229 | + 'favoritelist-options' => 'Поставки за бендисани', |
210 | 230 | 'favoriteing' => 'Бендисувам...', |
211 | 231 | 'unfavoriteing' => 'Одбендисувам...', |
| 232 | + 'tooltip-pt-favoritelist' => 'Список на страници кои сте избрале да ги набљудувате', |
| 233 | + 'tooltip-ca-favorite' => 'Додај ја страницава во бендисаните', |
| 234 | + 'tooltip-ca-unfavorite' => 'Отстрани ја страницава од бендисаните', |
| 235 | + 'tooltip-favorite' => 'Додај ја страницава во бендисаните', |
212 | 236 | 'favoritelistall2' => 'сите', |
| 237 | + 'favoritelistedit-numitems' => 'Во бендисаните има {{PLURAL:$1|1 наслов|$1 наслови}}.', |
| 238 | + 'favoritelistedit-noitems' => 'Немате наслови во бендисаните.', |
| 239 | + 'favoritelistedit-normal-title' => 'Уреди бендисани', |
| 240 | + 'favoritelistedit-normal-legend' => 'Отстрани наслови од бендисаните', |
| 241 | + 'favoritelistedit-normal-explain' => 'Насловите во вашиот список на набљудувања се прикажани подолу. |
| 242 | +За да избришете наслов, штиклирајте го квадратчето лево од насловот, и стиснете на „{{int:Favoritelistedit-normal-submit}}“. |
| 243 | +Можете да го [[Special:Favoritelist/raw|уредите сировниот список]].', |
| 244 | + 'favoritelistedit-normal-submit' => 'Отстрани наслови', |
| 245 | + 'favoritelistedit-normal-done' => '{{PLURAL:$1|1 наслов|$1 наслови}} се отстранети од бендисаните:', |
| 246 | + 'favoritelistedit-raw-title' => 'Уреди сиров список на бендисани', |
| 247 | + 'favoritelistedit-raw-legend' => 'Уреди сиров список на бендисани', |
| 248 | + 'favoritelistedit-raw-explain' => 'Насловите во бендисаните се прикажани подолу, и можат да се уредуваат со додавање или бришење на ставки од списокот; |
| 249 | +по еден наслов во секој ред. |
| 250 | +Кога ќе завршите, стиснете на „{{int:Favoritelistedit-raw-submit}}“. |
| 251 | +Можете и да го [[Special:Favoritelist/edit|употребите обичниот уредувач]].', |
213 | 252 | 'favoritelistedit-raw-titles' => 'Наслови:', |
| 253 | + 'favoritelistedit-raw-submit' => 'Поднови бендисани', |
| 254 | + 'favoritelistedit-raw-done' => 'Бендисаните се подновени.', |
| 255 | + 'favoritelistedit-raw-added' => '{{PLURAL:$1|Додаден е 1 наслов|Додадени се $1 наслови}}:', |
| 256 | + 'favoritelistedit-raw-removed' => '{{PLURAL:$1|Отстранет е 1 наслов|Отстранети се $1 наслови}}:', |
| 257 | + 'favoritelisttools-view' => 'Погледај „Бендисани“', |
| 258 | + 'favoritelisttools-edit' => 'Погледај и уреди „Бендисани“', |
| 259 | + 'favoritelisttools-raw' => 'Уреди сирови бендисани', |
214 | 260 | ); |
215 | 261 | |
216 | 262 | /** Dutch (Nederlands) |
| 263 | + * @author SPQRobin |
217 | 264 | * @author Siebrand |
218 | 265 | */ |
219 | 266 | $messages['nl'] = array( |
| 267 | + 'prefs-favoritelist' => 'Favorieten', |
| 268 | + 'favoritelist' => 'Mijn favorieten', |
| 269 | + 'myfavoritelist' => 'Mijn favorieten', |
| 270 | + 'favoritelistfor' => "(voor '''$1''')", |
| 271 | + 'favoritenologin' => 'Niet aangemeld', |
220 | 272 | 'favoritelistall2' => 'alle', |
221 | 273 | 'favoritelistedit-normal-submit' => "Pagina's verwijderen", |
222 | 274 | 'favoritelistedit-normal-done' => 'Er {{PLURAL:$1|is 1 pagina|zijn $1 pagina’s}} verwijderd uit uw favorieten:', |
— | — | @@ -268,7 +320,7 @@ |
269 | 321 | 'tooltip-ca-unfavorite' => 'Remover esta página das páginas preferidas', |
270 | 322 | 'tooltip-favorite' => 'Adicionar esta página às suas preferidas', |
271 | 323 | 'favoritelistall2' => 'todas', |
272 | | - 'favoritelistedit-numitems' => 'A sua lista de páginas preferidas contém {{PLURAL:$1|uma página|$1 páginas}}, excluindo páginas de discussão.', |
| 324 | + 'favoritelistedit-numitems' => 'A sua lista de páginas preferidas contém {{PLURAL:$1|uma página|$1 páginas}}.', |
273 | 325 | 'favoritelistedit-noitems' => 'A sua lista de página preferidas está vazia.', |
274 | 326 | 'favoritelistedit-normal-title' => 'Editar a lista de preferidas', |
275 | 327 | 'favoritelistedit-normal-legend' => 'Remover páginas das preferidas', |
Index: branches/REL1_16/extensions/Favorites/FavoritedItem.php |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | */ |
91 | 91 | public static function duplicateEntries( $ot, $nt ) { |
92 | 92 | FavoritedItem::doDuplicateEntries( $ot->getSubjectPage(), $nt->getSubjectPage() ); |
93 | | - FavoritedItem::doDuplicateEntries( $ot->getTalkPage(), $nt->getTalkPage() ); |
| 93 | + //FavoritedItem::doDuplicateEntries( $ot->getTalkPage(), $nt->getTalkPage() ); |
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
— | — | @@ -126,6 +126,12 @@ |
127 | 127 | # Note that multi-row replace is very efficient for MySQL but may be inefficient for |
128 | 128 | # some other DBMSes, mostly due to poor simulation by us |
129 | 129 | $dbw->replace( 'favoritelist', array( array( 'fl_user', 'fl_namespace', 'fl_title' ) ), $values, __METHOD__ ); |
| 130 | + |
| 131 | + # Delete the old item - we don't need to have the old page on the list of favorites. |
| 132 | + $dbw->delete('favoritelist', array( |
| 133 | + 'fl_namespace' => $oldnamespace, |
| 134 | + 'fl_title' => $oldtitle), |
| 135 | + $fname = 'Database::delete'); |
130 | 136 | return true; |
131 | 137 | } |
132 | 138 | } |
Index: branches/REL1_16/extensions/Favorites/FavoritelistEditor.php |
— | — | @@ -150,7 +150,7 @@ |
151 | 151 | } |
152 | 152 | |
153 | 153 | /** |
154 | | - * Count the number of titles on a user's favoritelist, excluding talk pages |
| 154 | + * Count the number of titles on a user's favoritelist |
155 | 155 | * |
156 | 156 | * @param $user User |
157 | 157 | * @return int |
— | — | @@ -159,11 +159,11 @@ |
160 | 160 | $dbr = wfGetDB( DB_MASTER ); |
161 | 161 | $res = $dbr->select( 'favoritelist', 'COUNT(*) AS count', array( 'fl_user' => $user->getId() ), __METHOD__ ); |
162 | 162 | $row = $dbr->fetchObject( $res ); |
163 | | - return ceil( $row->count / 2 ); // Paranoia |
| 163 | + return ceil( $row->count); |
164 | 164 | } |
165 | 165 | |
166 | 166 | /** |
167 | | - * Prepare a list of titles on a user's favoritelist (excluding talk pages) |
| 167 | + * Prepare a list of titles on a user's favoritelist |
168 | 168 | * and return an array of (prefixed) strings |
169 | 169 | * |
170 | 170 | * @param $user User |
— | — | @@ -192,7 +192,7 @@ |
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
196 | | - * Get a list of titles on a user's favoritelist, excluding talk pages, |
| 196 | + * Get a list of titles on a user's favoritelist, |
197 | 197 | * and return as a two-dimensional array with namespace, title and |
198 | 198 | * redirect status |
199 | 199 | * |
— | — | @@ -220,7 +220,7 @@ |
221 | 221 | $cache->addBadLinkObj( $title ); |
222 | 222 | } |
223 | 223 | // Ignore non-talk |
224 | | - if( !$title->isTalkPage() ) |
| 224 | + //if( !$title->isTalkPage() ) |
225 | 225 | $titles[$row->fl_namespace][$row->fl_title] = $row->page_is_redirect; |
226 | 226 | } |
227 | 227 | } |
— | — | @@ -274,12 +274,6 @@ |
275 | 275 | if( $title instanceof Title ) { |
276 | 276 | $rows[] = array( |
277 | 277 | 'fl_user' => $user->getId(), |
278 | | - 'fl_namespace' => ( $title->getNamespace() & ~1 ), |
279 | | - 'fl_title' => $title->getDBkey(), |
280 | | - 'fl_notificationtimestamp' => null, |
281 | | - ); |
282 | | - $rows[] = array( |
283 | | - 'fl_user' => $user->getId(), |
284 | 278 | 'fl_namespace' => ( $title->getNamespace() | 1 ), |
285 | 279 | 'fl_title' => $title->getDBkey(), |
286 | 280 | 'fl_notificationtimestamp' => null, |
— | — | @@ -308,15 +302,6 @@ |
309 | 303 | 'favoritelist', |
310 | 304 | array( |
311 | 305 | 'fl_user' => $user->getId(), |
312 | | - 'fl_namespace' => ( $title->getNamespace() & ~1 ), |
313 | | - 'fl_title' => $title->getDBkey(), |
314 | | - ), |
315 | | - __METHOD__ |
316 | | - ); |
317 | | - $dbw->delete( |
318 | | - 'favoritelist', |
319 | | - array( |
320 | | - 'fl_user' => $user->getId(), |
321 | 306 | 'fl_namespace' => ( $title->getNamespace() | 1 ), |
322 | 307 | 'fl_title' => $title->getDBkey(), |
323 | 308 | ), |
— | — | @@ -370,12 +355,12 @@ |
371 | 356 | $list .= $skin->makeHeadLine( 2, ">", $anchor, $heading, "" ); |
372 | 357 | $toc .= $skin->tocLine( $anchor, $heading, $tocLength, 1 ) . $skin->tocLineEnd(); |
373 | 358 | |
374 | | - $list .= "<ul>\n"; |
| 359 | + $list .= "\n"; |
375 | 360 | foreach( $pages as $dbkey => $redirect ) { |
376 | 361 | $title = Title::makeTitleSafe( $namespace, $dbkey ); |
377 | 362 | $list .= $this->buildRemoveLine( $title, $redirect, $skin ); |
378 | 363 | } |
379 | | - $list .= "</ul>\n"; |
| 364 | + $list .= "\n"; |
380 | 365 | } |
381 | 366 | // ISSUE: omit the TOC if the total number of titles is low? |
382 | 367 | if( $tocLength > 1 ) { |
— | — | @@ -407,12 +392,15 @@ |
408 | 393 | */ |
409 | 394 | private function buildRemoveLine( $title, $redirect, $skin ) { |
410 | 395 | global $wgLang; |
411 | | - |
| 396 | + # In case the user adds something unusual to their list using the raw editor |
| 397 | + # We moved the Tools array completely into the "if( $title->exists() )" section. |
| 398 | + $showlinks=false; |
412 | 399 | $link = $skin->link( $title ); |
413 | 400 | if( $redirect ) |
414 | 401 | $link = '<span class="favoritelistredir">' . $link . '</span>'; |
415 | | - $tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) ); |
416 | 402 | if( $title->exists() ) { |
| 403 | + $showlinks = true; |
| 404 | + $tools[] = $skin->link( $title->getTalkPage(), wfMsgHtml( 'talkpagelinktext' ) ); |
417 | 405 | $tools[] = $skin->link( |
418 | 406 | $title, |
419 | 407 | wfMsgHtml( 'history_short' ), |
— | — | @@ -430,10 +418,18 @@ |
431 | 419 | array( 'known', 'noclasses' ) |
432 | 420 | ); |
433 | 421 | } |
434 | | - return "<li>" |
435 | | - . Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) ) |
436 | | - . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "</li>\n"; |
| 422 | + |
| 423 | + if ($showlinks) { |
| 424 | + return |
| 425 | + Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) ) |
| 426 | + . $link . " (" . $wgLang->pipeList( $tools ) . ")" . "\n<br>"; |
| 427 | + } else { |
| 428 | + return |
| 429 | + Xml::check( 'titles[]', false, array( 'value' => $title->getPrefixedText() ) ) |
| 430 | + . $link . "\n<br>"; |
437 | 431 | } |
| 432 | + |
| 433 | + } |
438 | 434 | |
439 | 435 | /** |
440 | 436 | * Show a form for editing the favoritelist in "raw" mode |
Index: branches/REL1_16/extensions/Favorites/Favorites.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | 'name' => 'Favorites', |
24 | 24 | 'author' => 'Jeremy Lemley', |
25 | 25 | 'descriptionmsg' => 'favorites-desc', |
26 | | - 'version' => '0.0.7', |
| 26 | + 'version' => '0.1.4', |
27 | 27 | 'url' => "http://www.mediawiki.org/wiki/Extension:Favorites", |
28 | 28 | ); |
29 | 29 | |
— | — | @@ -55,8 +55,9 @@ |
56 | 56 | //add or remove |
57 | 57 | $wgHooks['UnknownAction'][] = 'fnAction'; |
58 | 58 | |
59 | | -//handle page moves |
| 59 | +//handle page moves and deletes |
60 | 60 | $wgHooks['TitleMoveComplete'][] = 'fnHookMoveToFav'; |
| 61 | +$wgHooks['ArticleDeleteComplete'][] = 'fnHookDeleteFav'; |
61 | 62 | |
62 | 63 | //add CSS |
63 | 64 | $wgHooks['BeforePageDisplay'][] = 'fnAddCss'; |
— | — | @@ -96,6 +97,14 @@ |
97 | 98 | return true; |
98 | 99 | } |
99 | 100 | |
| 101 | +function fnHookDeleteFav(&$article, &$user, $reason, $id ){ |
| 102 | + $dbw = wfGetDB( DB_MASTER ); |
| 103 | + $dbw->delete('favoritelist', array( |
| 104 | + 'fl_title' => $article->mTitle->getDBKey()), |
| 105 | + $fname = 'Database::delete'); |
| 106 | + return true; |
| 107 | +} |
| 108 | + |
100 | 109 | function fnAddCss (&$out) { |
101 | 110 | global $wgScriptPath; |
102 | 111 | $out->addStyle($wgScriptPath. '/extensions/favorites/favorites.css'); |
— | — | @@ -115,10 +124,10 @@ |
116 | 125 | # The parser function itself |
117 | 126 | # The input parameters are wikitext with templates expanded |
118 | 127 | # The output should be wikitext too |
119 | | - $output = "Parser Output goes here."; |
| 128 | + //$output = "Parser Output goes here."; |
120 | 129 | |
121 | 130 | $favParse = new FavParser(); |
122 | | - $output = $favParse->wfSpecialFavoritelist(); |
| 131 | + $output = $favParse->wfSpecialFavoritelist($argv, $parser); |
123 | 132 | $parser->disableCache(); |
124 | 133 | return $output; |
125 | 134 | |