From b9b85843572bf283f48285001e276ba7e61b63f6 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 22 Feb 2009 13:37:51 +0100 Subject: updated to MediaWiki 1.14.0 --- includes/LogEventsList.php | 468 ++++++++++++++++++++++++++------------------- 1 file changed, 270 insertions(+), 198 deletions(-) (limited to 'includes/LogEventsList.php') diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index d49f636b..528bd3aa 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -24,7 +24,7 @@ class LogEventsList { private $out; public $flags; - function __construct( $skin, $out, $flags = 0 ) { + public function __construct( $skin, $out, $flags = 0 ) { $this->skin = $skin; $this->out = $out; $this->flags = $flags; @@ -38,34 +38,38 @@ class LogEventsList { private function preCacheMessages() { // Precache various messages if( !isset( $this->message ) ) { - $messages = 'revertmerge protect_change unblocklink revertmove undeletelink revdel-restore rev-delundel'; - foreach( explode(' ', $messages ) as $msg ) { - $this->message[$msg] = wfMsgExt( $msg, array( 'escape') ); + $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink', + 'revertmove', 'undeletelink', 'revdel-restore', 'rev-delundel', 'hist', 'pipe-separator' ); + foreach( $messages as $msg ) { + $this->message[$msg] = wfMsgExt( $msg, array( 'escape' ) ); } } } /** * Set page title and show header for this log type - * @param string $type + * @param $type String */ public function showHeader( $type ) { if( LogPage::isLogType( $type ) ) { $this->out->setPageTitle( LogPage::logName( $type ) ); - $this->out->addHtml( LogPage::logHeader( $type ) ); + $this->out->addHTML( LogPage::logHeader( $type ) ); } } /** * Show options for the log list - * @param string $type, - * @param string $user, - * @param string $page, - * @param string $pattern - * @param int $year - * @parm int $month + * @param $type String + * @param $user String + * @param $page String + * @param $pattern String + * @param $year Integer: year + * @param $month Integer: month + * @param $filter Boolean */ - public function showOptions( $type='', $user='', $page='', $pattern='', $year='', $month='' ) { + public function showOptions( $type = '', $user = '', $page = '', $pattern = '', $year = '', + $month = '', $filter = null ) + { global $wgScript, $wgMiserMode; $action = htmlspecialchars( $wgScript ); $title = SpecialPage::getTitleFor( 'Log' ); @@ -79,13 +83,46 @@ class LogEventsList { $this->getTitleInput( $page ) . "\n" . ( !$wgMiserMode ? ($this->getTitlePattern( $pattern )."\n") : "" ) . "

" . $this->getDateMenu( $year, $month ) . "\n" . + ( $filter ? "

".$this->getFilterLinks( $type, $filter )."\n" : "" ) . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "

\n" . - "" ); + "" + ); + } + + private function getFilterLinks( $logType, $filter ) { + global $wgTitle; + // show/hide links + $messages = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) ); + // Option value -> message mapping + $links = array(); + foreach( $filter as $type => $val ) { + $hideVal = 1 - intval($val); + $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal], + wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() ) + ); + $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link ); + } + // Build links + return implode( ' | ', $links ); + } + + private function getDefaultQuery() { + if ( !isset( $this->mDefaultQuery ) ) { + $this->mDefaultQuery = $_GET; + unset( $this->mDefaultQuery['title'] ); + unset( $this->mDefaultQuery['dir'] ); + unset( $this->mDefaultQuery['offset'] ); + unset( $this->mDefaultQuery['limit'] ); + unset( $this->mDefaultQuery['order'] ); + unset( $this->mDefaultQuery['month'] ); + unset( $this->mDefaultQuery['year'] ); + } + return $this->mDefaultQuery; } /** - * @return string Formatted HTML - * @param string $queryType + * @param $queryType String + * @return String: Formatted HTML */ private function getTypeMenu( $queryType ) { global $wgLogRestrictions, $wgUser; @@ -93,19 +130,19 @@ class LogEventsList { $html = "