r23850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23849‎ | r23850 | r23851 >
Date:17:38, 7 July 2007
Author:mkroetzsch
Status:old
Tags:
Comment:
Updated to use new datavalue API
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByAttribute.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByAttribute.php
@@ -53,35 +53,36 @@
5454 $html .= wfMsg('smw_sbv_docu') . "\n";
5555 } else {
5656 // Now that we have an attribute, let's figure out the datavalue
57 - $value = SMWDataValue::newAttributeValue( $attribute->getText(), $valuestring );
 57+ $value = SMWDataValueFactory::newAttributeObjectValue( $attribute, $valuestring );
5858 if ( $value->isValid() == FALSE ) { // no value understood
5959 $html .= wfMSG('smw_sbv_novalue', $skin->makeLinkObj($attribute, $attribute->getText()));
6060 $valuestring = '';
6161 } else { // everything is given
62 - $wgOut->setPagetitle( $attribute->getText() . ' ' . $value->getUserValue() );
 62+ $wgOut->setPagetitle( $attribute->getText() . ' ' . $value->getXSDValue() ); //TODO: use escaped wiki value instead?
6363
6464 $options = new SMWRequestOptions();
6565 $options->limit = $limit+1;
6666 $options->offset = $offset;
6767
68 - $res = &smwfGetStore()->getAttributeSubjects( $attribute, $value, $options, 'gt' );
 68+ $res = &smwfGetStore()->getAttributeSubjects( $attribute, $value, $options );
6969 $count = count($res);
7070
7171
72 - $html .= wfMsg('smw_sbv_displayresult', $skin->makeLinkObj($attribute, $attribute->getText()), $value->getUserValue()) . "<br />\n";
 72+ $html .= wfMsg('smw_sbv_displayresult', $skin->makeLinkObj($attribute, $attribute->getText()), $value->getShortHTMLText($skin)) . "<br />\n";
7373
7474 // prepare navigation bar
7575 if ($offset > 0)
76 - $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SearchByAttribute','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&attribute=' . urlencode($attribute->getText()) .'&value=' . urlencode($value->getUserValue()))) . '">' . wfMsg('smw_result_prev') . '</a>';
 76+ $navigation = '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SearchByAttribute','offset=' . max(0,$offset-$limit) . '&limit=' . $limit . '&attribute=' . urlencode($attribute->getText()) .'&value=' . urlencode($value->getWikiValue()))) . '">' . wfMsg('smw_result_prev') . '</a>';
7777 else
7878 $navigation = wfMsg('smw_result_prev');
7979
8080 $navigation .= '&nbsp;&nbsp;&nbsp;&nbsp; <b>' . wfMsg('smw_result_results') . ' ' . ($offset+1) . '&ndash; ' . ($offset + min($count, $limit)) . '</b>&nbsp;&nbsp;&nbsp;&nbsp;';
8181
82 - if ($count>$limit)
83 - $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SearchByAttribute', 'offset=' . ($offset+$limit) . '&limit=' . $limit . '&attribute=' . urlencode($attribute->getText()) . '&value=' . urlencode($value->getUserValue()))) . '">' . wfMsg('smw_result_next') . '</a>';
84 - else
 82+ if ($count>$limit) {
 83+ $navigation .= ' <a href="' . htmlspecialchars($skin->makeSpecialUrl('SearchByAttribute', 'offset=' . ($offset+$limit) . '&limit=' . $limit . '&attribute=' . urlencode($attribute->getText()) . '&value=' . urlencode($value->getWikiValue()))) . '">' . wfMsg('smw_result_next') . '</a>';
 84+ } else {
8585 $navigation .= wfMsg('smw_result_next');
 86+ }
8687
8788 $max = false; $first=true;
8889 foreach (array(20,50,100,250,500) as $l) {
@@ -96,7 +97,7 @@
9798 $max = true;
9899 }
99100 if ( $limit != $l ) {
100 - $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SearchByAttribute','offset=' . $offset . '&limit=' . $l . '&attribute=' . urlencode($attribute->getText()) . '&value=' . urlencode($value->getUserValue()))) . '">' . $l . '</a>';
 101+ $navigation .= '<a href="' . htmlspecialchars($skin->makeSpecialUrl('SearchByAttribute','offset=' . $offset . '&limit=' . $l . '&attribute=' . urlencode($attribute->getText()) . '&value=' . urlencode($value->getWikiValue()))) . '">' . $l . '</a>';
101102 } else {
102103 $navigation .= '<b>' . $l . '</b>';
103104 }

Status & tagging log