X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=includes%2FLogEventsList.php;h=3a626548dc002527a376d2122f3e2d13c24ef3ce;hb=0202aeec2cc4c28c657845062e3bbf2696481172;hp=a73e4781f3a5a0d449069633ea6d6d228cd16f22;hpb=fef7d4d95d7ee1fedf219f5a7e75a263566cccae;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/LogEventsList.php b/includes/LogEventsList.php
index a73e4781f3..3a626548dc 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 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( '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 = "