';
- drawPager(pager);
- }
- // navi
- var results = document.getElementById("mkwsRecords");
+ function onBytarget(data, teamName) {
+ debug("target");
+ var node = findnode('.mkwsBytarget');
+ if (node.length === 0) return;
- var html = [];
- for (var i = 0; i < data.hits.length; i++) {
- var hit = data.hits[i];
- html.push('
');
}
- function my_onrecord(data) {
- // FIXME: record is async!!
- clearTimeout(m_paz.recordTimer);
- // in case on_show was faster to redraw element
- var detRecordDiv = document.getElementById('mkwsDet_'+data.recid);
- if (detRecordDiv) return;
- curDetRecData = data;
- var recordDiv = document.getElementById('mkwsRecdiv_'+curDetRecData.recid);
- var html = renderDetails(curDetRecData);
- recordDiv.innerHTML += html;
- }
-
- function my_onbytarget(data) {
- var targetDiv = document.getElementById("mkwsBytarget");
- if (!targetDiv) {
- // No mkwsTargets div.
- return;
- }
-
- var table ='
' +
- '
' + M('Target ID') + '
' +
- '
' + M('Hits') + '
' +
- '
' + M('Diags') + '
' +
- '
' + M('Records') + '
' +
- '
' + M('State') + '
' +
- '
';
- for (var i = 0; i < data.length; i++ ) {
- table += "
" + data[i].id +
- "
" + data[i].hits +
- "
" + data[i].diagnostic +
- "
" + data[i].records +
- "
" + data[i].state + "
";
+ function targetFiltered(id) {
+ for (var i = 0; i < m_filters.length; i++) {
+ if (m_filters[i].id === id ||
+ m_filters[i].id === 'pz:id=' + id) {
+ return true;
+ }
}
-
- table += '
';
- targetDiv.innerHTML = table;
+ return false;
}
+
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
- // wait until the DOM is ready
- function domReady ()
- {
- document.mkwsSearchForm.onsubmit = onFormSubmitEventHandler;
- document.mkwsSearchForm.mkwsQuery.value = '';
- if (document.mkwsSelect) {
- if (document.mkwsSelect.mkwsSort)
- document.mkwsSelect.mkwsSort.onchange = onSelectDdChange;
- if (document.mkwsSelect.mkwsPerpage)
- document.mkwsSelect.mkwsPerpage.onchange = onSelectDdChange;
- }
- }
// when search button pressed
function onFormSubmitEventHandler()
{
- newSearch(document.mkwsSearchForm.mkwsQuery.value);
+ var val = findnode('.mkwsQuery').val();
+ newSearch(val);
return false;
}
- function newSearch(query, sort, targets, windowid)
+
+ function newSearch(query, sort, targets)
{
debug("newSearch: " + query);
@@ -464,30 +430,33 @@ function _make_mkws_team($, teamName) {
}
m_filters = []
- redraw_navi(); // ### should use windowid
- resetPage(); // ### the globals it resents should be indexed by windowid
- loadSelect(); // ### should use windowid
- triggerSearch(query, sort, targets, windowid);
- mkws.switchView('records'); // In case it's configured to start off as hidden
- submitted = true;
+ redrawNavi();
+ resetPage();
+ loadSelect();
+ triggerSearch(query, sort, targets);
+ switchView('records'); // In case it's configured to start off as hidden
+ m_submitted = true;
}
+
function onSelectDdChange()
{
- if (!submitted) return false;
+ if (!m_submitted) return false;
resetPage();
loadSelect();
- m_paz.show(0, recPerPage, m_sort);
+ m_paz.show(0, m_perpage, m_sort);
return false;
}
+
function resetPage()
{
- curPage = 1;
- totalRec = 0;
+ m_curPage = 1;
+ m_totalRec = 0;
}
- function triggerSearch (query, sort, targets, windowid)
+
+ function triggerSearch (query, sort, targets)
{
var pp2filter = "";
var pp2limit = "";
@@ -500,7 +469,6 @@ function _make_mkws_team($, teamName) {
m_sort = sort;
}
if (targets) {
- // ### should support multiple |-separated targets
m_filters.push({ id: targets, name: targets });
}
@@ -526,57 +494,63 @@ function _make_mkws_team($, teamName) {
if (pp2limit) {
params.limit = pp2limit;
}
- if (windowid) {
- params.windowid = windowid;
- }
+
debug("triggerSearch(" + m_query + "): filters = " + $.toJSON(m_filters) + ", pp2filter = " + pp2filter + ", params = " + $.toJSON(params));
- m_paz.search(m_query, recPerPage, m_sort, pp2filter, undefined, 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);
}
+
function loadSelect ()
{
- if (document.mkwsSelect) {
- if (document.mkwsSelect.mkwsSort)
- m_sort = document.mkwsSelect.mkwsSort.value;
- if (document.mkwsSelect.mkwsPerpage)
- recPerPage = document.mkwsSelect.mkwsPerpage.value;
+ var node = findnode('.mkwsSort');
+ if (node.length && node.val() != m_sort) {
+ debug("changing m_sort from " + m_sort + " to " + node.val());
+ m_sort = node.val();
+ }
+ node = findnode('.mkwsPerpage');
+ if (node.length && node.val() != m_perpage) {
+ debug("changing m_perpage from " + m_perpage + " to " + node.val());
+ m_perpage = node.val();
}
}
- // limit the query after clicking the facet
- mkws.limitQuery = function (field, value)
+
+ // limit by target functions
+ that.limitTarget = function (id, name)
{
- debug("limitQuery(field=" + field + ", value=" + value + ")");
- m_filters.push({ field: field, value: value });
- redraw_navi();
+ debug("limitTarget(id=" + id + ", name=" + name + ")");
+ m_filters.push({ id: id, name: name });
+ redrawNavi();
resetPage();
loadSelect();
triggerSearch();
return false;
}
- // limit by target functions
- mkws.limitTarget = function (id, name)
+
+ // limit the query after clicking the facet
+ that.limitQuery = function (field, value)
{
- debug("limitTarget(id=" + id + ", name=" + name + ")");
- m_filters.push({ id: id, name: name });
- redraw_navi();
+ debug("limitQuery(field=" + field + ", value=" + value + ")");
+ m_filters.push({ field: field, value: value });
+ redrawNavi();
resetPage();
loadSelect();
triggerSearch();
return false;
}
- mkws.delimitQuery = function (field, value)
+
+ that.delimitTarget = function (id)
{
- debug("delimitQuery(field=" + field + ", value=" + value + ")");
+ debug("delimitTarget(id=" + id + ")");
var newFilters = [];
for (var i in m_filters) {
var filter = m_filters[i];
- if (filter.field &&
- field == filter.field &&
- value == filter.value) {
+ if (filter.id) {
debug("delimitTarget() removing filter " + $.toJSON(filter));
} else {
debug("delimitTarget() keeping filter " + $.toJSON(filter));
@@ -585,7 +559,7 @@ function _make_mkws_team($, teamName) {
}
m_filters = newFilters;
- redraw_navi();
+ redrawNavi();
resetPage();
loadSelect();
triggerSearch();
@@ -593,22 +567,24 @@ function _make_mkws_team($, teamName) {
}
- mkws.delimitTarget = function (id)
+ that.delimitQuery = function (field, value)
{
- debug("delimitTarget(id=" + id + ")");
+ debug("delimitQuery(field=" + field + ", value=" + value + ")");
var newFilters = [];
for (var i in m_filters) {
var filter = m_filters[i];
- if (filter.id) {
- debug("delimitTarget() removing filter " + $.toJSON(filter));
+ if (filter.field &&
+ field == filter.field &&
+ value == filter.value) {
+ debug("delimitQuery() removing filter " + $.toJSON(filter));
} else {
- debug("delimitTarget() keeping filter " + $.toJSON(filter));
+ debug("delimitQuery() keeping filter " + $.toJSON(filter));
newFilters.push(filter);
}
}
m_filters = newFilters;
- redraw_navi();
+ redrawNavi();
resetPage();
loadSelect();
triggerSearch();
@@ -616,9 +592,9 @@ function _make_mkws_team($, teamName) {
}
- function redraw_navi ()
+ function redrawNavi ()
{
- var navi = document.getElementById('mkwsNavi');
+ var navi = findnode('.mkwsNavi');
if (!navi) return;
var text = "";
@@ -628,51 +604,56 @@ function _make_mkws_team($, teamName) {
}
var filter = m_filters[i];
if (filter.id) {
- text += 'Source: ' + filter.name + '';
+ text += M('source') + ': ' + filter.name + '';
} else {
- text += filter.field + ': ' + filter.value + '';
}
}
- navi.innerHTML = text;
+ navi.html(text);
}
- function drawPager (pagerDiv)
+ function drawPager (data)
{
+ var s = '
\
@@ -885,212 +1167,191 @@ function _make_mkws_team($, teamName) {
}
- /*
- * All the HTML stuff to render the search forms and
- * result pages.
- */
- function mkws_html_all() {
- mkws_set_lang();
- if (mkws_config.show_lang)
- mkws_html_lang();
-
- // For some reason, doing this programmatically results in
- // document.mkwsSearchForm.mkwsQuery being undefined, hence the raw HTML.
- debug("HTML search form");
- $("#mkwsSearch").html('\
-');
+ // main
+ (function() {
+ try {
+ mkwsHtmlAll()
+ }
- debug("HTML records");
- // If the application has an #mkwsResults, populate it in the
- // usual way. If not, assume that it's a smarter application that
- // defines its own subcomponents:
- // #mkwsTermlists
- // #mkwsRanking
- // #mkwsPager
- // #mkwsNavi
- // #mkwsRecords
- if ($("#mkwsResults").length) {
- $("#mkwsResults").html('\
-
\
-
\
-
\
- \
-
\
-
\
- \
- \
- \
- \
-
\
-
\
-
\
-
\
- \
-
\
-
\
-
');
+ catch (e) {
+ mkws_config.error = e.message;
+ // alert(e.message);
}
+ })();
- if ($("#mkwsRanking").length) {
- var ranking_data = '';
- ranking_data += '';
+ // Bizarrely, 'that' is just an empty hash. All its state is in
+ // the closure variables defined earlier in this function.
+ return that;
+};
- $("#mkwsRanking").html(ranking_data);
- }
- mkws_html_switch();
+// wrapper to call team() after page load
+(function (j) {
+ mkws.debug = function (string) {
+ if (!mkws.debug_level)
+ return;
- if (mkws_config.use_service_proxy) {
- mkws_service_proxy_auth(mkws_config.service_proxy_auth,
- mkws_config.service_proxy_auth_domain,
- mkws_config.pazpar2_url);
- } else {
- // raw pp2
- run_auto_searches();
+ if (typeof console === "undefined" || typeof console.log === "undefined") { /* ARGH!!! old IE */
+ return;
}
- if (mkws_config.responsive_design_width) {
- // Responsive web design - change layout on the fly based on
- // current screen width. Required for mobile devices.
- $(window).resize( function(e) { mkws_resize_page() });
- // initial check after page load
- $(document).ready(function() { mkws_resize_page() });
+ // you need to disable use strict at the top of the file!!!
+ if (mkws.debug_level >= 3) {
+ console.log(arguments.callee.caller);
+ } else if (mkws.debug_level >= 2) {
+ console.log(">>> called from function " + arguments.callee.caller.name + ' <<<');
}
-
- domReady();
-
- // on first page, hide the termlist
- $(document).ready(function() { $("#mkwsTermlists").hide(); } );
- var motd = document.getElementById("mkwsMOTD");
- var container = document.getElementById("mkwsMOTDContainer");
- if (motd && container) {
- // Move the MOTD from the provided element down into the container
- motd.parentNode.removeChild(motd);
- container.appendChild(motd);
+ console.log(string);
+ }
+ var debug = mkws.debug;
+
+
+ mkws.handleNodeWithTeam = function(node, callback) {
+ // First branch for DOM objects; second branch for jQuery objects
+ var classes = node.className || node.attr('class');
+ if (!classes) {
+ // For some reason, if we try to proceed when classes is
+ // undefined, we don't get an error message, but this
+ // function and its callers, up several stack level,
+ // silently return. What a crock.
+ mkws.debug("handleNodeWithTeam() called on node with no classes");
+ return;
+ }
+ var list = classes.split(/\s+/)
+ var teamName, type;
+
+ for (var i = 0; i < list.length; i++) {
+ var cname = list[i];
+ if (cname.match(/^mkwsTeam_/)) {
+ teamName = cname.replace(/^mkwsTeam_/, '');
+ } else if (cname.match(/^mkws/)) {
+ type = cname.replace(/^mkws/, '');
+ }
}
+ callback.call(node, teamName, type);
}
- function run_auto_searches() {
- debug("running auto searches");
+ mkws.resizePage = function () {
+ var list = ["mkwsSwitch", "mkwsLang"];
- $('[id^="mkwsRecords"]').each(function () {
- var node = $(this);
- var query = node.attr('autosearch');
+ var width = mkws_config.responsive_design_width;
+ var parent = $(".mkwsTermlists").parent();
- if (query) {
- var windowid = undefined;
- var id = node.attr('id');
- if (id.match(/^mkwsRecords_/, '')) {
- windowid = id.replace(/^mkwsRecords_/, '');
+ if ($(window).width() <= width &&
+ parent.hasClass("mkwsTermlistContainer1")) {
+ debug("changing from wide to narrow: " + $(window).width());
+ $(".mkwsTermlistContainer1").hide();
+ $(".mkwsTermlistContainer2").show();
+ for (var tname in mkws.teams) {
+ $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer2.mkwsTeam_" + tname));
+ for(var i = 0; i < list.length; i++) {
+ $("." + list[i] + ".mkwsTeam_" + tname).hide();
}
-
- var sort = node.attr('sort');
- var targets = node.attr('targets');
- var s = "running auto search: '" + query + "'";
- if (windowid) s += " [windowid '" + windowid + "']";
- if (sort) s += " sorted by '" + sort + "'";
- if (targets) s += " in targets '" + targets + "'";
- debug(s);
- newSearch(query, sort, targets, windowid);
}
- });
- }
+ } else if ($(window).width() > width &&
+ parent.hasClass("mkwsTermlistContainer2")) {
+ debug("changing from narrow to wide: " + $(window).width());
+ $(".mkwsTermlistContainer1").show();
+ $(".mkwsTermlistContainer2").hide();
+ for (var tname in mkws.teams) {
+ $(".mkwsTermlists.mkwsTeam_" + tname).appendTo($(".mkwsTermlistContainer1.mkwsTeam_" + tname));
+ for(var i = 0; i < list.length; i++) {
+ $("." + list[i] + ".mkwsTeam_" + tname).show();
+ }
+ }
+ }
+ };
- // implement $.parseQuerystring() for parsing URL parameters
- function parseQuerystring() {
- var nvpair = {};
- var qs = window.location.search.replace('?', '');
- var pairs = qs.split('&');
- $.each(pairs, function(i, v){
- var pair = v.split('=');
- nvpair[pair[0]] = pair[1];
- });
- return nvpair;
+ mkws.switchView = function(tname, view) {
+ mkws.teams[tname].switchView(view);
}
- function mkws_set_lang() {
- var lang = parseQuerystring().lang || mkws_config.lang;
- if (!lang || !mkws.locale_lang[lang]) {
- mkws_config.lang = ""
- } else {
- mkws_config.lang = lang;
- }
-
- debug("Locale language: " + (mkws_config.lang ? mkws_config.lang : "none"));
- return mkws_config.lang;
+ mkws.showDetails = function (tname, prefixRecId) {
+ mkws.teams[tname].showDetails(prefixRecId);
}
- function mkws_html_switch() {
- debug("HTML switch");
+ mkws.limitTarget = function (tname, id, name) {
+ mkws.teams[tname].limitTarget(id, name);
+ }
- $("#mkwsSwitch").append($('' + M('Records') + ''));
- $("#mkwsSwitch").append($("", { text: " | " }));
- $("#mkwsSwitch").append($('' + M('Targets') + ''));
+ mkws.limitQuery = function (tname, field, value) {
+ mkws.teams[tname].limitQuery(field, value);
+ }
- debug("HTML targets");
- $("#mkwsTargets").html('\
-
\
- No information available yet.\
-
');
- $("#mkwsTargets").css("display", "none");
+ mkws.delimitTarget = function (tname, id) {
+ mkws.teams[tname].delimitTarget(id);
}
- function mkws_html_sort() {
- debug("HTML sort, m_sort = '" + m_sort + "'");
- var sort_html = '';
+ mkws.pagerPrev = function (tname) {
+ mkws.teams[tname].pagerPrev();
+ }
- return sort_html;
+ mkws.pagerNext = function (tname) {
+ mkws.teams[tname].pagerNext();
}
- function mkws_html_perpage() {
- debug("HTML perpage");
- var perpage_html = '';
- return perpage_html;
+ // make sure the mkws_config is a valid hash
+ if (!$.isPlainObject(mkws_config)) {
+ debug("ERROR: mkws_config is not an JS object, ignore it....");
+ mkws_config = {};
+ }
+
+ /* override standard config values by function parameters */
+ for (var k in config_default) {
+ if (typeof mkws_config[k] === 'undefined')
+ mkws_config[k] = config_default[k];
+ //debug("Set config: " + k + ' => ' + mkws_config[k]);
+ }
}
+
/*
* Run service-proxy authentication in background (after page load).
* The username/password is configured in the apache config file
* for the site.
*/
- function mkws_service_proxy_auth(auth_url, auth_domain, pp2_url) {
+ function authenticateSession(auth_url, auth_domain, pp2_url) {
debug("Run service proxy auth URL: " + auth_url);
if (!auth_domain) {
@@ -1116,256 +1377,100 @@ function _make_mkws_team($, teamName) {
debug("Service proxy auth successfully done");
mkws.authenticated = true;
- run_auto_searches();
+ runAutoSearches();
});
}
- /* create locale language menu */
- function mkws_html_lang() {
- var lang_default = "en";
- var lang = mkws_config.lang || lang_default;
- var list = [];
- /* display a list of configured languages, or all */
- var lang_options = mkws_config.lang_options || [];
- var hash = {};
- for (var i = 0; i < lang_options.length; i++) {
- hash[lang_options[i]] = 1;
- }
+ function runAutoSearches() {
+ debug("running auto searches");
- for (var k in mkws.locale_lang) {
- if (hash[k] == 1 || lang_options.length == 0)
- list.push(k);
+ for (var teamName in mkws.teams) {
+ mkws.teams[teamName].runAutoSearch();
}
+ }
- // add english link
- if (lang_options.length == 0 || hash[lang_default] == 1)
- list.push(lang_default);
-
- debug("Language menu for: " + list.join(", "));
-
- /* the HTML part */
- var data = "";
- for(var i = 0; i < list.length; i++) {
- var l = list[i];
- if (data)
- data += ' | ';
+ $(document).ready(function() {
+ debug("on load ready");
+ defaultMkwsConfig();
- if (lang == l) {
- data += ' ' + l + ' ';
- } else {
- data += ' ' + l + ' '
- }
+ if (mkws_config.query_width < 5 || mkws_config.query_width > 150) {
+ debug("Reset query width: " + mkws_config.query_width);
+ mkws_config.query_width = 50;
}
- $("#mkwsLang").html(data);
- }
-
- function mkws_resize_page () {
- var list = ["mkwsSwitch"];
-
- var width = mkws_config.responsive_design_width;
- var parentId = $("#mkwsTermlists").parent().attr('id');
-
- if ($(window).width() <= width &&
- parentId === "mkwsTermlistContainer1") {
- debug("changing from wide to narrow: " + $(window).width());
- $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer2"));
- $("#mkwsTermlistContainer1").hide();
- $("#mkwsTermlistContainer2").show();
- for(var i = 0; i < list.length; i++) {
- $("#" + list[i]).hide();
- }
- } else if ($(window).width() > width &&
- parentId === "mkwsTermlistContainer2") {
- debug("changing from narrow to wide: " + $(window).width());
- $("#mkwsTermlists").appendTo($("#mkwsTermlistContainer1"));
- $("#mkwsTermlistContainer1").show();
- $("#mkwsTermlistContainer2").hide();
- for(var i = 0; i < list.length; i++) {
- $("#" + list[i]).show();
+ for (var key in mkws_config) {
+ if (mkws_config.hasOwnProperty(key)) {
+ if (key.match(/^language_/)) {
+ var lang = key.replace(/^language_/, "");
+ // Copy custom languages into list
+ mkws.locale_lang[lang] = mkws_config[key];
+ debug("Added locally configured language '" + lang + "'");
+ }
}
}
- };
- /* locale */
- function M(word) {
- var lang = mkws_config.lang;
-
- if (!lang || !mkws.locale_lang[lang])
- return word;
-
- return mkws.locale_lang[lang][word] || word;
- }
-
- // main
- (function() {
- try {
- mkws_html_all()
+ if (mkws_config.responsive_design_width) {
+ // Responsive web design - change layout on the fly based on
+ // current screen width. Required for mobile devices.
+ $(window).resize(function(e) { mkws.resizePage() });
+ // initial check after page load
+ $(document).ready(function() { mkws.resizePage() });
}
- catch (e) {
- mkws_config.error = e.message;
- // alert(e.message);
+ // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp"
+ if (mkws_config.pazpar2_url.match(/^\/\//)) {
+ mkws_config.pazpar2_url = document.location.protocol + mkws_config.pazpar2_url;
+ debug("adjust protocol independent links: " + mkws_config.pazpar2_url);
}
- })();
-
- // done
- mkws.init = true;
-};
-
-/*
- * implement jQuery plugin $.pazpar2({})
- */
-function _mkws_jquery_plugin ($) {
- var debug_level = 1;
-
- function debug (string) {
- if (!debug_level)
- return;
-
- if (typeof console === "undefined" || typeof console.log === "undefined")
- return;
-
- console.log("jquery.pazpar2: " + string);
- }
-
- function init_popup(obj) {
- var config = obj ? obj : {};
-
- var height = config.height || 760;
- var width = config.width || 880;
- var id_button = config.id_button || "input#mkwsButton";
- var id_popup = config.id_popup || "#mkwsPopup";
-
- debug("popup height: " + height + ", width: " + width);
-
- // make sure that jquery-ui was loaded afte jQuery core lib, e.g.:
- //
- if (!$.ui) {
- debug("Error: jquery-ui.js is missing, did you include it after jQuery core in the HTML file?");
- return;
+ // Backwards compatibility: set new magic class names on any
+ // elements that have the old magic IDs.
+ var ids = [ "Switch", "Lang", "Search", "Pager", "Navi",
+ "Results", "Records", "Targets", "Ranking",
+ "Termlists", "Stat", "MOTD" ];
+ for (var i = 0; i < ids.length; i++) {
+ var id = 'mkws' + ids[i];
+ var node = $('#' + id);
+ if (node.attr('id')) {
+ node.addClass(id);
+ debug("added magic class to '" + node.attr('id') + "'");
+ }
}
- $(id_popup).dialog({
- closeOnEscape: true,
- autoOpen: false,
- height: height,
- width: width,
- modal: true,
- resizable: true,
- buttons: {
- Cancel: function() {
- $(this).dialog("close");
- }
- },
- close: function() { }
+ // For all MKWS-classed nodes that don't have a team
+ // specified, set the team to AUTO.
+ $('[class^="mkws"],[class*=" mkws"]').each(function () {
+ if (!this.className.match(/mkwsTeam_/)) {
+ debug("adding AUTO team to node with class '" + this.className + "'");
+ $(this).addClass('mkwsTeam_AUTO');
+ }
});
- $(id_button)
- .button()
- .click(function() {
- $(id_popup).dialog("open");
+ // 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 () {
+ mkws.handleNodeWithTeam(this, function(tname, type) {
+ if (!mkws.teams[tname]) {
+ mkws.teams[tname] = team(j, tname);
+ debug("Made MKWS team '" + tname + "'");
+ }
+ var myTeam = mkws.teams[tname];
+ var myWidget = widget(j, myTeam, type, this);
});
- };
+ });
+ var now = $.now();
+ debug("Walking MKWS nodes took " + (now-then) + " ms");
- $.extend({
-
- // service-proxy or pazpar2
- pazpar2: function(config) {
- var id_popup = config.id_popup || "#mkwsPopup";
- id_popup = id_popup.replace(/^#/, "");
-
- // simple layout
- var div = '\
-\
-\
-\
-\
-\
-';
-
- // new table layout
- var table = '\
-\
- \
-
\
-
\
-
\
- \
- \
- \
-
\
-
\
-
\
-
\
-
\
- \
- \
- \
- \
- \
-
\
-
\
-
\
-
\
-
\
-
\
- \
-
\
-
\
-
\
-
\
-
\
- \
-
\
-
\
-
';
-
- var popup = '\
-\
-
\
- \
- \
- \
- \
- \
-
'
-
- if (config && config.layout == 'div') {
- debug("jquery plugin layout: div");
- document.write(div);
- } else if (config && config.layout == 'popup') {
- debug("jquery plugin layout: popup with id: " + id_popup);
- document.write(popup);
- $(document).ready( function() { init_popup(config); } );
- } else {
- debug("jquery plugin layout: table");
- document.write(table);
- }
+ if (mkws_config.use_service_proxy) {
+ authenticateSession(mkws_config.service_proxy_auth,
+ mkws_config.service_proxy_auth_domain,
+ mkws_config.pazpar2_url);
+ } else {
+ // raw pp2
+ runAutoSearches();
}
});
-};
-
-
-// wrapper to call _make_mkws_team() after page load
-(function (j) {
- // enable before page load, so we could call it before mkws() runs
- _mkws_jquery_plugin(j);
-
- $(document).ready(function() {
- // if (console && console.log) console.log("on load ready");
- _make_mkws_team(j, null);
- });
})(jQuery);