Changeset 29443
- Timestamp:
- 2014-11-17T16:13:35+13:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-sites-dev/von-sparql/js/von-sparql-setup.js
r29425 r29443 2 2 var sparqlEndpoint= location.protocol + '//' + location.hostname + ":3030/greenstone/query" ; 3 3 var collectionName = gs.cgiParams.c; 4 5 //returns the query used to recieve autocomplete data6 function getAutocompleteQuery()7 {8 var sparqlQuery = "PREFIX gsdl: <http://localhost:3030/greenstone/data/>" +9 "SELECT ?o ?identifier where{ "+10 " GRAPH gsdl:" + collectionName + " {" +11 " ?s <http://purl.org/dc/elements/1.1/Title> ?o" +12 ' FILTER regex(?o, "' + $('#autocomplete').val() + '", "i")'+13 '}}LIMIT 50 ';14 15 return sparqlEndpoint + "?query=" + encodeURIComponent(sparqlQuery);16 17 }18 4 19 5 //Sets up various parts of the page, setting up onclick actions etc … … 62 48 $('#table_refineControls tr td:first').addClass("alignRight"); 63 49 64 $('#autocomplete').autocomplete({65 source: function(request, response) {66 $.ajax({67 url: getAutocompleteQuery(),68 type:"GET",69 data:"output=json",70 success: function( json ) {71 console.log($('#autocomplete').val());72 var parsedJSON = ((typeof json) == "string") ? $.parseJSON(json) : json;73 response( $.map(json.results.bindings, function(item){74 return{75 label: /*item.identifier.value + " " + */item.o.value,76 value: item.o.value77 }78 }))79 },80 open: function(){81 $(this).removeClass("ui-corner-all").addClass("ui-corner-top");82 },83 close: function(){84 $(this).removeClass("ui-corner-top").addClass("ui-corner-all");85 }86 });87 },88 appendTo: "div_autocomplete",89 minLength: 0,90 delay: 500,91 })92 93 50 setupCharts(); 94 51
Note:
See TracChangeset
for help on using the changeset viewer.