// limitQuery(), delimitTarget(), delimitQuery(), pagerPrev(),
// pagerNext(), showPage()
+
// Set up global mkws object. Contains a hash of session objects,
// indexed by windowid.
var mkws = {
}
};
+
// Define empty mkws_config for simple applications that don't define it.
if (mkws_config == null || typeof mkws_config != 'object') {
var mkws_config = {};
}
+
// wrapper for jQuery lib
function _make_mkws_team($, teamName) {
// if (console && console.log) // disabled, will fail in IE8
"last": $.now()
};
+
mkws.debug_function = function (string) {
if (!mkws.debug_level)
return;
recPerPage = parseInt(mkws_config.perpage_default);
}
+
//
// pz2.js event handlers:
//
m_paz.bytarget();
}
+
function my_onshow(data) {
totalRec = data.merged;
// move it out
'<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>';
}
+
function my_onterm(data) {
// no facets
if (!mkws_config.facets || mkws_config.facets.length == 0) {
replaceHtml(termlist, acc.join(''));
}
+
function add_single_facet(acc, caption, data, max, pzIndex) {
acc.push('<div class="facet" id="mkwsFacet' + caption + '">');
acc.push('<div class="termtitle">' + M(caption) + '</div>');
acc.push('</div>');
}
+
function my_onrecord(data) {
// FIXME: record is async!!
clearTimeout(m_paz.recordTimer);
recordDiv.innerHTML += html;
}
+
function my_onbytarget(data) {
var targetDiv = document.getElementById("mkwsBytarget");
if (!targetDiv) {
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
+
// wait until the DOM is ready
function domReady ()
{
}
}
+
// when search button pressed
function onFormSubmitEventHandler()
{
return false;
}
+
function newSearch(query, sort, targets, windowid)
{
debug("newSearch: " + query);
submitted = true;
}
+
function onSelectDdChange()
{
if (!submitted) return false;
return false;
}
+
function resetPage()
{
curPage = 1;
totalRec = 0;
}
+
function triggerSearch (query, sort, targets, windowid)
{
var pp2filter = "";
m_paz.search(m_query, recPerPage, m_sort, pp2filter, undefined, params);
}
+
function loadSelect ()
{
if (document.mkwsSelect) {
}
}
+
// limit the query after clicking the facet
mkws.limitQuery = function (field, value)
{
return false;
}
+
// limit by target functions
mkws.limitTarget = function (id, name)
{
return false;
}
+
mkws.delimitQuery = function (field, value)
{
debug("delimitQuery(field=" + field + ", value=" + value + ")");
+ prev + predots + middle + postdots + next + '</div>';
}
+
mkws.showPage = function (pageNum)
{
curPage = pageNum;
m_paz.showPage( curPage - 1 );
}
- // simple paging functions
+ // simple paging functions
mkws.pagerNext = function () {
if ( totalRec - recPerPage*curPage > 0) {
m_paz.showNext();
}
}
+
mkws.pagerPrev = function () {
if ( m_paz.showPrev() != false )
curPage--;
}
- // switching view between targets and records
+ // switching view between targets and records
mkws.switchView = function(view) {
debug("switchView: " + view);
}
}
+
// detailed record drawing
mkws.showDetails = function (prefixRecId) {
var recId = prefixRecId.replace('mkwsRec_', '');
m_paz.record(recId);
}
+
function replaceHtml(el, html) {
var oldEl = typeof el === "string" ? document.getElementById(el) : el;
/*@cc_on // Pure innerHTML is slightly faster in IE
return newEl;
};
+
function renderDetails(data, marker)
{
var template = loadTemplate("Record");
return nvpair;
}
+
function mkws_set_lang() {
var lang = parseQuerystring().lang || mkws_config.lang;
if (!lang || !mkws.locale_lang[lang]) {
return mkws_config.lang;
}
+
function mkws_html_switch() {
debug("HTML switch");
$("#mkwsTargets").css("display", "none");
}
+
function mkws_html_sort() {
debug("HTML sort, m_sort = '" + m_sort + "'");
var sort_html = '<select name="mkwsSort" id="mkwsSort">';
return sort_html;
}
+
function mkws_html_perpage() {
debug("HTML perpage");
var perpage_html = '<select name="mkwsPerpage" id="mkwsPerpage">';
return perpage_html;
}
+
/*
* Run service-proxy authentication in background (after page load).
* The username/password is configured in the apache config file
});
}
+
/* create locale language menu */
function mkws_html_lang() {
var lang_default = "en";
$("#mkwsLang").html(data);
}
+
function mkws_resize_page () {
var list = ["mkwsSwitch"];
}
};
+
/* locale */
function M(word) {
var lang = mkws_config.lang;
return mkws.locale_lang[lang][word] || word;
}
+
// main
(function() {
try {