Index: trunk/phase3/includes/ImageQueryPage.php |
— | — | @@ -9,6 +9,8 @@ |
10 | 10 | */ |
11 | 11 | class ImageQueryPage extends QueryPage { |
12 | 12 | |
| 13 | + var $mIsGallery = true; |
| 14 | + |
13 | 15 | /** |
14 | 16 | * Format and output report results using the given information plus |
15 | 17 | * OutputPage |
— | — | @@ -22,19 +24,36 @@ |
23 | 25 | */ |
24 | 26 | protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) { |
25 | 27 | if( $num > 0 ) { |
26 | | - $gallery = new ImageGallery(); |
27 | | - $gallery->useSkin( $skin ); |
28 | | - |
29 | | - # $res might contain the whole 1,000 rows, so we read up to |
30 | | - # $num [should update this to use a Pager] |
31 | | - for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) { |
32 | | - $image = $this->prepareImage( $row ); |
33 | | - if( $image ) { |
34 | | - $gallery->add( $image->getTitle(), $this->getCellHtml( $row ) ); |
| 28 | + if ( $this->mIsGallery ) { |
| 29 | + $gallery = new ImageGallery(); |
| 30 | + $gallery->useSkin( $skin ); |
| 31 | + |
| 32 | + # $res might contain the whole 1,000 rows, so we read up to |
| 33 | + # $num [should update this to use a Pager] |
| 34 | + for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) { |
| 35 | + $image = $this->prepareImage( $row ); |
| 36 | + if( $image ) { |
| 37 | + $gallery->add( $image->getTitle(), $this->getCellHtml( $row ) ); |
| 38 | + } |
35 | 39 | } |
| 40 | + $html = $gallery->toHtml(); |
36 | 41 | } |
| 42 | + else { |
| 43 | + global $wgUser, $wgLang; |
| 44 | + $sk = $wgUser->getSkin(); |
| 45 | + $html = "<ol>\n"; |
| 46 | + for( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) { |
| 47 | + $image = $this->prepareImage( $row ); |
| 48 | + if( $image ) { |
| 49 | + $bytes = wfMsgExt( 'nbytes', array( 'parsemag', 'escape'), $wgLang->formatNum( $image->getSize() ) ); |
| 50 | + $html .= "<li>" . $sk->makeKnownLinkObj( $image->getTitle(), $image->getTitle()->getText() ) . |
| 51 | + " (" . $bytes . ")</li>\n"; |
| 52 | + } |
| 53 | + } |
| 54 | + $html .= "</ol>\n"; |
| 55 | + } |
37 | 56 | |
38 | | - $out->addHtml( $gallery->toHtml() ); |
| 57 | + $out->addHtml( $html ); |
39 | 58 | } |
40 | 59 | } |
41 | 60 | |
— | — | @@ -51,7 +70,7 @@ |
52 | 71 | ? wfFindFile( $title ) |
53 | 72 | : null; |
54 | 73 | } |
55 | | - |
| 74 | + |
56 | 75 | /** |
57 | 76 | * Get additional HTML to be shown in a results' cell |
58 | 77 | * |
— | — | @@ -61,5 +80,11 @@ |
62 | 81 | protected function getCellHtml( $row ) { |
63 | 82 | return ''; |
64 | 83 | } |
65 | | - |
| 84 | + |
| 85 | + /** |
| 86 | + * Is this to be output as a gallery? |
| 87 | + */ |
| 88 | + public function setGallery( $val ) { |
| 89 | + $this->mIsGallery = $val; |
| 90 | + } |
66 | 91 | } |
Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -744,7 +744,7 @@ |
745 | 745 | global $wgUser, $wgOutputEncoding, $wgRequest; |
746 | 746 | global $wgContLanguageCode, $wgDebugRedirects, $wgMimeType; |
747 | 747 | global $wgJsMimeType, $wgUseAjax, $wgAjaxSearch, $wgAjaxWatch; |
748 | | - global $wgServer, $wgEnableMWSuggest; |
| 748 | + global $wgEnableMWSuggest; |
749 | 749 | |
750 | 750 | if( $this->mDoNothing ){ |
751 | 751 | return; |