From: Aaron Schulz Date: Sat, 3 Jan 2009 05:13:48 +0000 (+0000) Subject: (bug 16107) Imagelist -> ListFiles X-Git-Tag: 1.31.0-rc.0~43593 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=commitdiff_plain;h=62c9b1dd543fe2bcf9161ca0bd549545b520d3ce;p=lhc%2Fweb%2Fwiklou.git (bug 16107) Imagelist -> ListFiles --- diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 1cbd6be823..4219688aac 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -2959,7 +2959,7 @@ $wgSpecialPageGroups = array( 'Log' => 'changes', 'Upload' => 'media', - 'Imagelist' => 'media', + 'Listfiles' => 'media', 'MIMEsearch' => 'media', 'FileDuplicateSearch' => 'media', 'Filepath' => 'media', diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 812ad53888..00eacd1ed1 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -94,7 +94,7 @@ class SpecialPage 'Recentchanges' => 'SpecialRecentchanges', 'Upload' => array( 'SpecialPage', 'Upload' ), - 'Imagelist' => array( 'SpecialPage', 'Imagelist' ), + 'Listfiles' => array( 'SpecialPage', 'Listfiles' ), 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ), 'Listusers' => array( 'SpecialPage', 'Listusers' ), 'Listgrouprights' => 'SpecialListGroupRights', diff --git a/includes/specials/SpecialImagelist.php b/includes/specials/SpecialImagelist.php deleted file mode 100644 index 35966319c4..0000000000 --- a/includes/specials/SpecialImagelist.php +++ /dev/null @@ -1,161 +0,0 @@ -getForm(); - $body = $pager->getBody(); - $nav = $pager->getNavigationBar(); - $wgOut->addHTML( "$limit
\n$body
\n$nav" ); -} - -/** - * @ingroup SpecialPage Pager - */ -class ImageListPager extends TablePager { - var $mFieldNames = null; - var $mQueryConds = array(); - - function __construct() { - global $wgRequest, $wgMiserMode; - if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { - $this->mDefaultDirection = true; - } else { - $this->mDefaultDirection = false; - } - $search = $wgRequest->getText( 'ilsearch' ); - if ( $search != '' && !$wgMiserMode ) { - $nt = Title::newFromUrl( $search ); - if( $nt ) { - $dbr = wfGetDB( DB_SLAVE ); - $m = $dbr->strencode( strtolower( $nt->getDBkey() ) ); - $m = str_replace( "%", "\\%", $m ); - $m = str_replace( "_", "\\_", $m ); - $this->mQueryConds = array( "LOWER(img_name) LIKE '%{$m}%'" ); - } - } - - parent::__construct(); - } - - function getFieldNames() { - if ( !$this->mFieldNames ) { - $this->mFieldNames = array( - 'img_timestamp' => wfMsg( 'imagelist_date' ), - 'img_name' => wfMsg( 'imagelist_name' ), - 'img_user_text' => wfMsg( 'imagelist_user' ), - 'img_size' => wfMsg( 'imagelist_size' ), - 'img_description' => wfMsg( 'imagelist_description' ), - ); - } - return $this->mFieldNames; - } - - function isFieldSortable( $field ) { - static $sortable = array( 'img_timestamp', 'img_name', 'img_size' ); - return in_array( $field, $sortable ); - } - - function getQueryInfo() { - $fields = $this->getFieldNames(); - $fields = array_keys( $fields ); - $fields[] = 'img_user'; - return array( - 'tables' => 'image', - 'fields' => $fields, - 'conds' => $this->mQueryConds - ); - } - - function getDefaultSort() { - return 'img_timestamp'; - } - - function getStartBody() { - # Do a link batch query for user pages - if ( $this->mResult->numRows() ) { - $lb = new LinkBatch; - $this->mResult->seek( 0 ); - while ( $row = $this->mResult->fetchObject() ) { - if ( $row->img_user ) { - $lb->add( NS_USER, str_replace( ' ', '_', $row->img_user_text ) ); - } - } - $lb->execute(); - } - - return parent::getStartBody(); - } - - function formatValue( $field, $value ) { - global $wgLang; - switch ( $field ) { - case 'img_timestamp': - return $wgLang->timeanddate( $value, true ); - case 'img_name': - static $imgfile = null; - if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' ); - - $name = $this->mCurrentRow->img_name; - $link = $this->getSkin()->makeKnownLinkObj( Title::makeTitle( NS_FILE, $name ), $value ); - $image = wfLocalFile( $value ); - $url = $image->getURL(); - $download = Xml::element('a', array( 'href' => $url ), $imgfile ); - return "$link ($download)"; - case 'img_user_text': - if ( $this->mCurrentRow->img_user ) { - $link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ), - htmlspecialchars( $value ) ); - } else { - $link = htmlspecialchars( $value ); - } - return $link; - case 'img_size': - return $this->getSkin()->formatSize( $value ); - case 'img_description': - return $this->getSkin()->commentBlock( $value ); - } - } - - function getForm() { - global $wgRequest, $wgMiserMode; - $search = $wgRequest->getText( 'ilsearch' ); - - $s = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getTitle()->getLocalURL(), 'id' => 'mw-imagelist-form' ) ) . - Xml::openElement( 'fieldset' ) . - Xml::element( 'legend', null, wfMsg( 'imagelist' ) ) . - Xml::tags( 'label', null, wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) ); - - if ( !$wgMiserMode ) { - $s .= "
\n" . - Xml::inputLabel( wfMsg( 'imagelist_search_for' ), 'ilsearch', 'mw-ilsearch', 20, $search ); - } - $s .= ' ' . - Xml::submitButton( wfMsg( 'table_pager_limit_submit' ) ) ."\n" . - $this->getHiddenFields( array( 'limit', 'ilsearch' ) ) . - Xml::closeElement( 'fieldset' ) . - Xml::closeElement( 'form' ) . "\n"; - return $s; - } - - function getTableClass() { - return 'imagelist ' . parent::getTableClass(); - } - - function getNavClass() { - return 'imagelist_nav ' . parent::getNavClass(); - } - - function getSortHeaderClass() { - return 'imagelist_sort ' . parent::getSortHeaderClass(); - } -} diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php new file mode 100644 index 0000000000..4ee29412ad --- /dev/null +++ b/includes/specials/SpecialListfiles.php @@ -0,0 +1,161 @@ +getForm(); + $body = $pager->getBody(); + $nav = $pager->getNavigationBar(); + $wgOut->addHTML( "$limit
\n$body
\n$nav" ); +} + +/** + * @ingroup SpecialPage Pager + */ +class ImageListPager extends TablePager { + var $mFieldNames = null; + var $mQueryConds = array(); + + function __construct() { + global $wgRequest, $wgMiserMode; + if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { + $this->mDefaultDirection = true; + } else { + $this->mDefaultDirection = false; + } + $search = $wgRequest->getText( 'ilsearch' ); + if ( $search != '' && !$wgMiserMode ) { + $nt = Title::newFromUrl( $search ); + if( $nt ) { + $dbr = wfGetDB( DB_SLAVE ); + $m = $dbr->strencode( strtolower( $nt->getDBkey() ) ); + $m = str_replace( "%", "\\%", $m ); + $m = str_replace( "_", "\\_", $m ); + $this->mQueryConds = array( "LOWER(img_name) LIKE '%{$m}%'" ); + } + } + + parent::__construct(); + } + + function getFieldNames() { + if ( !$this->mFieldNames ) { + $this->mFieldNames = array( + 'img_timestamp' => wfMsg( 'listfiles_date' ), + 'img_name' => wfMsg( 'listfiles_name' ), + 'img_user_text' => wfMsg( 'listfiles_user' ), + 'img_size' => wfMsg( 'listfiles_size' ), + 'img_description' => wfMsg( 'listfiles_description' ), + ); + } + return $this->mFieldNames; + } + + function isFieldSortable( $field ) { + static $sortable = array( 'img_timestamp', 'img_name', 'img_size' ); + return in_array( $field, $sortable ); + } + + function getQueryInfo() { + $fields = $this->getFieldNames(); + $fields = array_keys( $fields ); + $fields[] = 'img_user'; + return array( + 'tables' => 'image', + 'fields' => $fields, + 'conds' => $this->mQueryConds + ); + } + + function getDefaultSort() { + return 'img_timestamp'; + } + + function getStartBody() { + # Do a link batch query for user pages + if ( $this->mResult->numRows() ) { + $lb = new LinkBatch; + $this->mResult->seek( 0 ); + while ( $row = $this->mResult->fetchObject() ) { + if ( $row->img_user ) { + $lb->add( NS_USER, str_replace( ' ', '_', $row->img_user_text ) ); + } + } + $lb->execute(); + } + + return parent::getStartBody(); + } + + function formatValue( $field, $value ) { + global $wgLang; + switch ( $field ) { + case 'img_timestamp': + return $wgLang->timeanddate( $value, true ); + case 'img_name': + static $imgfile = null; + if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' ); + + $name = $this->mCurrentRow->img_name; + $link = $this->getSkin()->makeKnownLinkObj( Title::makeTitle( NS_FILE, $name ), $value ); + $image = wfLocalFile( $value ); + $url = $image->getURL(); + $download = Xml::element('a', array( 'href' => $url ), $imgfile ); + return "$link ($download)"; + case 'img_user_text': + if ( $this->mCurrentRow->img_user ) { + $link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ), + htmlspecialchars( $value ) ); + } else { + $link = htmlspecialchars( $value ); + } + return $link; + case 'img_size': + return $this->getSkin()->formatSize( $value ); + case 'img_description': + return $this->getSkin()->commentBlock( $value ); + } + } + + function getForm() { + global $wgRequest, $wgMiserMode; + $search = $wgRequest->getText( 'ilsearch' ); + + $s = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getTitle()->getLocalURL(), 'id' => 'mw-listfiles-form' ) ) . + Xml::openElement( 'fieldset' ) . + Xml::element( 'legend', null, wfMsg( 'listfiles' ) ) . + Xml::tags( 'label', null, wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) ); + + if ( !$wgMiserMode ) { + $s .= "
\n" . + Xml::inputLabel( wfMsg( 'listfiles_search_for' ), 'ilsearch', 'mw-ilsearch', 20, $search ); + } + $s .= ' ' . + Xml::submitButton( wfMsg( 'table_pager_limit_submit' ) ) ."\n" . + $this->getHiddenFields( array( 'limit', 'ilsearch' ) ) . + Xml::closeElement( 'fieldset' ) . + Xml::closeElement( 'form' ) . "\n"; + return $s; + } + + function getTableClass() { + return 'listfiles ' . parent::getTableClass(); + } + + function getNavClass() { + return 'listfiles_nav ' . parent::getNavClass(); + } + + function getSortHeaderClass() { + return 'listfiles_sort ' . parent::getSortHeaderClass(); + } +} diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 9f967247ab..f58e4ec416 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -354,7 +354,7 @@ $specialPageAliases = array( 'Watchlist' => array( 'Watchlist' ), 'Recentchanges' => array( 'RecentChanges' ), 'Upload' => array( 'Upload' ), - 'Imagelist' => array( 'ListFiles', 'FileList', 'ImageList' ), + 'Listfiles' => array( 'ListFiles', 'FileList', 'ImageList' ), 'Newimages' => array( 'NewFiles', 'NewImages' ), 'Listusers' => array( 'ListUsers', 'UserList' ), 'Listgrouprights' => array( 'ListGroupRights' ), @@ -1887,18 +1887,18 @@ You may want to try at a less busy time.', 'upload_source_url' => ' (a valid, publicly accessible URL)', 'upload_source_file' => ' (a file on your computer)', -# Special:FileList -'imagelist-summary' => 'This special page shows all uploaded files. +# Special:ListFiles +'listfiles-summary' => 'This special page shows all uploaded files. By default the last uploaded files are shown at top of the list. A click on a column header changes the sorting.', -'imagelist_search_for' => 'Search for media name:', +'listfiles_search_for' => 'Search for media name:', 'imgfile' => 'file', -'imagelist' => 'File list', -'imagelist_date' => 'Date', -'imagelist_name' => 'Name', -'imagelist_user' => 'User', -'imagelist_size' => 'Size', -'imagelist_description' => 'Description', +'listfiles' => 'File list', +'listfiles_date' => 'Date', +'listfiles_name' => 'Name', +'listfiles_user' => 'User', +'listfiles_size' => 'Size', +'listfiles_description' => 'Description', # File description page 'filehist' => 'File history',