2007-03-28 21:01:58 +00:00
|
|
|
<?php
|
2012-05-12 20:33:02 +00:00
|
|
|
/**
|
|
|
|
|
* Variant of QueryPage which uses a gallery to output results.
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
* http://www.gnu.org/copyleft/gpl.html
|
|
|
|
|
*
|
|
|
|
|
* @file
|
|
|
|
|
* @ingroup SpecialPage
|
|
|
|
|
*/
|
2007-03-28 21:01:58 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Variant of QueryPage which uses a gallery to output results, thus
|
|
|
|
|
* suited for reports generating images
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup SpecialPage
|
2007-03-28 21:01:58 +00:00
|
|
|
* @author Rob Church <robchur@gmail.com>
|
|
|
|
|
*/
|
2010-12-22 14:16:25 +00:00
|
|
|
abstract class ImageQueryPage extends QueryPage {
|
2007-03-28 21:01:58 +00:00
|
|
|
/**
|
|
|
|
|
* Format and output report results using the given information plus
|
|
|
|
|
* OutputPage
|
|
|
|
|
*
|
2013-04-14 19:18:38 +00:00
|
|
|
* @param OutputPage $out OutputPage to print to
|
|
|
|
|
* @param Skin $skin User skin to use [unused]
|
|
|
|
|
* @param DatabaseBase $dbr (read) connection to use
|
|
|
|
|
* @param int $res Result pointer
|
|
|
|
|
* @param int $num Number of available result rows
|
|
|
|
|
* @param int $offset Paging offset
|
2007-03-28 21:01:58 +00:00
|
|
|
*/
|
|
|
|
|
protected function outputResults( $out, $skin, $dbr, $res, $num, $offset ) {
|
2013-04-20 22:49:30 +00:00
|
|
|
if ( $num > 0 ) {
|
New more slick gallery display
This extension adds a "mode" parameter to the gallery
tag, allowing different formats for the gallery tag
(galleries in the ui can be controlled by a global)
The added modes are:
*traditional - The original gallery
*nolines - Like the original, no borders, less padding
*packed - All images aligned by having same height.
JS also justifies the images.
(I think this one is the one that will go over best
with users.)
*packed-overlay - like packed, but caption goes over
top the image in a transloucent box.
*packed-hover - like packed-overlay, but caption only
visible on hover. Degrades gracefully on screen
readers, and falls back to packed-overlay if
you are using a touch screen. I kind of like
this mode when the caption is not that important
(ex a category where its just the file name).
This also adds a hook to allow people to make their
own gallery version. I believe there would be interest
in this, as different people have done different
experiments. For example:
* Wikia: http://community.wikia.com/wiki/Help:Galleries,_Slideshows,_and_Sliders/wikitext
* Wikinews: https://en.wikinews.org/wiki/Template:Picture_select
What I would like to see for this patch, is first it gets
enabled, with the default still "traditional". After
about a month or two we consult with users. If feedback
is positive, we change the default mode to one of the
others (probably "packed").
Adds a "mode" parameter to gallery for different
mode, including one 'height-constrained-overlay'
which looks much more like other modern websites.
Note: This makes one change to the old gallery format.
It makes Nonexistent files be rendered like thumbnails
(i.e. they are rendered with a little grey border).
One thing I'm slightly worried about with this patch,
is that I added an option to MediaTransformOutput::toHtml
to override the width attribute. I'm not sure if that
is the best approach, and would appreciate thoughts
on that.
This should be merged at the same time as Ie82c1548
Change-Id: I33462a8b52502ed76aeb163b66e3704c8618ba23
2013-06-08 04:47:07 +00:00
|
|
|
$gallery = ImageGalleryBase::factory();
|
|
|
|
|
$gallery->setContext( $this->getContext() );
|
2008-07-30 03:07:54 +00:00
|
|
|
|
|
|
|
|
# $res might contain the whole 1,000 rows, so we read up to
|
|
|
|
|
# $num [should update this to use a Pager]
|
2013-04-20 22:49:30 +00:00
|
|
|
for ( $i = 0; $i < $num && $row = $dbr->fetchObject( $res ); $i++ ) {
|
2010-12-22 16:20:16 +00:00
|
|
|
$namespace = isset( $row->namespace ) ? $row->namespace : NS_FILE;
|
|
|
|
|
$title = Title::makeTitleSafe( $namespace, $row->title );
|
|
|
|
|
if ( $title instanceof Title && $title->getNamespace() == NS_FILE ) {
|
2011-05-12 11:51:53 +00:00
|
|
|
$gallery->add( $title, $this->getCellHtml( $row ) );
|
2007-04-21 14:44:56 +00:00
|
|
|
}
|
2007-03-28 21:01:58 +00:00
|
|
|
}
|
2007-04-21 14:44:56 +00:00
|
|
|
|
2008-11-06 22:20:29 +00:00
|
|
|
$out->addHTML( $gallery->toHtml() );
|
2007-03-28 21:01:58 +00:00
|
|
|
}
|
|
|
|
|
}
|
2010-12-22 16:20:16 +00:00
|
|
|
|
2010-12-22 14:16:25 +00:00
|
|
|
// Gotta override this since it's abstract
|
|
|
|
|
function formatResult( $skin, $result ) { }
|
2007-04-21 14:44:56 +00:00
|
|
|
|
2007-03-28 21:01:58 +00:00
|
|
|
/**
|
|
|
|
|
* Get additional HTML to be shown in a results' cell
|
|
|
|
|
*
|
2013-04-14 19:18:38 +00:00
|
|
|
* @param object $row Result row
|
|
|
|
|
* @return string
|
2007-03-28 21:01:58 +00:00
|
|
|
*/
|
|
|
|
|
protected function getCellHtml( $row ) {
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|