Index: trunk/phase3/includes/specials/SpecialListfiles.php |
— | — | @@ -21,7 +21,7 @@ |
22 | 22 | * @ingroup SpecialPage |
23 | 23 | */ |
24 | 24 | |
25 | | -class SpecialListFiles extends SpecialPage { |
| 25 | +class SpecialListFiles extends IncludableSpecialPage { |
26 | 26 | |
27 | 27 | public function __construct(){ |
28 | 28 | parent::__construct( 'Listfiles' ); |
— | — | @@ -32,12 +32,17 @@ |
33 | 33 | $this->setHeaders(); |
34 | 34 | $this->outputHeader(); |
35 | 35 | |
36 | | - $pager = new ImageListPager( $par ); |
| 36 | + $pager = new ImageListPager( $par, $this->including() ); |
37 | 37 | |
38 | | - $limit = $pager->getForm(); |
39 | | - $body = $pager->getBody(); |
40 | | - $nav = $pager->getNavigationBar(); |
41 | | - $wgOut->addHTML( "$limit<br />\n$body<br />\n$nav" ); |
| 38 | + if ( $this->including() ) { |
| 39 | + $html = $pager->getBody(); |
| 40 | + } else { |
| 41 | + $limit = $pager->getForm(); |
| 42 | + $body = $pager->getBody(); |
| 43 | + $nav = $pager->getNavigationBar(); |
| 44 | + $html = "$limit<br />\n$body<br />\n$nav"; |
| 45 | + } |
| 46 | + $wgOut->addHTML( $html ); |
42 | 47 | } |
43 | 48 | } |
44 | 49 | |
— | — | @@ -48,16 +53,15 @@ |
49 | 54 | var $mFieldNames = null; |
50 | 55 | var $mQueryConds = array(); |
51 | 56 | var $mUserName = null; |
| 57 | + var $mIncluding = false; |
52 | 58 | |
53 | | - function __construct( $par = null ) { |
| 59 | + function __construct( $par = null, $including = false ) { |
54 | 60 | global $wgRequest, $wgMiserMode; |
55 | | - if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { |
56 | | - $this->mDefaultDirection = true; |
57 | | - } else { |
58 | | - $this->mDefaultDirection = false; |
59 | | - } |
60 | 61 | |
61 | | - $userName = $wgRequest->getText( 'user', $par ); |
| 62 | + $this->mIncluding = $including; |
| 63 | + |
| 64 | + |
| 65 | + $userName = $including ? $par : $wgRequest->getText( 'user', $par ); |
62 | 66 | if ( $userName ) { |
63 | 67 | $nt = Title::newFromText( $userName, NS_USER ); |
64 | 68 | if ( !is_null( $nt ) ) { |
— | — | @@ -66,14 +70,24 @@ |
67 | 71 | } |
68 | 72 | } |
69 | 73 | |
70 | | - $search = $wgRequest->getText( 'ilsearch' ); |
71 | | - if ( $search != '' && !$wgMiserMode ) { |
72 | | - $nt = Title::newFromURL( $search ); |
73 | | - if ( $nt ) { |
74 | | - $dbr = wfGetDB( DB_SLAVE ); |
75 | | - $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(), |
76 | | - strtolower( $nt->getDBkey() ), $dbr->anyString() ); |
| 74 | + if ( !$including ) { |
| 75 | + if ( $wgRequest->getText( 'sort', 'img_date' ) == 'img_date' ) { |
| 76 | + $this->mDefaultDirection = true; |
| 77 | + } else { |
| 78 | + $this->mDefaultDirection = false; |
77 | 79 | } |
| 80 | + |
| 81 | + $search = $wgRequest->getText( 'ilsearch' ); |
| 82 | + if ( $search != '' && !$wgMiserMode ) { |
| 83 | + $nt = Title::newFromURL( $search ); |
| 84 | + if ( $nt ) { |
| 85 | + $dbr = wfGetDB( DB_SLAVE ); |
| 86 | + $this->mQueryConds[] = 'LOWER(img_name)' . $dbr->buildLike( $dbr->anyString(), |
| 87 | + strtolower( $nt->getDBkey() ), $dbr->anyString() ); |
| 88 | + } |
| 89 | + } |
| 90 | + } else { |
| 91 | + $this->mDefaultDirection = true; |
78 | 92 | } |
79 | 93 | |
80 | 94 | parent::__construct(); |
— | — | @@ -101,6 +115,9 @@ |
102 | 116 | } |
103 | 117 | |
104 | 118 | function isFieldSortable( $field ) { |
| 119 | + if ( $this->mIncluding ) { |
| 120 | + return false; |
| 121 | + } |
105 | 122 | static $sortable = array( 'img_timestamp', 'img_name' ); |
106 | 123 | if ( $field == 'img_size' ) { |
107 | 124 | # No index for both img_size and img_user_text |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -125,6 +125,7 @@ |
126 | 126 | 'AbortNewAccount' triggered by explicit account creations. (They are separate |
127 | 127 | to avoid loops and confusion; auth plugins like CentralAuth need to handle |
128 | 128 | AbortNewAccount separately. |
| 129 | +* Special:ListFiles is now transcludable. |
129 | 130 | |
130 | 131 | |
131 | 132 | === Bug fixes in 1.18 === |