From: Wolfram Schneider Date: Thu, 20 Jun 2013 11:45:34 +0000 (+0000) Subject: Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws into wosch X-Git-Tag: 0.9.1~575 X-Git-Url: http://git.indexdata.com/?a=commitdiff_plain;h=01d95c59750f32341a720843030e3c44b264f8e1;hp=16611c5abf3c70963a49744bb0fce0fadea716db;p=mkws-moved-to-github.git Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws into wosch Conflicts: experiments/spclient/mkws.js --- diff --git a/etc/apache2/spclient-live b/etc/apache2/spclient-live new file mode 100644 index 0000000..59e5a2b --- /dev/null +++ b/etc/apache2/spclient-live @@ -0,0 +1,43 @@ +# Configuration for the apache web server +# Running on caliban + + + ServerName mkws.indexdata.com + + ErrorLog /var/log/apache2/mkws-error.log + CustomLog /var/log/apache2/mkws-access.log combined + + DocumentRoot /home/indexdata/mkws/experiments/spclient/ + Alias /libjs-pz2/ /home/indexdata/libjs-pz2/ + Alias /index.html /home/indexdata/mkws/experiments/spclient/index-mkws.html + + RewriteEngine on + RewriteLogLevel 1 + RewriteLog /var/log/apache2/mkws-rewrite.log + RewriteRule /service-proxy-auth /service-proxy/?command=auth&action=login&username=guest&password=guest [P] # [NE,P] + + Header set Access-Control-Allow-Origin "http://somesite.indexdata.com" + + # For MKC Service Proxy + ProxyPass /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/ + ProxyPassReverse /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/ + + + + ServerName somesite.indexdata.com + + ErrorLog /var/log/apache2/somesite-error.log + CustomLog /var/log/apache2/somesite-access.log combined + + DocumentRoot /home/indexdata/mkws/experiments/spclient/ + Alias /index.html /home/indexdata/mkws/experiments/spclient/index-somesite.html + + RewriteEngine on + RewriteLogLevel 1 + RewriteLog /var/log/apache2/mkws-rewrite.log + RewriteRule /service-proxy-auth /service-proxy/?command=auth&action=login&username=guest&password=guest [P] # [NE,P] + + # For MKC Service Proxy + ProxyPass /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/ + ProxyPassReverse /service-proxy/ http://mkc.indexdata.com:9009/service-proxy/ + diff --git a/etc/apache2/spclient-proxy b/etc/apache2/spclient-proxy new file mode 100644 index 0000000..4e16c51 --- /dev/null +++ b/etc/apache2/spclient-proxy @@ -0,0 +1,19 @@ + + ServerName mkws.indexdata.com + ServerAlias somesite.indexdata.com + + ProxyRequests off + ProxyVia On + ProxyPreserveHost On + + Order deny,allow + Allow from all + + + ProxyPass / http://caliban:80/ + ProxyPassReverse / http://caliban:80/ + + # These are the logs for the proxying operation + ErrorLog /var/log/apache2/mkws-proxy-error.log + CustomLog /var/log/apache2/mkws-proxy-access.log combined + diff --git a/experiments/spclient/README b/experiments/spclient/README index be54707..16b3bc3 100644 --- a/experiments/spclient/README +++ b/experiments/spclient/README @@ -1,20 +1,73 @@ -In its current form, this is very close to -/usr/local/src/git/pazpar2/www/jsdemo/ - -- It uses indexdata_logo.png directly from that location -- It uses styles.css directly from that location -- It uses pz2.js directly from /usr/local/src/git/pazpar2/js -- Its HTML (index.html) differs only in a few lines: - diff /usr/local/src/git/pazpar2/www/jsdemo/index.html index.html - - It has a boolean indicating whether the SP is in use - - When that is set it performs simple authentication - (The username/pw are hardwired into the Apache2 config) -- Its JavaScript (example_client.js) differs only in a few lines: - diff /usr/local/src/git/pazpar2/www/jsdemo/example_client.js example_client.js - - usesessions and pazpar2path are set differently if SP is in use - - authURLServiceProxy is defined (to be used in the HTML) - - status info has extra info to say whether SP is in use -- A simple favicon.ico is added to avoid spamming the error-log with 404s -- A simple robots.txt is added +An embryonic MasterKey Widget Set +================================= + +This directory contains an embryonic MasterKey Widget Set, based +initially on "jsdemo" though now far removed from those beginnnings. + + +How this works +-------------- + +The goal is to make it that as much of the searching functionality as +possible is hosted on + http://mkws.indexdata.com/ +so that very simple websites such as + http://somesite.indexdata.com/ +can have MasterKey searching with minimal effort. + +The following files must be hosted on mkws.indexdata.com: + mkws.js + mkwsStyle.css + /libjs-pz2/pz2api.1.js + +The following files make up the application: + index.html + favicon.ico [optional] + robots.txt [optional] + +(At present, the client application's configuruation also needs an +Alias for /service-proxy/, to avoid cross-site scripting issues. We +will fix this.) + + +Configuring a client +-------------------- + +The application's HTML must contains the following elements as well as +whatever makes up the application itself: + +Prerequisites: + + + + +(Yes, we're using JQuery. We use it only in the most trivial ways, and +could probably get rid of it without too much pain. I'd like to have +mkws.js automatically pull in pz2api.1.js, too, so you don't need to +do so many things, but that's not quite trivial.) + +Then the following special
s can be added (with no content), and +will be filled in by MKWS: +
-- switch between record and target views +
-- search box and button +
-- result list, including pager/sorting +
-- target list, including status +
-- summary statistics + +At present, MKWS will not work correctly if any of these is +missing. One of the TODOs is to fix it so that it doesn't try to use +whatever is not there, and just uses what is. + + +What next? +---------- + +Main areas of work: +* Fix cross-site issues proper +* Make MKWS robust to missing widgets +* Make CSS more tightly targeted at MKWS elements only +* Make CSS prettier +* Embed in a real, existing, site +* Clean up the code diff --git a/experiments/spclient/index-mkws.html b/experiments/spclient/index-mkws.html new file mode 100644 index 0000000..9efe0cb --- /dev/null +++ b/experiments/spclient/index-mkws.html @@ -0,0 +1,36 @@ +

+ There is no content on the MKWS site, just tools: +

+ +

+ For a very simple application that uses these, see + http://somesite.indexdata.com/. + It's worth viewing the source to see how small it is +

+

+ See also the README. +

diff --git a/experiments/spclient/index-somesite.html b/experiments/spclient/index-somesite.html new file mode 100644 index 0000000..2d9077a --- /dev/null +++ b/experiments/spclient/index-somesite.html @@ -0,0 +1,21 @@ + + + + + + MKWS demo client + + + + + + + + +
+
+
+
+
+ + diff --git a/experiments/spclient/index.html b/experiments/spclient/index.html index 87edf8e..f1d0982 100644 --- a/experiments/spclient/index.html +++ b/experiments/spclient/index.html @@ -4,38 +4,18 @@ MKWS demo client - + + +
-
- - - - - -
-
-
-
-
- Sort by - - and show - - per page. -
-
-
- -
-
-
+
-
+
diff --git a/experiments/spclient/mkws.js b/experiments/spclient/mkws.js index 82f7603..3c8d76e 100644 --- a/experiments/spclient/mkws.js +++ b/experiments/spclient/mkws.js @@ -72,7 +72,7 @@ function my_onshow(data) { } function my_onstat(data) { - var stat = document.getElementById("stat"); + var stat = document.getElementById("mkwsStat"); if (stat == null) return; @@ -373,15 +373,17 @@ function renderDetails(data, marker) $(document).ready(function() { - $("#mkwsSwitch").html($("", { href: '#', - onclick: "switchView(\'records\')", - text: "Record Browser", - })); + $("#mkwsSwitch").html($("", { + href: '#', + onclick: "switchView(\'records\')", + text: "Records", + })); $("#mkwsSwitch").append($("", { text: " | " })); - $("#mkwsSwitch").append($("", { href: '#', - onclick: "switchView(\'targets\')", - text: "Target Info", - })); + $("#mkwsSwitch").append($("", { + href: '#', + onclick: "switchView(\'targets\')", + text: "Targets", + })); // For some reason, doing this programmatically results in // document.search.query being undefined, hence the raw HTML. @@ -391,6 +393,30 @@ $(document).ready(function() { \ '); + $("#mkwsRecords").html('\ + \ + \ + \ + \ + \ +
\ +
\ +
\ +
\ +
\ + Sort by\ + \ + and show \ + \ + per page.\ +
\ +
\ +
\ + \ +
\ +
\ +
'); + $("#mkwsTargets").html('\
\ No information available yet.\ @@ -401,22 +427,19 @@ $(document).ready(function() { }); $(document).ready(function() { - if (useServiceProxy) { - var jqxhr = jQuery.get(authURLServiceProxy) - .fail(function() { - alert("service proxy authentifiction failed for URL " + authURLServiceProxy + " , give up!"); - }) - .success(function(data) { - if (!jQuery.isXMLDoc(data)) { - alert("service proxy auth response document is not valid XML document, give up!"); - return; - } - - var status = $(data).find("status"); - if (status.text() != "OK") { + var jqxhr = jQuery.get("/service-proxy-auth") + .fail(function() { + alert("service proxy authentification failed, give up!"); + }) + .success(function(data) { + if (!jQuery.isXMLDoc(data)) { + alert("service proxy auth response document is not valid XML document, give up!"); + return; + } + var status = $(data).find("status"); + if (status.text() != "OK") { alert("service proxy auth repsonse status: " + status.text() + ", give up!"); return; - } - }); - } + } + }); }); diff --git a/experiments/spclient/mkwsStyle.css b/experiments/spclient/mkwsStyle.css new file mode 100644 index 0000000..f17c546 --- /dev/null +++ b/experiments/spclient/mkwsStyle.css @@ -0,0 +1,71 @@ +a { + color: #005701; + text-decoration: none; +} + +a:hover { + text-decoration: underline; +} + +a.crossout:hover { + text-decoration: line-through; +} + +input#button { + border: 3px outset #132194; + background-color: #132194; + padding: 2px; + width: 6em; + color: #FFFFFF; + font-weight: bold; + text-transform: uppercase; + font-size: 10px; + margin-left: 8px; + cursor: pointer; +} + +input#query { + border: 2px inset #34cc67; + padding: 3px; + font-size: 12px; +} + +div.termtitle { + margin: 4px; + font-weight: bold; +} + +div.record { + padding: 5px; +} + +div.details { + border: 3px dashed gray; + color: gray; + padding: 5px; + margin: 4px; +} + +#mkwsSwitch, #mkwsSearch, #mkwsRecords, #mkwsTargets { + font-family: Gill Sans, "Gillius ADF", Gillius, GilliusADF, Verdana, Sans-Serif; +} + +#mkwsSwitch { + float: right; + padding-left: 1em; + padding-top: 0.4em; +} + +#mkwsSearch { + float: right; +} + +#mkwsRecords { + background-color: #fafafa; + border-bottom: 1px solid #156a16; +} + +#mkwsTargets { + background-color: #fafafa; + border-bottom: 1px solid #156a16; +} diff --git a/experiments/spclient/styles.css b/experiments/spclient/styles.css deleted file mode 100644 index 8e50008..0000000 --- a/experiments/spclient/styles.css +++ /dev/null @@ -1,62 +0,0 @@ -a { - color: #005701; - text-decoration: none; -} - -a:hover { - text-decoration: underline; -} - -a.crossout:hover { - text-decoration: line-through; -} - -input#button { - border: 3px outset #132194; - background-color: #132194; - padding: 2px; - width: 6em; - color: #FFFFFF; - font-weight: bold; - text-transform: uppercase; - font-size: 10px; - margin-left: 8px; - cursor: pointer; -} - -input#query { - border: 2px inset #34cc67; - padding: 3px; - font-size: 12px; -} - -div.termtitle { - margin: 4px; - font-weight: bold; -} - -div.record { - padding: 5px; -} - -div.details { - border: 3px dashed gray; - color: gray; - padding: 5px; - margin: 4px; -} - -#mkwsSwitch { - padding-bottom: 3px; - text-align: right; -} - -#mkwsRecords { - background-color: #fafafa; - border-bottom: 1px solid #156a16; -} - -#mkwsTargets { - background-color: #fafafa; - border-bottom: 1px solid #156a16; -}