From: Wolfram Schneider Date: Wed, 10 Sep 2014 11:06:10 +0000 (+0000) Subject: Merge remote branch 'origin/master' into wosch X-Git-Tag: 1.0.0~39^2~6 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=ce1bb9c5c49becae5b1b36d25b532b08ff655180;hp=ac631fa1fa1ce18a4b878537a14fd99c9754aef5;p=mkws-moved-to-github.git Merge remote branch 'origin/master' into wosch --- diff --git a/doc/Makefile b/doc/Makefile index 2a6b99b..d87c1f8 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -45,9 +45,16 @@ all: $(DOCS) clean: rm -f $(DOCS) + rm -f *.drupal.html distclean: clean uninstall +push: + pandoc --toc README.markdown > README.drupal.html + pandoc --toc mkws-manual.markdown > mkws-manual.drupal.html + cat README.drupal.html | ./drupaljson.pl | curl --upload-file - http://www.indexdata.com/script/node/332?services_token=cda1e26e5733ce3f604773e94f0721df5c31a948 -v --header "Content-Type:application/json" + cat mkws-manual.drupal.html | ./drupaljson.pl | curl --upload-file - http://www.indexdata.com/script/node/323?services_token=cda1e26e5733ce3f604773e94f0721df5c31a948 -v --header "Content-Type:application/json" + help: - @echo "make [ all | install | clean | distclean ]" + @echo "make [ all | install | clean | distclean | push ]" diff --git a/doc/drupaljson.pl b/doc/drupaljson.pl new file mode 100755 index 0000000..0135867 --- /dev/null +++ b/doc/drupaljson.pl @@ -0,0 +1,9 @@ +#!/usr/bin/perl +use strict; +use warnings; +use JSON; + +local $/; # enable localized slurp mode +my %rec_hash = ('body' => {'und' => [{'value' => }]}); +my $json = encode_json \%rec_hash; +print $json; diff --git a/examples/htdocs/mike.html b/examples/htdocs/mike.html index 5d794a0..198cc44 100644 --- a/examples/htdocs/mike.html +++ b/examples/htdocs/mike.html @@ -7,12 +7,10 @@ var mkws_config = { // For now, we have to provide known-bad credentials to skip user/pw login: see bug MKSP-125 // Was: //sp-mkws.indexdata.com/service-proxy/?command=auth&action=perconfig&username=XXX&password=XXX - pp2_hostname: "x.sp-mkws.indexdata.com", - sp_path: "service-proxy/", - sp_auth_query: "command=auth&action=perconfig", - sp_auth_credentials: "XXX/XXX", - // ### This should automatically follow pp2_hostname - pazpar2_url: "//x.sp-mkws.indexdata.com/service-proxy/", +// pp2_hostname: "sp-mkws.indexdata.com", +// sp_auth_path: "service-proxy/", +// sp_auth_query: "command=auth&action=perconfig", +// sp_auth_credentials: "XXX/XXX", }; diff --git a/examples/htdocs/mkws-widget-wimp.css b/examples/htdocs/mkws-widget-wimp.css new file mode 100644 index 0000000..2212e25 --- /dev/null +++ b/examples/htdocs/mkws-widget-wimp.css @@ -0,0 +1,37 @@ +.mkwsWimp { + 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%); +} + +h2 { + font-size: 100%; + color: #4A5456; + padding-bottom: .5em; +} + +ul { + margin: 0; + padding: 0; +} + +li { + margin: .95em .25em; + padding-top: .75em; + border-top: 1px dotted #BEC8CC; + font-size: 90%; + list-style: none; +} + +a { + text-decoration: none; + font-weight:bold; + color: #2B77AF; +} diff --git a/examples/htdocs/mkws-widget-wimp.html b/examples/htdocs/mkws-widget-wimp.html new file mode 100644 index 0000000..b203ef2 --- /dev/null +++ b/examples/htdocs/mkws-widget-wimp.html @@ -0,0 +1,8 @@ + +
+ + + +
+
+ diff --git a/examples/htdocs/mkws-widget-wimp.js b/examples/htdocs/mkws-widget-wimp.js new file mode 100644 index 0000000..4b1425b --- /dev/null +++ b/examples/htdocs/mkws-widget-wimp.js @@ -0,0 +1,36 @@ +var mkws_config = { + service_proxy_auth: "//sp-mkws.indexdata.com/service-proxy/?command=auth&action=login&username=wimp&password=wimp6363" +}; + +mkws.registerWidgetType('Wimp', function() { + if (!this.config.perpage) this.config.perpage = 5; + if (!this.config.sort) this.config.sort = "position"; + this.team.registerTemplate('Wimp', '\ +

Results from Wimp

\ +\ +'); + + var that = this; + var template = that.team.loadTemplate(that.config.template || "Wimp"); + this.team.queue("records").subscribe(function(data) { + that.node.html(template(data)); + }); + that.autosearch(); +}); + diff --git a/src/mkws-core.js b/src/mkws-core.js index abe414d..6b3e00d 100644 --- a/src/mkws-core.js +++ b/src/mkws-core.js @@ -167,13 +167,13 @@ mkws.setMkwsConfig = function(overrides) { var config_default = { use_service_proxy: true, - pazpar2_url: "//mkws.indexdata.com/service-proxy/", - service_proxy_auth: undefined, // generally rolled from the next three properties - // Was: //mkws.indexdata.com/service-proxy-auth - pp2_hostname: "mkws.indexdata.com", - sp_path: "service-proxy-auth", - sp_auth_query: undefined, // Will be: "command=auth&action=perconfig", - sp_auth_credentials: undefined, + pazpar2_url: undefined, + pp2_hostname: "sp-mkws.indexdata.com", + pp2_path: "service-proxy", + service_proxy_auth: undefined, + sp_auth_path: "service-proxy/", + sp_auth_query: "command=auth&action=perconfig", + sp_auth_credentials: "XXX/XXX", // Should be undefined: see bug MKSP-125. lang: "", sort_options: [["relevance"], ["title:1", "title"], ["date:0", "newest"], ["date:1", "oldest"]], perpage_options: [10, 20, 30, 50], @@ -360,7 +360,14 @@ mkws.pagerNext = function(tname) { mkws.pazpar2_url = function() { - return mkws.config.pazpar2_url; + if (mkws.config.pazpar2_url) { + mkws.log("using pre-baked pazpar2_url '" + mkws.config.pazpar2_url + "'"); + return mkws.config.pazpar2_url; + } else { + var s = document.location.protocol + "//" + mkws.config.pp2_hostname + "/" + mkws.config.pp2_path + "/"; + mkws.log("generated pazpar2_url '" + s + "'"); + return s; + } }; @@ -640,7 +647,7 @@ mkws.pazpar2_url = function() { } // protocol independent link for pazpar2: "//mkws/sp" -> "https://mkws/sp" - if (mkws.config.pazpar2_url.match(/^\/\//)) { + if (mkws.pazpar2_url().match(/^\/\//)) { mkws.config.pazpar2_url = document.location.protocol + mkws.config.pazpar2_url; log("adjusted protocol independent link to " + mkws.pazpar2_url()); } @@ -681,7 +688,7 @@ mkws.pazpar2_url = function() { } else { var s = '//'; s += config.auth_hostname ? config.auth_hostname : config.pp2_hostname; - s += '/' + config.sp_path; + s += '/' + config.sp_auth_path; var q = config.sp_auth_query; if (q) { s += '?' + q; diff --git a/test/package.json b/test/package.json index 1416efa..5450176 100644 --- a/test/package.json +++ b/test/package.json @@ -12,7 +12,7 @@ "devDependencies": { "jQuery": "*", "xmlhttprequest": "*", - "jsdom": "*", + "jsdom": "<= 0.11.1", "request": "*", "jasmine-reporters": "<= 0.4.1", "jasmine-node": "*", diff --git a/test/spec/mkws-config.js b/test/spec/mkws-config.js index 59a0132..b6852a9 100644 --- a/test/spec/mkws-config.js +++ b/test/spec/mkws-config.js @@ -34,8 +34,8 @@ describe("Check mkws.config object", function () { describe("Check pazpar2 config", function () { - it("pazpar2path is a path or an full URL", function () { - expect(mkws.config.pazpar2_url).toMatch(/^(\/|https?:\/\/)/) + it("pazpar2_url is a path or an full URL", function () { + expect(mkws.config.pazpar2_url).toMatch(/^(\/|https?:\/\/|undefined$)/) }); });