WatchlistEditor Class Reference

Provides the UI through which users can perform editing operations on their watchlist. More...

List of all members.

Public Member Functions

 execute ($user, $output, $request, $mode)
 Main execution point.
 showRawForm ($output, $user)
 Show a form for editing the watchlist in "raw" mode.

Static Public Member Functions

static getMode ($request, $par)
 Determine whether we are editing the watchlist, and if so, what kind of editing operation.
static buildTools ($skin)
 Build a set of links for convenient navigation between watchlist viewing and editing modes.

Public Attributes

const EDIT_CLEAR = 1
 Editing modes.
const EDIT_RAW = 2
const EDIT_NORMAL = 3

Private Member Functions

 checkToken ($request, $user)
 Check the edit token from a form submission.
 extractTitles ($list)
 Extract a list of titles from a blob of text, returning (prefixed) strings; unwatchable titles are ignored.
 showTitles ($titles, $output, $skin)
 Print out a list of linked titles.
 countWatchlist ($user)
 Count the number of titles on a user's watchlist, excluding talk pages.
 getWatchlist ($user)
 Prepare a list of titles on a user's watchlist (excluding talk pages) and return an array of (prefixed) strings.
 getWatchlistInfo ($user)
 Get a list of titles on a user's watchlist, excluding talk pages, and return as a two-dimensional array with namespace, title and redirect status.
 showItemCount ($output, $user)
 Show a message indicating the number of items on the user's watchlist, and return this count for additional checking.
 clearWatchlist ($user)
 Remove all titles from a user's watchlist.
 watchTitles ($titles, $user)
 Add a list of titles to a user's watchlist.
 unwatchTitles ($titles, $user)
 Remove a list of titles from a user's watchlist.
 showNormalForm ($output, $user)
 Show the standard watchlist editing form.
 buildRemoveList ($user, $skin)
 Build the part of the standard watchlist editing form with the actual title selection checkboxes and stuff.
 getNamespaceHeading ($namespace)
 Get the correct "heading" for a namespace.
 buildRemoveLine ($title, $redirect, $skin)
 Build a single list item containing a check box selecting a title and a link to that title, with various additional bits.


Detailed Description

Provides the UI through which users can perform editing operations on their watchlist.

Author:
Rob Church <robchur@gmail.com>

Definition at line 10 of file WatchlistEditor.php.


Member Function Documentation

WatchlistEditor::buildRemoveLine ( title,
redirect,
skin 
) [private]

Build a single list item containing a check box selecting a title and a link to that title, with various additional bits.

Parameters:
$title Title
$redirect bool
$skin Skin
Returns:
string

Definition at line 409 of file WatchlistEditor.php.

References $title, $wgLang, Xml::check(), SpecialPage::getTitleFor(), and wfMsgHtml().

Referenced by buildRemoveList().

WatchlistEditor::buildRemoveList ( user,
skin 
) [private]

Build the part of the standard watchlist editing form with the actual title selection checkboxes and stuff.

Also generates a table of contents if there's more than one heading.

Parameters:
$user User
$skin Skin (really, Linker)

Definition at line 362 of file WatchlistEditor.php.

References $title, $user, buildRemoveLine(), getNamespaceHeading(), getWatchlistInfo(), and Title::makeTitleSafe().

Referenced by showNormalForm().

static WatchlistEditor::buildTools ( skin  )  [static]

Build a set of links for convenient navigation between watchlist viewing and editing modes.

Parameters:
$skin Skin to use
Returns:
string

Definition at line 484 of file WatchlistEditor.php.

References $mode, $wgLang, SpecialPage::getTitleFor(), and wfMsgHtml().

Referenced by wfSpecialWatchlist().

WatchlistEditor::checkToken ( request,
user 
) [private]

Check the edit token from a form submission.

Parameters:
$request WebRequest
$user User
Returns:
bool

Definition at line 88 of file WatchlistEditor.php.

References $user.

Referenced by execute().

WatchlistEditor::clearWatchlist ( user  )  [private]

Remove all titles from a user's watchlist.

Parameters:
$user User

Definition at line 255 of file WatchlistEditor.php.

References $dbw, $user, and wfGetDB().

Referenced by execute().

WatchlistEditor::countWatchlist ( user  )  [private]

Count the number of titles on a user's watchlist, excluding talk pages.

Parameters:
$user User
Returns:
int

Definition at line 159 of file WatchlistEditor.php.

References $dbr, $res, $row, $user, and wfGetDB().

Referenced by showItemCount().

WatchlistEditor::execute ( user,
output,
request,
mode 
)

WatchlistEditor::extractTitles ( list  )  [private]

Extract a list of titles from a blob of text, returning (prefixed) strings; unwatchable titles are ignored.

Parameters:
$list mixed
Returns:
array

Definition at line 99 of file WatchlistEditor.php.

References $text, $title, and Title::newFromText().

Referenced by execute().

static WatchlistEditor::getMode ( request,
par 
) [static]

Determine whether we are editing the watchlist, and if so, what kind of editing operation.

Parameters:
$request WebRequest
$par mixed
Returns:
int

Definition at line 463 of file WatchlistEditor.php.

References $mode.

Referenced by wfSpecialWatchlist().

WatchlistEditor::getNamespaceHeading ( namespace  )  [private]

Get the correct "heading" for a namespace.

Parameters:
$namespace int
Returns:
string

Definition at line 394 of file WatchlistEditor.php.

References $GLOBALS, and wfMsgHtml().

Referenced by buildRemoveList().

WatchlistEditor::getWatchlist ( user  )  [private]

Prepare a list of titles on a user's watchlist (excluding talk pages) and return an array of (prefixed) strings.

Parameters:
$user User
Returns:
array

Definition at line 173 of file WatchlistEditor.php.

References $dbr, $res, $row, $title, $user, Title::makeTitleSafe(), and wfGetDB().

Referenced by execute(), and showRawForm().

WatchlistEditor::getWatchlistInfo ( user  )  [private]

Get a list of titles on a user's watchlist, excluding talk pages, and return as a two-dimensional array with namespace, title and redirect status.

Parameters:
$user User
Returns:
array

Definition at line 203 of file WatchlistEditor.php.

References $dbr, $page, $res, $row, $sql, $title, $user, Title::makeTitleSafe(), LinkCache::singleton(), and wfGetDB().

Referenced by buildRemoveList().

WatchlistEditor::showItemCount ( output,
user 
) [private]

Show a message indicating the number of items on the user's watchlist, and return this count for additional checking.

Parameters:
$output OutputPage
$user User
Returns:
int

Definition at line 240 of file WatchlistEditor.php.

References $count, $GLOBALS, $output, $user, countWatchlist(), and wfMsgExt().

Referenced by showNormalForm(), and showRawForm().

WatchlistEditor::showNormalForm ( output,
user 
) [private]

Show the standard watchlist editing form.

Parameters:
$output OutputPage
$user User

Definition at line 338 of file WatchlistEditor.php.

References $count, $output, $self, $user, $wgUser, buildRemoveList(), SpecialPage::getTitleFor(), Xml::hidden(), Xml::openElement(), showItemCount(), Xml::submitButton(), wfMsg(), wfMsgExt(), and wfMsgHtml().

Referenced by execute().

WatchlistEditor::showRawForm ( output,
user 
)

Show a form for editing the watchlist in "raw" mode.

Parameters:
$output OutputPage
$user User

Definition at line 433 of file WatchlistEditor.php.

References $output, $self, $title, $user, $wgUser, SpecialPage::getTitleFor(), getWatchlist(), Xml::hidden(), Xml::label(), Xml::openElement(), showItemCount(), Xml::submitButton(), wfMsg(), wfMsgExt(), and wfMsgHtml().

Referenced by execute().

WatchlistEditor::showTitles ( titles,
output,
skin 
) [private]

Print out a list of linked titles.

$titles can be an array of strings or Title objects; the former is preferred, since Titles are very memory-heavy

Parameters:
$titles An array of strings, or Title objects
$output OutputPage
$skin Skin

Definition at line 127 of file WatchlistEditor.php.

References $batch, $output, $title, Title::newFromText(), and wfMsgHtml().

Referenced by execute().

WatchlistEditor::unwatchTitles ( titles,
user 
) [private]

Remove a list of titles from a user's watchlist.

$titles can be an array of strings or Title objects; the former is preferred, since Titles are very memory-heavy

Parameters:
$titles An array of strings, or Title objects
$user User

Definition at line 302 of file WatchlistEditor.php.

References $dbw, $title, $user, Title::newFromText(), wfGetDB(), and wfRunHooks().

Referenced by execute().

WatchlistEditor::watchTitles ( titles,
user 
) [private]

Add a list of titles to a user's watchlist.

$titles can be an array of strings or Title objects; the former is preferred, since Titles are very memory-heavy

Parameters:
$titles An array of strings, or Title objects
$user User

Definition at line 269 of file WatchlistEditor.php.

References $dbw, $rows, $title, $user, Title::newFromText(), and wfGetDB().

Referenced by execute().


Member Data Documentation

Editing modes.

Definition at line 15 of file WatchlistEditor.php.

Definition at line 17 of file WatchlistEditor.php.

Definition at line 16 of file WatchlistEditor.php.


The documentation for this class was generated from the following file:

Generated on Sat Sep 5 02:08:50 2009 for MediaWiki by  doxygen 1.5.9