r37124 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37123‎ | r37124 | r37125 >
Date:18:43, 5 July 2008
Author:mkroetzsch
Status:old
Tags:
Comment:
Give preview directly on concept pages (may once look like category page, but is just a simple list
now)
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/includes/SMW_GlobalFunctions.php
@@ -321,7 +321,8 @@
322322 $params = func_get_args();
323323 array_shift( $params ); // we already know the $parser ...
324324 $concept_input = array_shift( $params ); // use first parameter as concept (query) string
325 - $query = SMWQueryProcessor::createQuery($concept_input, array('limit' => -1), SMWQueryProcessor::CONCEPT_DESC);
 325+// $query = SMWQueryProcessor::createQuery($concept_input, array('limit' => -1), SMWQueryProcessor::CONCEPT_DESC);
 326+ $query = SMWQueryProcessor::createQuery($concept_input, array('limit' => 20, 'format' => 'list'), SMWQueryProcessor::CONCEPT_DESC);
326327 $concept_text = $query->getDescription()->getQueryString();
327328 $concept_docu = array_shift( $params ); // second parameter, if any, might be a description
328329
@@ -331,14 +332,16 @@
332333
333334 // display concept box:
334335 $qresult = smwfGetStore()->getQueryResult($query);
335 - $printer = new SMWListResultPrinter('list',true);
336 - $resultlink = $printer->getResult($qresult, array('searchlabel' => wfMsgForContent('smw_concept_preview')), SMW_OUTPUT_WIKI);
 336+ $printer = SMWQueryProcessor::getResultPrinter('list', SMWQueryProcessor::CONCEPT_DESC, $qresult);
 337+ $printer->setShowErrors(false);
 338+ $resultlink = $printer->getResult($qresult, array('sep' => ',_'), SMW_OUTPUT_WIKI);
337339 smwfRequireHeadItem(SMW_HEADER_STYLE);
338340 $result = '<div class="smwfact"><span class="smwfactboxhead">' . wfMsgForContent('smw_concept_description',$title->getText()) .
339 - //(count($query->getErrors())>0?' ' . smwfEncodeMessages($query->getErrors()):'') . // errors are shown by $resultlink anyway
340 - '</span> &nbsp;&nbsp;&nbsp;' . $resultlink . '<br />' .
 341+ (count($query->getErrors())>0?' ' . smwfEncodeMessages($query->getErrors()):'') .
 342+ '</span><br />' .
341343 ($concept_docu?"<p>$concept_docu</p>":'') .
342 - '<pre>' . str_replace('[', '&#x005B;', $concept_text) . '</pre></div>';
 344+ '<pre>' . str_replace('[', '&#x005B;', $concept_text) . "</pre>\n" .
 345+ $resultlink . '</div>';
343346 return $result;
344347 }
345348

Status & tagging log