all:
${MAKE} -C./tools/htdocs $@
- ${MAKE} -C./doc $@
+ ${MAKE} -C./doc install
clean distclean:
${MAKE} -C./tools/htdocs $@
../tools/htdocs/%: %
rm -f $@
cp -p $? $@
- chmod -w $@
+ chmod ugo-w $@
all: $(DOCS)
<title>MKWS demo: Orex</title>
<link rel="stylesheet" type="text/css" href="tools/htdocs/mkws.css" />
<script type="text/javascript">
- var mkws_config = { service_proxy_auth:
- "//sp-mkws.indexdata.com/service-proxy/?command=auth&action=check,login&username=orex&password=orexmkc"
+ var mkws_config = {
+ pazpar2_url: "//sp-mkws.indexdata.com/service-proxy/",
+ service_proxy_auth: "//sp-mkws.indexdata.com/service-proxy/?command=auth&action=check,login&username=orex&password=orexmkc"
};
</script>
<script type="text/javascript" src="//code.jquery.com/jquery-1.10.0.min.js"></script>
+++ /dev/null
-README.html
-README.odt
-README.pdf
-handlebars-v1.1.2.js
-jquery-1.10.0.min.js
-jquery.json-2.4.js
-mkws-complete.js
-mkws-complete.min.js
-mkws.js
-mkws.min.js
-pz2.js
-whitepaper.html
-whitepaper.odt
-whitepaper.pdf
"use strict"; // HTML5: disable for log_level >= 2
-// Incredible that the standard JavaScript runtime doesn't define a
-// unique windowId. Instead, we have to make one up. And since there's
-// no global area shared between windows, the best we can do for
-// ensuring uniqueness is generating a random ID and crossing our
-// fingers. We stash this in window.name, as it's the only place to
-// keep data that is preserved across reloads and within-site
-// navigation. pz2.js picks this up and uses it as part of the
-// cookie-name, to ensure each tab gets its own session.
-if (window.name) {
- console.log("Using existing window.name '" + window.name + "'");
-} else {
- // Ten chars from 26 alpha-numerics = 36^10 = 3.65e15 combinations.
- // At one per second, it will take 116 million years to duplicate a session
- window.name = Math.random().toString(36).slice(2, 12);
- console.log("Generated new window.name '" + window.name + "'");
-}
-
// Set up global mkws object. Contains truly global state such as SP
// authentication, and a hash of team objects, indexed by team-name.
//
};
+// Incredible that the standard JavaScript runtime doesn't define a
+// unique windowId. Instead, we have to make one up. And since there's
+// no global area shared between windows, the best we can do for
+// ensuring uniqueness is generating a random ID and crossing our
+// fingers. We stash this in window.name, as it's the only place to
+// keep data that is preserved across reloads and within-site
+// navigation. pz2.js picks this up and uses it as part of the
+// cookie-name, to ensure each tab gets its own session.
+if (window.name) {
+ mkws.log("Using existing window.name '" + window.name + "'");
+} else {
+ // Ten chars from 26 alpha-numerics = 36^10 = 3.65e15 combinations.
+ // At one per second, it will take 116 million years to duplicate a session
+ window.name = Math.random().toString(36).slice(2, 12);
+ mkws.log("Generated new window.name '" + window.name + "'");
+}
+
+
// Translation function.
mkws.M = function(word) {
var lang = mkws.config.lang;
request.get(null, function(data) {
if (!$.isXMLDoc(data)) {
- alert("service proxy auth response document is not valid XML document, give up!");
+ alert("Service Proxy authentication response is not a valid XML document");
return;
}
var status = $(data).find("status");
if (status.text() != "OK") {
- alert("service proxy auth response status: " + status.text() + ", give up!");
+ var message = $(data).find("message");
+ alert("Service Proxy authentication response: " + status.text() + " (" + message.text() + ")");
return;
}
// Handlebars helpers
Handlebars.registerHelper('mkws-json', function(obj) {
- return $.toJSON(obj);
+ return mkws.$.toJSON(obj);
});
#PHANTOMJS_URL=https://mkws-dev.indexdata.com/jasmine-popup.html
PHANTOMJS_PATH=jasmine-local-popup.html
PHANTOMJS_URL=http://localhost:${APACHE_PORT}/${PHANTOMJS_PATH}
-PHANTOMJS_TIMEOUT=16
+PHANTOMJS_TIMEOUT=18
NPM_INSTALL_FLAGS=-q
JASMINE_NODE= ./node_modules/jasmine-node/bin/jasmine-node
@echo " [ node-modules ]"
@echo " [ apache-stop apache-start ]"
@echo ""
- @echo "DEBUG=1 make phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_URL=${PHANTOMJS_URL}"
+ @echo "Examples"
+ @echo ""
+ @echo "make phantomjs PHANTOMJS_PATH=${PHANTOMJS_PATH}"
+ @echo "DEBUG=0 APACHE_PORT=5050 make -s phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_PATH=${PHANTOMJS_PATH}"
+ @echo "DEBUG=2 make phantomjs PHANTOMJS_TIMEOUT=12 PHANTOMJS_URL=${PHANTOMJS_URL}"
+ @echo ""
"xmlhttprequest": "*",
"jsdom": "*",
"request": "*",
- "jasmine-reporters": "<= 0.4.1",
+ "jasmine-reporters": "<= 0.4.1",
"jasmine-node": "*",
"phantomjs": "*"
},
show_record_url: true,
// check for valid URL in records
check_motd: true,
+
+ // check sort by and per page menu
+ check_sortby: false,
+
dummy: false
};
});
});
+
+
describe("Check Author Facets", function () {
it("limit search to first author", function () {
if (mkws.config.disable_facet_authors_search) {
waitsFor(function () {
var hits_single_target = get_hit_counter();
- console.log("hits_single_target='" + hits_single_target + "' cf. hits_all_targets='" + hits_all_targets + "'");
+ // debug("hits_single_target='" + hits_single_target + "' cf. hits_all_targets='" + hits_all_targets + "'");
return hits_single_target > 0 && hits_single_target < hits_all_targets ? true : false;
}, "Limited author search for less than " + hits_all_targets + " hits", 4.5 * jasmine_config.second);
expect(mkws.$("div.mkwsSwitch").length).toBe(1);
// expect 2 clickable links
- expect(mkws.$("div.mkwsSwitch a").length).toBe(2);
+ expect(mkws.$("div.mkwsSwitch > a").length).toBe(2);
});
it("switch to target view", function () {
- mkws.$("div.mkwsSwitch").children('a').eq(1).trigger("click");
+ mkws.$("div.mkwsSwitch > a").eq(1).trigger("click");
// now the target table must be visible
expect(mkws.$("div.mkwsTargets").is(":visible")).toBe(true);
});
it("switch back to record view", function () {
- mkws.$("div.mkwsSwitch").children('a').eq(0).trigger("click");
+ mkws.$("div.mkwsSwitch > a").eq(0).trigger("click");
// now the target table must be visible
expect(mkws.$("div.mkwsTargets").is(":visible")).toBe(false);
});
});
+/* remove the "source" and "author" facet link to get more records again */
+describe("Check removable facets links", function () {
+ var $ = mkws.$;
+
+ it("remove links for source and author", function () {
+ var waitcount = 0;
+ if (!jasmine_config.check_sortby) {
+ debug("ignore check for removable facets");
+ return;
+ }
+
+
+ runs(function () {
+ var click = $("a.mkwsRemovable").eq(0).trigger("click");
+ debug("Removed first facets link: " + click.length);
+ expect(click.length).toBe(1);
+ });
+
+ runs(function () {
+ $(".mkwsPager").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
+ waitcount++;
+ debug("DOM change for removeable: " + waitcount);
+ });
+ });
+
+ waitsFor(function () {
+ return $("a.mkwsRemovable").length == 1 ? 1 : 0;
+ });
+
+ runs(function () {
+ var click = $("a.mkwsRemovable").eq(0).trigger("click");
+ debug("Removed second facets link: " + click.length);
+ expect(click.length).toBe(1);
+ });
+
+ waitsFor(function () {
+ // debug("wait for: " + waitcount);
+ return waitcount >= 2 ? true : false;
+ }, "Records DOM change, by per page", 2 * jasmine_config.second);
+
+
+ runs(function () {
+ debug("unbind removable");
+ $(".mkwsPager").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
+ });
+ });
+});
+
+
+describe("Check per page options", function () {
+ var $ = mkws.$;
+
+ it("show per page", function () {
+ if (!jasmine_config.check_sortby) {
+ debug("ignore check for per page select");
+ return;
+ }
+ var waitcount = 0;
+ var per_page_number = 20;
+
+
+ runs(function () {
+ var select = $("select.mkwsPerpage option[selected='selected']");
+ debug("per page default is: " + select.text() + " and unselect it");
+ select.removeAttr('selected');
+
+ select = $("select.mkwsPerpage option[value='" + per_page_number + "']").attr('selected', true);
+ debug("per page is set to: " + select.text());
+ select.trigger("change");
+
+ $("div.mkwsRecords").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
+ waitcount++;
+ debug("DOM wait for change, per page: " + waitcount);
+ });
+ });
+
+ waitsFor(function () {
+ //debug("wait for: " + waitcount);
+ return waitcount >= 30 ? true : false;
+ }, "Records DOM change, by per page", 3 * jasmine_config.second);
+
+ runs(function () {
+ $("div.mkwsRecords").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
+ debug("unbind per page");
+ });
+
+ runs(function () {
+ var records = $("div.mkwsRecords > div.mkwsSummary");
+ debug("Got now " + records.length + " records");
+ expect(records.length).toBe(per_page_number);
+ });
+ });
+});
+
+describe("Check SortBy options", function () {
+ var $ = mkws.$;
+
+ it("show per page", function () {
+ if (!jasmine_config.check_sortby) {
+ debug("ignore check for sort by");
+ return;
+ }
+
+ var waitcount = 0;
+ var sort_value = 'title:1';
+ var per_page_number = 20;
+ var title_list_old = title_list("xxx ");
+
+ function title_list(prefix) {
+ var list = [];
+ var terms = $("div.mkwsRecords > div.mkwsSummary > a");
+ for (var i = 0; i < terms.length; i++) {
+ var term = $(terms[i]).text();
+ list.push(term);
+ // debug(prefix + "title: " + term);
+ }
+ return list;
+ }
+
+ runs(function () {
+ $("div.mkwsRecords").bind("DOMNodeInserted DOMNodeRemoved propertychange", function () {
+ waitcount++;
+ //debug("DOM wait for change, sort by: " + waitcount);
+ });
+
+ var select = $("select.mkwsSort option[selected='selected']");
+ debug("Sort by default is: " + select.text() + " and unselect it");
+ select.removeAttr('selected');
+
+ select = $("select.mkwsSort option[value='" + sort_value + "']").attr('selected', true);
+ debug("sort by is set to: " + select.text());
+ select.trigger("change");
+ });
+
+ waitsFor(function () {
+ //debug("wait for2: " + waitcount);
+ return waitcount >= 6 ? true : false;
+ }, "Records DOM change, by sort page", 3 * jasmine_config.second);
+
+ runs(function () {
+ $("div.mkwsRecords").unbind("DOMNodeInserted DOMNodeRemoved propertychange");
+ debug("unbind per page");
+ });
+
+ runs(function () {
+ var records = $("div.mkwsRecords > div.mkwsSummary a");
+ debug("Got now " + records.length + " records");
+ expect(records.length).toBe(per_page_number);
+ });
+
+ runs(function () {
+ var title_list_new = title_list("yyy ");
+ var diff_flag = 0;
+ for (var i = 0; i < title_list_old.length; i++) {
+ debug(title_list_old[i] + " :: " + title_list_new[i]);
+
+ if (title_list_old[i] != title_list_new[i]) {
+ diff_flag++;
+ }
+ }
+ debug("Title changes: " + diff_flag + " out of " + per_page_number);
+ expect(diff_flag).not.toBe(0);
+ });
+ });
+});
+
+
/* done */
describe("All tests are done", function () {
it(">>> hooray <<<", function () {
PerlOutputFilterHandler MyApache2::SetACAO
</Location>
</VirtualHost>
-
-# Separate hostname for the MKWS instance of the Service Proxy.
-# This allows us to use a different SP configuration that handles
-# authentication differently.
-#
-# Once this is in universal use, we can get rid of the Service Proxy
-# stuff in the configuration for mkws.indexdata.com
-#
-<VirtualHost *:80>
- ServerName sp-mkws.indexdata.com
-
- ErrorLog /var/log/apache2/sp-mkws-error.log
- CustomLog /var/log/apache2/sp-mkws-access.log combined
-
- DocumentRoot /home/indexdata/mkws/tools/sp-htdocs
-
- # No rewriting on this server: use the true URL.
- # (The security value of rewrite is when the application site does it.)
-
- Header set Access-Control-Allow-Credentials true
-
- ProxyPass /service-proxy/ http://sp-mkc.indexdata.com/service-proxy/
- ProxyPassReverse /service-proxy/ http://sp-mkc.indexdata.com/service-proxy/
- # Or use: sp-mkc-sansa.indexdata.com:8080 or sp-mkc-arya.indexdata.com:8080
-
- PerlOptions +Parent
- PerlSwitches -I/home/indexdata/mkws/tools/mod_perl
- <Location /service-proxy>
- PerlOutputFilterHandler MyApache2::SetACAO
- </Location>
-</VirtualHost>
--- /dev/null
+# Separate hostname for the MKWS instance of the Service Proxy.
+# This allows us to use a different SP configuration that handles
+# authentication differently.
+#
+# Once this is in universal use, we can get rid of the Service Proxy
+# stuff in the configuration for mkws.indexdata.com
+#
+<VirtualHost *:80>
+ ServerName sp-mkws.indexdata.com
+
+ ErrorLog /var/log/apache2/sp-mkws-error.log
+ CustomLog /var/log/apache2/sp-mkws-access.log combined
+
+ DocumentRoot /home/indexdata/mkws/tools/sp-htdocs
+
+ # No rewriting on this server: use the true URL.
+ # (The security value of rewrite is when the application site does it.)
+
+ Header set Access-Control-Allow-Credentials true
+
+ ProxyPreserveHost On
+ # We could use any of the following:
+ # sp-mkc.indexdata.com/service-proxy/ -- multiplexer
+ # sp-mkc-sansa.indexdata.com:8080/service-proxy/ -- 1st back-end server
+ # sp-mkc-arya.indexdata.com:8080/service-proxy/ -- 2nd back-end server
+ ProxyPass /service-proxy/ http://sp-mkc-sansa.indexdata.com:8080/service-proxy/
+ ProxyPassReverse /service-proxy/ http://sp-mkc-sansa.indexdata.com:8080/service-proxy/
+
+ PerlOptions +Parent
+ PerlSwitches -I/home/indexdata/mkws/tools/mod_perl
+ <Location /service-proxy>
+ PerlOutputFilterHandler MyApache2::SetACAO
+ </Location>
+</VirtualHost>
+# Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
+#
+# this makefile will generate CSS files for Koha MKWS widgets
+
E_DIR= ../../../../examples/htdocs
-COMPONENTS = ${E_DIR}/mkws-widget-reference.css
+COMPONENTS = ${E_DIR}/mkws-widget-reference.css koha-mkws-widget-ru.css
KOHA_CSS = koha-mkws.css
KOHA_COMPLETE_CSS = koha-mkws-complete.css
clean:
rm -f ${KOHA_COMPLETE_CSS}
-${KOHA_COMPLETE_CSS}:
+${KOHA_COMPLETE_CSS}: ${COMPONENTS} ${KOHA_CSS}
cat ${COMPONENTS} ${KOHA_CSS} > $@.tmp
mv -f $@.tmp $@
distclean: clean
rm -f *.orig *.bak *.rej
+help:
+ @echo "make [ all | clean ]"
+
content: "Source: ";
font-weight: bold;
}
+/* original "ru" config
+.mkwsReferenceUniverse {
+ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
+ background: #FCFBFA;
+ padding: 0.5em 1em 0.25em;
+ box-shadow: 0 0 2px 0 #7F8F93;
+ border-radius: 0 0 1.5em;
+ -moz-border-radius: 0 0 1.5em;
+ -webkit-border-radius: 0 0 1.5em;
+ line-height: 1.4;
+ color: #86979B;
+ background: radial-gradient(ellipse at center, #ffffff 0%,#f8f8f8 100%);
+}
+*/
+
+.mkwsReferenceUniverse {
+ padding: 0.5em 1em 0.25em;
+}
+
+.mkwsReferenceUniverse h2 {
+ font-size: 100%;
+ color: #4A5456;
+ padding-bottom: .5em;
+}
+
+.mkwsReferenceUniverse ul {
+ margin: 0;
+ padding: 0;
+}
+
+.mkwsReferenceUniverse li {
+ margin: .95em .25em;
+ padding-top: .75em;
+ border-top: 1px dotted #BEC8CC;
+ font-size: 90%;
+ list-style: none;
+}
+
+.mkwsReferenceUniverse a {
+ text-decoration: none;
+ font-weight:bold;
+ color: #2B77AF;
+}
/*! Copyright (c) 2013-2014 IndexData ApS. http://indexdata.com
* Licence: GPL, http://www.indexdata.com/licences/gpl
*