projects
/
mkws-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
cbc77f8
)
Vertical whitespace only.
author
Mike Taylor
<mike@indexdata.com>
Thu, 23 Jan 2014 15:35:35 +0000
(15:35 +0000)
committer
Mike Taylor
<mike@indexdata.com>
Thu, 23 Jan 2014 15:35:35 +0000
(15:35 +0000)
tools/htdocs/mkws.js
patch
|
blob
|
history
diff --git
a/tools/htdocs/mkws.js
b/tools/htdocs/mkws.js
index
12f3f71
..
fab98c7
100644
(file)
--- a/
tools/htdocs/mkws.js
+++ b/
tools/htdocs/mkws.js
@@
-7,6
+7,7
@@
// limitQuery(), delimitTarget(), delimitQuery(), pagerPrev(),
// pagerNext(), showPage()
// limitQuery(), delimitTarget(), delimitQuery(), pagerPrev(),
// pagerNext(), showPage()
+
// Set up global mkws object. Contains a hash of session objects,
// indexed by windowid.
var mkws = {
// Set up global mkws object. Contains a hash of session objects,
// indexed by windowid.
var mkws = {
@@
-70,11
+71,13
@@
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 = {};
}
// 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
// wrapper for jQuery lib
function _make_mkws_team($, teamName) {
// if (console && console.log) // disabled, will fail in IE8
@@
-95,6
+98,7
@@
function _make_mkws_team($, teamName) {
"last": $.now()
};
"last": $.now()
};
+
mkws.debug_function = function (string) {
if (!mkws.debug_level)
return;
mkws.debug_function = function (string) {
if (!mkws.debug_level)
return;
@@
-281,6
+285,7
@@
function _make_mkws_team($, teamName) {
recPerPage = parseInt(mkws_config.perpage_default);
}
recPerPage = parseInt(mkws_config.perpage_default);
}
+
//
// pz2.js event handlers:
//
//
// pz2.js event handlers:
//
@@
-289,6
+294,7
@@
function _make_mkws_team($, teamName) {
m_paz.bytarget();
}
m_paz.bytarget();
}
+
function my_onshow(data) {
totalRec = data.merged;
// move it out
function my_onshow(data) {
totalRec = data.merged;
// move it out
@@
-340,6
+346,7
@@
function _make_mkws_team($, teamName) {
'<span class="records">' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + '</span>';
}
'<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) {
function my_onterm(data) {
// no facets
if (!mkws_config.facets || mkws_config.facets.length == 0) {
@@
-371,6
+378,7
@@
function _make_mkws_team($, teamName) {
replaceHtml(termlist, acc.join(''));
}
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>');
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>');
@@
-392,6
+400,7
@@
function _make_mkws_team($, teamName) {
acc.push('</div>');
}
acc.push('</div>');
}
+
function my_onrecord(data) {
// FIXME: record is async!!
clearTimeout(m_paz.recordTimer);
function my_onrecord(data) {
// FIXME: record is async!!
clearTimeout(m_paz.recordTimer);
@@
-404,6
+413,7
@@
function _make_mkws_team($, teamName) {
recordDiv.innerHTML += html;
}
recordDiv.innerHTML += html;
}
+
function my_onbytarget(data) {
var targetDiv = document.getElementById("mkwsBytarget");
if (!targetDiv) {
function my_onbytarget(data) {
var targetDiv = document.getElementById("mkwsBytarget");
if (!targetDiv) {
@@
-434,6
+444,7
@@
function _make_mkws_team($, teamName) {
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
+
// wait until the DOM is ready
function domReady ()
{
// wait until the DOM is ready
function domReady ()
{
@@
-447,6
+458,7
@@
function _make_mkws_team($, teamName) {
}
}
}
}
+
// when search button pressed
function onFormSubmitEventHandler()
{
// when search button pressed
function onFormSubmitEventHandler()
{
@@
-454,6
+466,7
@@
function _make_mkws_team($, teamName) {
return false;
}
return false;
}
+
function newSearch(query, sort, targets, windowid)
{
debug("newSearch: " + query);
function newSearch(query, sort, targets, windowid)
{
debug("newSearch: " + query);
@@
-472,6
+485,7
@@
function _make_mkws_team($, teamName) {
submitted = true;
}
submitted = true;
}
+
function onSelectDdChange()
{
if (!submitted) return false;
function onSelectDdChange()
{
if (!submitted) return false;
@@
-481,12
+495,14
@@
function _make_mkws_team($, teamName) {
return false;
}
return false;
}
+
function resetPage()
{
curPage = 1;
totalRec = 0;
}
function resetPage()
{
curPage = 1;
totalRec = 0;
}
+
function triggerSearch (query, sort, targets, windowid)
{
var pp2filter = "";
function triggerSearch (query, sort, targets, windowid)
{
var pp2filter = "";
@@
-534,6
+550,7
@@
function _make_mkws_team($, teamName) {
m_paz.search(m_query, recPerPage, m_sort, pp2filter, undefined, params);
}
m_paz.search(m_query, recPerPage, m_sort, pp2filter, undefined, params);
}
+
function loadSelect ()
{
if (document.mkwsSelect) {
function loadSelect ()
{
if (document.mkwsSelect) {
@@
-544,6
+561,7
@@
function _make_mkws_team($, teamName) {
}
}
}
}
+
// limit the query after clicking the facet
mkws.limitQuery = function (field, value)
{
// limit the query after clicking the facet
mkws.limitQuery = function (field, value)
{
@@
-556,6
+574,7
@@
function _make_mkws_team($, teamName) {
return false;
}
return false;
}
+
// limit by target functions
mkws.limitTarget = function (id, name)
{
// limit by target functions
mkws.limitTarget = function (id, name)
{
@@
-568,6
+587,7
@@
function _make_mkws_team($, teamName) {
return false;
}
return false;
}
+
mkws.delimitQuery = function (field, value)
{
debug("delimitQuery(field=" + field + ", value=" + value + ")");
mkws.delimitQuery = function (field, value)
{
debug("delimitQuery(field=" + field + ", value=" + value + ")");
@@
-687,14
+707,15
@@
function _make_mkws_team($, teamName) {
+ prev + predots + middle + postdots + next + '</div>';
}
+ prev + predots + middle + postdots + next + '</div>';
}
+
mkws.showPage = function (pageNum)
{
curPage = pageNum;
m_paz.showPage( curPage - 1 );
}
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.pagerNext = function () {
if ( totalRec - recPerPage*curPage > 0) {
m_paz.showNext();
@@
-702,13
+723,14
@@
function _make_mkws_team($, teamName) {
}
}
}
}
+
mkws.pagerPrev = function () {
if ( m_paz.showPrev() != false )
curPage--;
}
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);
mkws.switchView = function(view) {
debug("switchView: " + view);
@@
-742,6
+764,7
@@
function _make_mkws_team($, teamName) {
}
}
}
}
+
// detailed record drawing
mkws.showDetails = function (prefixRecId) {
var recId = prefixRecId.replace('mkwsRec_', '');
// detailed record drawing
mkws.showDetails = function (prefixRecId) {
var recId = prefixRecId.replace('mkwsRec_', '');
@@
-764,6
+787,7
@@
function _make_mkws_team($, teamName) {
m_paz.record(recId);
}
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
function replaceHtml(el, html) {
var oldEl = typeof el === "string" ? document.getElementById(el) : el;
/*@cc_on // Pure innerHTML is slightly faster in IE
@@
-778,6
+802,7
@@
function _make_mkws_team($, teamName) {
return newEl;
};
return newEl;
};
+
function renderDetails(data, marker)
{
var template = loadTemplate("Record");
function renderDetails(data, marker)
{
var template = loadTemplate("Record");
@@
-1020,6
+1045,7
@@
function _make_mkws_team($, teamName) {
return nvpair;
}
return nvpair;
}
+
function mkws_set_lang() {
var lang = parseQuerystring().lang || mkws_config.lang;
if (!lang || !mkws.locale_lang[lang]) {
function mkws_set_lang() {
var lang = parseQuerystring().lang || mkws_config.lang;
if (!lang || !mkws.locale_lang[lang]) {
@@
-1032,6
+1058,7
@@
function _make_mkws_team($, teamName) {
return mkws_config.lang;
}
return mkws_config.lang;
}
+
function mkws_html_switch() {
debug("HTML switch");
function mkws_html_switch() {
debug("HTML switch");
@@
-1047,6
+1074,7
@@
function _make_mkws_team($, teamName) {
$("#mkwsTargets").css("display", "none");
}
$("#mkwsTargets").css("display", "none");
}
+
function mkws_html_sort() {
debug("HTML sort, m_sort = '" + m_sort + "'");
var sort_html = '<select name="mkwsSort" id="mkwsSort">';
function mkws_html_sort() {
debug("HTML sort, m_sort = '" + m_sort + "'");
var sort_html = '<select name="mkwsSort" id="mkwsSort">';
@@
-1067,6
+1095,7
@@
function _make_mkws_team($, teamName) {
return sort_html;
}
return sort_html;
}
+
function mkws_html_perpage() {
debug("HTML perpage");
var perpage_html = '<select name="mkwsPerpage" id="mkwsPerpage">';
function mkws_html_perpage() {
debug("HTML perpage");
var perpage_html = '<select name="mkwsPerpage" id="mkwsPerpage">';
@@
-1085,6
+1114,7
@@
function _make_mkws_team($, teamName) {
return perpage_html;
}
return perpage_html;
}
+
/*
* Run service-proxy authentication in background (after page load).
* The username/password is configured in the apache config file
/*
* Run service-proxy authentication in background (after page load).
* The username/password is configured in the apache config file
@@
-1120,6
+1150,7
@@
function _make_mkws_team($, teamName) {
});
}
});
}
+
/* create locale language menu */
function mkws_html_lang() {
var lang_default = "en";
/* create locale language menu */
function mkws_html_lang() {
var lang_default = "en";
@@
-1162,6
+1193,7
@@
function _make_mkws_team($, teamName) {
$("#mkwsLang").html(data);
}
$("#mkwsLang").html(data);
}
+
function mkws_resize_page () {
var list = ["mkwsSwitch"];
function mkws_resize_page () {
var list = ["mkwsSwitch"];
@@
-1189,6
+1221,7
@@
function _make_mkws_team($, teamName) {
}
};
}
};
+
/* locale */
function M(word) {
var lang = mkws_config.lang;
/* locale */
function M(word) {
var lang = mkws_config.lang;
@@
-1199,6
+1232,7
@@
function _make_mkws_team($, teamName) {
return mkws.locale_lang[lang][word] || word;
}
return mkws.locale_lang[lang][word] || word;
}
+
// main
(function() {
try {
// main
(function() {
try {