r91251 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91250‎ | r91251 | r91252 >
Date:06:40, 1 July 2011
Author:devayon
Status:deferred
Tags:
Comment:
Followup to r90836, r90834 and r90765
Modified paths:
  • /trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php (modified) (history)
  • /trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMediaWiki/specials/AskSpecial/SMW_SpecialAsk.php
@@ -262,10 +262,11 @@
263263 minLength: 2,
264264 source: function(request, response) {
265265 request.term=request.term.substr(request.term.lastIndexOf("\\n")+1);
266 -
267 - jQuery.getJSON(wgScriptPath+'/api.php?action=opensearch&limit=10&namespace=102&form&search='+request.term, function(data){
268 - //remove the word 'Property:' from returned data and add prefix '?'
269 - for(i=0;i<data[1].length;i++) data[1][i]="?"+data[1][i].substr(9); // 9 because "Property:".length==9
 266+ url=wgScriptPath+'/api.php?action=opensearch&limit=10&namespace='+wgNamespaceIds['property']+'&format=jsonfm&search=';
 267+
 268+ jQuery.getJSON(url+request.term, function(data){
 269+ //remove the namespace prefix 'Property:' from returned data and add prefix '?'
 270+ for(i=0;i<data[1].length;i++) data[1][i]="?"+data[1][i].substr(data[1][i].indexOf(':')+1);
270271 response(jQuery.ui.autocomplete.filter(data[1], escapeQuestion(extractLast(request.term))));
271272 });
272273 },
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialSearchByProperty.php
@@ -452,9 +452,9 @@
453453 jQuery("#property_box").autocomplete({
454454 minLength: 2,
455455 source: function(request, response) {
456 - jQuery.getJSON(wgScriptPath+'/api.php?action=opensearch&limit=10&namespace=102&form&search='+request.term, function(data){
 456+ jQuery.getJSON(wgScriptPath+'/api.php?action=opensearch&limit=10&namespace='+wgNamespaceIds['property']+'&format=jsonfm&search='+request.term, function(data){
457457 //remove the word 'Property:' from returned data
458 - for(i=0;i<data[1].length;i++) data[1][i]= data[1][i].substr(9); // 9 because "Property:".length==9
 458+ for(i=0;i<data[1].length;i++) data[1][i]=data[1][i].substr(data[1][i].indexOf(':')+1);
459459 response(data[1]);
460460 });
461461 }
Index: trunk/extensions/SemanticMediaWiki/specials/SearchTriple/SMW_SpecialBrowse.php
@@ -426,7 +426,7 @@
427427 jQuery("#page_input_box").autocomplete({
428428 minLength: 3,
429429 source: function(request, response) {
430 - jQuery.getJSON(wgScriptPath+'/api.php?action=opensearch&limit=10&namespace=0&form&search='+request.term, function(data){
 430+ jQuery.getJSON(wgScriptPath+'/api.php?action=opensearch&limit=10&namespace=0&format=jsonfm&search='+request.term, function(data){
431431 response(data[1]);
432432 });
433433 }

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90765Changed the autocomplete to use ajax and MW API. Addressed bug 27687devayon11:34, 25 June 2011
r90834Added AutoSuggestdevayon15:27, 26 June 2011
r90836Added AutoSuggest for propertiesdevayon16:16, 26 June 2011