r68697 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68696‎ | r68697 | r68698 >
Date:02:23, 29 June 2010
Author:yaron
Status:deferred
Tags:
Comment:
Fixed handling of remote autocompletion for concepts
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_yui_autocompletion.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -329,7 +329,17 @@
330330 $query_result = $store->getQueryResult( $query );
331331 $pages = array();
332332 while ( $res = $query_result->getNext() ) {
333 - $pages[] = $res[0]->getNextText( SMW_OUTPUT_WIKI );
 333+ $page_name = $res[0]->getNextText( SMW_OUTPUT_WIKI );
 334+ if ( ! is_null( $substring ) ) {
 335+ // until SMW queries can handle substrings, we
 336+ // have to filter out pages manually
 337+ if ( stripos( $page_name, $substring ) === 0 ||
 338+ stristr( $page_name, ' ' . $substring ) ) {
 339+ $pages[] = $page_name;
 340+ }
 341+ } else {
 342+ $pages[] = $page_name;
 343+ }
334344 }
335345 sort( $pages );
336346 return $pages;
Index: trunk/extensions/SemanticForms/libs/SF_yui_autocompletion.js
@@ -27,6 +27,8 @@
2828 this.oACDS.scriptQueryAppend = "action=sfautocomplete&format=json&attribute=" + data_source;
2929 else if (data_type == 'category')
3030 this.oACDS.scriptQueryAppend = "action=sfautocomplete&format=json&category=" + data_source;
 31+ else if (data_type == 'concept')
 32+ this.oACDS.scriptQueryAppend = "action=sfautocomplete&format=json&concept=" + data_source;
3133 else if (data_type == 'namespace')
3234 this.oACDS.scriptQueryAppend = "action=sfautocomplete&format=json&namespace=" + data_source;
3335 else if (data_type == 'external_url')

Status & tagging log