r113453 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113452‎ | r113453 | r113454 >
Date:03:57, 9 March 2012
Author:yaron
Status:new
Tags:
Comment:
Added fix by Paul Oranje to get $sdgNumResultsPerPage working for MW >= 1.18; also some small formatting fixes
Modified paths:
  • /trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticDrilldown/specials/SD_BrowseData.php
@@ -137,7 +137,7 @@
138138 }
139139
140140 $wgOut->addHTML( "\n <div class=\"drilldown-results\">\n" );
141 - $rep = new SDBrowseDataPage( $category, $subcategory, $applied_filters, $remaining_filters );
 141+ $rep = new SDBrowseDataPage( $category, $subcategory, $applied_filters, $remaining_filters, $offset, $limit );
142142 // Handling changed in MW version 1.18.
143143 if ( method_exists( $rep, 'execute' ) ) {
144144 $num = $rep->execute( $query );
@@ -166,7 +166,7 @@
167167 /**
168168 * Initialize the variables of this page
169169 */
170 - function __construct( $category, $subcategory, $applied_filters, $remaining_filters ) {
 170+ function __construct( $category, $subcategory, $applied_filters, $remaining_filters, $offset, $limit ) {
171171 // Backwards compatibility for pre-version 1.18
172172 if ( $this instanceof SpecialPage ) {
173173 parent::__construct( 'BrowseData' );
@@ -175,6 +175,8 @@
176176 $this->subcategory = $subcategory;
177177 $this->applied_filters = $applied_filters;
178178 $this->remaining_filters = $remaining_filters;
 179+ $this->offset = $offset;
 180+ $this->limit = $limit;
179181
180182 $dbr = wfGetDB( DB_SLAVE );
181183 $categorylinks = $dbr->tableName( 'categorylinks' );
@@ -941,7 +943,8 @@
942944 $highest_num_results = max( $subcat_values );
943945 $num_results_midpoint = ( $lowest_num_results + $highest_num_results ) / 2;
944946 $font_size_midpoint = ( $sdgFiltersSmallestFontSize + $sdgFiltersLargestFontSize ) / 2;
945 - $num_results_per_font_pixel = ( $highest_num_results + 1 - $lowest_num_results ) / ( $sdgFiltersLargestFontSize + 1 - $sdgFiltersSmallestFontSize );
 947+ $num_results_per_font_pixel = ( $highest_num_results + 1 - $lowest_num_results ) /
 948+ ( $sdgFiltersLargestFontSize + 1 - $sdgFiltersSmallestFontSize );
946949 }
947950
948951 foreach ( $subcat_values as $subcat => $num_results ) {
@@ -1090,7 +1093,7 @@
10911094 SMW_OUTPUT_HTML
10921095 );
10931096
1094 - $prtext = is_array( $prresult ) ? $prresult[0] : $prresult;
 1097+ $prtext = is_array( $prresult ) ? $prresult[0] : $prresult;
10951098
10961099 SMWOutputs::commitToOutputPage( $out );
10971100
@@ -1107,7 +1110,7 @@
11081111 }
11091112 // Force one more parser function, so links appear.
11101113 $wgParser->replaceLinkHolders( $prtext );
1111 - }
 1114+ }
11121115
11131116 $html = array();
11141117 $html[] = $prtext;

Status & tagging log