-/*! 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
*/
"Authors": "Autoren",
"Subjects": "Schlagwörter",
"Sources": "Daten und Quellen",
+ "source": "datenquelle",
"Termlists": "Termlisten",
"Next": "Weiter",
"Prev": "Zurück",
"found": "gefunden",
"Title": "Titel",
"Author": "Autor",
+ "author": "autor",
"Date": "Datum",
"Subject": "Schlagwort",
+ "subject": "schlagwort",
"Location": "Ort",
"Records": "Datensätze",
"Targets": "Datenbanken",
"Authors": "Forfattere",
"Subjects": "Emner",
"Sources": "Kilder",
+ "source": "kilder",
"Termlists": "Termlists",
"Next": "Næste",
"Prev": "Forrige",
"found": "fandt",
"Title": "Title",
"Author": "Forfatter",
+ "author": "forfatter",
"Date": "Dato",
"Subject": "Emneord",
+ "subject": "emneord",
"Location": "Lokation",
"Records": "Poster",
"Targets": "Baser",
} 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");
"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?)
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;
}
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] + "'");
function add_single_facet(acc, caption, data, max, pzIndex) {
- acc.push('<div class="facet" id="mkwsFacet' + caption + '">');
+ acc.push('<div class="facet mkwsFacet' + caption + ' mkwsTeam_' + m_teamName + '">');
acc.push('<div class="termtitle">' + M(caption) + '</div>');
for (var i = 0; i < data.length && i < max; i++) {
acc.push('<div class="term">');
if (!pzIndex) {
// Special case: target selection
acc.push('target_id='+data[i].id+' ');
- action = 'mkws.limitTarget(this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
+ action = 'mkws.limitTarget(\'' + m_teamName + '\', this.getAttribute(\'target_id\'),this.firstChild.nodeValue)';
} else {
action = 'mkws.limitQuery(\'' + pzIndex + '\', this.firstChild.nodeValue)';
}
// wait until the DOM is ready
function domReady ()
{
- debug("starting domReady()");
$('.mkwsSearchForm.mkwsTeam_' + m_teamName).each(function (i, obj) {
debug("adding search-forms for team '" + m_teamName + "'");
var node = this;
});
});
- debug("in domReady() 1");
- debug("document = '" + document + "'");
- debug("document.mkwsSearchForm = '" + document.mkwsSearchForm + "'");
- debug("document.mkwsSearchForm.mkwsQuery = '" + document.mkwsSearchForm.mkwsQuery + "'");
- debug("document.mkwsSearchForm.mkwsQuery.value = '" + document.mkwsSearchForm.mkwsQuery.value + "'");
- document.mkwsSearchForm.mkwsQuery.value = '';
- debug("in domReady() 2");
if (document.mkwsSelect) {
debug("messing with mkwsSelect");
if (document.mkwsSelect.mkwsSort)
if (document.mkwsSelect.mkwsPerpage)
document.mkwsSelect.mkwsPerpage.onchange = onSelectDdChange;
}
- debug("finished domReady()");
}
}
m_filters = []
- redraw_navi(); // ### should use windowid
+ redraw_navi();
resetPage(); // ### the globals it resents should be indexed by windowid
loadSelect(); // ### should use windowid
triggerSearch(query, sort, targets, windowid);
// limit by target functions
- mkws.limitTarget = function (id, name)
+ that.limitTarget = function (id, name)
{
debug("limitTarget(id=" + id + ", name=" + name + ")");
m_filters.push({ id: id, name: name });
function redraw_navi ()
{
- var navi = document.getElementById('mkwsNavi');
+ var navi = $('.mkwsNavi.mkwsTeam_' + m_teamName);
if (!navi) return;
var text = "";
}
var filter = m_filters[i];
if (filter.id) {
- text += 'Source: <a class="crossout" href="#" onclick="mkws.delimitTarget(' +
+ text += M('source') + ': <a class="crossout" href="#" onclick="mkws.delimitTarget(' +
"'" + filter.id + "'" + ');return false;">' + filter.name + '</a>';
} else {
- text += filter.field + ': <a class="crossout" href="#" onclick="mkws.delimitQuery(' +
+ text += M(filter.field) + ': <a class="crossout" href="#" onclick="mkws.delimitQuery(' +
"'" + filter.field + "', '" + filter.value + "'" +
');return false;">' + filter.value + '</a>';
}
}
- navi.innerHTML = text;
+ navi.html(text);
}
debug("after domReady()");
// on first page, hide the termlist
- $(document).ready(function() { $("#mkwsTermlists").hide(); });
+ $(document).ready(function() { $(".mkwsTermlists.mkwsTeam_" + m_teamName).hide(); });
var motd = $(".mkwsMOTD.mkwsTeam_" + m_teamName);
var container = $(".mkwsMOTDContainer.mkwsTeam_" + m_teamName);
debug("for team '" + m_teamName + "', motd=" + motd + "(" + motd.length + "), container=" + container + "(" + container.length + ")");
mkws.teams[tname].showDetails(prefixRecId);
}
+ mkws.limitTarget = function (tname, id, name) {
+ mkws.teams[tname].limitTarget(id, name);
+ }
+
function default_mkws_config() {
/* default mkws config */
show_sort: true, /* show/hide sort menu */
show_perpage: true, /* show/hide perpage menu */
lang_options: [], /* display languages links for given languages, [] for all */
- facets: ["sources", "subjects", "authors"], /* display facets, in this order, [] for none */
+ facets: ["xtargets", "subject", "author"], /* display facets, in this order, [] for none */
responsive_design_width: undefined, /* a page with less pixel width considered as narrow */
debug_level: 1, /* debug level for development: 0..2 */