Merge branch 'master' of ssh://git.indexdata.com:222/home/git/private/mkws
authorWolfram Schneider <wosch@indexdata.dk>
Tue, 9 Sep 2014 15:11:49 +0000 (15:11 +0000)
committerWolfram Schneider <wosch@indexdata.dk>
Tue, 9 Sep 2014 15:11:49 +0000 (15:11 +0000)
doc/Makefile
doc/drupaljson.pl [new file with mode: 0755]
examples/htdocs/mike.html
src/mkws-core.js

index 2a6b99b..d87c1f8 100644 (file)
@@ -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 (executable)
index 0000000..0135867
--- /dev/null
@@ -0,0 +1,9 @@
+#!/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;
index 5d794a0..198cc44 100644 (file)
@@ -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",
       };
     </script>
     <script type="text/javascript" src="tools/htdocs/jquery-1.10.0.min.js"></script>
index abe414d..6b3e00d 100644 (file)
@@ -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;