Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -2959,7 +2959,7 @@ |
2960 | 2960 | 'Log' => 'changes', |
2961 | 2961 | |
2962 | 2962 | 'Upload' => 'media', |
2963 | | - 'Imagelist' => 'media', |
| 2963 | + 'Listfiles' => 'media', |
2964 | 2964 | 'MIMEsearch' => 'media', |
2965 | 2965 | 'FileDuplicateSearch' => 'media', |
2966 | 2966 | 'Filepath' => 'media', |
Index: trunk/phase3/includes/specials/SpecialImagelist.php |
— | — | @@ -1,161 +0,0 @@ |
2 | | -<?php |
3 | | -/** |
4 | | - * @file |
5 | | - * @ingroup SpecialPage |
6 | | - */ |
7 | | - |
8 | | -/** |
9 | | - * |
10 | | - */ |
11 | | -function wfSpecialImagelist() { |
12 | | - global $wgOut; |
13 | | - |
14 | | - $pager = new ImageListPager; |
15 | | - |
16 | | - $limit = $pager->getForm(); |
17 | | - $body = $pager->getBody(); |
18 | | - $nav = $pager->getNavigationBar(); |
19 | | - $wgOut->addHTML( "$limit<br />\n$body<br />\n$nav" ); |
20 | | -} |
21 | | - |
22 | | -/** |
23 | | - * @ingroup SpecialPage Pager |
24 | | - */ |
25 | | -class ImageListPager extends TablePager { |
26 | | - var $mFieldNames = null; |
27 | | - var $mQueryConds = array(); |
28 | | - |
29 | | - function __construct() { |
30 | | - global $wgRequest, $wgMiserMode; |
31 | | - if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { |
32 | | - $this->mDefaultDirection = true; |
33 | | - } else { |
34 | | - $this->mDefaultDirection = false; |
35 | | - } |
36 | | - $search = $wgRequest->getText( 'ilsearch' ); |
37 | | - if ( $search != '' && !$wgMiserMode ) { |
38 | | - $nt = Title::newFromUrl( $search ); |
39 | | - if( $nt ) { |
40 | | - $dbr = wfGetDB( DB_SLAVE ); |
41 | | - $m = $dbr->strencode( strtolower( $nt->getDBkey() ) ); |
42 | | - $m = str_replace( "%", "\\%", $m ); |
43 | | - $m = str_replace( "_", "\\_", $m ); |
44 | | - $this->mQueryConds = array( "LOWER(img_name) LIKE '%{$m}%'" ); |
45 | | - } |
46 | | - } |
47 | | - |
48 | | - parent::__construct(); |
49 | | - } |
50 | | - |
51 | | - function getFieldNames() { |
52 | | - if ( !$this->mFieldNames ) { |
53 | | - $this->mFieldNames = array( |
54 | | - 'img_timestamp' => wfMsg( 'imagelist_date' ), |
55 | | - 'img_name' => wfMsg( 'imagelist_name' ), |
56 | | - 'img_user_text' => wfMsg( 'imagelist_user' ), |
57 | | - 'img_size' => wfMsg( 'imagelist_size' ), |
58 | | - 'img_description' => wfMsg( 'imagelist_description' ), |
59 | | - ); |
60 | | - } |
61 | | - return $this->mFieldNames; |
62 | | - } |
63 | | - |
64 | | - function isFieldSortable( $field ) { |
65 | | - static $sortable = array( 'img_timestamp', 'img_name', 'img_size' ); |
66 | | - return in_array( $field, $sortable ); |
67 | | - } |
68 | | - |
69 | | - function getQueryInfo() { |
70 | | - $fields = $this->getFieldNames(); |
71 | | - $fields = array_keys( $fields ); |
72 | | - $fields[] = 'img_user'; |
73 | | - return array( |
74 | | - 'tables' => 'image', |
75 | | - 'fields' => $fields, |
76 | | - 'conds' => $this->mQueryConds |
77 | | - ); |
78 | | - } |
79 | | - |
80 | | - function getDefaultSort() { |
81 | | - return 'img_timestamp'; |
82 | | - } |
83 | | - |
84 | | - function getStartBody() { |
85 | | - # Do a link batch query for user pages |
86 | | - if ( $this->mResult->numRows() ) { |
87 | | - $lb = new LinkBatch; |
88 | | - $this->mResult->seek( 0 ); |
89 | | - while ( $row = $this->mResult->fetchObject() ) { |
90 | | - if ( $row->img_user ) { |
91 | | - $lb->add( NS_USER, str_replace( ' ', '_', $row->img_user_text ) ); |
92 | | - } |
93 | | - } |
94 | | - $lb->execute(); |
95 | | - } |
96 | | - |
97 | | - return parent::getStartBody(); |
98 | | - } |
99 | | - |
100 | | - function formatValue( $field, $value ) { |
101 | | - global $wgLang; |
102 | | - switch ( $field ) { |
103 | | - case 'img_timestamp': |
104 | | - return $wgLang->timeanddate( $value, true ); |
105 | | - case 'img_name': |
106 | | - static $imgfile = null; |
107 | | - if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' ); |
108 | | - |
109 | | - $name = $this->mCurrentRow->img_name; |
110 | | - $link = $this->getSkin()->makeKnownLinkObj( Title::makeTitle( NS_FILE, $name ), $value ); |
111 | | - $image = wfLocalFile( $value ); |
112 | | - $url = $image->getURL(); |
113 | | - $download = Xml::element('a', array( 'href' => $url ), $imgfile ); |
114 | | - return "$link ($download)"; |
115 | | - case 'img_user_text': |
116 | | - if ( $this->mCurrentRow->img_user ) { |
117 | | - $link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ), |
118 | | - htmlspecialchars( $value ) ); |
119 | | - } else { |
120 | | - $link = htmlspecialchars( $value ); |
121 | | - } |
122 | | - return $link; |
123 | | - case 'img_size': |
124 | | - return $this->getSkin()->formatSize( $value ); |
125 | | - case 'img_description': |
126 | | - return $this->getSkin()->commentBlock( $value ); |
127 | | - } |
128 | | - } |
129 | | - |
130 | | - function getForm() { |
131 | | - global $wgRequest, $wgMiserMode; |
132 | | - $search = $wgRequest->getText( 'ilsearch' ); |
133 | | - |
134 | | - $s = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getTitle()->getLocalURL(), 'id' => 'mw-imagelist-form' ) ) . |
135 | | - Xml::openElement( 'fieldset' ) . |
136 | | - Xml::element( 'legend', null, wfMsg( 'imagelist' ) ) . |
137 | | - Xml::tags( 'label', null, wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) ); |
138 | | - |
139 | | - if ( !$wgMiserMode ) { |
140 | | - $s .= "<br />\n" . |
141 | | - Xml::inputLabel( wfMsg( 'imagelist_search_for' ), 'ilsearch', 'mw-ilsearch', 20, $search ); |
142 | | - } |
143 | | - $s .= ' ' . |
144 | | - Xml::submitButton( wfMsg( 'table_pager_limit_submit' ) ) ."\n" . |
145 | | - $this->getHiddenFields( array( 'limit', 'ilsearch' ) ) . |
146 | | - Xml::closeElement( 'fieldset' ) . |
147 | | - Xml::closeElement( 'form' ) . "\n"; |
148 | | - return $s; |
149 | | - } |
150 | | - |
151 | | - function getTableClass() { |
152 | | - return 'imagelist ' . parent::getTableClass(); |
153 | | - } |
154 | | - |
155 | | - function getNavClass() { |
156 | | - return 'imagelist_nav ' . parent::getNavClass(); |
157 | | - } |
158 | | - |
159 | | - function getSortHeaderClass() { |
160 | | - return 'imagelist_sort ' . parent::getSortHeaderClass(); |
161 | | - } |
162 | | -} |
Index: trunk/phase3/includes/specials/SpecialListfiles.php |
— | — | @@ -0,0 +1,161 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @file |
| 5 | + * @ingroup SpecialPage |
| 6 | + */ |
| 7 | + |
| 8 | +/** |
| 9 | + * |
| 10 | + */ |
| 11 | +function wfSpecialListfiles() { |
| 12 | + global $wgOut; |
| 13 | + |
| 14 | + $pager = new ImageListPager; |
| 15 | + |
| 16 | + $limit = $pager->getForm(); |
| 17 | + $body = $pager->getBody(); |
| 18 | + $nav = $pager->getNavigationBar(); |
| 19 | + $wgOut->addHTML( "$limit<br />\n$body<br />\n$nav" ); |
| 20 | +} |
| 21 | + |
| 22 | +/** |
| 23 | + * @ingroup SpecialPage Pager |
| 24 | + */ |
| 25 | +class ImageListPager extends TablePager { |
| 26 | + var $mFieldNames = null; |
| 27 | + var $mQueryConds = array(); |
| 28 | + |
| 29 | + function __construct() { |
| 30 | + global $wgRequest, $wgMiserMode; |
| 31 | + if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { |
| 32 | + $this->mDefaultDirection = true; |
| 33 | + } else { |
| 34 | + $this->mDefaultDirection = false; |
| 35 | + } |
| 36 | + $search = $wgRequest->getText( 'ilsearch' ); |
| 37 | + if ( $search != '' && !$wgMiserMode ) { |
| 38 | + $nt = Title::newFromUrl( $search ); |
| 39 | + if( $nt ) { |
| 40 | + $dbr = wfGetDB( DB_SLAVE ); |
| 41 | + $m = $dbr->strencode( strtolower( $nt->getDBkey() ) ); |
| 42 | + $m = str_replace( "%", "\\%", $m ); |
| 43 | + $m = str_replace( "_", "\\_", $m ); |
| 44 | + $this->mQueryConds = array( "LOWER(img_name) LIKE '%{$m}%'" ); |
| 45 | + } |
| 46 | + } |
| 47 | + |
| 48 | + parent::__construct(); |
| 49 | + } |
| 50 | + |
| 51 | + function getFieldNames() { |
| 52 | + if ( !$this->mFieldNames ) { |
| 53 | + $this->mFieldNames = array( |
| 54 | + 'img_timestamp' => wfMsg( 'listfiles_date' ), |
| 55 | + 'img_name' => wfMsg( 'listfiles_name' ), |
| 56 | + 'img_user_text' => wfMsg( 'listfiles_user' ), |
| 57 | + 'img_size' => wfMsg( 'listfiles_size' ), |
| 58 | + 'img_description' => wfMsg( 'listfiles_description' ), |
| 59 | + ); |
| 60 | + } |
| 61 | + return $this->mFieldNames; |
| 62 | + } |
| 63 | + |
| 64 | + function isFieldSortable( $field ) { |
| 65 | + static $sortable = array( 'img_timestamp', 'img_name', 'img_size' ); |
| 66 | + return in_array( $field, $sortable ); |
| 67 | + } |
| 68 | + |
| 69 | + function getQueryInfo() { |
| 70 | + $fields = $this->getFieldNames(); |
| 71 | + $fields = array_keys( $fields ); |
| 72 | + $fields[] = 'img_user'; |
| 73 | + return array( |
| 74 | + 'tables' => 'image', |
| 75 | + 'fields' => $fields, |
| 76 | + 'conds' => $this->mQueryConds |
| 77 | + ); |
| 78 | + } |
| 79 | + |
| 80 | + function getDefaultSort() { |
| 81 | + return 'img_timestamp'; |
| 82 | + } |
| 83 | + |
| 84 | + function getStartBody() { |
| 85 | + # Do a link batch query for user pages |
| 86 | + if ( $this->mResult->numRows() ) { |
| 87 | + $lb = new LinkBatch; |
| 88 | + $this->mResult->seek( 0 ); |
| 89 | + while ( $row = $this->mResult->fetchObject() ) { |
| 90 | + if ( $row->img_user ) { |
| 91 | + $lb->add( NS_USER, str_replace( ' ', '_', $row->img_user_text ) ); |
| 92 | + } |
| 93 | + } |
| 94 | + $lb->execute(); |
| 95 | + } |
| 96 | + |
| 97 | + return parent::getStartBody(); |
| 98 | + } |
| 99 | + |
| 100 | + function formatValue( $field, $value ) { |
| 101 | + global $wgLang; |
| 102 | + switch ( $field ) { |
| 103 | + case 'img_timestamp': |
| 104 | + return $wgLang->timeanddate( $value, true ); |
| 105 | + case 'img_name': |
| 106 | + static $imgfile = null; |
| 107 | + if ( $imgfile === null ) $imgfile = wfMsg( 'imgfile' ); |
| 108 | + |
| 109 | + $name = $this->mCurrentRow->img_name; |
| 110 | + $link = $this->getSkin()->makeKnownLinkObj( Title::makeTitle( NS_FILE, $name ), $value ); |
| 111 | + $image = wfLocalFile( $value ); |
| 112 | + $url = $image->getURL(); |
| 113 | + $download = Xml::element('a', array( 'href' => $url ), $imgfile ); |
| 114 | + return "$link ($download)"; |
| 115 | + case 'img_user_text': |
| 116 | + if ( $this->mCurrentRow->img_user ) { |
| 117 | + $link = $this->getSkin()->makeLinkObj( Title::makeTitle( NS_USER, $value ), |
| 118 | + htmlspecialchars( $value ) ); |
| 119 | + } else { |
| 120 | + $link = htmlspecialchars( $value ); |
| 121 | + } |
| 122 | + return $link; |
| 123 | + case 'img_size': |
| 124 | + return $this->getSkin()->formatSize( $value ); |
| 125 | + case 'img_description': |
| 126 | + return $this->getSkin()->commentBlock( $value ); |
| 127 | + } |
| 128 | + } |
| 129 | + |
| 130 | + function getForm() { |
| 131 | + global $wgRequest, $wgMiserMode; |
| 132 | + $search = $wgRequest->getText( 'ilsearch' ); |
| 133 | + |
| 134 | + $s = Xml::openElement( 'form', array( 'method' => 'get', 'action' => $this->getTitle()->getLocalURL(), 'id' => 'mw-listfiles-form' ) ) . |
| 135 | + Xml::openElement( 'fieldset' ) . |
| 136 | + Xml::element( 'legend', null, wfMsg( 'listfiles' ) ) . |
| 137 | + Xml::tags( 'label', null, wfMsgHtml( 'table_pager_limit', $this->getLimitSelect() ) ); |
| 138 | + |
| 139 | + if ( !$wgMiserMode ) { |
| 140 | + $s .= "<br />\n" . |
| 141 | + Xml::inputLabel( wfMsg( 'listfiles_search_for' ), 'ilsearch', 'mw-ilsearch', 20, $search ); |
| 142 | + } |
| 143 | + $s .= ' ' . |
| 144 | + Xml::submitButton( wfMsg( 'table_pager_limit_submit' ) ) ."\n" . |
| 145 | + $this->getHiddenFields( array( 'limit', 'ilsearch' ) ) . |
| 146 | + Xml::closeElement( 'fieldset' ) . |
| 147 | + Xml::closeElement( 'form' ) . "\n"; |
| 148 | + return $s; |
| 149 | + } |
| 150 | + |
| 151 | + function getTableClass() { |
| 152 | + return 'listfiles ' . parent::getTableClass(); |
| 153 | + } |
| 154 | + |
| 155 | + function getNavClass() { |
| 156 | + return 'listfiles_nav ' . parent::getNavClass(); |
| 157 | + } |
| 158 | + |
| 159 | + function getSortHeaderClass() { |
| 160 | + return 'listfiles_sort ' . parent::getSortHeaderClass(); |
| 161 | + } |
| 162 | +} |
Property changes on: trunk/phase3/includes/specials/SpecialListfiles.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 163 | + native |
Added: svn:keywords |
2 | 164 | + Author Date Id Revision |
Index: trunk/phase3/includes/SpecialPage.php |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | |
96 | 96 | 'Recentchanges' => 'SpecialRecentchanges', |
97 | 97 | 'Upload' => array( 'SpecialPage', 'Upload' ), |
98 | | - 'Imagelist' => array( 'SpecialPage', 'Imagelist' ), |
| 98 | + 'Listfiles' => array( 'SpecialPage', 'Listfiles' ), |
99 | 99 | 'Newimages' => array( 'IncludableSpecialPage', 'Newimages' ), |
100 | 100 | 'Listusers' => array( 'SpecialPage', 'Listusers' ), |
101 | 101 | 'Listgrouprights' => 'SpecialListGroupRights', |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -354,7 +354,7 @@ |
355 | 355 | 'Watchlist' => array( 'Watchlist' ), |
356 | 356 | 'Recentchanges' => array( 'RecentChanges' ), |
357 | 357 | 'Upload' => array( 'Upload' ), |
358 | | - 'Imagelist' => array( 'ListFiles', 'FileList', 'ImageList' ), |
| 358 | + 'Listfiles' => array( 'ListFiles', 'FileList', 'ImageList' ), |
359 | 359 | 'Newimages' => array( 'NewFiles', 'NewImages' ), |
360 | 360 | 'Listusers' => array( 'ListUsers', 'UserList' ), |
361 | 361 | 'Listgrouprights' => array( 'ListGroupRights' ), |
— | — | @@ -1887,18 +1887,18 @@ |
1888 | 1888 | 'upload_source_url' => ' (a valid, publicly accessible URL)', |
1889 | 1889 | 'upload_source_file' => ' (a file on your computer)', |
1890 | 1890 | |
1891 | | -# Special:FileList |
1892 | | -'imagelist-summary' => 'This special page shows all uploaded files. |
| 1891 | +# Special:ListFiles |
| 1892 | +'listfiles-summary' => 'This special page shows all uploaded files. |
1893 | 1893 | By default the last uploaded files are shown at top of the list. |
1894 | 1894 | A click on a column header changes the sorting.', |
1895 | | -'imagelist_search_for' => 'Search for media name:', |
| 1895 | +'listfiles_search_for' => 'Search for media name:', |
1896 | 1896 | 'imgfile' => 'file', |
1897 | | -'imagelist' => 'File list', |
1898 | | -'imagelist_date' => 'Date', |
1899 | | -'imagelist_name' => 'Name', |
1900 | | -'imagelist_user' => 'User', |
1901 | | -'imagelist_size' => 'Size', |
1902 | | -'imagelist_description' => 'Description', |
| 1897 | +'listfiles' => 'File list', |
| 1898 | +'listfiles_date' => 'Date', |
| 1899 | +'listfiles_name' => 'Name', |
| 1900 | +'listfiles_user' => 'User', |
| 1901 | +'listfiles_size' => 'Size', |
| 1902 | +'listfiles_description' => 'Description', |
1903 | 1903 | |
1904 | 1904 | # File description page |
1905 | 1905 | 'filehist' => 'File history', |