3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
19 * @ingroup Change tagging
23 * Item class for a logging table row with its associated change tags.
24 * @todo Abstract out a base class for this and RevDelLogItem, similar to the
25 * RevisionItem class but specifically for log items.
28 class ChangeTagsLogItem
extends RevisionItemBase
{
29 public function getIdField() {
33 public function getTimestampField() {
34 return 'log_timestamp';
37 public function getAuthorIdField() {
41 public function getAuthorNameField() {
42 return 'log_user_text';
45 public function canView() {
46 return LogEventsList
::userCan( $this->row
, Revision
::DELETED_RESTRICTED
, $this->list->getUser() );
49 public function canViewContent() {
54 * @return string Comma-separated list of tags
56 public function getTags() {
57 return $this->row
->ts_tags
;
61 * @return string A HTML <li> element representing this revision, showing
62 * change tags and everything
64 public function getHTML() {
65 $date = htmlspecialchars( $this->list->getLanguage()->userTimeAndDate(
66 $this->row
->log_timestamp
, $this->list->getUser() ) );
67 $title = Title
::makeTitle( $this->row
->log_namespace
, $this->row
->log_title
);
68 $formatter = LogFormatter
::newFromRow( $this->row
);
69 $formatter->setContext( $this->list->getContext() );
70 $formatter->setAudience( LogFormatter
::FOR_THIS_USER
);
72 // Log link for this page
73 $loglink = Linker
::link(
74 SpecialPage
::getTitleFor( 'Log' ),
75 $this->list->msg( 'log' )->escaped(),
77 array( 'page' => $title->getPrefixedText() )
79 $loglink = $this->list->msg( 'parentheses' )->rawParams( $loglink )->escaped();
80 // User links and action text
81 $action = $formatter->getActionText();
83 $comment = $this->list->getLanguage()->getDirMark() .
84 $formatter->getComment();
86 if ( LogEventsList
::isDeleted( $this->row
, LogPage
::DELETED_COMMENT
) ) {
87 $comment = '<span class="history-deleted">' . $comment . '</span>';
90 $content = "$loglink $date $action $comment";
92 $tags = $this->getTags();
94 list( $tagSummary, $classes ) = ChangeTags
::formatSummaryRow( $tags, 'edittags' );
95 $content .= " $tagSummary";
96 $attribs['class'] = implode( ' ', $classes );
98 return Xml
::tags( 'li', $attribs, $content );