source: main/trunk/model-sites-dev/von-sparql/js/von-sparql-setup.js@ 32419

Last change on this file since 32419 was 29443, checked in by sjs49, 10 years ago

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

File size: 2.4 KB
Line 
1//SPARQL endpoint queries are sent to
2var sparqlEndpoint= location.protocol + '//' + location.hostname + ":3030/greenstone/query" ;
3var collectionName = gs.cgiParams.c;
4
5//Sets up various parts of the page, setting up onclick actions etc
6function setupPage()
7{
8
9 $("#btn_ShowChart").click(function(){
10 newQuery("sgvzl_container", $('#sel_ChartType').val(),2000);
11 });
12
13 $("#cb_RefineSearch").click(function(){
14 if(document.getElementById("cb_RefineSearch").checked==false)
15 toggle_RefineSearch(0);
16 else
17 toggle_RefineSearch(1);
18 generateQuery();
19 });
20
21
22
23 $("#sel_Limit").change(function(){
24 generateQuery();
25 });
26
27 $('#div_Selects select').combobox({
28 select: function(event, ui){
29 var id = event.target.id;
30 if(id=="sel_Predicate"){
31 updateRefineObjectSelector($("#sel_Predicate").val());
32 //Empty predicate selector and put empty option in it
33 /* $('#sel_RefinePredicate').empty();
34 $('#sel_RefinePredicate')
35 .append("<option value=\"\">Select ?o above</option>");
36 $('#sel_RefinePredicate').next().find('.custom-combobox-input').val("Select ?o above");*/
37
38 generateQuery();
39 }
40 else if(id=="sel_RefineObject"){
41 //updateRefinePredicateSelector($("#sel_RefineObject").val());
42 generateQuery();
43 }
44 else if(id=="sel_RefinePredicate"){
45 generateQuery();
46 }
47 }});
48 $('#table_refineControls tr td:first').addClass("alignRight");
49
50 setupCharts();
51
52}
53
54function setupCharts()
55{
56
57$(document).on("click", "#div_PredicateOverview .google-visualization-table-tr-even td:first-child, #div_PredicateOverview .google-visualization-table-tr-odd td:first-child", function(){
58 var clickedText = tidyPredicate($(this).text());
59 $('#sel_Predicate option').removeAttr("selected");
60 $('#sel_Predicate option').filter(function(){
61 return $(this).text() == clickedText;
62 }).prop('selected', true);
63
64 //Update refine object selector with new value for predicate
65 updateRefineObjectSelector($("#sel_Predicate").val());
66
67 //Clear refine predicate selector
68 /*$('#sel_RefinePredicate').empty();
69 $('#sel_RefinePredicate')
70 .append("<option value=\"\">Select ?o above</option>");
71 $('#sel_RefinePredicate').next().find('.custom-combobox-input').val("Select ?o above");*/
72 generateQuery();
73
74 $('#sel_Predicate').siblings('.custom-combobox').find('.custom-combobox-input').val(clickedText);
75
76 newQuery("sgvzl_container", $('#sel_ChartType').val(),500);
77 });
78
79 sgvizler.defaultChartWidth(675);
80}
Note: See TracBrowser for help on using the repository browser.