Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php |
— | — | @@ -67,6 +67,8 @@ |
68 | 68 | if ($this->propertystring == '') $this->propertystring = current($params); |
69 | 69 | if ($this->valuestring == '') $this->valuestring = next($params); |
70 | 70 | |
| 71 | + $this->valuestring = str_replace(" ", " ", $this->valuestring); |
| 72 | + |
71 | 73 | $this->property = Title::newFromText( $this->propertystring, SMW_NS_PROPERTY ); |
72 | 74 | if (null === $this->property) { |
73 | 75 | $this->propertystring = ''; |
— | — | @@ -86,7 +88,7 @@ |
87 | 89 | if (is_numeric($offsetstring)) $this->offset = intval($offsetstring); |
88 | 90 | |
89 | 91 | $wgOut->addHTML($this->displaySearchByProperty()); |
90 | | - $wgOut->addHTML($this->queryFormAutocomplete()); |
| 92 | + $wgOut->addHTML($this->queryForm()); |
91 | 93 | } |
92 | 94 | |
93 | 95 | /** |
— | — | @@ -171,7 +173,7 @@ |
172 | 174 | if (!$first && ($number > 0)) while ( count($results) > $number ) array_pop($results); |
173 | 175 | while ( $results && $number != 0) { |
174 | 176 | $result = array_pop( $results ); |
175 | | - $thing = $skin->makeKnownLinkObj( $result[0]->getTitle() ); |
| 177 | + $thing = $skin->makeKnownLinkObj( $result[0]->getTitle(), $result[0]->getText() ); |
176 | 178 | $browselink = SMWInfolink::newBrowsingLink('+', $result[0]->getShortHTMLText())->getHTML($skin); |
177 | 179 | $val = $result[1]->getLongHTMLText( $skin ); |
178 | 180 | $html .= '<li>' . $thing . ' ' . $browselink; |
— | — | @@ -311,101 +313,4 @@ |
312 | 314 | return $html; |
313 | 315 | } |
314 | 316 | |
315 | | - private function queryFormAutocomplete() { |
316 | | - global $wgAjaxExportList; |
317 | | - $wgAjaxExportList[] = 'smwfGetValues'; |
318 | | - $javascript_text =<<<END |
319 | | - |
320 | | -var last_property = null; |
321 | | - |
322 | | -function suggestValues(){ |
323 | | - var suggestdiv = document.getElementById("suggestedvalues"); |
324 | | - var x = document.getElementById("smw_searchbyprop_value").value; |
325 | | - var z = document.getElementById("searchInput2").value; |
326 | | - |
327 | | - if (z == last_property) { |
328 | | - return; |
329 | | - } |
330 | | - last_property = z; |
331 | | - |
332 | | - if (z.value != "" && z.length > 3) { |
333 | | - sajax_do_call("smwfGetValues", [z,x], suggestdiv); |
334 | | - } |
335 | 317 | } |
336 | | - |
337 | | -function start_value_suggestion_onload(){ |
338 | | - var z = document.getElementById('searchInput2'); |
339 | | - var y = document.getElementById('smw_searchbyprop_value'); |
340 | | - y.onfocus = function() { suggestValues(); }; |
341 | | - |
342 | | - if(z.value != "" && y.value == "") { |
343 | | - suggestValues(); |
344 | | - } |
345 | | -} |
346 | | - |
347 | | -function setValues(){ |
348 | | - document.getElementById("smw_searchbyprop_value").value = document.getElementById("smw_suggestedvalueselection").options[document.getElementById("smw_suggestedvalueselection").selectedIndex].value; |
349 | | -} |
350 | | -END; |
351 | | - global $wgJsMimeType, $wgOut; |
352 | | - $spectitle = Title::makeTitle( NS_SPECIAL, 'SearchByProperty' ); |
353 | | - $wgOut->addScript('<script type="' . $wgJsMimeType . '" >' . $javascript_text . '</script>'); |
354 | | - $wgOut->addScript('<script type="' . $wgJsMimeType . '"> hookEvent("load", start_value_suggestion_onload);</script>'); |
355 | | - |
356 | | - // display query form |
357 | | - $html = '<p> ' . |
358 | | - '<form id="searchform2" action ="' . $spectitle->escapeLocalURL() . '" method="get">' . |
359 | | - '<table>' . |
360 | | - '<tr>' . |
361 | | - '<td>' . |
362 | | - '<input type="hidden" name="title" value="' . $spectitle->getPrefixedText() . '" />' . |
363 | | - '<input type="hidden" name="ns'.SMW_NS_PROPERTY.'" value="1" />'. //defines the namespace for mwsuggest |
364 | | - wfMsg('smw_sbv_property') . '' . |
365 | | - ' <input id="searchInput2" type="text" name="property" value="' . htmlspecialchars($this->propertystring) . '" />'. |
366 | | - '</td>' . |
367 | | - '<td>' . ' ' . wfMsg('smw_sbv_value') . |
368 | | - '</td>' . |
369 | | - '<td>' . |
370 | | - '<input id ="smw_searchbyprop_value" type="text" name="value" value="' . htmlspecialchars($this->valuestring) . '" style="width:100%;" />'. |
371 | | - '</td>' . |
372 | | - '<td>' . |
373 | | - ' <input type="submit" value="' . wfMsg('smw_sbv_submit') . '" />' . |
374 | | - '</td>'. |
375 | | - '</tr>' . |
376 | | - '<tr>' . |
377 | | - '<td></td>' . |
378 | | - '<td></td>' . |
379 | | - '<td><div id="suggestedvalues"></div></td>' . |
380 | | - '<td></td>' . |
381 | | - '</tr>' . |
382 | | - '</table>' . |
383 | | - '</form>'. |
384 | | - '</p>'; |
385 | | - |
386 | | - return $html; |
387 | | - } |
388 | | - |
389 | | - // @todo doc |
390 | | - static function getSuggestedValues($property, $value) { |
391 | | - //replace white space with underscore |
392 | | - $property = str_replace(' ', '_', $property); |
393 | | - $propertytitle = Title::newFromText($property, SMW_NS_PROPERTY ); |
394 | | - $values = array(); |
395 | | - $values = smwfGetStore()->getPropertyValues(null, $propertytitle); |
396 | | - |
397 | | - $r = ''; |
398 | | - foreach($values as $datavalue){ |
399 | | - $r .= '<option>' .$datavalue->getWikiValue() . "</option>"; |
400 | | - } |
401 | | - $number = sizeof($values); |
402 | | - if ($number > 5) |
403 | | - $number = 5; |
404 | | - if ($number == 0) { |
405 | | - $html = wfMsg('smw_sbv_novaluesuggest'); |
406 | | - } else { |
407 | | - $html = '<form><select id="smw_suggestedvalueselection" size="' . $number . '" onfocus="setValues()" onchange="setValues()" style="width:100%;">' . $r . '</select></form>'; |
408 | | - } |
409 | | - return $html; |
410 | | - } |
411 | | - |
412 | | -} |
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php |
— | — | @@ -210,8 +210,9 @@ |
211 | 211 | * @return A string containing the HTML with the subject line |
212 | 212 | */ |
213 | 213 | private function displayHead() { |
214 | | - global $wgUser; |
| 214 | + global $wgUser, $wgOut; |
215 | 215 | $skin = $wgUser->getSkin(); |
| 216 | + $wgOut->setHTMLTitle($this->subject->getTitle()); |
216 | 217 | $html = "<table class=\"smwb-factbox\" cellpadding=\"0\" cellspacing=\"0\">\n"; |
217 | 218 | $html .= "<tr class=\"smwb-title\"><td colspan=\"2\">\n"; |
218 | 219 | $html .= $skin->makeLinkObj($this->subject->getTitle()) . "\n"; // @todo Replace makeLinkObj with link as soon as we drop MW1.12 compatibility |