X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FLogEventsList.php;h=e8d437910ee8a1fd27482c36ae11fe6287559944;hb=004b81ff4eb72d26b3515c4461aac36db8b95f6d;hp=075860aa5832574b6c503f958d72d841101fe2bc;hpb=be13f1d353ee43220f1347575dea1cf5553f64b8;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 075860aa58..e8d437910e 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,39 +38,46 @@ class LogEventsList { private function preCacheMessages() { // Precache various messages if( !isset( $this->message ) ) { - $messages = 'revertmerge protect_change unblocklink revertmove undeletelink revdel-restore rev-delundel hist'; - 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( 'escapenoentities' ) ); } } } /** * 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: array + * @param $tagFilter: array? */ - public function showOptions( $type='', $user='', $page='', $pattern='', $year='', $month='' ) { + public function showOptions( $type = '', $user = '', $page = '', $pattern = '', $year = '', + $month = '', $filter = null, $tagFilter='' ) + { global $wgScript, $wgMiserMode; $action = htmlspecialchars( $wgScript ); $title = SpecialPage::getTitleFor( 'Log' ); $special = htmlspecialchars( $title->getPrefixedDBkey() ); + $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); + $this->out->addHTML( "
" . Xml::element( 'legend', array(), wfMsg( 'log' ) ) . Xml::hidden( 'title', $special ) . "\n" . @@ -78,14 +85,50 @@ class LogEventsList { $this->getUserInput( $user ) . "\n" . $this->getTitleInput( $page ) . "\n" . ( !$wgMiserMode ? ($this->getTitlePattern( $pattern )."\n") : "" ) . - "

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

" . Xml::dateMenu( $year, $month ) . "\n" . + ( $tagSelector ? Xml::tags( 'p', null, implode( ' ', $tagSelector ) ) :'' ). "\n" . + ( $filter ? "

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

\n" . - "
" ); + "" + ); + } + + private function getFilterLinks( $logType, $filter ) { + global $wgTitle, $wgLang; + // show/hide links + $messages = array( wfMsgHtml( 'show' ), wfMsgHtml( 'hide' ) ); + // Option value -> message mapping + $links = array(); + $hiddens = ''; // keep track for "go" button + 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 ); + $hiddens .= Xml::hidden( "hide_{$type}_log", $val ) . "\n"; + } + // Build links + return ''.$wgLang->pipeList( $links ) . '' . $hiddens; + } + + 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 +136,19 @@ class LogEventsList { $html = "