};
var m_paz; // will be initialised below
var m_template = {};
+ var m_config = Object.create(mkws.config);
that.toString = function() { return '[Team ' + teamName + ']'; };
log("start running MKWS");
- m_sortOrder = mkws.config.sort_default;
- m_perpage = mkws.config.perpage_default;
+ m_sortOrder = m_config.sort_default;
+ m_perpage = m_config.perpage_default;
log("Create main pz2 object");
// create a parameters array and pass it to the pz2's constructor
// then register the form submit event with the pz2.search function
// autoInit is set to true on default
m_paz = new pz2({ "windowid": teamName,
- "pazpar2path": mkws.config.pazpar2_url,
- "usesessions" : mkws.config.use_service_proxy ? false : true,
+ "pazpar2path": m_config.pazpar2_url,
+ "usesessions" : m_config.use_service_proxy ? false : true,
"oninit": onInit,
"onbytarget": onBytarget,
"onstat": onStat,
- "onterm": (mkws.config.facets.length ? onTerm : undefined),
+ "onterm": (m_config.facets.length ? onTerm : undefined),
"onshow": onShow,
"onrecord": onRecord,
"showtime": 500, //each timer (show, stat, term, bytarget) can be specified this way
- "termlist": mkws.config.facets.join(',')
+ "termlist": m_config.facets.join(',')
});
{
log("newSearch: " + query);
- if (mkws.config.use_service_proxy && !mkws.authenticated) {
+ if (m_config.use_service_proxy && !mkws.authenticated) {
alert("searching before authentication");
return;
}
*/
function mkwsHtmlAll() {
mkwsSetLang();
- if (mkws.config.show_lang)
+ if (m_config.show_lang)
mkwsHtmlLang();
log("HTML search form");
findnode('.mkwsSearch').html('\
<form name="mkwsSearchForm" class="mkwsSearchForm mkwsTeam_' + m_teamName + '" action="" >\
- <input class="mkwsQuery mkwsTeam_' + m_teamName + '" type="text" size="' + mkws.config.query_width + '" />\
+ <input class="mkwsQuery mkwsTeam_' + m_teamName + '" type="text" size="' + m_config.query_width + '" />\
<input class="mkwsButton mkwsTeam_' + m_teamName + '" type="submit" value="' + M('Search') + '" />\
</form>');
</table>');
var ranking_data = '<form name="mkwsSelect" class="mkwsSelect mkwsTeam_' + m_teamName + '" action="" >';
- if (mkws.config.show_sort) {
+ if (m_config.show_sort) {
ranking_data += M('Sort by') + ' ' + mkwsHtmlSort() + ' ';
}
- if (mkws.config.show_perpage) {
+ if (m_config.show_perpage) {
ranking_data += M('and show') + ' ' + mkwsHtmlPerpage() + ' ' + M('per page') + '.';
}
ranking_data += '</form>';
function mkwsSetLang() {
- var lang = getParameterByName("lang") || mkws.config.lang;
+ var lang = getParameterByName("lang") || m_config.lang;
if (!lang || !mkws.locale_lang[lang]) {
- mkws.config.lang = ""
+ m_config.lang = ""
} else {
- mkws.config.lang = lang;
+ m_config.lang = lang;
}
- log("Locale language: " + (mkws.config.lang ? mkws.config.lang : "none"));
- return mkws.config.lang;
+ log("Locale language: " + (m_config.lang ? m_config.lang : "none"));
+ return m_config.lang;
}
/* create locale language menu */
function mkwsHtmlLang() {
var lang_default = "en";
- var lang = mkws.config.lang || lang_default;
+ var lang = m_config.lang || lang_default;
var list = [];
/* display a list of configured languages, or all */
- var lang_options = mkws.config.lang_options || [];
+ var lang_options = m_config.lang_options || [];
var toBeIncluded = {};
for (var i = 0; i < lang_options.length; i++) {
toBeIncluded[lang_options[i]] = true;
log("HTML sort, m_sortOrder = '" + m_sortOrder + "'");
var sort_html = '<select class="mkwsSort mkwsTeam_' + m_teamName + '">';
- for(var i = 0; i < mkws.config.sort_options.length; i++) {
- var opt = mkws.config.sort_options[i];
+ for(var i = 0; i < m_config.sort_options.length; i++) {
+ var opt = m_config.sort_options[i];
var key = opt[0];
var val = opt.length == 1 ? opt[0] : opt[1];
log("HTML perpage, m_perpage = " + m_perpage);
var perpage_html = '<select class="mkwsPerpage mkwsTeam_' + m_teamName + '">';
- for(var i = 0; i < mkws.config.perpage_options.length; i++) {
- var key = mkws.config.perpage_options[i];
+ for(var i = 0; i < m_config.perpage_options.length; i++) {
+ var key = m_config.perpage_options[i];
perpage_html += '<option value="' + key + '"';
if (key == m_perpage) {
// different languages.
//
function M(word) {
- var lang = mkws.config.lang;
+ var lang = m_config.lang;
if (!lang || !mkws.locale_lang[lang])
return word;