r81777 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81776‎ | r81777 | r81778 >
Date:21:57, 8 February 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Added param descriptions for gallery format
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/SRF_Messages.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php
@@ -14,25 +14,19 @@
1515 /**
1616 * Result printer that prints query results as a gallery.
1717 */
18 -class SRFGallery extends SMWResultPrinter
19 -{
 18+class SRFGallery extends SMWResultPrinter {
2019
21 - public function getName()
22 - {
 20+ public function getName() {
2321 return wfMsg( 'srf_printername_gallery' );
2422 }
2523
26 -
27 - public function getResult( $results, $params, $outputmode )
28 - {
 24+ public function getResult( $results, $params, $outputmode ) {
2925 // skip checks, results with 0 entries are normal
3026 $this->readParameters( $params, $outputmode );
3127 return $this->getResultText( $results, SMW_OUTPUT_HTML );
3228 }
3329
34 -
35 - public function getResultText( $results, $outputmode )
36 - {
 30+ public function getResultText( $results, $outputmode ) {
3731 global $wgUser, $wgParser;
3832
3933 $ig = new ImageGallery();
@@ -167,4 +161,23 @@
168162 }
169163 }
170164
 165+ /**
 166+ * @see SMWResultPrinter::getParameters
 167+ *
 168+ * @since 1.5.3
 169+ *
 170+ * @return array
 171+ */
 172+ public function getParameters() {
 173+ $params = parent::getParameters();
 174+
 175+ $params[] = array( 'name' => 'perrow', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_perrow' ) );
 176+ $params[] = array( 'name' => 'widths', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_widths' ) );
 177+ $params[] = array( 'name' => 'heights', 'type' => 'int', 'description' => wfMsg( 'srf_paramdesc_heights' ) );
 178+
 179+ $params[] = array( 'name' => 'autocaptions', 'type' => 'enumeration', 'description' => wfMsg( 'srf_paramdesc_autocaptions' ), 'values' => array( 'on', 'off' ) );
 180+
 181+ return $params;
 182+ }
 183+
171184 }
Index: trunk/extensions/SemanticResultFormats/SRF_Messages.php
@@ -70,8 +70,13 @@
7171 'srf_paramdesc_barcolor' => 'The color of the bars',
7272 'srf_paramdesc_bardirection'=> 'The direction of the bar chart',
7373 'srf_paramdesc_barnumbersaxislabel' => 'The label for the numbers axis',
74 - // format "gallery"
 74+
 75+ // "gallery" format
7576 'srf_printername_gallery' => 'Gallery',
 77+ 'srf_paramdesc_perrow' => 'The amount of images per row',
 78+ 'srf_paramdesc_widths' => 'The width of the images',
 79+ 'srf_paramdesc_heights' => 'The height of the images',
 80+ 'srf_paramdesc_autocaptions' => 'Use file name as caption when none is provided',
7681
7782 // "tagcloud" format
7883 'srf_printername_tagcloud' => 'Tag cloud',

Status & tagging log