X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FLogEventsList.php;h=29a54c6f314d927628b72d89acbfeb66a1c6ec6f;hb=c4a604a984f26bb2b044bf7d152bd7b9c535f97c;hp=7fee678d6961dc72799b2e3afa8acba0a3a4925d;hpb=8432c504c34efaff080c10f722ba08aa17c5ff66;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php index 7fee678d69..29a54c6f31 100644 --- a/includes/LogEventsList.php +++ b/includes/LogEventsList.php @@ -39,7 +39,7 @@ class LogEventsList { // Precache various messages if( !isset( $this->message ) ) { $messages = array( 'revertmerge', 'protect_change', 'unblocklink', 'change-blocklink', - 'revertmove', 'undeletelink', 'revdel-restore', 'rev-delundel', 'hist', 'diff', + 'revertmove', 'undeletelink', 'undeleteviewlink', 'revdel-restore', 'rev-delundel', 'hist', 'diff', 'pipe-separator' ); foreach( $messages as $msg ) { $this->message[$msg] = wfMsgExt( $msg, array( 'escapenoentities' ) ); @@ -49,12 +49,16 @@ class LogEventsList { /** * Set page title and show header for this log type - * @param $type String + * @param $type Array */ public function showHeader( $type ) { - if( LogPage::isLogType( $type ) ) { - $this->out->setPageTitle( LogPage::logName( $type ) ); - $this->out->addHTML( LogPage::logHeader( $type ) ); + // If only one log type is used, then show a special message... + $headerType = (count($type) == 1) ? $type[0] : ''; + if( LogPage::isLogType( $headerType ) ) { + $this->out->setPageTitle( LogPage::logName( $headerType ) ); + $this->out->addHTML( LogPage::logHeader( $headerType ) ); + } else { + $this->out->addHTML( wfMsgExt('alllogstext',array('parseinline')) ); } } @@ -73,27 +77,53 @@ class LogEventsList { $month = '', $filter = null, $tagFilter='' ) { global $wgScript, $wgMiserMode; - $action = htmlspecialchars( $wgScript ); + + $action = $wgScript; $title = SpecialPage::getTitleFor( 'Log' ); - $special = htmlspecialchars( $title->getPrefixedDBkey() ); + $special = $title->getPrefixedDBkey(); + // For B/C, we take strings, but make sure they are converted... $types = ($types === '') ? array() : (array)$types; $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter ); + + $html = ''; + $html .= Xml::hidden( 'title', $special ); + + // Basic selectors + $html .= $this->getTypeMenu( $types ) . "\n"; + $html .= $this->getUserInput( $user ) . "\n"; + $html .= $this->getTitleInput( $page ) . "\n"; + $html .= $this->getExtraInputs( $types ) . "\n"; - $this->out->addHTML( "
" . - Xml::element( 'legend', array(), wfMsg( 'log' ) ) . - Xml::hidden( 'title', $special ) . "\n" . - $this->getTypeMenu( $types ) . "\n" . - $this->getUserInput( $user ) . "\n" . - $this->getTitleInput( $page ) . "\n" . - ( !$wgMiserMode ? ($this->getTitlePattern( $pattern )."\n") : "" ) . - "

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

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

\n" . - "
" - ); + // Title pattern, if allowed + if (!$wgMiserMode) { + $html .= $this->getTitlePattern( $pattern ) . "\n"; + } + + // date menu + $html .= Xml::tags( 'p', null, Xml::dateMenu( $year, $month ) ); + + // Tag filter + if ($tagSelector) { + $html .= Xml::tags( 'p', null, implode( ' ', $tagSelector ) ); + } + + // Filter links + if ($filter) { + $html .= Xml::tags( 'p', null, $this->getFilterLinks( $filter ) ); + } + + // Submit button + $html .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ); + + // Fieldset + $html = Xml::fieldset( wfMsg( 'log' ), $html ); + + // Form wrapping + $html = Xml::tags( 'form', array( 'action' => $action, 'method' => 'get' ), $html ); + + $this->out->addHTML( $html ); } /** @@ -108,10 +138,22 @@ class LogEventsList { $links = array(); $hiddens = ''; // keep track for "go" button foreach( $filter as $type => $val ) { + // Should the below assignment be outside the foreach? + // Then it would have to be copied. Not certain what is more expensive. + $query = $this->getDefaultQuery(); + $queryKey = "hide_{$type}_log"; + $hideVal = 1 - intval($val); - $link = $this->skin->makeKnownLinkObj( $wgTitle, $messages[$hideVal], - wfArrayToCGI( array( "hide_{$type}_log" => $hideVal ), $this->getDefaultQuery() ) + $query[$queryKey] = $hideVal; + + $link = $this->skin->link( + $wgTitle, + $messages[$hideVal], + array(), + $query, + array( 'known', 'noclasses' ) ); + $links[$type] = wfMsgHtml( "log-show-hide-{$type}", $link ); $hiddens .= Xml::hidden( "hide_{$type}_log", $val ) . "\n"; } @@ -197,6 +239,15 @@ class LogEventsList { Xml::checkLabel( wfMsg( 'log-title-wildcard' ), 'pattern', 'pattern', $pattern ) . ''; } + + private function getExtraInputs( $types ) { + global $wgRequest; + if( count($types) == 1 && $types[0] == 'suppress' ) { + return Xml::inputLabel( wfMsg('revdelete-offender'), 'offender', + 'mw-log-offender', 20, $wgRequest->getVal('offender') ); + } + return ''; + } public function beginLogEventsList() { return "