From 183851b06bd6c52f3cae5375f433da720d410447 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 11 Oct 2006 18:12:39 +0000 Subject: MediaWiki 1.7.1 wiederhergestellt --- includes/ChangesList.php | 653 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 653 insertions(+) create mode 100644 includes/ChangesList.php (limited to 'includes/ChangesList.php') diff --git a/includes/ChangesList.php b/includes/ChangesList.php new file mode 100644 index 00000000..b2c1abe2 --- /dev/null +++ b/includes/ChangesList.php @@ -0,0 +1,653 @@ +mAttribs = $rc->mAttribs; + $rc2->mExtra = $rc->mExtra; + return $rc2; + } +} ; + +/** + * @package MediaWiki + */ +class ChangesList { + # Called by history lists and recent changes + # + + /** @todo document */ + function ChangesList( &$skin ) { + $this->skin =& $skin; + $this->preCacheMessages(); + } + + /** + * Fetch an appropriate changes list class for the specified user + * Some users might want to use an enhanced list format, for instance + * + * @param $user User to fetch the list class for + * @return ChangesList derivative + */ + function newFromUser( &$user ) { + $sk =& $user->getSkin(); + $list = NULL; + if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) { + return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk ); + } else { + return $list; + } + } + + /** + * As we use the same small set of messages in various methods and that + * they are called often, we call them once and save them in $this->message + */ + function preCacheMessages() { + // Precache various messages + if( !isset( $this->message ) ) { + foreach( explode(' ', 'cur diff hist minoreditletter newpageletter last '. + 'blocklink changes history boteditletter' ) as $msg ) { + $this->message[$msg] = wfMsgExt( $msg, array( 'escape') ); + } + } + } + + + /** + * Returns the appropriate flags for new page, minor change and patrolling + */ + function recentChangesFlags( $new, $minor, $patrolled, $nothing = ' ', $bot = false ) { + $f = $new ? '' . $this->message['newpageletter'] . '' + : $nothing; + $f .= $minor ? '' . $this->message['minoreditletter'] . '' + : $nothing; + $f .= $bot ? '' . $this->message['boteditletter'] . '' : $nothing; + $f .= $patrolled ? '!' : $nothing; + return $f; + } + + /** + * Returns text for the start of the tabular part of RC + */ + function beginRecentChangesList() { + $this->rc_cache = array(); + $this->rcMoveIndex = 0; + $this->rcCacheIndex = 0; + $this->lastdate = ''; + $this->rclistOpen = false; + return ''; + } + + /** + * Returns text for the end of RC + */ + function endRecentChangesList() { + if( $this->rclistOpen ) { + return "\n"; + } else { + return ''; + } + } + + + function insertMove( &$s, $rc ) { + # Diff + $s .= '(' . $this->message['diff'] . ') ('; + # Hist + $s .= $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), $this->message['hist'], 'action=history' ) . + ') . . '; + + # "[[x]] moved to [[y]]" + $msg = ( $rc->mAttribs['rc_type'] == RC_MOVE ) ? '1movedto2' : '1movedto2_redir'; + $s .= wfMsg( $msg, $this->skin->makeKnownLinkObj( $rc->getTitle(), '', 'redirect=no' ), + $this->skin->makeKnownLinkObj( $rc->getMovedToTitle(), '' ) ); + } + + function insertDateHeader(&$s, $rc_timestamp) { + global $wgLang; + + # Make date header if necessary + $date = $wgLang->date( $rc_timestamp, true, true ); + $s = ''; + if( $date != $this->lastdate ) { + if( '' != $this->lastdate ) { + $s .= "\n"; + } + $s .= '

'.$date."

\n