');
@@ -350,9 +356,9 @@ function team($, teamName) {
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)';
+ action = 'mkws.limitQuery(\'' + m_teamName + '\', \'' + pzIndex + '\', this.firstChild.nodeValue)';
}
acc.push('onclick="' + action + ';return false;">' + data[i].name + ''
+ '
' + data[i].freq + '');
@@ -410,7 +416,6 @@ function team($, teamName) {
// 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;
@@ -420,13 +425,6 @@ function team($, teamName) {
});
});
- 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)
@@ -434,7 +432,6 @@ function team($, teamName) {
if (document.mkwsSelect.mkwsPerpage)
document.mkwsSelect.mkwsPerpage.onchange = onSelectDdChange;
}
- debug("finished domReady()");
}
@@ -460,7 +457,7 @@ function team($, teamName) {
}
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);
@@ -545,11 +542,11 @@ function team($, teamName) {
}
- // limit the query after clicking the facet
- mkws.limitQuery = function (field, value)
+ // limit by target functions
+ that.limitTarget = function (id, name)
{
- debug("limitQuery(field=" + field + ", value=" + value + ")");
- m_filters.push({ field: field, value: value });
+ debug("limitTarget(id=" + id + ", name=" + name + ")");
+ m_filters.push({ id: id, name: name });
redraw_navi();
resetPage();
loadSelect();
@@ -558,11 +555,11 @@ function team($, teamName) {
}
- // limit by target functions
- mkws.limitTarget = function (id, name)
+ // limit the query after clicking the facet
+ that.limitQuery = function (field, value)
{
- debug("limitTarget(id=" + id + ", name=" + name + ")");
- m_filters.push({ id: id, name: name });
+ debug("limitQuery(field=" + field + ", value=" + value + ")");
+ m_filters.push({ field: field, value: value });
redraw_navi();
resetPage();
loadSelect();
@@ -571,15 +568,13 @@ function team($, teamName) {
}
- mkws.delimitQuery = function (field, value)
+ that.delimitTarget = function (id)
{
- debug("delimitQuery(field=" + field + ", value=" + value + ")");
+ debug("delimitTarget(id=" + id + ")");
var newFilters = [];
for (var i in m_filters) {
var filter = m_filters[i];
- if (filter.field &&
- field == filter.field &&
- value == filter.value) {
+ if (filter.id) {
debug("delimitTarget() removing filter " + $.toJSON(filter));
} else {
debug("delimitTarget() keeping filter " + $.toJSON(filter));
@@ -596,16 +591,18 @@ function team($, teamName) {
}
- mkws.delimitTarget = function (id)
+ that.delimitQuery = function (field, value)
{
- debug("delimitTarget(id=" + id + ")");
+ debug("delimitQuery(field=" + field + ", value=" + value + ")");
var newFilters = [];
for (var i in m_filters) {
var filter = m_filters[i];
- if (filter.id) {
- debug("delimitTarget() removing filter " + $.toJSON(filter));
+ if (filter.field &&
+ field == filter.field &&
+ value == filter.value) {
+ debug("delimitQuery() removing filter " + $.toJSON(filter));
} else {
- debug("delimitTarget() keeping filter " + $.toJSON(filter));
+ debug("delimitQuery() keeping filter " + $.toJSON(filter));
newFilters.push(filter);
}
}
@@ -621,7 +618,7 @@ function team($, teamName) {
function redraw_navi ()
{
- var navi = document.getElementById('mkwsNavi');
+ var navi = $('.mkwsNavi.mkwsTeam_' + m_teamName);
if (!navi) return;
var text = "";
@@ -631,16 +628,16 @@ function team($, teamName) {
}
var filter = m_filters[i];
if (filter.id) {
- text += 'Source:
' + filter.name + '';
+ text += M('source') + ':
' + filter.name + '';
} else {
- text += filter.field + ':
' + filter.value + '';
}
}
- navi.innerHTML = text;
+ navi.html(text);
}
@@ -963,7 +960,7 @@ function team($, teamName) {
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 + ")");
@@ -1384,10 +1381,25 @@ function _mkws_jquery_plugin ($) {
};
- mkws.showDetails = function (prefixRecId, tname) {
+ mkws.showDetails = function (tname, prefixRecId) {
mkws.teams[tname].showDetails(prefixRecId);
}
+ mkws.limitTarget = function (tname, id, name) {
+ mkws.teams[tname].limitTarget(id, name);
+ }
+
+ mkws.limitQuery = function (tname, field, value) {
+ mkws.teams[tname].limitQuery(field, value);
+ }
+
+ mkws.delimitTarget = function (tname, id) {
+ mkws.teams[tname].delimitTarget(id);
+ }
+
+ mkws.delimitQuery = function (tname, field, value) {
+ mkws.teams[tname].delimitQuery(field, value);
+ }
function default_mkws_config() {
/* default mkws config */