r23212 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23211‎ | r23212 | r23213 >
Date:11:41, 22 June 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Use new query system in ask-special.
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -10,6 +10,8 @@
1111
1212 global $IP;
1313 require_once( "$IP/includes/SpecialPage.php" );
 14+global $smwgIP;
 15+require_once( "$smwgIP/includes/SMW_QueryProcessor.php" );
1416
1517 function doSpecialAsk() {
1618 SMW_AskPage::execute();
@@ -53,17 +55,20 @@
5456
5557 // print results if any
5658 if ($smwgIQEnabled && ('' != $query) ) {
57 - $iq = new SMWInlineQuery(array('offset' => $offset, 'limit' => $limit, 'format' => 'broadtable', 'mainlabel' => ' ', 'link' => 'all', 'default' => wfMsg('smw_result_noresults'), 'sort' => $sort, 'order' => $order), false);
58 - $result = $iq->getHTMLResult($query);
 59+ $params = array('offset' => $offset, 'limit' => $limit, 'format' => 'broadtable', 'mainlabel' => ' ', 'link' => 'all', 'default' => wfMsg('smw_result_noresults'), 'sort' => $sort, 'order' => $order);
 60+ $queryobj = SMWQueryProcessor::createQuery($query, $params, false);
 61+ $res = smwfGetStore()->getQueryResult($queryobj);
 62+ $printer = new SMWTableResultPrinter('broadtable',false);
 63+ $result = $printer->getResultHTML($res, $params);
5964
6065 // prepare navigation bar
6166 if ($offset > 0)
6267 $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '">' . wfMsg('smw_result_prev') . '</a>';
6368 else $navigation = wfMsg('smw_result_prev');
6469
65 - $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp; <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '&ndash; ' . ($offset + $iq->getDisplayCount()) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;';
 70+ $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp; <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '&ndash; ' . ($offset + $res->getCount()) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;';
6671
67 - if ($iq->hasFurtherResults())
 72+ if ($res->hasFurtherResults())
6873 $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('Ask','offset=' . ($offset+$limit) . '&limit=' . $limit . '&query=' . urlencode($query) . '&sort=' . urlencode($sort) .'&order=' . urlencode($order))) . '">' . wfMsg('smw_result_next') . '</a>';
6974 else $navigation .= wfMsg('smw_result_next');
7075

Status & tagging log