projects
/
mkws-moved-to-github.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Comment on use of SP.
[mkws-moved-to-github.git]
/
tools
/
htdocs
/
mkws.js
diff --git
a/tools/htdocs/mkws.js
b/tools/htdocs/mkws.js
index
d41cba3
..
c739684
100644
(file)
--- a/
tools/htdocs/mkws.js
+++ b/
tools/htdocs/mkws.js
@@
-174,6
+174,7
@@
function team($, teamName) {
"last": $.now()
};
var m_paz; // will be initialised below
"last": $.now()
};
var m_paz; // will be initialised below
+ var m_template = {};
var debug = function (s) {
var debug = function (s) {
@@
-501,6
+502,8
@@
function team($, teamName) {
}
debug("triggerSearch(" + m_query + "): filters = " + $.toJSON(m_filters) + ", pp2filter = " + pp2filter + ", params = " + $.toJSON(params));
}
debug("triggerSearch(" + m_query + "): filters = " + $.toJSON(m_filters) + ", pp2filter = " + pp2filter + ", params = " + $.toJSON(params));
+ // We can use: params.torusquery = "udb=NAME"
+ // Note: that won't work when running against raw pazpar2
m_paz.search(m_query, m_perpage, m_sort, pp2filter, undefined, params);
}
m_paz.search(m_query, m_perpage, m_sort, pp2filter, undefined, params);
}
@@
-762,17
+765,23
@@
function team($, teamName) {
function loadTemplate(name)
{
function loadTemplate(name)
{
- var template = mkws['template' + name];
+ var template = m_template[name];
if (template === undefined) {
if (template === undefined) {
- var source = $("#mkwsTemplate" + name).html();
+ // Fall back to generic template if there is no team-specific one
+ var node = $(".mkwsTemplate_" + name + ".mkwsTeam_" + m_teamName)
+ if (!node.length) {
+ node = $(".mkwsTemplate_" + name + ".mkwsTeam_ALL")
+ }
+
+ var source = node.html();
if (!source) {
source = defaultTemplate(name);
}
template = Handlebars.compile(source);
debug("compiled template '" + name + "'");
if (!source) {
source = defaultTemplate(name);
}
template = Handlebars.compile(source);
debug("compiled template '" + name + "'");
- mkws['template' + name] = template;
+ m_template[name] = template;
}
return template;
}
return template;
@@
-1394,6
+1403,7
@@
function team($, teamName) {
// Find all nodes with an class, and determine their team from
// the mkwsTeam_* class. Make all team objects.
// Find all nodes with an class, and determine their team from
// the mkwsTeam_* class. Make all team objects.
+ var then = $.now();
$('[class^="mkws"],[class*=" mkws"]').each(function () {
var node = this;
mkws.handle_node_with_team(node, function(tname) {
$('[class^="mkws"],[class*=" mkws"]').each(function () {
var node = this;
mkws.handle_node_with_team(node, function(tname) {
@@
-1403,6
+1413,8
@@
function team($, teamName) {
}
});
});
}
});
});
+ var now = $.now();
+ debug("Walking MKWS nodes took " + (now-then) + " ms");
if (mkws_config.use_service_proxy) {
authenticate_session(mkws_config.service_proxy_auth,
if (mkws_config.use_service_proxy) {
authenticate_session(mkws_config.service_proxy_auth,