[29423] | 1 | //SPARQL endpoint queries are sent to
|
---|
[28914] | 2 | var sparqlEndpoint= location.protocol + '//' + location.hostname + ":3030/greenstone/query" ;
|
---|
| 3 | var collectionName = gs.cgiParams.c;
|
---|
[29423] | 4 |
|
---|
| 5 | //Sets up various parts of the page, setting up onclick actions etc
|
---|
[28914] | 6 | function 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 |
|
---|
| 54 | function setupCharts()
|
---|
| 55 | {
|
---|
[29423] | 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(){
|
---|
[28914] | 58 | var clickedText = tidyPredicate($(this).text());
|
---|
[29423] | 59 | $('#sel_Predicate option').removeAttr("selected");
|
---|
[28914] | 60 | $('#sel_Predicate option').filter(function(){
|
---|
| 61 | return $(this).text() == clickedText;
|
---|
[29425] | 62 | }).prop('selected', true);
|
---|
[28914] | 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 | }
|
---|