X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=b1a04d713463aa8d77542b65c7f61b20c2994b73;hb=099876e5483d5fcc77aebc69e63b238e09889b1f;hp=fb54a8e3f577cea827b3b55ac05f633ff4c0609b;hpb=3d550d4fcd67dae13cb96f558a315ae06f8f4585;p=mkws-moved-to-github.git diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index fb54a8e..b1a04d7 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -1,5 +1,5 @@ -/*! MKWS, the MasterKey Widget Set. - * Copyright (C) 2013-2014 Index Data +/*! MKWS, the MasterKey Widget Set. + * Copyright (C) 2013-2014 Index Data * See the file LICENSE for details */ @@ -67,7 +67,7 @@ Handlebars.registerHelper('commaList', function(items, options) { // Some functions are visible to be called from outside code, namely -// generated HTML: mkws.switchView(), showDetails(), limitTarget(), +// generated HTML: that.switchView(), showDetails(), limitTarget(), // limitQuery(), delimitTarget(), delimitQuery(), pagerPrev(), // pagerNext(), showPage(). Also mkws.M() is made available for the // Handlebars helper 'translate' @@ -86,6 +86,7 @@ var mkws = { "Authors": "Autoren", "Subjects": "Schlagwörter", "Sources": "Daten und Quellen", + "source": "datenquelle", "Termlists": "Termlisten", "Next": "Weiter", "Prev": "Zurück", @@ -99,8 +100,10 @@ var mkws = { "found": "gefunden", "Title": "Titel", "Author": "Autor", + "author": "autor", "Date": "Datum", "Subject": "Schlagwort", + "subject": "schlagwort", "Location": "Ort", "Records": "Datensätze", "Targets": "Datenbanken", @@ -112,6 +115,7 @@ var mkws = { "Authors": "Forfattere", "Subjects": "Emner", "Sources": "Kilder", + "source": "kilder", "Termlists": "Termlists", "Next": "Næste", "Prev": "Forrige", @@ -125,8 +129,10 @@ var mkws = { "found": "fandt", "Title": "Title", "Author": "Forfatter", + "author": "forfatter", "Date": "Dato", "Subject": "Emneord", + "subject": "emneord", "Location": "Lokation", "Records": "Poster", "Targets": "Baser", @@ -188,7 +194,7 @@ function team($, teamName) { } else if (mkws.debug_level >= 2) { console.log(timestamp + ">>> called from function " + arguments.callee.caller.name + ' <<<'); } - console.log(timestamp + string); + console.log(m_teamName + ": " + timestamp + string); } var debug = mkws.debug_function; // local alias debug("start running MKWS"); @@ -228,8 +234,8 @@ function team($, teamName) { "pazpar2path": mkws_config.pazpar2_url, "oninit": my_oninit, "onstat": my_onstat, - "onterm": my_onterm, - "termlist": "xtargets,subject,author", // ### should only request the ones we actually want + "onterm": (mkws_config.facets.length ? my_onterm : undefined), + "termlist": mkws_config.facets.join(','), "onbytarget": my_onbytarget, "usesessions" : mkws_config.use_service_proxy ? false : true, "showResponseType": '', // or "json" (for debugging?) @@ -286,7 +292,7 @@ function team($, teamName) { { var template = loadTemplate("Summary"); hit._id = "mkwsRec_" + hit.recid; - hit._onclick = "mkws.showDetails(this.id, '" + m_teamName + "');return false;" + hit._onclick = "mkws.showDetails('" + m_teamName + "', this.id);return false;" return template(hit); } @@ -310,9 +316,9 @@ function team($, teamName) { var node = $(".mkwsTermlists.mkwsTeam_" + teamName); if (node.length == 0) return; - // no facets + // no facets: this should never happen if (!mkws_config.facets || mkws_config.facets.length == 0) { - debug("my_onterm called even though we have no facets: " + $.toJSON(data)); + alert("my_onterm called even though we have no facets: " + $.toJSON(data)); node.hide(); return; } @@ -325,11 +331,11 @@ function team($, teamName) { var facets = mkws_config.facets; for(var i = 0; i < facets.length; i++) { - if (facets[i] == "sources") { + if (facets[i] == "xtargets") { add_single_facet(acc, "Sources", data.xtargets, 16, null); - } else if (facets[i] == "subjects") { + } else if (facets[i] == "subject") { add_single_facet(acc, "Subjects", data.subject, 10, "subject"); - } else if (facets[i] == "authors") { + } else if (facets[i] == "author") { add_single_facet(acc, "Authors", data.author, 10, "author"); } else { alert("bad facet configuration: '" + facets[i] + "'"); @@ -341,7 +347,7 @@ function team($, teamName) { function add_single_facet(acc, caption, data, max, pzIndex) { - acc.push('