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 ]"
--- /dev/null
+#!/usr/bin/perl
+use strict;
+use warnings;
+use JSON;
+
+local $/; # enable localized slurp mode
+my %rec_hash = ('body' => {'und' => [{'value' => <STDIN>}]});
+my $json = encode_json \%rec_hash;
+print $json;
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",
};
</script>
<script type="text/javascript" src="tools/htdocs/jquery-1.10.0.min.js"></script>
--- /dev/null
+.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;
+}
--- /dev/null
+<html>
+ <div style="max-width: 18em; margin: 1.5em 1.5em">
+ <script src="//mkws.indexdata.com/mkws-complete.js"></script>
+ <script src="mkws-widget-wimp.js"></script>
+ <link rel="stylesheet" type="text/css" href="mkws-widget-wimp.css" />
+ <div class="mkwsWimp" autosearch="!param!q"></div>
+ </div>
+</html>
--- /dev/null
+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', '\
+<h2>Results from Wimp</h2>\
+<ul>\
+{{#each hits}}\
+ <li>\
+ {{#mkws-first md-electronic-url}}\
+ <a href="{{this}}">\
+ {{/mkws-first}}\
+ {{md-title}}\
+ </a>\
+ {{#if md-title-remainder}}\
+ <span>{{md-title-remainder}}</span>\
+ {{/if}}\
+ {{#if md-title-responsibility}}\
+ <span><i>{{md-title-responsibility}}</i></span>\
+ {{/if}}\
+ </li>\
+{{/each}}\
+</ul>\
+');
+
+ 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();
+});
+
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],
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;
+ }
};
}
// 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());
}
} 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;
"devDependencies": {
"jQuery": "*",
"xmlhttprequest": "*",
- "jsdom": "*",
+ "jsdom": "<= 0.11.1",
"request": "*",
"jasmine-reporters": "<= 0.4.1",
"jasmine-node": "*",
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$)/)
});
});