@@ -4,11 +4,11 @@ var edsOptions = "";
44var kohaOptions = "";
55var firstTimeSearchOptions = "";
66var edsSelectedKnownItem = "";
7- //var defaultSearch =""; set by configure
7+ //var defaultsearch =""; set by configure
88var browseNextPage = "";
99var catalogueId = "";
1010var nocorrect = "";
11- var defaultSearch = "[% defaultsearch %]";
11+ var defaultsearch = "[% defaultsearch %]";
1212//-configurable in plugin config
1313var edsSwitchText = '';
1414var kohaSwitchText = '';
@@ -27,6 +27,7 @@ var bibListLocal = 0;
2727
2828//Config written from template
2929edsConfig.logerrors = "[% logerrors %]";
30+ edsConfig.defaultsearch = "[% defaultsearch %]"
3031edsConfig.iprange = "[% iprange %]";
3132edsConfig.cookieexpiry = "[% cookieexpiry %]";
3233edsConfig.cataloguedbid = "[% cataloguedbid %]";
@@ -210,7 +211,7 @@ $.each($.cookie('bib_list').split("/"), function () {
210211});
211212
212213function StartEDS(edsLang) {
213- // console.log("Running startEDS...");
214+ console.log("Running startEDS...");
214215 if (!edsLang) {
215216 console.error("No language files found, the plugin is broken");
216217 return;
@@ -250,6 +251,7 @@ function StartEDS(edsLang) {
250251 // ConfigDefaultData();
251252 //$.getJSON('[% PLUGIN_HTTP_PATH %]/opac/eds-raw.pl' + '?' + 'q=config', function (data) { ConfigData(data); });
252253 //}
254+ console.log("Running ConfigData");
253255 ConfigData(edsConfig);
254256
255257 //$("#masthead_search").attr("disabled","disabled");
@@ -303,18 +305,19 @@ function SearchPublication(searchinTerm, pubAction) {
303305// }
304306
305307function ConfigData(data) {
306-
308+ console.log("ConfigData got");
309+ console.log(data);
307310 //window.edsConfig = data;
308311 eds_sessionStorage.set('edsConfig', data);
309312
310313 catalogueId = (data.cataloguedbid == "-") ? "" : data.cataloguedbid;
311314 defaultParams = (data.defaultparams == "-") ? "" : data.defaultparams;
312315
313316
314- if (data.defaultSearch != "off") {
315- var currentDefaultSearchValue = eds_sessionStorage.get('defaultSearch ');
317+ if (data.defaultsearch != "off") {
318+ var currentDefaultSearchValue = eds_sessionStorage.get('defaultsearch ');
316319 if (!currentDefaultSearchValue) {
317- eds_sessionStorage.set('defaultSearch ', data.defaultSearch )
320+ eds_sessionStorage.set('defaultsearch ', data.defaultsearch )
318321 }
319322 GoDiscovery();
320323 }
@@ -349,8 +352,8 @@ function GoDiscovery() {
349352 $('#masthead_search option[value=""]').attr("selected", "selected");
350353 $("#masthead_search").change(function () {
351354 knownItem = $(this).val();
352- if (($(this).val() == 'eds') && (eds_sessionStorage.get('defaultSearch ') != 'eds')) { SetEDS(1); }// Search EDS
353- else if (($(this).val() == '') && (eds_sessionStorage.get('defaultSearch ') != 'koha')) { SetKoha(1); }// Search Koha
355+ if (($(this).val() == 'eds') && (eds_sessionStorage.get('defaultsearch ') != 'eds')) { SetEDS(1); }// Search EDS
356+ else if (($(this).val() == '') && (eds_sessionStorage.get('defaultsearch ') != 'koha')) { SetKoha(1); }// Search Koha
354357 });
355358
356359 if (eds_sessionStorage.get('edsKnownItems')) {
@@ -360,7 +363,7 @@ function GoDiscovery() {
360363 $.getJSON('[% PLUGIN_HTTP_PATH %]/opac/eds-raw.pl?q=knownitems', function (data) { StoreEDSOptions(data); });
361364 }
362365
363- if (eds_sessionStorage.get('defaultSearch ') == 'eds') {
366+ if (eds_sessionStorage.get('defaultsearch ') == 'eds') {
364367 SetEDS(0);
365368 }
366369
@@ -382,9 +385,9 @@ function SetEDSOptions(data) {
382385 edsOptions += '<option ' + selectedItem + ' value="' + data[i].FieldCode + '">--- ' + data[i].FieldCode + ': ' + data[i].Label + '</option>';
383386 }
384387
385- if (eds_sessionStorage.get('defaultSearch ') == "eds") {
388+ if (eds_sessionStorage.get('defaultsearch ') == "eds") {
386389 SetEDS(0);
387- } else if (eds_sessionStorage.get('defaultSearch ') == "koha") { SetKoha(0); }
390+ } else if (eds_sessionStorage.get('defaultsearch ') == "koha") { SetKoha(0); }
388391
389392 var date = new Date();
390393 var minutes = 30;
@@ -398,7 +401,7 @@ function SetEDS(showInfo) {
398401 $('#masthead_search option').each(function () { $(this).remove(); });
399402 if (showInfo) { ShowInfo(edsSelectInfo); }
400403 $('#masthead_search').append(edsOptions);
401- eds_sessionStorage.set('defaultSearch ', 'eds');
404+ eds_sessionStorage.set('defaultsearch ', 'eds');
402405 $('#transl1').val($.cookie('QueryTerm'));
403406 $('.transl1').val($.cookie('QueryTerm')); //for 314
404407 $('#searchBread').text(edsLang.search_breadcrumb + " " + $.cookie('QueryTerm'));
@@ -429,7 +432,7 @@ function SetKoha(showInfo) {
429432 $('#masthead_search').append(kohaOptions);
430433 $('#masthead_search option[value="eds"]').remove();
431434 $('#masthead_search').prepend("<option value='eds'>" + edsSwitchText + "</option>");
432- eds_sessionStorage.set('defaultSearch ', 'koha')
435+ eds_sessionStorage.set('defaultsearch ', 'koha')
433436 //advSearch
434437 if (document.URL.indexOf("[% PLUGIN_HTTP_PATH %]/opac/eds-search.pl") != -1 && QueryString('q') == "") {
435438 $('a[href="/cgi-bin/koha/opac-search.pl"]').attr('title', kohaSwitchText);
@@ -1176,7 +1179,7 @@ function EDSAutoComp() {
11761179 idx = "holdings";
11771180 }
11781181
1179- if (eds_sessionStorage.get('defaultSearch ') != "eds") {
1182+ if (eds_sessionStorage.get('defaultsearch ') != "eds") {
11801183 return;
11811184 }
11821185
@@ -1226,7 +1229,7 @@ function EDSautoSearch(event, ui) {
12261229 });
12271230}
12281231$('body').on('click', '#translControl1', function () {
1229- if (eds_sessionStorage.get('defaultSearch ') == "eds") {
1232+ if (eds_sessionStorage.get('defaultsearch ') == "eds") {
12301233 $("#translControl1").autocomplete("search");
12311234 }
12321235});
0 commit comments