Index: includes/SpecialWatchlist.php =================================================================== RCS file: /cvsroot/wikipedia/phase3/includes/SpecialWatchlist.php,v retrieving revision 1.36 diff -u -r1.36 SpecialWatchlist.php --- includes/SpecialWatchlist.php 3 Sep 2004 23:00:00 -0000 1.36 +++ includes/SpecialWatchlist.php 9 Sep 2004 19:50:26 -0000 @@ -17,8 +17,12 @@ function wfSpecialWatchlist() { global $wgUser, $wgOut, $wgLang, $wgTitle, $wgMemc, $wgRequest; global $wgUseWatchlistCache, $wgWLCacheTimeout, $wgDBname; + global $wgFeedClasses; $fname = "wfSpecialWatchlist"; + # Get query parameters + $feedFormat = $wgRequest->getVal( 'feed' ); + $wgOut->setPagetitle( wfMsg( "watchlist" ) ); $sub = wfMsg( "watchlistsub", $wgUser->getName() ); $wgOut->setSubtitle( $sub ); @@ -186,19 +190,58 @@ return; } - $sk = $wgUser->getSkin(); - $s = $sk->beginRecentChangesList(); - $counter = 1; - while ( $obj = $dbr->fetchObject( $res ) ) { - # Make fake RC entry - $rc = RecentChange::newFromCurRow( $obj ); - $rc->counter = $counter++; - $s .= $sk->recentChangesLine( $rc, true ); + $rows = array(); + while( $row = $dbr->fetchObject( $res ) ){ + $rows[] = $row; } - $s .= $sk->endRecentChangesList(); - $dbr->freeResult( $res ); - $wgOut->addHTML( $s ); + $sk = $wgUser->getSkin(); + + if( isset($wgFeedClasses[$feedFormat]) ) { + # Feed XML (RSS or Atom) + + $feed = new $wgFeedClasses[$feedFormat] + ( + wfMsg( 'watchlist' ) . " " . wfMsg( "watchlistsub", $wgUser->mName ), + wfMsg( "watchdetails", + $wgLang->formatNum( $nitems ), + $wgLang->formatNum( $npages ), + $y, + $specialTitle->escapeLocalUrl( "magic=yes" ) + ) + , + $wgTitle->getFullUrl() + ); + $feed->outHeader(); + + foreach( $rows as $obj ) { + + $title = Title::makeTitle( $obj->cur_namespace, $obj->cur_title ); + $talkpage = $title->getTalkPage(); + $item = new FeedItem( + $title->getPrefixedText(), + htmlspecialchars( $obj->cur_comment ), + $title->getFullURL(), + $obj->cur_timestamp, + $obj->cur_user_text, + $talkpage->getFullURL() + ); + $feed->outItem( $item ); + } + $feed->outFooter(); + } else { + #XHTML output + $wgOut->setSyndicated( true ); + $s = $sk->beginRecentChangesList(); + $counter = 1; + foreach( $rows as $obj ) { + $rc = RecentChange::newFromCurRow( $obj ); + $rc->counter = $counter++; + $s .= $sk->recentChangesLine( $rc, true ); + } + $s .= $sk->endRecentChangesList(); + $wgOut->addHTML( $s ); + } if ( $wgUseWatchlistCache ) { $wgMemc->set( $memckey, $s, $wgWLCacheTimeout);