From: Wolfram Schneider Date: Wed, 5 Feb 2014 13:22:43 +0000 (+0000) Subject: Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws X-Git-Tag: 1.0.0~1515^2~14 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=83ee2bcf59fdd0c3c6dcc502e372a00a2a53dd3d;hp=329840de4815ae08900c31f9e5ff1e3a85c6e6a9;p=mkws-moved-to-github.git Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws --- diff --git a/examples/htdocs/mike.html b/examples/htdocs/mike.html index 84e17d6..1fc539b 100644 --- a/examples/htdocs/mike.html +++ b/examples/htdocs/mike.html @@ -19,12 +19,25 @@ -
-
-
-
-
-
-
+ + + + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/htdocs/mike2.html b/examples/htdocs/mike2.html index 9dc7d88..cddc36e 100644 --- a/examples/htdocs/mike2.html +++ b/examples/htdocs/mike2.html @@ -20,10 +20,10 @@
-
+
-
-
+
+
diff --git a/test/package.json b/test/package.json index ac5366d..3f69e77 100644 --- a/test/package.json +++ b/test/package.json @@ -1,7 +1,7 @@ { "name": "MKWS", "version": "0.9.1", - "license": "IndexData ApS, Copyright (c) 2013-2014", + "license": "GPL, http://www.indexdata.com/licences/gpl", "contributors": [{ "name": "Mike Taylor", "email": "mike@indexdata.com" @@ -17,5 +17,8 @@ "jasmine-node": "*", "phantomjs": "*" }, - "dummy": "EOF" + "repository": { + "type": "git", + "url": "http://git.indexdata.com/mkws.git" + } } diff --git a/tools/htdocs/mkws.css b/tools/htdocs/mkws.css index ef5c1c8..b39c8b1 100644 --- a/tools/htdocs/mkws.css +++ b/tools/htdocs/mkws.css @@ -1,4 +1,4 @@ -#mkwsLang, +#mkwsLang, .mkwsLang, #mkwsSwitch, .mkwsSwitch, #mkwsSearch, .mkwsSearch, #mkwsTermlists, @@ -7,23 +7,23 @@ #mkwsNavi, #mkwsRecords, #mkwsTargets, .mkwsTargets, -#mkwsStat, +#mkwsStat, .mkwsStat, #mkwsMOTD { font-family: Gill Sans, "Gillius ADF", Gillius, GilliusADF, Verdana, Sans-Serif; } -#mkwsLang { +#mkwsLang, .mkwsLang { float: left; padding-left: 1em; padding-top: 0.4em; } -#mkwsLang a { +#mkwsLang a, .mkwsLang a { background: #d0e0ff; padding: 1px 4px; } -#mkwsLang span { +#mkwsLang span, .mkwsLang span { border: solid 1px #d0e0ff; padding: 0px 3px; } @@ -42,19 +42,19 @@ background-color: #fafafa; } -#mkwsStat { +#mkwsStat, .mkwsStat { margin-top: 10px; border-top: 1px solid #156a16; padding-top: 5px; font-size: small; } -#mkwsStat span.head { +#mkwsStat span.head, .mkwsStat span.head { font-weight: bold; } #mkwsSwitch a, .mkwsSwitch a, -#mkwsLang a, +#mkwsLang a, .mkwsLang a, #mkwsTermlists a, #mkwsRanking a, #mkwsPager a, @@ -65,7 +65,7 @@ } #mkwsSwitch a:hover, .mkwsSwitch a:hover, -#mkwsLang a:hover, +#mkwsLang a:hover, .mkwsLang a:hover, #mkwsTermlists a:hover, #mkwsPager a:hover, #mkwsRecords a:hover { diff --git a/tools/htdocs/mkws.js b/tools/htdocs/mkws.js index 45564dd..6a39166 100644 --- a/tools/htdocs/mkws.js +++ b/tools/htdocs/mkws.js @@ -290,15 +290,15 @@ function team($, teamName) { function my_onstat(data, teamName) { debug("stat for " + teamName); - var stat = document.getElementById("mkwsStat"); - if (stat == null) + var stat = $('.mkwsStat.mkwsTeam_' + teamName); + if (stat.length === 0) return; - stat.innerHTML = '' + M('Status info') + '' + + stat.html('' + M('Status info') + '' + ' -- ' + '' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '' + ' -- ' + - '' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + ''; + '' + M('Retrieved records') + ': ' + data.records + '/' + data.hits + ''); } @@ -375,7 +375,6 @@ function team($, teamName) { debug("target for " + teamName); var targetDiv = $('.mkwsBytarget.mkwsTeam_' + teamName); if (!targetDiv) { - // No mkwsTargets div. return; } @@ -704,7 +703,6 @@ function team($, teamName) { mkws.switchView = function(tname, view) { debug("switchView(" + tname + ", " + view + ")"); - //var targets = document.getElementById('mkwsTargets'); var targets = $('.mkwsTargets.mkwsTeam_' + tname); var results = $('.mkwsResults.mkwsTeam_' + tname + ',.mkwsRecords.mkwsTeam_' + tname); var blanket = $('#mkwsBlanket'); @@ -904,19 +902,19 @@ function team($, teamName) { $(".mkwsResults.mkwsTeam_" + m_teamName).html('\ \ \ - \ \ \ \ \ \
\ -
\ +
\ +
\
\ -
\ -
\ -
\ -
\ +
\ +
\ +
\ +
\
\ -
\ +
\
'); @@ -941,9 +939,9 @@ function team($, teamName) { 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() }); + $(window).resize(function(e) { mkws.resize_page() }); // initial check after page load - $(document).ready(function() { mkws_resize_page() }); + $(document).ready(function() { mkws.resize_page() }); } domReady(); @@ -1052,18 +1050,18 @@ function team($, teamName) { /* display a list of configured languages, or all */ var lang_options = mkws_config.lang_options || []; - var hash = {}; + var toBeIncluded = {}; for (var i = 0; i < lang_options.length; i++) { - hash[lang_options[i]] = 1; + toBeIncluded[lang_options[i]] = true; } for (var k in mkws.locale_lang) { - if (hash[k] == 1 || lang_options.length == 0) + if (toBeIncluded[k] || lang_options.length == 0) list.push(k); } // add english link - if (lang_options.length == 0 || hash[lang_default] == 1) + if (lang_options.length == 0 || toBeIncluded[lang_default]) list.push(lang_default); debug("Language menu for: " + list.join(", ")); @@ -1083,38 +1081,10 @@ function team($, teamName) { } } - $("#mkwsLang").html(data); + $(".mkwsLang.mkwsTeam_" + m_teamName).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(); // ### make team-aware - } - } 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(); // ### make team-aware - } - } - }; - - /* locale */ function M(word) { var lang = mkws_config.lang; @@ -1367,6 +1337,38 @@ function _mkws_jquery_plugin ($) { } + mkws.resize_page = function () { + var list = ["mkwsSwitch", "mkwsLang"]; + + var width = mkws_config.responsive_design_width; + var parent = $(".mkwsTermlists").parent(); + + if ($(window).width() <= width && + parent.hasClass("mkwsTermlistContainer1")) { + log("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(); + } + } + } else if ($(window).width() > width && + parent.hasClass("mkwsTermlistContainer2")) { + log("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(); + } + } + } + }; + + mkws.showDetails = function (prefixRecId, tname) { mkws.teams[tname].showDetails(prefixRecId); } @@ -1423,11 +1425,11 @@ function _mkws_jquery_plugin ($) { * for the site. */ function authenticate_session(auth_url, auth_domain, pp2_url) { - console.log("Run service proxy auth URL: " + auth_url); + log("Run service proxy auth URL: " + auth_url); if (!auth_domain) { auth_domain = pp2_url.replace(/^(https?:)?\/\/(.*?)\/.*/, '$2'); - console.log("guessed auth_domain '" + auth_domain + "' from pp2_url '" + pp2_url + "'"); + log("guessed auth_domain '" + auth_domain + "' from pp2_url '" + pp2_url + "'"); } var request = new pzHttpRequest(auth_url, function(err) { @@ -1446,7 +1448,7 @@ function _mkws_jquery_plugin ($) { return; } - console.log("Service proxy auth successfully done"); + log("Service proxy auth successfully done"); mkws.authenticated = true; run_auto_searches(); }); @@ -1454,13 +1456,13 @@ function _mkws_jquery_plugin ($) { function run_auto_searches() { - console.log("running auto searches"); + log("running auto searches"); for (var teamName in mkws.teams) { // ### should check mkwsTermlist as well, for facet-only teams var node = $('.mkwsRecords.mkwsTeam_' + teamName); var query = node.attr('autosearch'); - console.log("teamName '" + teamName + "', node=" + node + ", class='" + node.className + "', query=" + query); + log("teamName '" + teamName + "', node=" + node + ", class='" + node.className + "', query=" + query); if (query) { var sort = node.attr('sort'); @@ -1469,9 +1471,9 @@ function _mkws_jquery_plugin ($) { if (teamName) s += " [teamName '" + teamName + "']"; if (sort) s += " sorted by '" + sort + "'"; if (targets) s += " in targets '" + targets + "'"; - console.log(s); + log(s); var team = mkws.teams[teamName]; - console.log($.toJSON(team)); + log($.toJSON(team)); team.newSearch(query, sort, targets, teamName); } }