Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -849,12 +849,17 @@ |
850 | 850 | 'imgdelete', |
851 | 851 | 'imgdesc', |
852 | 852 | 'imgfile', |
853 | | - 'imglegend', |
854 | | - 'imghistory', |
855 | | - 'revertimg', |
856 | | - 'deleteimg', |
857 | | - 'deleteimgcompletely', |
858 | | - 'imghistlegend', |
| 853 | + 'filehistory', |
| 854 | + 'filehist-help', |
| 855 | + 'filehist-deleteall', |
| 856 | + 'filehist-deleteone', |
| 857 | + 'filehist-revert', |
| 858 | + 'filehist-current', |
| 859 | + 'filehist-datetime', |
| 860 | + 'filehist-user', |
| 861 | + 'filehist-dimensions', |
| 862 | + 'filehist-filesize', |
| 863 | + 'filehist-comment', |
859 | 864 | 'imagelinks', |
860 | 865 | 'linkstoimage', |
861 | 866 | 'nolinkstoimage', |
Index: trunk/phase3/skins/monobook/main.css |
— | — | @@ -1585,3 +1585,19 @@ |
1586 | 1586 | vertical-align: middle; |
1587 | 1587 | font-size: 90%; |
1588 | 1588 | } |
| 1589 | + |
| 1590 | +/** |
| 1591 | + * File histories |
| 1592 | + */ |
| 1593 | +table.filehistory { |
| 1594 | + border-collapse: collapse; |
| 1595 | +} |
| 1596 | +table.filehistory, |
| 1597 | +table.filehistory th, |
| 1598 | +table.filehistory td { |
| 1599 | + border: 1px solid #AAAAAA; |
| 1600 | +} |
| 1601 | +table.filehistory th, |
| 1602 | +table.filehistory tr:hover td { |
| 1603 | + background-color: #EEEEFF; |
| 1604 | +} |
\ No newline at end of file |
Index: trunk/phase3/skins/common/shared.css |
— | — | @@ -27,3 +27,14 @@ |
28 | 28 | float: right; |
29 | 29 | margin-left: 5px; |
30 | 30 | } |
| 31 | + |
| 32 | +/** |
| 33 | + * File histories |
| 34 | + */ |
| 35 | +table.filehistory th, |
| 36 | +table.filehistory td { |
| 37 | + padding: 0 0.15em 0 0.15em; |
| 38 | +} |
| 39 | +table.filehistory th { |
| 40 | + text-align: left; |
| 41 | +} |
\ No newline at end of file |
Index: trunk/phase3/includes/ImagePage.php |
— | — | @@ -693,85 +693,105 @@ |
694 | 694 | } |
695 | 695 | |
696 | 696 | /** |
697 | | - * @todo document |
| 697 | + * Builds the image revision log shown on image pages |
| 698 | + * |
698 | 699 | * @addtogroup Media |
699 | 700 | */ |
700 | 701 | class ImageHistoryList { |
701 | | - var $img, $skin; |
702 | | - function ImageHistoryList( $skin, $img ) { |
| 702 | + |
| 703 | + protected $img, $skin, $title; |
| 704 | + |
| 705 | + public function __construct( $skin, $img ) { |
703 | 706 | $this->skin = $skin; |
704 | 707 | $this->img = $img; |
| 708 | + $this->title = $img->getTitle(); |
705 | 709 | } |
706 | 710 | |
707 | | - function beginImageHistoryList() { |
708 | | - $s = "\n" . |
709 | | - Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'imghistory' ) ) . |
710 | | - "\n<p>" . wfMsg( 'imghistlegend' ) . "</p>\n".'<ul class="special">'; |
711 | | - return $s; |
| 711 | + public function beginImageHistoryList() { |
| 712 | + global $wgOut, $wgUser; |
| 713 | + return Xml::element( 'h2', array( 'id' => 'filehistory' ), wfMsg( 'filehist' ) ) |
| 714 | + . $wgOut->parse( wfMsgNoTrans( 'filehist-help' ) ) |
| 715 | + . Xml::openElement( 'table', array( 'class' => 'filehistory' ) ) . "\n" |
| 716 | + . '<tr><th></th>' |
| 717 | + . ( $this->img->isLocal() && $wgUser->isAllowed( 'delete' ) ? '<th></th>' : '' ) |
| 718 | + . '<th>' . wfMsgHtml( 'filehist-datetime' ) . '</th>' |
| 719 | + . '<th>' . wfMsgHtml( 'filehist-user' ) . '</th>' |
| 720 | + . '<th>' . wfMsgHtml( 'filehist-dimensions' ) . '</th>' |
| 721 | + . '<th>' . wfMsgHtml( 'filehist-filesize' ) . '</th>' |
| 722 | + . '<th>' . wfMsgHtml( 'filehist-comment' ) . '</th>' |
| 723 | + . "</tr>\n"; |
712 | 724 | } |
713 | 725 | |
714 | | - function endImageHistoryList() { |
715 | | - $s = "</ul>\n"; |
716 | | - return $s; |
| 726 | + public function endImageHistoryList() { |
| 727 | + return "</table>\n"; |
717 | 728 | } |
718 | 729 | |
719 | | - function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $width, $height ) { |
| 730 | + public function imageHistoryLine( $iscur, $timestamp, $img, $user, $usertext, $size, $description, $width, $height ) { |
720 | 731 | global $wgUser, $wgLang, $wgTitle, $wgContLang; |
721 | | - |
722 | | - $datetime = $wgLang->timeanddate( $timestamp, true ); |
723 | | - $del = wfMsgHtml( 'deleteimg' ); |
724 | | - $delall = wfMsgHtml( 'deleteimgcompletely' ); |
725 | | - $cur = wfMsgHtml( 'cur' ); |
726 | 732 | $local = $this->img->isLocal(); |
727 | | - |
728 | | - if ( $iscur ) { |
729 | | - $url = htmlspecialchars( $this->img->getURL() ); |
730 | | - $rlink = $cur; |
731 | | - if ( $local && $wgUser->isAllowed('delete') ) { |
732 | | - $link = $wgTitle->escapeLocalURL( 'image=' . $wgTitle->getPartialURL() . |
733 | | - '&action=delete' ); |
734 | | - $style = $this->skin->getInternalLinkAttributes( $link, $delall ); |
735 | | - |
736 | | - $dlink = '<a href="'.$link.'"'.$style.'>'.$delall.'</a>'; |
737 | | - } else { |
738 | | - $dlink = $del; |
739 | | - } |
740 | | - } else { |
741 | | - $url = htmlspecialchars( $this->img->getArchiveUrl( $img ) ); |
742 | | - if( $local && $wgUser->getID() != 0 && $wgTitle->userCan( 'edit' ) ) { |
743 | | - $token = urlencode( $wgUser->editToken( $img ) ); |
744 | | - $rlink = $this->skin->makeKnownLinkObj( $wgTitle, |
745 | | - wfMsgHtml( 'revertimg' ), 'action=revert&oldimage=' . |
746 | | - urlencode( $img ) . "&wpEditToken=$token" ); |
747 | | - $dlink = $this->skin->makeKnownLinkObj( $wgTitle, |
748 | | - $del, 'action=delete&oldimage=' . urlencode( $img ) . |
749 | | - "&wpEditToken=$token" ); |
750 | | - } else { |
751 | | - # Having live active links for non-logged in users |
752 | | - # means that bots and spiders crawling our site can |
753 | | - # inadvertently change content. Baaaad idea. |
754 | | - $rlink = wfMsgHtml( 'revertimg' ); |
755 | | - $dlink = $del; |
756 | | - } |
| 733 | + $row = ''; |
| 734 | + |
| 735 | + // Deletion link |
| 736 | + if( $local && $wgUser->isAllowed( 'delete' ) ) { |
| 737 | + $row .= '<td>'; |
| 738 | + $q[] = 'action=delete'; |
| 739 | + $q[] = ( $iscur ? 'image=' . $this->title->getPartialUrl() : 'oldimage=' . urlencode( $img ) ); |
| 740 | + if( !$iscur ) |
| 741 | + $q[] = 'wpEditToken=' . urlencode( $wgUser->editToken( $img ) ); |
| 742 | + $row .= '(' . $this->skin->makeKnownLinkObj( |
| 743 | + $this->title, |
| 744 | + wfMsgHtml( $iscur ? 'filehist-deleteall' : 'filehist-deleteone' ), |
| 745 | + implode( '&', $q ) |
| 746 | + ) . ')'; |
| 747 | + $row .= '</td>'; |
757 | 748 | } |
758 | | - |
759 | | - if ( $local ) { |
760 | | - $userlink = $this->skin->userLink( $user, $usertext ) . $this->skin->userToolLinks( $user, $usertext ); |
| 749 | + |
| 750 | + // Reversion link/current indicator |
| 751 | + $row .= '<td>'; |
| 752 | + if( $iscur ) { |
| 753 | + $row .= '(' . wfMsgHtml( 'filehist-current' ) . ')'; |
| 754 | + } elseif( $local && $wgUser->isLoggedIn() && $this->title->userCan( 'edit' ) ) { |
| 755 | + $q[] = 'action=revert'; |
| 756 | + $q[] = 'oldimage=' . urlencode( $img ); |
| 757 | + $q[] = 'wpEditToken=' . urlencode( $wgUser->editToken( $img ) ); |
| 758 | + $row .= '(' . $this->skin->makeKnownLinkObj( |
| 759 | + $this->title, |
| 760 | + wfMsgHtml( 'filehist-revert' ), |
| 761 | + implode( '&', $q ) |
| 762 | + ) . ')'; |
| 763 | + } |
| 764 | + $row .= '</td>'; |
| 765 | + |
| 766 | + // Date/time and image link |
| 767 | + $row .= '<td>'; |
| 768 | + $url = $iscur ? $this->img->getUrl() : $this->img->getArchiveUrl( $img ); |
| 769 | + $row .= Xml::element( |
| 770 | + 'a', |
| 771 | + array( 'href' => $url ), |
| 772 | + $wgLang->timeAndDate( $timestamp, true ) |
| 773 | + ); |
| 774 | + $row .= '</td>'; |
| 775 | + |
| 776 | + // Uploading user |
| 777 | + $row .= '<td>'; |
| 778 | + if( $local ) { |
| 779 | + $row .= $this->skin->userLink( $user, $usertext ) . $this->skin->userToolLinks( $user, $usertext ); |
761 | 780 | } else { |
762 | | - $userlink = htmlspecialchars( $usertext ); |
| 781 | + $row .= htmlspecialchars( $usertext ); |
763 | 782 | } |
764 | | - $nbytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape' ), |
765 | | - $wgLang->formatNum( $size ) ); |
766 | | - $widthheight = wfMsgHtml( 'widthheight', $width, $height ); |
767 | | - $style = $this->skin->getInternalLinkAttributes( $url, $datetime ); |
768 | | - |
769 | | - $s = "<li> ({$dlink}) ({$rlink}) <a href=\"{$url}\"{$style}>{$datetime}</a> . . {$userlink} . . {$widthheight} ({$nbytes})"; |
770 | | - |
771 | | - $s .= $this->skin->commentBlock( $description, $wgTitle ); |
772 | | - $s .= "</li>\n"; |
773 | | - return $s; |
| 783 | + $row .= '</td>'; |
| 784 | + |
| 785 | + // Image dimensions |
| 786 | + // FIXME: What about sound files? Should have the duration instead... |
| 787 | + $row .= '<td>' . wfMsgHtml( 'widthheight', $width, $height ) . '</td>'; |
| 788 | + |
| 789 | + // File size |
| 790 | + $row .= '<td>' . $this->skin->formatSize( $size ) . '</td>'; |
| 791 | + |
| 792 | + // Comment |
| 793 | + $row .= '<td>' . $this->skin->formatComment( $description, $this->title ) . '</td>'; |
| 794 | + |
| 795 | + return "<tr>{$row}</tr>\n"; |
774 | 796 | } |
775 | | -} |
776 | 797 | |
777 | | - |
778 | | - |
| 798 | +} |
\ No newline at end of file |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1439,14 +1439,17 @@ |
1440 | 1440 | 'imgdelete' => 'del', |
1441 | 1441 | 'imgdesc' => 'desc', |
1442 | 1442 | 'imgfile' => 'file', |
1443 | | -'imglegend' => 'Legend: (desc) = show/edit file description.', |
1444 | | -'imghistory' => 'File history', |
1445 | | -'revertimg' => 'rev', |
1446 | | -'deleteimg' => 'del', |
1447 | | -'deleteimgcompletely' => 'Delete all revisions of this file', |
1448 | | -'imghistlegend' => 'Legend: (cur) = this is the current file, (del) = delete |
1449 | | -this old version, (rev) = revert to this old version. |
1450 | | -<br /><i>Click on date to see the file uploaded on that date</i>.', |
| 1443 | +'filehist' => 'File history', |
| 1444 | +'filehist-help' => 'Click on a date/time to view the file as it appeared at that time.', |
| 1445 | +'filehist-deleteall' => 'delete all', |
| 1446 | +'filehist-deleteone' => 'delete this', |
| 1447 | +'filehist-revert' => 'revert', |
| 1448 | +'filehist-current' => 'current', |
| 1449 | +'filehist-datetime' => 'Date/Time', |
| 1450 | +'filehist-user' => 'User', |
| 1451 | +'filehist-dimensions' => 'Dimensions', |
| 1452 | +'filehist-filesize' => 'File size', |
| 1453 | +'filehist-comment' => 'Comment', |
1451 | 1454 | 'imagelinks' => 'Links', |
1452 | 1455 | 'linkstoimage' => 'The following pages link to this file:', |
1453 | 1456 | 'nolinkstoimage' => 'There are no pages that link to this file.', |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -159,6 +159,7 @@ |
160 | 160 | * Skip the difference engine cache when 'action=purge' is used while requesting |
161 | 161 | a difference page, to allow refreshing the cache in case of errors |
162 | 162 | * (bug 10701) Link to Special:Listusers in default Special:Statistics messages |
| 163 | +* Improved file history presentation |
163 | 164 | |
164 | 165 | == Bugfixes since 1.10 == |
165 | 166 | |
— | — | @@ -331,6 +332,7 @@ |
332 | 333 | * Improved speed of file delete by storing the SHA-1 hash in image/oldimage |
333 | 334 | * Fixed leading zero in base 36 SHA-1 hash |
334 | 335 | * Protection form no longer produces JavaScript errors |
| 336 | +* (bug 10741) File histories show "delete" links for non-sysops |
335 | 337 | |
336 | 338 | == API changes since 1.10 == |
337 | 339 | |