Changeset 29443


Ignore:
Timestamp:
11/17/14 16:13:35 (6 years ago)
Author:
sjs49
Message:

Removed old autocomplete functionality which is no longer available on About page

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/model-sites-dev/von-sparql/js/von-sparql-setup.js

    r29425 r29443  
    22var sparqlEndpoint= location.protocol + '//' + location.hostname + ":3030/greenstone/query" ;
    33var collectionName = gs.cgiParams.c;
    4 
    5 //returns the query used to recieve autocomplete data
    6 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 }
    184
    195//Sets up various parts of the page, setting up onclick actions etc
     
    6248    $('#table_refineControls tr td:first').addClass("alignRight");
    6349
    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.value
    77                     }
    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 
    9350    setupCharts();
    9451
Note: See TracChangeset for help on using the changeset viewer.