http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95098
Revision: 95098
Author: jeroendedauw
Date: 2011-08-20 17:23:20 +0000 (Sat, 20 Aug 2011)
Log Message:
-----------
fix compat w/ mw 1.17 and earlier
Modified Paths:
--------------
trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php
Modified:
trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php
===================================================================
--- trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php
2011-08-20 16:35:15 UTC (rev 95097)
+++ trunk/extensions/SemanticMediaWiki/includes/queryprinters/SMW_QP_Table.php
2011-08-20 17:23:20 UTC (rev 95098)
@@ -17,7 +17,7 @@
}
protected function getResultText( SMWQueryResult $res, $outputmode ) {
- global $smwgIQRunningNumber;
+ global $wgVersion;
$tableRows = array();
@@ -29,7 +29,7 @@
$result = '<table class="sortable wikitable"' .
( $this->mFormat == 'broadtable' ? ' width="100%"' :
'' ) .
">\n";
-
+
if ( $this->mShowHeaders != SMW_HEADERS_HIDE ) { // building
headers
$headers = array();
@@ -43,11 +43,25 @@
);
}
- array_unshift( $tableRows, '<thead><tr>' . implode(
"\n", $headers ) . '</tr></thead><tbody>' );
+ $headers = '<tr>' . implode( "\n", $headers ) . '</tr>';
+
+ // MW 1.17 and earlier do not accept thead while later
versions require it.
+ if ( version_compare( $wgVersion, '1.18', '>=' ) ) {
+ $headers = '<thead>' . $headers . '</thead>';
+ }
+
+ $result .= $headers;
}
- $result .= implode( "\n", $tableRows ) . '</tbody>';
+ $tableRows = implode( "\n", $tableRows );
+ // MW 1.17 and earlier do not accept thead while later versions
require it.
+ if ( version_compare( $wgVersion, '1.18', '>=' ) ) {
+ $tableRows = '<tbody>' . $tableRows . '</tbody>';
+ }
+
+ $result .= $tableRows;
+
// print further results footer
if ( $this->linkFurtherResults( $res ) ) {
$link = $res->getQueryLink();
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs