X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=tools%2Fhtdocs%2Fmkws.js;h=c9c0419b23db61f31cd7b4e718abe7769eaf6e41;hb=891162c526852295263ace8b5f9c0e70314c0d39;hp=12c47731f35718437bd61d620687c7809a4931eb;hpb=678edcab9901bc72d4445b44135d6dfcd03af242;p=mkws-moved-to-github.git
diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js
index 12c4773..c9c0419 100644
--- a/tools/htdocs/mkws.js
+++ b/tools/htdocs/mkws.js
@@ -262,12 +262,7 @@ function team($, teamName) {
// move it out
var pager = document.getElementById("mkwsPager");
if (pager) {
- pager.innerHTML = "";
- pager.innerHTML +='
' + M('Displaying') + ': '
- + (data.start + 1) + ' ' + M('to') + ' ' + (data.start + data.num) +
- ' ' + M('of') + ' ' + data.merged + ' (' + M('found') + ': '
- + data.total + ')
';
- drawPager(pager);
+ drawPager(pager, data);
}
// navi
@@ -426,7 +421,6 @@ function team($, teamName) {
});
if (document.mkwsSelect) {
- debug("messing with mkwsSelect");
if (document.mkwsSelect.mkwsSort)
document.mkwsSelect.mkwsSort.onchange = onSelectDdChange;
if (document.mkwsSelect.mkwsPerpage)
@@ -461,7 +455,7 @@ function team($, teamName) {
resetPage(); // ### the globals it resents should be indexed by windowid
loadSelect(); // ### should use windowid
triggerSearch(query, sort, targets, windowid);
- mkws.switchView(m_teamName, 'records'); // In case it's configured to start off as hidden
+ that.switchView('records'); // In case it's configured to start off as hidden
m_submitted = true;
}
@@ -641,8 +635,13 @@ function team($, teamName) {
}
- function drawPager (pagerDiv)
+ function drawPager (pagerDiv, data)
{
+ pagerDiv.innerHTML ='' + M('Displaying') + ': '
+ + (data.start + 1) + ' ' + M('to') + ' ' + (data.start + data.num) +
+ ' ' + M('of') + ' ' + data.merged + ' (' + M('found') + ': '
+ + data.total + ')
';
+
//client indexes pages from 1 but pz2 from 0
var onsides = 6;
var pages = Math.ceil(m_totalRec / m_recPerPage);
@@ -711,13 +710,11 @@ function team($, teamName) {
// switching view between targets and records
- mkws.switchView = function(tname, view) {
- debug("switchView(" + tname + ", " + view + ")");
-
- var targets = $('.mkwsTargets.mkwsTeam_' + tname);
- var results = $('.mkwsResults.mkwsTeam_' + tname + ',.mkwsRecords.mkwsTeam_' + tname);
- var blanket = $('.mkwsBlanket.mkwsTeam_' + tname);
- var motd = $('.mkwsMOTD.mkwsTeam_' + tname);
+ that.switchView = function(view) {
+ var targets = $('.mkwsTargets.mkwsTeam_' + m_teamName);
+ var results = $('.mkwsResults.mkwsTeam_' + m_teamName + ',.mkwsRecords.mkwsTeam_' + m_teamName);
+ var blanket = $('.mkwsBlanket.mkwsTeam_' + m_teamName);
+ var motd = $('.mkwsMOTD.mkwsTeam_' + m_teamName);
switch(view) {
case 'targets':
@@ -733,7 +730,7 @@ function team($, teamName) {
if (motd) motd.css('display', 'none');
break;
case 'none':
- alert("mkws.switchView(" + tname + ", 'none') shouldn't happen");
+ alert("mkws.switchView(" + m_teamName + ", 'none') shouldn't happen");
if (targets) targets.css('display', 'none');
if (results) results.css('display', 'none');
if (blanket) blanket.css('display', 'none');
@@ -956,15 +953,12 @@ function team($, teamName) {
$(document).ready(function() { mkws.resize_page() });
}
- debug("before domReady()");
domReady();
- debug("after domReady()");
// on first page, hide the termlist
$(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 + ")");
if (motd.length && container.length) {
// Move the MOTD from the provided element down into the container
motd.appendTo(container);
@@ -1331,6 +1325,10 @@ function _mkws_jquery_plugin ($) {
};
+ mkws.switchView = function(tname, view) {
+ mkws.teams[tname].switchView(view);
+ }
+
mkws.showDetails = function (tname, prefixRecId) {
mkws.teams[tname].showDetails(prefixRecId);
}
@@ -1490,9 +1488,7 @@ function _mkws_jquery_plugin ($) {
$('[class^="mkws"],[class*=" mkws"]').each(function () {
var node = this;
mkws.handle_node_with_team(node, function(tname) {
- if (mkws.teams[tname]) {
- log("MKWS team '" + tname + "' already exists, skipping");
- } else {
+ if (!mkws.teams[tname]) {
mkws.teams[tname] = team(j, tname);
log("Made MKWS team '" + tname + "'");
}